From patchwork Thu Jan 25 08:57:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13530273 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 DADEBC47422 for ; Thu, 25 Jan 2024 08:59:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 74635280009; Thu, 25 Jan 2024 03:59:14 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 6F736280001; Thu, 25 Jan 2024 03:59:14 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 596A1280009; Thu, 25 Jan 2024 03:59:14 -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 45577280001 for ; Thu, 25 Jan 2024 03:59:14 -0500 (EST) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 1756F1C132D for ; Thu, 25 Jan 2024 08:59:14 +0000 (UTC) X-FDA: 81717234228.04.7E02B3F Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf23.hostedemail.com (Postfix) with ESMTP id 7C52F140012 for ; Thu, 25 Jan 2024 08:59:12 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=MwDns8za; spf=none (imf23.hostedemail.com: domain of BATV+b97a0fc658bf3e588113+7459+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+b97a0fc658bf3e588113+7459+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=1706173152; 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=VteIp731KUh3YSK1JiCDa6aylLsuTXuUpMz7VQeOhBM=; b=kgFUkNBuzxW/xRyXeHuFIJu/r3kAIpOyoGwXpQXgfQ0cpA47U7+6k9yhA54PmNhFZliyHA 2ck2E/GnQTgkO7pms87cV+8ezXssfZKT71+fwv5RfYfTWfiIRkGd2YhKXsZJkqwzLcOUl2 1wGFH0BJVgeP0a7lXGAwIlC1CokJV2Q= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1706173152; a=rsa-sha256; cv=none; b=nixUlQ74NKV3HUzU2ryuMUvKdYt5hZwH+MfwX0UvPgC7A0d1x9G4vqK8vaAUHqZd3CTpnK WW4naG0+jVIdTI0QFLuX1laxvfrGn6wEdtW0LaZjpVLvg9AYcVRKHA1QpgB7T79Y4AqCdj vtQOjQme2gLDm7F5IoShftKiyr327IY= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=MwDns8za; spf=none (imf23.hostedemail.com: domain of BATV+b97a0fc658bf3e588113+7459+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+b97a0fc658bf3e588113+7459+infradead.org+hch@bombadil.srs.infradead.org; dmarc=none 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=VteIp731KUh3YSK1JiCDa6aylLsuTXuUpMz7VQeOhBM=; b=MwDns8za7rOoyeeWAlr3o2HuQV 6MsdXZx1OlD4vY4TVWPSxa5TjcHnxy09D2/JDj47wRd2wEL80LFuC5im3yK7CJXPj2jlucMoHhjYY 5ZfQoIWEjbS3nQGUD167nRpjZ9IYSoNIanwVbuJcTe8tTJhTKK4ufectQpX4R6xdrpv7nl7S3sak0 v3d1Nqpjk+YxJc8FB0tBthiV35NdcgzGgWajgKmp1mRJWvAQd5eTU+gEFmq7Eu6UAAF1itV8yLtxl 6KqrehrsyNRLzDHyou0HEwBNknKvykRNrwdjpWOZZrcDO7qYmxX27CByg2snYSfEFCFJfxeKf9Tkb Pf5DB47w==; 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 1rSvZm-007Qa9-3D; Thu, 25 Jan 2024 08:59:11 +0000 From: Christoph Hellwig To: linux-mm@kvack.org Cc: Matthew Wilcox , Jan Kara , David Howells , Brian Foster , Christian Brauner , "Darrick J. Wong" , linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 18/19] iomap: Convert iomap_writepages() to use for_each_writeback_folio() Date: Thu, 25 Jan 2024 09:57:57 +0100 Message-Id: <20240125085758.2393327-19-hch@lst.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240125085758.2393327-1-hch@lst.de> References: <20240125085758.2393327-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-Queue-Id: 7C52F140012 X-Rspam-User: X-Stat-Signature: 6bisqpn9chq9i4t466qzxmo19s6bg94a X-Rspamd-Server: rspam03 X-HE-Tag: 1706173152-209709 X-HE-Meta: U2FsdGVkX1+6qp3J1PF3raweAYstugve6zffIkHvNimmEpJIj/ShX27nN//UmPAx0pxGWBQOXgVpU6fGr7gz415RPCLj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aTPMdnVDLVe/o44VML8JZubqlMQYxPfnh8xYPq/svT7+QmhSxDwrSNdfZXzcsNoMsILlDJ9SRnqgaQvniYe0gpATZ95q8uHLvxdej+q5KOvgwWd0Nl/h6J431MSqWZVI+YB6bO08N4IUt5VACNT4x6RBAAXdnWMpqXU3UIJ0dfzRux6O+OybEmA9sa7eE87GUjpVPrk7cnFQxrrJ8612eQwfcz3LB5b31NOovZ23IkBnYGt3rCTS94nPl9rfRKCj2J/dv+jvsUDTGXzf0bpgzcJ3SvdDYNjOoJAvABnaMApVr1f5807UBgj4c+sT05IS7crrlgAO7uM17VuSdCUYtrtUNTDU= 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 This removes one indirect function call per folio, and adds typesafety by not casting through a void pointer. Signed-off-by: Matthew Wilcox (Oracle) Signed-off-by: Christoph Hellwig Reviewed-by: Jan Kara --- fs/iomap/buffered-io.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c index 093c4515b22a53..58b3661f5eac9e 100644 --- a/fs/iomap/buffered-io.c +++ b/fs/iomap/buffered-io.c @@ -1887,9 +1887,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; @@ -1986,10 +1985,12 @@ 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 ret; wpc->ops = ops; - ret = write_cache_pages(mapping, wbc, iomap_do_writepage, wpc); + for_each_writeback_folio(mapping, wbc, folio, ret) + ret = iomap_do_writepage(folio, wbc, wpc); if (!wpc->ioend) return ret; return iomap_submit_ioend(wpc, wpc->ioend, ret);