]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
iomap: Add __iomap_get_folio helper
authorAndreas Gruenbacher <agruenba@redhat.com>
Sun, 15 Jan 2023 16:50:02 +0000 (08:50 -0800)
committerDarrick J. Wong <djwong@kernel.org>
Wed, 18 Jan 2023 18:44:05 +0000 (10:44 -0800)
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 <agruenba@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
fs/iomap/buffered-io.c

index 418519dea2ce1e438bb977026853c1bab15a0fba..666107c3a3850d9a0c4ea45224c18fb60991ce8b 100644 (file)
@@ -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);