From 965aab1cfc13dacc3d5ad0d8d8eb4e0a7ea8c1d1 Mon Sep 17 00:00:00 2001 From: Matthew Wilcox Date: Tue, 6 Mar 2018 11:23:16 -0800 Subject: btrfs: Use filemap_range_has_page() The current implementation of btrfs_page_exists_in_range() gives the wrong answer if the workingset code has stored a shadow entry in the page cache. The filemap_range_has_page() function does not have this problem, and it's shared code, so use it instead. eigned-off-by: Matthew Wilcox Reviewed-by: David Sterba Signed-off-by: David Sterba --- fs/btrfs/btrfs_inode.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'fs/btrfs/btrfs_inode.h') diff --git a/fs/btrfs/btrfs_inode.h b/fs/btrfs/btrfs_inode.h index f527e99c9f8d..078a53e01ece 100644 --- a/fs/btrfs/btrfs_inode.h +++ b/fs/btrfs/btrfs_inode.h @@ -364,6 +364,10 @@ static inline void btrfs_print_data_csum_error(struct btrfs_inode *inode, logical_start, csum, csum_expected, mirror_num); } -bool btrfs_page_exists_in_range(struct inode *inode, loff_t start, loff_t end); +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 -- cgit v1.2.3