diff options
Diffstat (limited to 'fs/btrfs')
-rw-r--r-- | fs/btrfs/volumes.c | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index da7e0e1107d2..b33c83be2a97 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c | |||
@@ -6252,13 +6252,13 @@ int btrfs_read_sys_array(struct btrfs_root *root) | |||
6252 | struct extent_buffer *sb; | 6252 | struct extent_buffer *sb; |
6253 | struct btrfs_disk_key *disk_key; | 6253 | struct btrfs_disk_key *disk_key; |
6254 | struct btrfs_chunk *chunk; | 6254 | struct btrfs_chunk *chunk; |
6255 | u8 *ptr; | 6255 | u8 *array_ptr; |
6256 | unsigned long sb_ptr; | 6256 | unsigned long sb_array_offset; |
6257 | int ret = 0; | 6257 | int ret = 0; |
6258 | u32 num_stripes; | 6258 | u32 num_stripes; |
6259 | u32 array_size; | 6259 | u32 array_size; |
6260 | u32 len = 0; | 6260 | u32 len = 0; |
6261 | u32 cur; | 6261 | u32 cur_offset; |
6262 | struct btrfs_key key; | 6262 | struct btrfs_key key; |
6263 | 6263 | ||
6264 | ASSERT(BTRFS_SUPER_INFO_SIZE <= root->nodesize); | 6264 | ASSERT(BTRFS_SUPER_INFO_SIZE <= root->nodesize); |
@@ -6290,20 +6290,21 @@ int btrfs_read_sys_array(struct btrfs_root *root) | |||
6290 | write_extent_buffer(sb, super_copy, 0, BTRFS_SUPER_INFO_SIZE); | 6290 | write_extent_buffer(sb, super_copy, 0, BTRFS_SUPER_INFO_SIZE); |
6291 | array_size = btrfs_super_sys_array_size(super_copy); | 6291 | array_size = btrfs_super_sys_array_size(super_copy); |
6292 | 6292 | ||
6293 | ptr = super_copy->sys_chunk_array; | 6293 | array_ptr = super_copy->sys_chunk_array; |
6294 | sb_ptr = offsetof(struct btrfs_super_block, sys_chunk_array); | 6294 | sb_array_offset = offsetof(struct btrfs_super_block, sys_chunk_array); |
6295 | cur = 0; | 6295 | cur_offset = 0; |
6296 | 6296 | ||
6297 | while (cur < array_size) { | 6297 | while (cur_offset < array_size) { |
6298 | disk_key = (struct btrfs_disk_key *)ptr; | 6298 | disk_key = (struct btrfs_disk_key *)array_ptr; |
6299 | btrfs_disk_key_to_cpu(&key, disk_key); | 6299 | btrfs_disk_key_to_cpu(&key, disk_key); |
6300 | 6300 | ||
6301 | len = sizeof(*disk_key); ptr += len; | 6301 | len = sizeof(*disk_key); |
6302 | sb_ptr += len; | 6302 | array_ptr += len; |
6303 | cur += len; | 6303 | sb_array_offset += len; |
6304 | cur_offset += len; | ||
6304 | 6305 | ||
6305 | if (key.type == BTRFS_CHUNK_ITEM_KEY) { | 6306 | if (key.type == BTRFS_CHUNK_ITEM_KEY) { |
6306 | chunk = (struct btrfs_chunk *)sb_ptr; | 6307 | chunk = (struct btrfs_chunk *)sb_array_offset; |
6307 | ret = read_one_chunk(root, &key, sb, chunk); | 6308 | ret = read_one_chunk(root, &key, sb, chunk); |
6308 | if (ret) | 6309 | if (ret) |
6309 | break; | 6310 | break; |
@@ -6313,9 +6314,9 @@ int btrfs_read_sys_array(struct btrfs_root *root) | |||
6313 | ret = -EIO; | 6314 | ret = -EIO; |
6314 | break; | 6315 | break; |
6315 | } | 6316 | } |
6316 | ptr += len; | 6317 | array_ptr += len; |
6317 | sb_ptr += len; | 6318 | sb_array_offset += len; |
6318 | cur += len; | 6319 | cur_offset += len; |
6319 | } | 6320 | } |
6320 | free_extent_buffer(sb); | 6321 | free_extent_buffer(sb); |
6321 | return ret; | 6322 | return ret; |