[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3ff1d03f6be91450830060372337b27c0a600d38.1728071257.git.rgoldwyn@suse.com>
Date: Fri, 4 Oct 2024 16:04:37 -0400
From: Goldwyn Rodrigues <rgoldwyn@...e.de>
To: linux-kernel@...r.kernel.org
Cc: linux-fsdevel@...r.kernel.org,
Goldwyn Rodrigues <rgoldwyn@...e.com>
Subject: [PATCH 10/12] btrfs: define btrfs_iomap_folio_ops
From: Goldwyn Rodrigues <rgoldwyn@...e.com>
The put_folio() sets folio->private to EXTENT_PAGE_PRIVATE if not
already set using set_page_extent_mapped().
Signed-off-by: Goldwyn Rodrigues <rgoldwyn@...e.com>
---
fs/btrfs/extent_io.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index 43418b6d4824..ee0d37388441 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -901,6 +901,18 @@ void clear_folio_extent_mapped(struct folio *folio)
folio_detach_private(folio);
}
+static void btrfs_put_folio(struct inode *inode, loff_t pos,
+ unsigned copied, struct folio *folio)
+{
+ set_folio_extent_mapped(folio);
+ folio_unlock(folio);
+ folio_put(folio);
+}
+
+static const struct iomap_folio_ops btrfs_iomap_folio_ops = {
+ .put_folio = btrfs_put_folio,
+};
+
static void btrfs_em_to_iomap(struct inode *inode,
struct extent_map *em, struct iomap *iomap,
loff_t sector_pos, bool write)
@@ -928,6 +940,7 @@ static void btrfs_em_to_iomap(struct inode *inode,
iomap->offset = em->start;
iomap->bdev = fs_info->fs_devices->latest_dev->bdev;
iomap->length = em->len;
+ iomap->folio_ops = &btrfs_iomap_folio_ops;
}
static struct extent_map *__get_extent_map(struct inode *inode,
--
2.46.1
Powered by blists - more mailing lists