btrfs: remove pointless indentation in btrfs_read_sys_array()
Instead of checking if we've read a BTRFS_CHUNK_ITEM_KEY from disk and then process it we could just bail out early if the read disk key wasn't a BTRFS_CHUNK_ITEM_KEY. This removes a level of indentation and makes the code nicer to read. Reviewed-by: Nikolay Borisov <nborisov@suse.com> Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
5ae2169290
commit
32ab3d1b4d
|
@ -6806,11 +6806,18 @@ int btrfs_read_sys_array(struct btrfs_fs_info *fs_info)
|
||||||
sb_array_offset += len;
|
sb_array_offset += len;
|
||||||
cur_offset += len;
|
cur_offset += len;
|
||||||
|
|
||||||
if (key.type == BTRFS_CHUNK_ITEM_KEY) {
|
if (key.type != BTRFS_CHUNK_ITEM_KEY) {
|
||||||
|
btrfs_err(fs_info,
|
||||||
|
"unexpected item type %u in sys_array at offset %u",
|
||||||
|
(u32)key.type, cur_offset);
|
||||||
|
ret = -EIO;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
chunk = (struct btrfs_chunk *)sb_array_offset;
|
chunk = (struct btrfs_chunk *)sb_array_offset;
|
||||||
/*
|
/*
|
||||||
* At least one btrfs_chunk with one stripe must be
|
* At least one btrfs_chunk with one stripe must be present,
|
||||||
* present, exact stripe count check comes afterwards
|
* exact stripe count check comes afterwards
|
||||||
*/
|
*/
|
||||||
len = btrfs_chunk_item_size(1);
|
len = btrfs_chunk_item_size(1);
|
||||||
if (cur_offset + len > array_size)
|
if (cur_offset + len > array_size)
|
||||||
|
@ -6841,13 +6848,7 @@ int btrfs_read_sys_array(struct btrfs_fs_info *fs_info)
|
||||||
ret = read_one_chunk(&key, sb, chunk);
|
ret = read_one_chunk(&key, sb, chunk);
|
||||||
if (ret)
|
if (ret)
|
||||||
break;
|
break;
|
||||||
} else {
|
|
||||||
btrfs_err(fs_info,
|
|
||||||
"unexpected item type %u in sys_array at offset %u",
|
|
||||||
(u32)key.type, cur_offset);
|
|
||||||
ret = -EIO;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
array_ptr += len;
|
array_ptr += len;
|
||||||
sb_array_offset += len;
|
sb_array_offset += len;
|
||||||
cur_offset += len;
|
cur_offset += len;
|
||||||
|
|
Loading…
Reference in New Issue