summaryrefslogtreecommitdiff
path: root/disk-io.c
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.com>2017-08-25 16:20:16 +0200
committerDavid Sterba <dsterba@suse.com>2017-09-08 16:15:05 +0200
commit1fa9653dc809ca05c21a2127c9faf15f04bd8ef8 (patch)
tree7ce07efb7cd0bde856650aacf9bf9156c75c6d26 /disk-io.c
parent5d8b645f6f2a5aa6d2b01b2023faeb92000c4d67 (diff)
btrfs-progs: drop local blocksize variables if they're nodesize
Prep work so we can drop the blocksize argument from several functions. Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'disk-io.c')
-rw-r--r--disk-io.c17
1 files changed, 4 insertions, 13 deletions
diff --git a/disk-io.c b/disk-io.c
index 8cf800ea..df262f6b 100644
--- a/disk-io.c
+++ b/disk-io.c
@@ -615,7 +615,6 @@ static int find_and_setup_root(struct btrfs_root *tree_root,
u64 objectid, struct btrfs_root *root)
{
int ret;
- u32 blocksize;
u64 generation;
btrfs_setup_root(root, fs_info, objectid);
@@ -624,11 +623,10 @@ static int find_and_setup_root(struct btrfs_root *tree_root,
if (ret)
return ret;
- blocksize = fs_info->nodesize;
generation = btrfs_root_generation(&root->root_item);
root->node = read_tree_block(fs_info,
btrfs_root_bytenr(&root->root_item),
- blocksize, generation);
+ fs_info->nodesize, generation);
if (!extent_buffer_uptodate(root->node))
return -EIO;
@@ -639,7 +637,6 @@ static int find_and_setup_log_root(struct btrfs_root *tree_root,
struct btrfs_fs_info *fs_info,
struct btrfs_super_block *disk_super)
{
- u32 blocksize;
u64 blocknr = btrfs_super_log_root(disk_super);
struct btrfs_root *log_root = malloc(sizeof(struct btrfs_root));
@@ -651,13 +648,11 @@ static int find_and_setup_log_root(struct btrfs_root *tree_root,
return 0;
}
- blocksize = fs_info->nodesize;
-
btrfs_setup_root(log_root, fs_info,
BTRFS_TREE_LOG_OBJECTID);
log_root->node = read_tree_block(fs_info, blocknr,
- blocksize,
+ fs_info->nodesize,
btrfs_super_generation(disk_super) + 1);
fs_info->log_root_tree = log_root;
@@ -700,7 +695,6 @@ struct btrfs_root *btrfs_read_fs_root_no_cache(struct btrfs_fs_info *fs_info,
struct btrfs_path *path;
struct extent_buffer *l;
u64 generation;
- u32 blocksize;
int ret = 0;
root = calloc(1, sizeof(*root));
@@ -744,10 +738,9 @@ out:
return ERR_PTR(ret);
}
generation = btrfs_root_generation(&root->root_item);
- blocksize = fs_info->nodesize;
root->node = read_tree_block(fs_info,
btrfs_root_bytenr(&root->root_item),
- blocksize, generation);
+ fs_info->nodesize, generation);
if (!extent_buffer_uptodate(root->node)) {
free(root);
return ERR_PTR(-EIO);
@@ -984,12 +977,10 @@ int btrfs_setup_all_roots(struct btrfs_fs_info *fs_info, u64 root_tree_bytenr,
struct btrfs_root *root;
struct btrfs_key key;
u64 generation;
- u32 blocksize;
int ret;
root = fs_info->tree_root;
btrfs_setup_root(root, fs_info, BTRFS_ROOT_TREE_OBJECTID);
- blocksize = fs_info->nodesize;
generation = btrfs_super_generation(sb);
if (!root_tree_bytenr && !(flags & OPEN_CTREE_BACKUP_ROOT)) {
@@ -1006,7 +997,7 @@ int btrfs_setup_all_roots(struct btrfs_fs_info *fs_info, u64 root_tree_bytenr,
generation = btrfs_backup_tree_root_gen(backup);
}
- root->node = read_tree_block(fs_info, root_tree_bytenr, blocksize,
+ root->node = read_tree_block(fs_info, root_tree_bytenr, fs_info->nodesize,
generation);
if (!extent_buffer_uptodate(root->node)) {
fprintf(stderr, "Couldn't read tree root\n");