From patchwork Thu Dec 29 16:10:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13083617 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2EA40C3DA79 for ; Thu, 29 Dec 2022 16:11:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 82A858E0001; Thu, 29 Dec 2022 11:10:58 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 795338E0005; Thu, 29 Dec 2022 11:10:58 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 51FAA8E0002; Thu, 29 Dec 2022 11:10:58 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 2CA2E8E0001 for ; Thu, 29 Dec 2022 11:10:58 -0500 (EST) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 0F0281C628A for ; Thu, 29 Dec 2022 16:10:58 +0000 (UTC) X-FDA: 80295832596.11.1A94DE8 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf01.hostedemail.com (Postfix) with ESMTP id C4EEA4002F for ; Thu, 29 Dec 2022 16:10:55 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=hCkiJn6N; spf=none (imf01.hostedemail.com: domain of BATV+e05b48f8d7082ec3c215+7067+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+e05b48f8d7082ec3c215+7067+infradead.org+hch@bombadil.srs.infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1672330256; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=x4y/4KuqfNuPAflIAi82X++2iXzPIgIv4Sol4IXfpIE=; b=8gb4LzJmAAkWqt0JkVPkhP6NMVgJmZnWb0tGJ7WAv0dgena4eVxAn3339pcplql3BzpTfl yIstEqKrbCjeZwwzBNNkx+ikKaGVvB0e1XegenR2hM8+AWJThvDEmhdlHSs1m9wL3rjKT/ 4LijokVDVBxN5gBkbtM/0DF9Bj3AfOk= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=hCkiJn6N; spf=none (imf01.hostedemail.com: domain of BATV+e05b48f8d7082ec3c215+7067+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+e05b48f8d7082ec3c215+7067+infradead.org+hch@bombadil.srs.infradead.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1672330256; a=rsa-sha256; cv=none; b=n+lWRNV7jxxMrQ6E+puWZ9COOOM7Ylz9CM2eRzrCrc3fEnaNNd3irfGqWUX6Yc6DJtNXjQ x9xyUPH4vxXhpJxGBeewMdVSa3bcywm5mD8z3cbBnsdfJh3xzBylVaLq5mRMq7jRrEXc5i nGe7K+KXWtCujd2DTVIrtD8wP4xKplA= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=x4y/4KuqfNuPAflIAi82X++2iXzPIgIv4Sol4IXfpIE=; b=hCkiJn6NwipyF95xZ/GfQjLDmb Si4sdlVrqYhOzIyOHDvE4X1IaWOLKGwwB/WyfjcmVjqFBn391Tx3NsE4ImwHez5KUQC/YOtFnd3mB r0I/7KTgno8i5rUd8vWxs5M/4cUs5R7OBibrzqx9/lV/aVXxlt4uKk9q1q5ScZ1TEx6FqrKHPk9Ow 3MypnruGXVZJgQEhTyB8WJmJjakTwGYd+3QT1gdqttF5scQ2eSbdXz50yJDorlrrXTwZmCZInLwjR YllxS++9Um0yVvQk5aqOUb7TRQl9yf2UWXnv73HmIV5RLJGI6TFAVilzX/ndLItpgvO2wMHJZDKsO xGCE/zIA==; Received: from rrcs-67-53-201-206.west.biz.rr.com ([67.53.201.206] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1pAvUQ-00HKPY-BW; Thu, 29 Dec 2022 16:10:42 +0000 From: Christoph Hellwig To: Andrew Morton , "Theodore Ts'o" , Jan Kara , Konstantin Komarov , Mark Fasheh , Joel Becker , Joseph Qi , "Matthew Wilcox (Oracle)" Cc: linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org, ntfs3@lists.linux.dev, ocfs2-devel@oss.oracle.com, linux-mm@kvack.org Subject: [PATCH 6/6] mm: remove generic_writepages Date: Thu, 29 Dec 2022 06:10:31 -1000 Message-Id: <20221229161031.391878-7-hch@lst.de> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221229161031.391878-1-hch@lst.de> References: <20221229161031.391878-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: C4EEA4002F X-Stat-Signature: pf3cmxhrwjtu1ro14zgrza3xzztf3qz7 X-HE-Tag: 1672330255-957571 X-HE-Meta: U2FsdGVkX19MDYFtlZO9HY4eDGAEEQzDz/WI0zdLxxNnvf3iafVRqv0x6oMjJ3jGTQTUKp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wF5rIwkGEq9dw62xUpEr289YoihV+j3HD1ai91qxNbDs9uW8fvhqwmauiC3FZEf7UwGsMQ9cc7OZApA/dYHRXU= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Now that all external callers are gone, just fold it into do_writepages. Signed-off-by: Christoph Hellwig Reviewed-by: Jan Kara --- include/linux/writeback.h | 2 -- mm/page-writeback.c | 53 +++++++++++---------------------------- 2 files changed, 15 insertions(+), 40 deletions(-) diff --git a/include/linux/writeback.h b/include/linux/writeback.h index 06f9291b6fd512..2554b71765e9d0 100644 --- a/include/linux/writeback.h +++ b/include/linux/writeback.h @@ -369,8 +369,6 @@ bool wb_over_bg_thresh(struct bdi_writeback *wb); typedef int (*writepage_t)(struct page *page, struct writeback_control *wbc, void *data); -int generic_writepages(struct address_space *mapping, - struct writeback_control *wbc); void tag_pages_for_writeback(struct address_space *mapping, pgoff_t start, pgoff_t end); int write_cache_pages(struct address_space *mapping, diff --git a/mm/page-writeback.c b/mm/page-writeback.c index ad608ef2a24365..dfeeceebba0ae0 100644 --- a/mm/page-writeback.c +++ b/mm/page-writeback.c @@ -2526,12 +2526,8 @@ int write_cache_pages(struct address_space *mapping, } EXPORT_SYMBOL(write_cache_pages); -/* - * Function used by generic_writepages to call the real writepage - * function and set the mapping flags on error - */ -static int __writepage(struct page *page, struct writeback_control *wbc, - void *data) +static int writepage_cb(struct page *page, struct writeback_control *wbc, + void *data) { struct address_space *mapping = data; int ret = mapping->a_ops->writepage(page, wbc); @@ -2539,34 +2535,6 @@ static int __writepage(struct page *page, struct writeback_control *wbc, return ret; } -/** - * generic_writepages - walk the list of dirty pages of the given address space and writepage() all of them. - * @mapping: address space structure to write - * @wbc: subtract the number of written pages from *@wbc->nr_to_write - * - * This is a library function, which implements the writepages() - * address_space_operation. - * - * Return: %0 on success, negative error code otherwise - */ -int generic_writepages(struct address_space *mapping, - struct writeback_control *wbc) -{ - struct blk_plug plug; - int ret; - - /* deal with chardevs and other special file */ - if (!mapping->a_ops->writepage) - return 0; - - blk_start_plug(&plug); - ret = write_cache_pages(mapping, wbc, __writepage, mapping); - blk_finish_plug(&plug); - return ret; -} - -EXPORT_SYMBOL(generic_writepages); - int do_writepages(struct address_space *mapping, struct writeback_control *wbc) { int ret; @@ -2577,11 +2545,20 @@ int do_writepages(struct address_space *mapping, struct writeback_control *wbc) wb = inode_to_wb_wbc(mapping->host, wbc); wb_bandwidth_estimate_start(wb); while (1) { - if (mapping->a_ops->writepages) + if (mapping->a_ops->writepages) { ret = mapping->a_ops->writepages(mapping, wbc); - else - ret = generic_writepages(mapping, wbc); - if ((ret != -ENOMEM) || (wbc->sync_mode != WB_SYNC_ALL)) + } else if (mapping->a_ops->writepage) { + struct blk_plug plug; + + blk_start_plug(&plug); + ret = write_cache_pages(mapping, wbc, writepage_cb, + mapping); + blk_finish_plug(&plug); + } else { + /* deal with chardevs and other special files */ + ret = 0; + } + if (ret != -ENOMEM || wbc->sync_mode != WB_SYNC_ALL) break; /*