summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQu Wenruo <quwenruo@cn.fujitsu.com>2017-06-13 17:19:26 +0800
committerDavid Sterba <dsterba@suse.com>2017-07-12 17:53:21 +0200
commitbb3ecd59f23b9cef8a657200c7455eb3f320682a (patch)
tree9a2a9e0b863d2a9d143173b29adc35cca2dbc50e
parent6aaf1b10e79d20db0727f0d56ce6a618bdc22285 (diff)
btrfs-progs: Refactor btrfs_readahead_tree_block to use btrfs_fs_info
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
-rw-r--r--cmds-check.c8
-rw-r--r--ctree.c2
-rw-r--r--disk-io.c8
-rw-r--r--disk-io.h4
-rw-r--r--image/main.c2
5 files changed, 13 insertions, 11 deletions
diff --git a/cmds-check.c b/cmds-check.c
index e49b529d..339297d3 100644
--- a/cmds-check.c
+++ b/cmds-check.c
@@ -1967,6 +1967,7 @@ out:
static void reada_walk_down(struct btrfs_root *root,
struct extent_buffer *node, int slot)
{
+ struct btrfs_fs_info *fs_info = root->fs_info;
u64 bytenr;
u64 ptr_gen;
u32 nritems;
@@ -1979,11 +1980,11 @@ static void reada_walk_down(struct btrfs_root *root,
return;
nritems = btrfs_header_nritems(node);
- blocksize = root->fs_info->nodesize;
+ blocksize = fs_info->nodesize;
for (i = slot; i < nritems; i++) {
bytenr = btrfs_node_blockptr(node, i);
ptr_gen = btrfs_node_ptr_generation(node, i);
- readahead_tree_block(root, bytenr, blocksize, ptr_gen);
+ readahead_tree_block(fs_info, bytenr, blocksize, ptr_gen);
}
}
@@ -7610,6 +7611,7 @@ static int run_next_block(struct btrfs_root *root,
struct device_extent_tree *dev_extent_cache,
struct root_item_record *ri)
{
+ struct btrfs_fs_info *fs_info = root->fs_info;
struct extent_buffer *buf;
struct extent_record *rec = NULL;
u64 bytenr;
@@ -7639,7 +7641,7 @@ static int run_next_block(struct btrfs_root *root,
continue;
/* fixme, get the parent transid */
- readahead_tree_block(root, bits[i].start,
+ readahead_tree_block(fs_info, bits[i].start,
bits[i].size, 0);
}
}
diff --git a/ctree.c b/ctree.c
index a6916b30..f3c13e1c 100644
--- a/ctree.c
+++ b/ctree.c
@@ -1021,7 +1021,7 @@ void reada_for_search(struct btrfs_root *root, struct btrfs_path *path,
if ((search >= lowest_read && search <= highest_read) ||
(search < lowest_read && lowest_read - search <= 32768) ||
(search > highest_read && search - highest_read <= 32768)) {
- readahead_tree_block(root, search, blocksize,
+ readahead_tree_block(fs_info, search, blocksize,
btrfs_node_ptr_generation(node, nr));
nread += blocksize;
}
diff --git a/disk-io.c b/disk-io.c
index 7addaf61..686c55e7 100644
--- a/disk-io.c
+++ b/disk-io.c
@@ -187,17 +187,17 @@ struct extent_buffer* btrfs_find_create_tree_block(
return alloc_extent_buffer(&fs_info->extent_cache, bytenr, blocksize);
}
-void readahead_tree_block(struct btrfs_root *root, u64 bytenr, u32 blocksize,
- u64 parent_transid)
+void readahead_tree_block(struct btrfs_fs_info *fs_info, u64 bytenr,
+ u32 blocksize, u64 parent_transid)
{
struct extent_buffer *eb;
u64 length;
struct btrfs_multi_bio *multi = NULL;
struct btrfs_device *device;
- eb = btrfs_find_tree_block(root->fs_info, bytenr, blocksize);
+ eb = btrfs_find_tree_block(fs_info, bytenr, blocksize);
if (!(eb && btrfs_buffer_uptodate(eb, parent_transid)) &&
- !btrfs_map_block(root->fs_info, READ, bytenr, &length, &multi, 0,
+ !btrfs_map_block(fs_info, READ, bytenr, &length, &multi, 0,
NULL)) {
device = multi->stripes[0].dev;
device->total_ios++;
diff --git a/disk-io.h b/disk-io.h
index 20520e59..b834fea4 100644
--- a/disk-io.h
+++ b/disk-io.h
@@ -121,8 +121,8 @@ struct extent_buffer* read_tree_block(
int read_extent_data(struct btrfs_fs_info *fs_info, char *data, u64 logical,
u64 *len, int mirror);
-void readahead_tree_block(struct btrfs_root *root, u64 bytenr, u32 blocksize,
- u64 parent_transid);
+void readahead_tree_block(struct btrfs_fs_info *fs_info, u64 bytenr,
+ u32 blocksize, u64 parent_transid);
struct extent_buffer* btrfs_find_create_tree_block(
struct btrfs_fs_info *fs_info, u64 bytenr, u32 blocksize);
diff --git a/image/main.c b/image/main.c
index e49430db..fac9b760 100644
--- a/image/main.c
+++ b/image/main.c
@@ -1029,7 +1029,7 @@ static int add_extent(u64 start, u64 size, struct metadump_struct *md,
return ret;
md->pending_start = start;
}
- readahead_tree_block(md->root, start, size, 0);
+ readahead_tree_block(md->root->fs_info, start, size, 0);
md->pending_size += size;
md->data = data;
return 0;