From patchwork Mon Jun 26 17:35:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 113077 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp7654665vqr; Mon, 26 Jun 2023 10:56:32 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ73ywOIkEHZQq84u4gmxQ3tj0yDg44c6jqp/SQgyjF1zJKcf3OOCAov00V8UO92EYOfRieW X-Received: by 2002:a17:907:3f18:b0:97d:ee91:df83 with SMTP id hq24-20020a1709073f1800b0097dee91df83mr30226353ejc.61.1687802192410; Mon, 26 Jun 2023 10:56:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687802192; cv=none; d=google.com; s=arc-20160816; b=JdZ1C6+k7Lj9CmdRlbNuQvLNe6MivSiuaunubMm2+ch8G1W5R9f+fHhCt46oR8tInG 5vki21fcobCX0tQCoR8xTzJd7+Kj17730B7A0fJXOlyS0Q+QR9F72dVxUF8RytMAtb+w GU1LzDSMzUQQ85LCKTs6TnD5VLoC3TwjY//QqsxIP2AHj9RaLD9eo+QYeOp9KRFeXatT fbUPcCFRZSIBkObBcQcKIJgW457IbbFauAq0xp/6i3IQr5CJkyqodMdmjfLMnnA00dkw e3wTYOTuc4aXTvermvMBtYIaVDugSviDJ51hbFuBIhZweIiQdJJ2PdnBZviEeV4TlNQ7 SxTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ImqynQi+azeOKkPbJPWnsB36hvgJ5MojMLeTL2XpTIs=; fh=s6qbYcpKmY0AEsK/gKDpT3qiaGyyaU+hQ5h16uVwDEk=; b=zIFeXnYRN3gR5iUG/Neh+lZ3xrGWbPJhPB4tIXIZ9/ixx5xwB+wTNKiTyug/c1V+p1 p3QR8iNVtfN0lka8HO7L/xMvukBoG6GOfXkhuDdszclqAS5zs0iYTIrhE4hqaVzHzZ90 XiiEgrqvYaPVKWqFffyH0vng+05kxh2b10aG7ZYfC7YIny7bwDV3Pz9w4/ahrbwxwXB3 RRTDkVQ+mtij+6l2EOaYim8wI5dkycAeIeQzFAoDAIl/OM2wxaEEJg+jyXksDPaiUvE+ wFKFLoBkk7oXFJ0O9ncK/YQRUka7KgT9000N1S8X0DV6ufFjRs5cYNsALcJdaskmaKAq 79Uw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=EnXvWYXx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e17-20020a170906081100b009837908b5c6si3205192ejd.976.2023.06.26.10.56.08; Mon, 26 Jun 2023 10:56:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=EnXvWYXx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231465AbjFZRgx (ORCPT + 99 others); Mon, 26 Jun 2023 13:36:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36724 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229621AbjFZRgC (ORCPT ); Mon, 26 Jun 2023 13:36:02 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6B418295C; Mon, 26 Jun 2023 10:35:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; 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=ImqynQi+azeOKkPbJPWnsB36hvgJ5MojMLeTL2XpTIs=; b=EnXvWYXx+3E+jBbF7Z3B+1Gi/T yYgl8ytz+fZoD1bsHwC8cXajllUXh279ulAn62xGFuLds1WNXkGTXCQQEyIO2oWdLPtMZma2d/AMg 5Su9uB7fPivq5SeGFfjxhRCguvBEtuQ+YT74zwhANJ5gvelakTfU9l8U8T0yUP1L00nf5upXTXCP+ Tl1v60WsSro8t+8iDng1kThDvglAI8CetB6z50p5gO6KiKgThZkNJZBBkCDUuV1iH9gr8bU4TyNAL wyAv9pc62eib4kBG2gca6eQc6JVqDCIx0YaYqXUQ3JQrqmBSOGcIkls/+Yr7M2SL3Upaqt+O1iEA3 6Vw5OxJw==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1qDq7Y-001vVM-AH; Mon, 26 Jun 2023 17:35:24 +0000 From: "Matthew Wilcox (Oracle)" 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 12/12] writeback: Remove a use of write_cache_pages() from do_writepages() Date: Mon, 26 Jun 2023 18:35:21 +0100 Message-Id: <20230626173521.459345-13-willy@infradead.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230626173521.459345-1-willy@infradead.org> References: <20230626173521.459345-1-willy@infradead.org> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769788871794280059?= X-GMAIL-MSGID: =?utf-8?q?1769788871794280059?= Use the new for_each_writeback_folio() directly instead of indirecting through a callback. Signed-off-by: Matthew Wilcox (Oracle) --- 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 245d6318dfb2..55832679af21 100644 --- a/mm/page-writeback.c +++ b/mm/page-writeback.c @@ -2557,13 +2557,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) @@ -2579,12 +2587,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;