diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 399e9fc2545e..7a2f657f5dbd 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c @@ -3134,6 +3134,8 @@ static int __do_readpage(struct extent_io_tree *tree, size_t blocksize = inode->i_sb->s_blocksize; unsigned long this_bio_flag = 0; + ASSERT(tree == &BTRFS_I(inode)->io_tree); + set_page_extent_mapped(page); if (!PageUptodate(page)) { @@ -3327,6 +3329,8 @@ static inline void contiguous_readpages(struct extent_io_tree *tree, struct btrfs_inode *inode = BTRFS_I(pages[0]->mapping->host); int index; + ASSERT(tree == &inode->io_tree); + btrfs_lock_and_flush_ordered_range(tree, inode, start, end, NULL); for (index = 0; index < nr_pages; index++) { @@ -3348,6 +3352,8 @@ static int __extent_read_full_page(struct extent_io_tree *tree, u64 end = start + PAGE_SIZE - 1; int ret; + ASSERT(tree == &inode->io_tree); + btrfs_lock_and_flush_ordered_range(tree, inode, start, end, NULL); ret = __do_readpage(tree, page, get_extent, NULL, bio, mirror_num, @@ -3362,6 +3368,8 @@ int extent_read_full_page(struct extent_io_tree *tree, struct page *page, unsigned long bio_flags = 0; int ret; + ASSERT(tree == &BTRFS_I(page->mapping->host)->io_tree); + ret = __extent_read_full_page(tree, page, get_extent, &bio, mirror_num, &bio_flags, 0); if (bio) @@ -5449,6 +5457,8 @@ int read_extent_buffer_pages(struct extent_buffer *eb, int wait, int mirror_num) if (test_bit(EXTENT_BUFFER_UPTODATE, &eb->bflags)) return 0; + ASSERT(tree == &BTRFS_I(eb->pages[0]->mapping->host)->io_tree); + num_pages = num_extent_pages(eb); for (i = 0; i < num_pages; i++) { page = eb->pages[i]; diff --git a/fs/btrfs/ordered-data.c b/fs/btrfs/ordered-data.c index 632981848649..f47accad6f05 100644 --- a/fs/btrfs/ordered-data.c +++ b/fs/btrfs/ordered-data.c @@ -854,6 +854,8 @@ void btrfs_lock_and_flush_ordered_range(struct extent_io_tree *tree, struct extent_state *cache = NULL; struct extent_state **cachedp = &cache; + ASSERT(tree == &inode->io_tree); + if (cached_state) cachedp = cached_state;