Commit 051c98eb authored by David Sterba's avatar David Sterba

btrfs: open code trivial helper btrfs_page_exists_in_range

The called function name is self explanatory.
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 965aab1c
...@@ -364,10 +364,4 @@ static inline void btrfs_print_data_csum_error(struct btrfs_inode *inode, ...@@ -364,10 +364,4 @@ static inline void btrfs_print_data_csum_error(struct btrfs_inode *inode,
logical_start, csum, csum_expected, mirror_num); logical_start, csum, csum_expected, mirror_num);
} }
static inline bool btrfs_page_exists_in_range(struct inode *inode,
loff_t start, loff_t end)
{
return filemap_range_has_page(inode->i_mapping, start, end);
}
#endif #endif
...@@ -2482,7 +2482,8 @@ static int btrfs_punch_hole_lock_range(struct inode *inode, ...@@ -2482,7 +2482,8 @@ static int btrfs_punch_hole_lock_range(struct inode *inode,
if ((!ordered || if ((!ordered ||
(ordered->file_offset + ordered->len <= lockstart || (ordered->file_offset + ordered->len <= lockstart ||
ordered->file_offset > lockend)) && ordered->file_offset > lockend)) &&
!btrfs_page_exists_in_range(inode, lockstart, lockend)) { !filemap_range_has_page(inode->i_mapping,
lockstart, lockend)) {
if (ordered) if (ordered)
btrfs_put_ordered_extent(ordered); btrfs_put_ordered_extent(ordered);
break; break;
......
...@@ -7489,8 +7489,8 @@ static int lock_extent_direct(struct inode *inode, u64 lockstart, u64 lockend, ...@@ -7489,8 +7489,8 @@ static int lock_extent_direct(struct inode *inode, u64 lockstart, u64 lockend,
* get stale data. * get stale data.
*/ */
if (!ordered && if (!ordered &&
(!writing || (!writing || !filemap_range_has_page(inode->i_mapping,
!btrfs_page_exists_in_range(inode, lockstart, lockend))) lockstart, lockend)))
break; break;
unlock_extent_cached(&BTRFS_I(inode)->io_tree, lockstart, lockend, unlock_extent_cached(&BTRFS_I(inode)->io_tree, lockstart, lockend,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment