btrfs: Move btrfs_lock_and_flush_ordered_range call in btrfs_do_readpage
PATCH 1/1 btrfs: Move btrfs_lock_and_flush_ordered_range call in btrfs_do_readpage
btrfs_lock_and_flush_ordered_range returns with the extent range locked. Subsequently this lock is being dropped in btrfs_do_readpage. Given this it makes more sense to move the call to the locking function inside btrfs_do_readpage making btrfs_do_readpage self-contained as it calls unlock_extent a couple of times. No functional changes.
--- fs/btrfs/extent_io.c | 2 ++ fs/btrfs/inode.c | 5 ----- 2 files changed, 2 insertions(+), 5 deletions(-)
fs/btrfs/extent_io.c +2 -0
@@ -3163,6 +3163,8 @@ int btrfs_do_readpage(struct page *page, struct extent_map **em_cached,unsigned long this_bio_flag =0 ;struct extent_io_tree *tree = &BTRFS_I (inode)->io_tree; +btrfs_lock_and_flush_ordered_range (BTRFS_I (inode), start, end,NULL ); +set_page_extent_mapped (page);if (!PageUptodate (page)) {
fs/btrfs/inode.c +0 -5
@@ -8023,15 +8023,10 @@ static int btrfs_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,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 ;unsigned long bio_flags =0 ;struct bio *bio =NULL ;int ret; -btrfs_lock_and_flush_ordered_range (inode, start, end,NULL ); - ret =btrfs_do_readpage (page,NULL , &bio, &bio_flags,0 ,NULL );if (bio) ret =submit_one_bio (bio,0 , bio_flags);
Signature · 1 line
2.17.1
Looks good,
Quoted 3 lines · Johannes Thumshirn
Looks good,
Reviewed-by Johannes Thumshirn <[email protected]>
Actually no, this conflicts with btrfs_do_readpage call from contiguous_readpages which results in double lock.
Quoted 3 lines · Nikolay Borisov
Actually no, this conflicts with
btrfs_do_readpagecall fromcontiguous_readpageswhich results in double lock.
Right didn't see it :(
But why can't we remove the btrfs_lock_and_flush_ordered_range call in contigous_readpages?