From patchwork Thu Dec 14 13:25:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13493103 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 619B2C4167B for ; Thu, 14 Dec 2023 13:53:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E0D4B8D00BF; Thu, 14 Dec 2023 08:53:39 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id DBD6E8D00B1; Thu, 14 Dec 2023 08:53:39 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CAC698D00BF; Thu, 14 Dec 2023 08:53:39 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id B7E8A8D00B1 for ; Thu, 14 Dec 2023 08:53:39 -0500 (EST) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 7FBEE80C99 for ; Thu, 14 Dec 2023 13:53:39 +0000 (UTC) X-FDA: 81565566558.26.8F53557 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf09.hostedemail.com (Postfix) with ESMTP id D3CC8140026 for ; Thu, 14 Dec 2023 13:53:37 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=WeEvgWpq; dmarc=none; spf=none (imf09.hostedemail.com: domain of BATV+55581d165dda9d0af87b+7417+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+55581d165dda9d0af87b+7417+infradead.org+hch@bombadil.srs.infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1702562017; a=rsa-sha256; cv=none; b=RNGSHRsanRTHvoO4rdSVRyBEcpOpSwYr8Wb3GVZyy7np+xD/JbJGkcJkm+uk+k7qCaB01g 1adGtqz+wmiCqCPDH16V0gJuy/5zACO2rq161tEWjLIST5Wbzo2hHQ0DzhdXOhVNfBg1hZ IOJqYYrAxZ39/dGOTw9NuuCda8pcGp0= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=WeEvgWpq; dmarc=none; spf=none (imf09.hostedemail.com: domain of BATV+55581d165dda9d0af87b+7417+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+55581d165dda9d0af87b+7417+infradead.org+hch@bombadil.srs.infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1702562017; 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=fSSCwYEFU0GoMDegAuKi55gdXGuKeNZB2TyfoMX/Y+w=; b=sKu1WL/CGEts08YsywC6/v8MYgq6S5f6ZPMG0Oi4V7DAdb5g1G5jjiXQWCq1PmvJ6IL4cz awAm2vk5fRqiR48Kej+4bXVwwyKKEjIqT17AppOHiBrcLH1zKcMTk6GjkMup4JhAP9m8N5 6Z99mgKmLpSPTmqYfhV6hJj9xpPdruc= 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=fSSCwYEFU0GoMDegAuKi55gdXGuKeNZB2TyfoMX/Y+w=; b=WeEvgWpqJWmJsBWQKrtwqaDcsx DdhfJGsb6lyX8JGqp2wBtNE8ntogWBaKjs0SOJvYsf4t1u1vtiknCwTL2Y5ngFQF0kHZAg2e/Wj3C /lKhI+vk7w1OAoB1r0oIpvJFGTE706ExEjmuIYhCM55Nj8hvhRQUA9mnbsQwwHBsnj+d7VdCtZaiz AY81oAYmK7szPOgEXKqDSPEWg+V3BHzPv5gMAzb2bezV/TCEPLMlfxFWEyiAH64GqL7CY0PY56S8R 8G4fBDbKysnieizxi5pWpxe++ocMLt+32i5pQpsFojwROwJzzgv1IQ/wHyjc0ZdcJzzDcdle2JPLh 7WwhmenQ==; Received: from [88.128.88.27] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1rDljT-000NGp-0B; Thu, 14 Dec 2023 13:26:31 +0000 From: Christoph Hellwig To: linux-mm@kvack.org Cc: "Matthew Wilcox (Oracle)" , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Jan Kara , David Howells Subject: [PATCH 11/11] writeback: Remove a use of write_cache_pages() from do_writepages() Date: Thu, 14 Dec 2023 14:25:44 +0100 Message-Id: <20231214132544.376574-12-hch@lst.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231214132544.376574-1-hch@lst.de> References: <20231214132544.376574-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: rspam06 X-Rspamd-Queue-Id: D3CC8140026 X-Stat-Signature: u9snfykgrmdt63fo7o1t99j34n7reu1d X-HE-Tag: 1702562017-147364 X-HE-Meta: U2FsdGVkX18MGqnClS4jsKeRkfy1etwhVri1Lr+Jq2gKnhuzYhn/pcVR2cDTC3JJr9WfBixMAK4/wQM+pZ7Fo4AhL0wsFFofHr92on/iipcbJXOkx9xSwCH/5vHMse4C7ji/c1gnqTV4cfNsYpQ068+hM7yfTau8OO8DwSVbUsiJW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KdF1ifLJJh6f56uso9Wy67UzYDvuyhIv4qsODnPzbBCitpe7mtgxU0snFL8iBr89wTnurTXHtvtoCZKo0xJLX51PvdOqisLiZ+chdQFI4ueV6eFvKP7w3rZK1kLwH7dhnd+pUsGty6u1J3Xvm7zB5DMLdhGn02xTONKtOYXSLeWbxm+51+PcM45fRST6XQ0n3Z8lWOdn88HhDeodIaR6EANgbNWtsLYkql7d+wrjrFRb6Ad3Cy8rsl+opiQ== 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: List-Subscribe: List-Unsubscribe: From: "Matthew Wilcox (Oracle)" Use the new for_each_writeback_folio() directly instead of indirecting through a callback. Signed-off-by: Matthew Wilcox (Oracle) Signed-off-by: Christoph Hellwig --- mm/page-writeback.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/mm/page-writeback.c b/mm/page-writeback.c index e4a1444502ccd4..338021bdd136b9 100644 --- a/mm/page-writeback.c +++ b/mm/page-writeback.c @@ -2558,13 +2558,21 @@ int write_cache_pages(struct address_space *mapping, } EXPORT_SYMBOL(write_cache_pages); -static int writepage_cb(struct folio *folio, struct writeback_control *wbc, - void *data) +static int writeback_use_writepage(struct address_space *mapping, + struct writeback_control *wbc) { - struct address_space *mapping = data; - int ret = mapping->a_ops->writepage(&folio->page, wbc); - mapping_set_error(mapping, ret); - return ret; + struct blk_plug plug; + struct folio *folio; + int err; + + blk_start_plug(&plug); + for_each_writeback_folio(mapping, wbc, folio, err) { + err = mapping->a_ops->writepage(&folio->page, wbc); + mapping_set_error(mapping, err); + } + blk_finish_plug(&plug); + + return err; } int do_writepages(struct address_space *mapping, struct writeback_control *wbc) @@ -2580,12 +2588,7 @@ int do_writepages(struct address_space *mapping, struct writeback_control *wbc) if (mapping->a_ops->writepages) { ret = mapping->a_ops->writepages(mapping, wbc); } 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); + ret = writeback_use_writepage(mapping, wbc); } else { /* deal with chardevs and other special files */ ret = 0;