diff mbox series

[RFC,31/31] btrfs: Switch to iomap_readpage() and iomap_readahead()

Message ID 92c58a2ffd31c6538fe3b1a50d5c38556631cbae.1623567940.git.rgoldwyn@suse.com (mailing list archive)
State New, archived
Headers show
Series btrfs buffered iomap support | expand

Commit Message

Goldwyn Rodrigues June 13, 2021, 1:39 p.m. UTC
From: Goldwyn Rodrigues <rgoldwyn@suse.com>

Use iomap readpage and readahead sequences.

Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com>
---
 fs/btrfs/inode.c | 17 ++++-------------
 1 file changed, 4 insertions(+), 13 deletions(-)
diff mbox series

Patch

diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 1ca83c11e8b9..56d9cbeb151d 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -8320,18 +8320,8 @@  const struct iomap_ops btrfs_buffered_read_iomap_ops = {
 
 int btrfs_readpage(struct file *file, struct page *page)
 {
-	struct btrfs_inode *inode = BTRFS_I(page->mapping->host);
-	u64 start = page_offset(page);
-	u64 end = start + PAGE_SIZE - 1;
-	struct btrfs_bio_ctrl bio_ctrl = { 0 };
-	int ret;
-
-	btrfs_lock_and_flush_ordered_range(inode, start, end, NULL);
-
-	ret = btrfs_do_readpage(page, NULL, &bio_ctrl, 0, NULL);
-	if (bio_ctrl.bio)
-		ret = submit_one_bio(bio_ctrl.bio, 0, bio_ctrl.bio_flags);
-	return ret;
+	return iomap_readpage(page, &btrfs_buffered_read_iomap_ops,
+				&btrfs_iomap_readpage_ops);
 }
 
 static int find_delalloc_range(struct inode *inode, u64 *start, u64 *end)
@@ -8492,7 +8482,8 @@  static int btrfs_writepages(struct address_space *mapping,
 
 static void btrfs_readahead(struct readahead_control *rac)
 {
-	extent_readahead(rac);
+	iomap_readahead(rac, &btrfs_buffered_read_iomap_ops,
+			&btrfs_iomap_readpage_ops);
 }
 
 static int __btrfs_releasepage(struct page *page, gfp_t gfp_flags)