Commit c2ccfbc6 authored by Nikolay Borisov's avatar Nikolay Borisov Committed by David Sterba

btrfs: Remove 'tree' argument from read_extent_buffer_pages

This function always uses the btree inode's io_tree. Stop taking the
tree as a function argument and instead access it internally from
read_extent_buffer_pages. No functional changes.
Reviewed-by: default avatarJohannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: default avatarNikolay Borisov <nborisov@suse.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent a56b1c7b
...@@ -465,8 +465,7 @@ static int btree_read_extent_buffer_pages(struct extent_buffer *eb, ...@@ -465,8 +465,7 @@ static int btree_read_extent_buffer_pages(struct extent_buffer *eb,
io_tree = &BTRFS_I(fs_info->btree_inode)->io_tree; io_tree = &BTRFS_I(fs_info->btree_inode)->io_tree;
while (1) { while (1) {
clear_bit(EXTENT_BUFFER_CORRUPT, &eb->bflags); clear_bit(EXTENT_BUFFER_CORRUPT, &eb->bflags);
ret = read_extent_buffer_pages(io_tree, eb, WAIT_COMPLETE, ret = read_extent_buffer_pages(eb, WAIT_COMPLETE, mirror_num);
mirror_num);
if (!ret) { if (!ret) {
if (verify_parent_transid(io_tree, eb, if (verify_parent_transid(io_tree, eb,
parent_transid, 0)) parent_transid, 0))
...@@ -1034,15 +1033,13 @@ static const struct address_space_operations btree_aops = { ...@@ -1034,15 +1033,13 @@ static const struct address_space_operations btree_aops = {
void readahead_tree_block(struct btrfs_fs_info *fs_info, u64 bytenr) void readahead_tree_block(struct btrfs_fs_info *fs_info, u64 bytenr)
{ {
struct extent_buffer *buf = NULL; struct extent_buffer *buf = NULL;
struct inode *btree_inode = fs_info->btree_inode;
int ret; int ret;
buf = btrfs_find_create_tree_block(fs_info, bytenr); buf = btrfs_find_create_tree_block(fs_info, bytenr);
if (IS_ERR(buf)) if (IS_ERR(buf))
return; return;
ret = read_extent_buffer_pages(&BTRFS_I(btree_inode)->io_tree, buf, ret = read_extent_buffer_pages(buf, WAIT_NONE, 0);
WAIT_NONE, 0);
if (ret < 0) if (ret < 0)
free_extent_buffer_stale(buf); free_extent_buffer_stale(buf);
else else
...@@ -1053,8 +1050,6 @@ int reada_tree_block_flagged(struct btrfs_fs_info *fs_info, u64 bytenr, ...@@ -1053,8 +1050,6 @@ int reada_tree_block_flagged(struct btrfs_fs_info *fs_info, u64 bytenr,
int mirror_num, struct extent_buffer **eb) int mirror_num, struct extent_buffer **eb)
{ {
struct extent_buffer *buf = NULL; struct extent_buffer *buf = NULL;
struct inode *btree_inode = fs_info->btree_inode;
struct extent_io_tree *io_tree = &BTRFS_I(btree_inode)->io_tree;
int ret; int ret;
buf = btrfs_find_create_tree_block(fs_info, bytenr); buf = btrfs_find_create_tree_block(fs_info, bytenr);
...@@ -1063,8 +1058,7 @@ int reada_tree_block_flagged(struct btrfs_fs_info *fs_info, u64 bytenr, ...@@ -1063,8 +1058,7 @@ int reada_tree_block_flagged(struct btrfs_fs_info *fs_info, u64 bytenr,
set_bit(EXTENT_BUFFER_READAHEAD, &buf->bflags); set_bit(EXTENT_BUFFER_READAHEAD, &buf->bflags);
ret = read_extent_buffer_pages(io_tree, buf, WAIT_PAGE_LOCK, ret = read_extent_buffer_pages(buf, WAIT_PAGE_LOCK, mirror_num);
mirror_num);
if (ret) { if (ret) {
free_extent_buffer_stale(buf); free_extent_buffer_stale(buf);
return ret; return ret;
......
...@@ -5330,8 +5330,7 @@ void set_extent_buffer_uptodate(struct extent_buffer *eb) ...@@ -5330,8 +5330,7 @@ void set_extent_buffer_uptodate(struct extent_buffer *eb)
} }
} }
int read_extent_buffer_pages(struct extent_io_tree *tree, int read_extent_buffer_pages(struct extent_buffer *eb, int wait, int mirror_num)
struct extent_buffer *eb, int wait, int mirror_num)
{ {
int i; int i;
struct page *page; struct page *page;
...@@ -5343,6 +5342,7 @@ int read_extent_buffer_pages(struct extent_io_tree *tree, ...@@ -5343,6 +5342,7 @@ int read_extent_buffer_pages(struct extent_io_tree *tree,
unsigned long num_reads = 0; unsigned long num_reads = 0;
struct bio *bio = NULL; struct bio *bio = NULL;
unsigned long bio_flags = 0; 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)) if (test_bit(EXTENT_BUFFER_UPTODATE, &eb->bflags))
return 0; return 0;
......
...@@ -433,8 +433,7 @@ void free_extent_buffer_stale(struct extent_buffer *eb); ...@@ -433,8 +433,7 @@ void free_extent_buffer_stale(struct extent_buffer *eb);
#define WAIT_NONE 0 #define WAIT_NONE 0
#define WAIT_COMPLETE 1 #define WAIT_COMPLETE 1
#define WAIT_PAGE_LOCK 2 #define WAIT_PAGE_LOCK 2
int read_extent_buffer_pages(struct extent_io_tree *tree, int read_extent_buffer_pages(struct extent_buffer *eb, int wait,
struct extent_buffer *eb, int wait,
int mirror_num); int mirror_num);
void wait_on_extent_buffer_writeback(struct extent_buffer *eb); void wait_on_extent_buffer_writeback(struct extent_buffer *eb);
......
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