Received: by 2002:a05:7412:8d06:b0:f9:332d:97f1 with SMTP id bj6csp13480rdb; Mon, 18 Dec 2023 07:42:12 -0800 (PST) X-Google-Smtp-Source: AGHT+IEbOp5BXGbzHF32ZYBNA4U3LvUw7F/Xuxw7GCWYXgRAupJ+NeVOiG3+9uFrGgZJ1tIWliiz X-Received: by 2002:a17:906:2d6:b0:a1f:8aa3:2bd4 with SMTP id 22-20020a17090602d600b00a1f8aa32bd4mr7663208ejk.133.1702914132650; Mon, 18 Dec 2023 07:42:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702914132; cv=none; d=google.com; s=arc-20160816; b=F/Z3SeM25uIG23QEXimbTKQG1OWte61B///bl13IXLrea1adgscaorLAgCNATG1x61 9OR1YvJMKjTIOE6+inJ4TXhXZulQuB4tfspNojZz6UWex95Btwgp7uu+aNmcMIBNq6wu I2tQ7eWSwxKDkKdesoh1tJ8hoSZgA1jGD3fYdNANWwYp6F15l5RM9UamwsoH9l4QavgR z8rfL6cCaVK6BAQL8NQ8zQ6Ng1snFNOTs30AajQ/U3aRE4u3PqXEqYhZRWYM2+hlyBaa xBpXerncs7L11t5cU1NlH92hGTOiKEXw4MSaJ6pJKOzuWdw55sL4iYbepq5jBxG9GJXe IV+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=KurkZBc/b3Q18ZfxQxDEcSa/TUrlUIiFySdkJrxwQjU=; fh=m0HBXuwgOCKat7wyuY7vstPypqMqxNmINnjBv5+EUjU=; b=Q6eTjgGwh0SaNc8nSsXaf9sqC5XKnFASaaRJKwei6w7JpEk6j4a2E9+AmDBnZeICyw 36TlRDFP2TwQoECIhwNyYeJv0cjxtaiL0HOmtEECjGnnNIaym23JMvKqm4rNAQAc8e1n t3Ozx4CA2KqfCxu0RrRkOGcFuV767kpyF0pVMlBrMgrrtbo3meuiNoPnY4M7DTydTI1Y UbW29XO0s6NRGR30HaLUWsA9y/K+jAyrl34RovjHw5jyEU/kFAf3MP7TCLG3jjUy8skf TOLbTjppSVlCgaDusVqGcUYoGZR1e8oPdZZOCGRYFavLE0Cc+NQaDgKb/ZFG5/5kaEXf WVVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=LVqlIw7q; spf=pass (google.com: domain of linux-kernel+bounces-3959-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-3959-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id u17-20020a17090626d100b00a1d3eccb0f1si9803422ejc.488.2023.12.18.07.42.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Dec 2023 07:42:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-3959-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=LVqlIw7q; spf=pass (google.com: domain of linux-kernel+bounces-3959-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-3959-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 2D6EF1F235C8 for ; Mon, 18 Dec 2023 15:41:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4BA0574E26; Mon, 18 Dec 2023 15:36:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="LVqlIw7q" X-Original-To: linux-kernel@vger.kernel.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 56A1D498A9; Mon, 18 Dec 2023 15:36:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bombadil.srs.infradead.org 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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html 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 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; -- 2.39.2