@@ -966,6 +966,29 @@ static int btree_releasepage(struct page *page, gfp_t gfp_flags)
return try_release_extent_buffer(page);
}
+/*
+ * basic invalidatepage code, this waits on any locked or writeback
+ * ranges corresponding to the page, and then deletes any extent state
+ * records from the tree
+ */
+static void extent_invalidatepage(struct extent_io_tree *tree,
+ struct page *page, unsigned long offset)
+{
+ struct extent_state *cached_state = NULL;
+ u64 start = page_offset(page);
+ u64 end = start + PAGE_SIZE - 1;
+ size_t blocksize = page->mapping->host->i_sb->s_blocksize;
+
+ start += ALIGN(offset, blocksize);
+ if (start > end)
+ return;
+
+ lock_extent_bits(tree, start, end, &cached_state);
+ wait_on_page_writeback(page);
+ clear_extent_bit(tree, start, end, EXTENT_LOCKED | EXTENT_DELALLOC |
+ EXTENT_DO_ACCOUNTING, 1, 1, &cached_state);
+}
+
static void btree_invalidatepage(struct page *page, unsigned int offset,
unsigned int length)
{
@@ -227,8 +227,6 @@ void find_first_clear_extent_bit(struct extent_io_tree *tree, u64 start,
u64 *start_ret, u64 *end_ret, unsigned bits);
int find_contiguous_extent_bit(struct extent_io_tree *tree, u64 start,
u64 *start_ret, u64 *end_ret, unsigned bits);
-int extent_invalidatepage(struct extent_io_tree *tree,
- struct page *page, unsigned long offset);
bool btrfs_find_delalloc_range(struct extent_io_tree *tree, u64 *start,
u64 *end, u64 max_bytes,
struct extent_state **cached_state);
@@ -4409,30 +4409,6 @@ void extent_readahead(struct readahead_control *rac)
}
}
-/*
- * basic invalidatepage code, this waits on any locked or writeback
- * ranges corresponding to the page, and then deletes any extent state
- * records from the tree
- */
-int extent_invalidatepage(struct extent_io_tree *tree,
- struct page *page, unsigned long offset)
-{
- struct extent_state *cached_state = NULL;
- u64 start = page_offset(page);
- u64 end = start + PAGE_SIZE - 1;
- size_t blocksize = page->mapping->host->i_sb->s_blocksize;
-
- start += ALIGN(offset, blocksize);
- if (start > end)
- return 0;
-
- lock_extent_bits(tree, start, end, &cached_state);
- wait_on_page_writeback(page);
- clear_extent_bit(tree, start, end, EXTENT_LOCKED | EXTENT_DELALLOC |
- EXTENT_DO_ACCOUNTING, 1, 1, &cached_state);
- return 0;
-}
-
/*
* a helper for releasepage, this tests for areas of the page that
* are locked or under IO and drops the related state bits if it is safe
Function extent_invalidatepage() has a single caller, btree_invalidatepage(). Just unexport this function and move it disk-io.c. Signed-off-by: Qu Wenruo <wqu@suse.com> --- fs/btrfs/disk-io.c | 23 +++++++++++++++++++++++ fs/btrfs/extent-io-tree.h | 2 -- fs/btrfs/extent_io.c | 24 ------------------------ 3 files changed, 23 insertions(+), 26 deletions(-)