From patchwork Thu Jan 25 08:57:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13530271 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 16A2CC47258 for ; Thu, 25 Jan 2024 08:59:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A2A7328000B; Thu, 25 Jan 2024 03:59:06 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 9B358280001; Thu, 25 Jan 2024 03:59:06 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 87CFF28000B; Thu, 25 Jan 2024 03:59:06 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 7263C280001 for ; Thu, 25 Jan 2024 03:59:06 -0500 (EST) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 4BEA212050D for ; Thu, 25 Jan 2024 08:59:06 +0000 (UTC) X-FDA: 81717233892.30.1376DC6 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf23.hostedemail.com (Postfix) with ESMTP id A54A814000D for ; Thu, 25 Jan 2024 08:59:04 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=b9+nO3yw; spf=none (imf23.hostedemail.com: domain of BATV+b97a0fc658bf3e588113+7459+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+b97a0fc658bf3e588113+7459+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=1706173144; 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=jmxBhEwvvP0SHYr6G/94FmB0blh/Svg4tA2Bb0QCX2c=; b=Rdh8C/UZYA0VDVSwW7jFOWTG2tme3282vd7lGFWInXpeFc8Um2e6Bt8/SA/E1jrgzmbPhz 6iAPq5FAJ8mKqAc026U+1ZTcA7vvTZRM7KhnUubN8S4RpaGoRGNTR2WWPmuA8CRVhmmn3V GvHRxK52rGl3cFXhx9apW+H2GKrDYpc= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1706173144; a=rsa-sha256; cv=none; b=aCWdKO/piC4UPbNUA+XJL7CKPaGzdsMQ2+aJdIkEtoz4CforO6hKiojTuh0vafu0GTarXb 4b5PH6UQMxq7RF4WmpXScea7LcqH/umni80QQ2eoSp4v2pc8Yv+M2+qm3RfPeS1OH6Cstb R1ozJzWD+MzTG6Y/yplGGcUw6/RADCw= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=b9+nO3yw; spf=none (imf23.hostedemail.com: domain of BATV+b97a0fc658bf3e588113+7459+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+b97a0fc658bf3e588113+7459+infradead.org+hch@bombadil.srs.infradead.org; dmarc=none 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=jmxBhEwvvP0SHYr6G/94FmB0blh/Svg4tA2Bb0QCX2c=; b=b9+nO3ywJHkLbo7Hj/APqwblnx 0Jd3qWrW11823FTn4RkUzafKOu7wPN4qXVWb3Y3abZVmd6IeXCyA/8h25NwJ06dR7W4WRb0TiGxgS XRSu+AWHyptJe9dauajhaWAA7KsaMgHO5l9+fuWnqXd836VjWfYGn7T8rlHhDYiTUCCkjK7cBPpc1 YguvS1IP6xeXvIaJiu8J8kF5tdyVBGE4IcyAC3h8JRFPuKt3k5hsvByqL8Pqf64BAMQy8cd2Rfb0b wNkEzo0iawP2oJl4sK/Ea1XshNHk9nHAXQGTHXcSoqAs1Zmi24m5dyKVCgIG0/f8uPIA29xjnRI8R Fq8sz5/A==; Received: from 2a02-8389-2341-5b80-39d3-4735-9a3c-88d8.cable.dynamic.v6.surfer.at ([2a02:8389:2341:5b80:39d3:4735:9a3c:88d8] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1rSvZe-007QWD-0t; Thu, 25 Jan 2024 08:59:03 +0000 From: Christoph Hellwig To: linux-mm@kvack.org Cc: Matthew Wilcox , Jan Kara , David Howells , Brian Foster , Christian Brauner , "Darrick J. Wong" , linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Jan Kara , Dave Chinner Subject: [PATCH 16/19] writeback: Remove a use of write_cache_pages() from do_writepages() Date: Thu, 25 Jan 2024 09:57:55 +0100 Message-Id: <20240125085758.2393327-17-hch@lst.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240125085758.2393327-1-hch@lst.de> References: <20240125085758.2393327-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-Rspamd-Queue-Id: A54A814000D X-Rspam-User: X-Stat-Signature: g4h4b8uburpytza559xu1oq5xzkp1o17 X-Rspamd-Server: rspam03 X-HE-Tag: 1706173144-305132 X-HE-Meta: U2FsdGVkX1+IHA7a2ea+pChFtFqdTj9OV9Cx7TuFlv11Wew1ZqyXk/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FVamAVMlcHuFXzLFduCv6rwKoT22h/vMONA/gaBk8N10wjKTj+OOGfdgUHZkPVlf7N6JE/6sjXrcoePgkcA2ojqwNrIUau/PosslZR6MPO3yGfNy+aiMFK1PMuwD8+HaaKMkrEch2wmPRbkLvpcBbHlwScKeuB9dFWdrP/J0TtBo5kvjMLJxGDkuaF4iXlF95JHH4soSTuhMvGnG3q8YLiryGCwApsFOyZOAn+t3Crg4fIn5LELxDivrwtS2qZx6ub81yMdcKyqaY0lfln6mebInSgOJ33/I6/3eu3hQBu58bWYfjy8MumLVlxbPuSEiowLiDiEWzUa5aAvLhzze6nLufZBZm34k8DHlmHNUm95VqXLBFe6RHuTMN1m1siZNWNhqxiKTC+KHiGf 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 Reviewed-by: Jan Kara Acked-by: Dave Chinner --- 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 aca0f43021a20c..81034d5d72e1f4 100644 --- a/mm/page-writeback.c +++ b/mm/page-writeback.c @@ -2559,13 +2559,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) @@ -2581,12 +2589,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;