From patchwork Fri Dec 22 15:08:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13503424 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 8116DC41535 for ; Fri, 22 Dec 2023 15:09:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 34DCF8D000A; Fri, 22 Dec 2023 10:09:10 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 2D6AC8D0003; Fri, 22 Dec 2023 10:09:10 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 179FC8D000A; Fri, 22 Dec 2023 10:09:10 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 01FC08D0003 for ; Fri, 22 Dec 2023 10:09:10 -0500 (EST) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id CF25440980 for ; Fri, 22 Dec 2023 15:09:09 +0000 (UTC) X-FDA: 81594787218.02.3F2AB6B Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf26.hostedemail.com (Postfix) with ESMTP id 2393F14002A for ; Fri, 22 Dec 2023 15:09:07 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=fr1wzmpg; spf=none (imf26.hostedemail.com: domain of BATV+af923ccb694ecd533eae+7425+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+af923ccb694ecd533eae+7425+infradead.org+hch@bombadil.srs.infradead.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1703257748; a=rsa-sha256; cv=none; b=vZeb2p8XHtD+kNs7sJFAPZiwbLXeFnZXpECNJyYln6uB0FzZjlMS2T/lJ4j87nVXwBYP1r llp88zHvvHVyZIXpD2pfvOpNyvL5E44ZujacEPG/450eOac5ACI8BisyEf+doJHeyi0gct /+5qi4hBdiGHPInH+q1B46O+wgBwGhY= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=fr1wzmpg; spf=none (imf26.hostedemail.com: domain of BATV+af923ccb694ecd533eae+7425+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+af923ccb694ecd533eae+7425+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=1703257748; 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=lixDX8ZESJjee4RWhykT/1y+dKD2DSRjw7efEsZauMY=; b=zmjD5ZgDxly0KijjI4UNGrtkLsBjP94av7lQGBVYqGYCS7CJ3DDvBz33RQd1Yyn3ZUE0NO Rhh0vH9RO4Or3led3lA5OltnCPkqZFugJ5B//e7VlCx3DYKIoAQpl1SuHfJuLC587quvuD JxyJTZgPwiuDJg7IgfrPLyogHyn1nDk= 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=lixDX8ZESJjee4RWhykT/1y+dKD2DSRjw7efEsZauMY=; b=fr1wzmpg3g1yRFa0Y9DqGv06Wk cfDoK78nyVATk2W00QiKsY/vi82udAF0M2pyy+Ay93XVwZPJE4qz+MVWOhvOnuXDUpB2cDR0YviWU pEa0p7C4tjXfPes+OGICWcueTOsQ06AIm0+bbjDoBE1CB0mmoXrZbVxR+vklmsbA8hsDQKSvi1pEy 26uOQbqYl11Ollia+yPhtCKAS7dsKtR+F/IMr9+yAhj597hdQxeg68obkW8aguZaJl/ZMU2OFxJjc N10rjpNyBKRSURZsWSof2IhpBNqPx+qHoW6tbAa3Vig8tLlTZDipLRaHFw1jenO2m6NAKArNjk9Ba 8eg37u/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 1rGh98-006Bcf-2W; Fri, 22 Dec 2023 15:09:07 +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, Jan Kara , Dave Chinner Subject: [PATCH 16/17] writeback: Remove a use of write_cache_pages() from do_writepages() Date: Fri, 22 Dec 2023 16:08:26 +0100 Message-Id: <20231222150827.1329938-17-hch@lst.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231222150827.1329938-1-hch@lst.de> References: <20231222150827.1329938-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-Server: rspam08 X-Rspamd-Queue-Id: 2393F14002A X-Stat-Signature: 646in3wu336riq3tsobt37q8kpj5igst X-Rspam-User: X-HE-Tag: 1703257747-863537 X-HE-Meta: U2FsdGVkX1/4c0jLv4XaqsL2+zyI0lxLXqXUlY5wHpdkLTKZOzaGry+sK+1K8r9/rSk75LHaWfOy/6Ni+e74A8rHNKboqAN4W3/8v4Jh/q72S19RO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et2wSnW5Vjwo0jeCy0KnQ3SlUPmyk/KN2Vqkqi99wNmWKqE8F8Py+LMSzjs/8irWwFpGkCkHWn1eU/HFIPa1poe2fH/ae+/fymMBfNES0xj5sV8bReC94X/sqeopzVW+K1a3rEQmAe3BB4BqxkGo7L6iB3kEkXgfieFhBOI8BDNx4BtbWkvWIc6zDRfWz9/i5O6QsuNIVdaSdAGI5i0UWmQZd9l/DvVwGELz46Jm0wQIoXzEJQ7b/nO6nKura9aNsKFrysy0jUwSlHQbpdRqdm01r/XMYX+tbsF2LCdBZSi8BAuLOUSJN8RYDvj0ZWe35Q4IDZLN505AAhk5uFFGSrDGc+jX 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 5c33a4a527b3fa..1ff444d5e4317a 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;