From patchwork Mon Jun 26 17:35:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 113076 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp7654327vqr; Mon, 26 Jun 2023 10:55:52 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5CNPp50o5hts3EwxeNbtfEh+KVf+TFMC9OdLCb6RFQITQzNJmitLLurT0KazHLggyq/bVu X-Received: by 2002:a05:6402:1250:b0:51b:ebd7:641a with SMTP id l16-20020a056402125000b0051bebd7641amr9239667edw.7.1687802151404; Mon, 26 Jun 2023 10:55:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687802151; cv=none; d=google.com; s=arc-20160816; b=k6bQ4ro29dRFfPZUldKw0meJv9p6pce+nPjoKq3otVE7AF/dsEN5Vo9N+4MUScroBW XMkQvVJsTud2pFXryQhgCychlc3/en1pl4gNGgUFC1Ot10NmWhVB19G/rSMiAeloaEUz G7ZnF3V9aN9r1jSqSs0249wq9GYaYqwIyKti05B71G4eXGbBuGmPL0KFe/UH0Vr7dKaE zaqityXRU2RkT9slqMnbS9zkyPLXCYniEgoVR3znox4xK91Xi6+yqe5BAvwylW3uHQaY xa0b7Buv0ePIhr9q+GbVsz1a5oQ7xVFxUvkdCh27yYgu1NxrTPGGc9B2hhsp9YAOUJb8 aETg== 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=sd4UR031RbDntAg7Q2TtCsIA81STdESVBYZOrBi6xDM=; fh=s6qbYcpKmY0AEsK/gKDpT3qiaGyyaU+hQ5h16uVwDEk=; b=dq5KaQNKDh7X0G2WLBNWlvwbw0/Y9vyKNz1SB19y0JNCQgcXszHaraGUqSBJ7niJYn y6zIYP0HoVXklR+LUKdN3ZeRHY0Iyw+3+W2m+ADdih2fYH25bPbrj2lgCkulKLGDVV0b Fs/c/9zTSJyQlDaaIWl1uJ8FRptS8IwmRBgUg6sY25xsETcgfEVVdw1wtDUTBohgovpy tp0c5I2W/HCXu8DH+3JPXTaaMLuV3mucLGP63SPhKGw8Ws9wLWUjt5cJ6DiKnor2DN6k IlIPrWHaCx0oZYo68FXNxN4t+xxJFBHkqiBUtb0w673bgF630zKN/RVZKWcqqWqqbf47 NdDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=qIKh3LKN; 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 m16-20020aa7c490000000b0051d7d8497dcsi2965433edq.512.2023.06.26.10.55.27; Mon, 26 Jun 2023 10:55:51 -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=qIKh3LKN; 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 S229965AbjFZRgR (ORCPT + 99 others); Mon, 26 Jun 2023 13:36:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36554 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231670AbjFZRf4 (ORCPT ); Mon, 26 Jun 2023 13:35:56 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C6A562738; Mon, 26 Jun 2023 10:35:27 -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=sd4UR031RbDntAg7Q2TtCsIA81STdESVBYZOrBi6xDM=; b=qIKh3LKNsyIKL6wn9vPVDEzZ+D eEqSPJa/7CQUC5xinii35WBEGVSuPYk98nQd3Rk665j4winBw8s0gcTwod5j//SI78kDfO8LiKpb2 QxPbWsAW0AuHq/5s0VxBqJ9MT/wDfN/+rlOdpY2Fk2YtsFFIPIG9BsONHh4138hmsct/3ELFT9roh e0+vNhPUTa71jfAWtaK5OPKL2MmIEixL3WqzjOmsa18TETHpzf2dOygWdHq4KBAPddiWMAqpgRmR3 ydq70lu0ywMlmKyHpMvrSv53DWf8nfN6Ya3A+O2Bn3zHyOeojHJDOD+gOEsd739ZMiyDu/U2u0Yl8 Ak2tJitA==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1qDq7Y-001vVK-58; 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 11/12] iomap: Convert iomap_writepages() to use for_each_writeback_folio() Date: Mon, 26 Jun 2023 18:35:20 +0100 Message-Id: <20230626173521.459345-12-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?1769788828529099547?= X-GMAIL-MSGID: =?utf-8?q?1769788828529099547?= This removes one indirect function call per folio, and adds typesafety by not casting through a void pointer. Signed-off-by: Matthew Wilcox (Oracle) --- fs/iomap/buffered-io.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c index a4fa81af60d9..a4dd17abe244 100644 --- a/fs/iomap/buffered-io.c +++ b/fs/iomap/buffered-io.c @@ -1711,9 +1711,8 @@ iomap_writepage_map(struct iomap_writepage_ctx *wpc, * regular allocated space. */ static int iomap_do_writepage(struct folio *folio, - struct writeback_control *wbc, void *data) + struct writeback_control *wbc, struct iomap_writepage_ctx *wpc) { - struct iomap_writepage_ctx *wpc = data; struct inode *inode = folio->mapping->host; u64 end_pos, isize; @@ -1810,13 +1809,16 @@ iomap_writepages(struct address_space *mapping, struct writeback_control *wbc, struct iomap_writepage_ctx *wpc, const struct iomap_writeback_ops *ops) { - int ret; + struct folio *folio; + int err; wpc->ops = ops; - ret = write_cache_pages(mapping, wbc, iomap_do_writepage, wpc); + for_each_writeback_folio(mapping, wbc, folio, err) + err = iomap_do_writepage(folio, wbc, wpc); + if (!wpc->ioend) - return ret; - return iomap_submit_ioend(wpc, wpc->ioend, ret); + return err; + return iomap_submit_ioend(wpc, wpc->ioend, err); } EXPORT_SYMBOL_GPL(iomap_writepages);