From patchwork Mon Dec 18 15:35:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13497170 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 77D70C35274 for ; Mon, 18 Dec 2023 15:36:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 236966B0089; Mon, 18 Dec 2023 10:36:46 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 1E94C6B0095; Mon, 18 Dec 2023 10:36:46 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 060E06B0096; Mon, 18 Dec 2023 10:36:45 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id DFB756B0089 for ; Mon, 18 Dec 2023 10:36:45 -0500 (EST) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id ADCCC1A01B3 for ; Mon, 18 Dec 2023 15:36:45 +0000 (UTC) X-FDA: 81580341570.19.D523C1D Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf05.hostedemail.com (Postfix) with ESMTP id 0DA14100015 for ; Mon, 18 Dec 2023 15:36:43 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=LVqlIw7q; dmarc=none; spf=none (imf05.hostedemail.com: domain of BATV+09f18f96a25a69770120+7421+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+09f18f96a25a69770120+7421+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=1702913804; 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=KurkZBc/b3Q18ZfxQxDEcSa/TUrlUIiFySdkJrxwQjU=; b=Pq0kHBlxZ+OSTheD4Sy1xNjxryiBl+5NS1s1Q8CIG6kWVHmucDuhCcPRpHYpwv53dIFA39 JYgOEkSnKPHaZ6oAMhO1MSCX4QDT6dQa+c8ijso0TH/URfVMv3HpPmmCLdpZw/x35pQjWD spQSY0zVImFLGKWVImSInZTnG0Ddm40= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=LVqlIw7q; dmarc=none; spf=none (imf05.hostedemail.com: domain of BATV+09f18f96a25a69770120+7421+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+09f18f96a25a69770120+7421+infradead.org+hch@bombadil.srs.infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1702913804; a=rsa-sha256; cv=none; b=qLlbjE215LaSFFGMlc/jo842XpkgQb0ru105qN+PfdaTdPp76rqUYSBS0pqoiQNStp8Xy6 mqHvoqy2Hp43Ww0X27OjESpnZE32a+/k5D6fG7gILe+6nvQsDpcajPOM7sDs/rZnM9wfe5 hoM5FEJfxVpD9mP0plJOFjjc9zQPYsA= 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=KurkZBc/b3Q18ZfxQxDEcSa/TUrlUIiFySdkJrxwQjU=; b=LVqlIw7qs07E3gyDPGZmtD0XyP 0J7DxBmpXttZFRG+IwdLRoQ210NJqeMDCPwvx8pcytOPK4WaPF5iALq+Gere9cAAFy5YHYuoayf7o WKwlr5cnMo6YK/xL/Cid/5e4NHsvCFFUVnAZk6rEgRm6ta5km+tzbpG8tZ3u4VQX7YjwvdIvd9La/ UUs/2czN4LRM0MbYNCm8auOK1c94pPR2Eurr2Se1DpfMw6swR2Hs3y1wij2cA5jK2l4wHgZychHBa Linj7FiVDQk01OoYZwI+pB0Q7q0czwR2HmdVCNnS2czPrextgY+XsAC2CLKMbkZM68/VA3sMoQD2r mAGHD9Yw==; 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 1rFFfe-00BEby-2D; Mon, 18 Dec 2023 15:36:43 +0000 From: Christoph Hellwig To: linux-mm@kvack.org Cc: "Matthew Wilcox (Oracle)" , Jan Kara , David Howells , Brian Foster , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 16/17] writeback: Remove a use of write_cache_pages() from do_writepages() Date: Mon, 18 Dec 2023 16:35:52 +0100 Message-Id: <20231218153553.807799-17-hch@lst.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231218153553.807799-1-hch@lst.de> References: <20231218153553.807799-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: rspam12 X-Rspamd-Queue-Id: 0DA14100015 X-Stat-Signature: yq8y78oo65w3c5b971gfdjurdix35rgi X-HE-Tag: 1702913803-53822 X-HE-Meta: U2FsdGVkX1/al0IgtCww3Ua3DzKkoZCIk3lR/DuBH3vwVXuqb+yS2/uXvsnOIqqy9BY4v8lJTPsy+OCNObhFZ+lc+FVtv+m9a8ptfGwaV2vnJN1eXC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KAK7QB/sorisZ0hedrDZmHd/rETGFfJdYNDr1ZFfr7/JhhDk57BQ6BjUWfoAjxw0tnFTlihsDW2RM6i9V9+x3R+LabQHmg9EVYaozRVqQHFV+yBhEwogoqLfGv0d0WnUVLsMK5mHRU8oA6xyr5l98axa8jTYwfT9sX8RToVatFMUbI3/4YlK5EeG7kUwxND1yO7H6IcEgHtYG8T/xEMu96qDLybNFcZ0e8lQ2LHNUIRXJr3//9gfwO+hTOu6jJ4BfLDhyasRDFnXmvb8FAetA3C208QGKGcFfyhnpBy+dh48BVDmCrT/M= 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 --- 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 fbffd30a9cc93f..d3c2c78e0c67ce 100644 --- a/mm/page-writeback.c +++ b/mm/page-writeback.c @@ -2564,13 +2564,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) @@ -2586,12 +2594,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;