Skip to content

Commit

Permalink
btrfs: sink argument tree to __extent_read_full_page
Browse files Browse the repository at this point in the history
The tree pointer can be safely read from the inode, use it and drop the
redundant argument.

Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Nikolay Borisov <nborisov@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
  • Loading branch information
David Sterba committed Mar 23, 2020
1 parent 71ad38b commit 0d44fea
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions fs/btrfs/extent_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -3340,8 +3340,7 @@ static inline void contiguous_readpages(struct extent_io_tree *tree,
}
}

static int __extent_read_full_page(struct extent_io_tree *tree,
struct page *page,
static int __extent_read_full_page(struct page *page,
get_extent_t *get_extent,
struct bio **bio, int mirror_num,
unsigned long *bio_flags,
Expand All @@ -3350,10 +3349,9 @@ static int __extent_read_full_page(struct extent_io_tree *tree,
struct btrfs_inode *inode = BTRFS_I(page->mapping->host);
u64 start = page_offset(page);
u64 end = start + PAGE_SIZE - 1;
struct extent_io_tree *tree = &inode->io_tree;
int ret;

ASSERT(tree == &inode->io_tree);

btrfs_lock_and_flush_ordered_range(inode, start, end, NULL);

ret = __do_readpage(tree, page, get_extent, NULL, bio, mirror_num,
Expand All @@ -3366,10 +3364,9 @@ int extent_read_full_page(struct page *page, get_extent_t *get_extent,
{
struct bio *bio = NULL;
unsigned long bio_flags = 0;
struct extent_io_tree *tree = &BTRFS_I(page->mapping->host)->io_tree;
int ret;

ret = __extent_read_full_page(tree, page, get_extent, &bio, mirror_num,
ret = __extent_read_full_page(page, get_extent, &bio, mirror_num,
&bio_flags, 0);
if (bio)
ret = submit_one_bio(bio, mirror_num, bio_flags);
Expand Down Expand Up @@ -5451,13 +5448,10 @@ int read_extent_buffer_pages(struct extent_buffer *eb, int wait, int mirror_num)
unsigned long num_reads = 0;
struct bio *bio = NULL;
unsigned long bio_flags = 0;
struct extent_io_tree *tree = &BTRFS_I(eb->fs_info->btree_inode)->io_tree;

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];
Expand Down Expand Up @@ -5501,7 +5495,7 @@ int read_extent_buffer_pages(struct extent_buffer *eb, int wait, int mirror_num)
}

ClearPageError(page);
err = __extent_read_full_page(tree, page,
err = __extent_read_full_page(page,
btree_get_extent, &bio,
mirror_num, &bio_flags,
REQ_META);
Expand Down

0 comments on commit 0d44fea

Please sign in to comment.