summaryrefslogtreecommitdiff
path: root/volumes.c
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.com>2017-08-25 17:44:22 +0200
committerDavid Sterba <dsterba@suse.com>2017-09-08 16:15:05 +0200
commit2030f497516e6e91f0884c12bbf0b91a6c6b83e4 (patch)
treee22450bcb20c4da920a572de06d189495c7495da /volumes.c
parentd1b968dcbad59a304fafbf62b859e0692287a2f8 (diff)
btrfs-progs: drop blocksize argument from btrfs_find_create_tree_block
Metadata blocks are always nodesize. When reading the superblock::sys_array, the actual size of data is fixed to 4k and smaller than nodesize, but otherwise everything works as before. Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'volumes.c')
-rw-r--r--volumes.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/volumes.c b/volumes.c
index 974c601..2ae2d1b 100644
--- a/volumes.c
+++ b/volumes.c
@@ -1963,9 +1963,12 @@ int btrfs_read_sys_array(struct btrfs_fs_info *fs_info)
u32 cur_offset;
struct btrfs_key key;
- sb = btrfs_find_create_tree_block(fs_info,
- BTRFS_SUPER_INFO_OFFSET,
- BTRFS_SUPER_INFO_SIZE);
+ if (fs_info->nodesize < BTRFS_SUPER_INFO_SIZE) {
+ printf("ERROR: nodesize %u too small to read superblock\n",
+ fs_info->nodesize);
+ return -EINVAL;
+ }
+ sb = btrfs_find_create_tree_block(fs_info, BTRFS_SUPER_INFO_OFFSET);
if (!sb)
return -ENOMEM;
btrfs_set_buffer_uptodate(sb);