diff options
author | Qu Wenruo <quwenruo@cn.fujitsu.com> | 2017-05-18 09:26:48 +0800 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2017-07-03 13:35:10 +0200 |
commit | fa48918bf0373003631698a030fb2cc0cf1f5fe5 (patch) | |
tree | 876f96fe5340d7a55fc5f06fe4537425594627bf /cmds-restore.c | |
parent | 155f4c217f54cec026108eab8d211561bb5ad549 (diff) |
btrfs-progs: Refactor block sizes users in cmds-restore.c
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Diffstat (limited to 'cmds-restore.c')
-rw-r--r-- | cmds-restore.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/cmds-restore.c b/cmds-restore.c index c327cef0..09388b29 100644 --- a/cmds-restore.c +++ b/cmds-restore.c @@ -126,7 +126,7 @@ static int decompress_lzo(struct btrfs_root *root, unsigned char *inbuf, inbuf += LZO_LEN; tot_in += LZO_LEN; - new_len = lzo1x_worst_compress(root->sectorsize); + new_len = lzo1x_worst_compress(root->fs_info->sectorsize); ret = lzo1x_decompress_safe((const unsigned char *)inbuf, in_len, (unsigned char *)outbuf, (void *)&new_len, NULL); @@ -143,8 +143,8 @@ static int decompress_lzo(struct btrfs_root *root, unsigned char *inbuf, * If the 4 byte header does not fit to the rest of the page we * have to move to the next one, unless we read some garbage */ - mod_page = tot_in % root->sectorsize; - rem_page = root->sectorsize - mod_page; + mod_page = tot_in % root->fs_info->sectorsize; + rem_page = root->fs_info->sectorsize - mod_page; if (rem_page < LZO_LEN) { inbuf += rem_page; tot_in += rem_page; @@ -1256,7 +1256,7 @@ static struct btrfs_root *open_fs(const char *dev, u64 root_location, root_location = btrfs_super_root(fs_info->super_copy); generation = btrfs_super_generation(fs_info->super_copy); root->node = read_tree_block(root, root_location, - root->nodesize, generation); + fs_info->nodesize, generation); if (!extent_buffer_uptodate(root->node)) { fprintf(stderr, "Error opening tree root\n"); close_ctree(root); @@ -1502,7 +1502,8 @@ int cmd_restore(int argc, char **argv) if (fs_location != 0) { free_extent_buffer(root->node); - root->node = read_tree_block(root, fs_location, root->nodesize, 0); + root->node = read_tree_block(root, fs_location, + root->fs_info->nodesize, 0); if (!extent_buffer_uptodate(root->node)) { fprintf(stderr, "Failed to read fs location\n"); ret = 1; |