Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp5269069rwl; Sun, 8 Jan 2023 11:44:07 -0800 (PST) X-Google-Smtp-Source: AMrXdXtz7V56H+DCGgonmm8/OJxQR3TPW3YF3254fr77pWFtQ02dm8QjtDvgTJ74MRSPxvmDMEZm X-Received: by 2002:a17:907:c28b:b0:84d:12d8:e1e9 with SMTP id tk11-20020a170907c28b00b0084d12d8e1e9mr287489ejc.41.1673207047779; Sun, 08 Jan 2023 11:44:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673207047; cv=none; d=google.com; s=arc-20160816; b=WsKyzzdcFqj1zLQl38HpNComSmXQVJnhgzAKeNAwp2Y4DO/FRFARmE6IQrMCHFxcoQ 76VFAqHiTvSEfssuXSzsaIoEFXnRpd3lJzGcvKTKolP6DrAbLNSKn4eUlZMA/0T13LgN 1G821dBnGyy7rKG+Izo7LScplcNCMTY8gkhIdVR7aWkzR7DR5chHKHJd3MCOJ2YkEFTD OX75Xo8tCBJ9h5hUeROACZ1bzxf8RVFV1qvKMgdGiKm4t5mXrmAHV4BedS3XkGfrRhaY Ne5lVktlhnWgD+McNsg8LkCbJYLwlNkPuKhUx96NUc890MV2EX0KMjmJeecbmXEQkYK2 SGQQ== 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=jtakh2AgEDKVCPUWaoe26OrkTCvuUUh6tKhp0SuOyNE=; b=T59gdUsQCNoPfEk9w+Z0dx/OGfzrJPGmNP79tSPQhYXcz9RjXK5sklxBldqUrve43O IRLXOYLX1bTS5xmCLL/DYzQZoJIFN6GVjjlsx7RD3h4mBpDnoKGgiiJgJQRsqNIlVya8 n28kYVaprjDSPbz0iYHXA3F5yGiW6jKUXDKVdbjEPHINhOpnM7X5rL+X6hkD1fxuQtEi vSTZGiIZqrLWXVpNxtgchW2L1NS80dkBXnxuDV7c4NHOX11Qh4UE1F0uLlkdE1291cTg cji2aNOJfO8Odvl2XK+gOfOw3nOThNqDqltiXyte2qX8UpbBXiYhrclqgwI6YaUMXpJN iA4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=UFUEfFnz; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ss4-20020a170907c00400b007e9516bc01dsi6368945ejc.212.2023.01.08.11.43.43; Sun, 08 Jan 2023 11:44:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-ext4-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=@redhat.com header.s=mimecast20190719 header.b=UFUEfFnz; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233612AbjAHTnG (ORCPT + 99 others); Sun, 8 Jan 2023 14:43:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49552 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233550AbjAHTnD (ORCPT ); Sun, 8 Jan 2023 14:43:03 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 106FCBC9B for ; Sun, 8 Jan 2023 11:41:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1673206860; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jtakh2AgEDKVCPUWaoe26OrkTCvuUUh6tKhp0SuOyNE=; b=UFUEfFnzu+apLBgsLR9/miU6HsYdY2+5USMIXDmQZg0tz8miBCzUU8XOTg33YmY5vnv6UZ yCGEWxQoxa/UbCUlD+l3DIx1R9a0VkSFvwZQOIL7ooJO6wFXFL6sDAU/b4/uiUmYF4XxOj OYRyl/K9CqMb0OQPgoQpc02MswTSArA= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-647-xSd0PQZENraCFS7Qx9oJQg-1; Sun, 08 Jan 2023 14:40:56 -0500 X-MC-Unique: xSd0PQZENraCFS7Qx9oJQg-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 94F161875043; Sun, 8 Jan 2023 19:40:55 +0000 (UTC) Received: from pasta.redhat.com (ovpn-192-3.brq.redhat.com [10.40.192.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 53A01492B06; Sun, 8 Jan 2023 19:40:53 +0000 (UTC) From: Andreas Gruenbacher To: Christoph Hellwig , "Darrick J . Wong" , Alexander Viro , Matthew Wilcox Cc: Andreas Gruenbacher , linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org, cluster-devel@redhat.com Subject: [RFC v6 06/10] iomap: Add __iomap_get_folio helper Date: Sun, 8 Jan 2023 20:40:30 +0100 Message-Id: <20230108194034.1444764-7-agruenba@redhat.com> In-Reply-To: <20230108194034.1444764-1-agruenba@redhat.com> References: <20230108194034.1444764-1-agruenba@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=unavailable 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-ext4@vger.kernel.org Add an __iomap_get_folio() helper as the counterpart of the existing __iomap_put_folio() helper. Use the new helper in iomap_write_begin(). Not a functional change. Signed-off-by: Andreas Gruenbacher --- fs/iomap/buffered-io.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c index 418519dea2ce..666107c3a385 100644 --- a/fs/iomap/buffered-io.c +++ b/fs/iomap/buffered-io.c @@ -602,6 +602,17 @@ static int __iomap_write_begin(const struct iomap_iter *iter, loff_t pos, return 0; } +static struct folio *__iomap_get_folio(struct iomap_iter *iter, loff_t pos, + size_t len) +{ + const struct iomap_page_ops *page_ops = iter->iomap.page_ops; + + if (page_ops && page_ops->page_prepare) + return page_ops->page_prepare(iter, pos, len); + else + return iomap_get_folio(iter, pos); +} + static void __iomap_put_folio(struct iomap_iter *iter, loff_t pos, size_t ret, struct folio *folio) { @@ -642,10 +653,7 @@ static int iomap_write_begin(struct iomap_iter *iter, loff_t pos, if (!mapping_large_folio_support(iter->inode->i_mapping)) len = min_t(size_t, len, PAGE_SIZE - offset_in_page(pos)); - if (page_ops && page_ops->page_prepare) - folio = page_ops->page_prepare(iter, pos, len); - else - folio = iomap_get_folio(iter, pos); + folio = __iomap_get_folio(iter, pos, len); if (IS_ERR(folio)) return PTR_ERR(folio); -- 2.38.1