{
struct btrfs_fs_devices *fs_devices;
- u32 nodesize = btrfs_super_nodesize(fs_info->super_copy);
+ u32 nodesize = fs_info->nodesize;
int ret = BTRFS_BAD_FSID;
if (buf->start != btrfs_header_bytenr(buf))
int ret;
struct extent_buffer *eb;
u64 best_transid = 0;
- u32 sectorsize = btrfs_super_sectorsize(fs_info->super_copy);
- u32 nodesize = btrfs_super_nodesize(fs_info->super_copy);
+ u32 sectorsize = fs_info->sectorsize;
+ u32 nodesize = fs_info->nodesize;
int mirror_num = 0;
int good_mirror = 0;
int num_copies;
return write_and_map_eb(root, eb);
}
-void btrfs_setup_root(u32 nodesize, u32 sectorsize,
- u32 stripesize, struct btrfs_root *root,
- struct btrfs_fs_info *fs_info, u64 objectid)
+void btrfs_setup_root(struct btrfs_root *root, struct btrfs_fs_info *fs_info,
+ u64 objectid)
{
root->node = NULL;
root->commit_root = NULL;
- root->sectorsize = sectorsize;
- root->nodesize = nodesize;
- root->stripesize = stripesize;
+ root->sectorsize = fs_info->sectorsize;
+ root->nodesize = fs_info->nodesize;
+ root->stripesize = fs_info->stripesize;
root->ref_cows = 0;
root->track_dirty = 0;
u32 blocksize;
u64 generation;
- btrfs_setup_root(tree_root->nodesize, tree_root->sectorsize,
- tree_root->stripesize, root, fs_info, objectid);
+ btrfs_setup_root(root, fs_info, objectid);
ret = btrfs_find_last_root(tree_root, objectid,
&root->root_item, &root->root_key);
if (ret)
return ret;
- blocksize = root->nodesize;
+ blocksize = fs_info->nodesize;
generation = btrfs_root_generation(&root->root_item);
root->node = read_tree_block(root, btrfs_root_bytenr(&root->root_item),
blocksize, generation);
return 0;
}
- blocksize = tree_root->nodesize;
+ blocksize = fs_info->nodesize;
- btrfs_setup_root(tree_root->nodesize, tree_root->sectorsize,
- tree_root->stripesize, log_root, fs_info,
+ btrfs_setup_root(log_root, fs_info,
BTRFS_TREE_LOG_OBJECTID);
log_root->node = read_tree_block(tree_root, blocknr,
goto insert;
}
- btrfs_setup_root(tree_root->nodesize, tree_root->sectorsize,
- tree_root->stripesize, root, fs_info,
+ btrfs_setup_root(root, fs_info,
location->objectid);
path = btrfs_alloc_path();
return ERR_PTR(ret);
}
generation = btrfs_root_generation(&root->root_item);
- blocksize = root->nodesize;
+ blocksize = fs_info->nodesize;
root->node = read_tree_block(root, btrfs_root_bytenr(&root->root_item),
blocksize, generation);
if (!extent_buffer_uptodate(root->node)) {
struct btrfs_super_block *sb = fs_info->super_copy;
struct btrfs_root *root;
struct btrfs_key key;
- u32 sectorsize;
- u32 nodesize;
- u32 stripesize;
u64 generation;
u32 blocksize;
int ret;
- nodesize = btrfs_super_nodesize(sb);
- sectorsize = btrfs_super_sectorsize(sb);
- stripesize = btrfs_super_stripesize(sb);
-
root = fs_info->tree_root;
- btrfs_setup_root(nodesize, sectorsize, stripesize,
- root, fs_info, BTRFS_ROOT_TREE_OBJECTID);
- blocksize = root->nodesize;
+ 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)) {
u64 chunk_root_bytenr)
{
struct btrfs_super_block *sb = fs_info->super_copy;
- u32 sectorsize;
- u32 nodesize;
- u32 blocksize;
- u32 stripesize;
u64 generation;
int ret;
- nodesize = btrfs_super_nodesize(sb);
- sectorsize = btrfs_super_sectorsize(sb);
- stripesize = btrfs_super_stripesize(sb);
-
- btrfs_setup_root(nodesize, sectorsize, stripesize,
- fs_info->chunk_root, fs_info, BTRFS_CHUNK_TREE_OBJECTID);
+ btrfs_setup_root(fs_info->chunk_root, fs_info,
+ BTRFS_CHUNK_TREE_OBJECTID);
ret = btrfs_read_sys_array(fs_info->chunk_root);
if (ret)
return ret;
- blocksize = fs_info->chunk_root->nodesize;
generation = btrfs_super_chunk_root_generation(sb);
if (chunk_root_bytenr && !IS_ALIGNED(chunk_root_bytenr,
- btrfs_super_sectorsize(sb))) {
+ fs_info->sectorsize)) {
warning("chunk_root_bytenr %llu is unaligned to %u, ignore it",
- chunk_root_bytenr, btrfs_super_sectorsize(sb));
+ chunk_root_bytenr, fs_info->sectorsize);
chunk_root_bytenr = 0;
}
fs_info->chunk_root->node = read_tree_block(fs_info->chunk_root,
chunk_root_bytenr,
- blocksize, generation);
+ fs_info->nodesize,
+ generation);
if (!extent_buffer_uptodate(fs_info->chunk_root->node)) {
if (fs_info->ignore_chunk_tree_error) {
warning("cannot read chunk root, continue anyway");