Skip to content

Commit

Permalink
btrfs: cleanup, rename a few variables in btrfs_read_sys_array
Browse files Browse the repository at this point in the history
There's a pointer to buffer, integer offset and offset passed as
pointer, try to find matching names for them.

Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <clm@fb.com>
  • Loading branch information
David Sterba authored and Chris Mason committed Feb 3, 2015
1 parent ce7fca5 commit 1ffb22c
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions fs/btrfs/volumes.c
Original file line number Diff line number Diff line change
Expand Up @@ -6252,13 +6252,13 @@ int btrfs_read_sys_array(struct btrfs_root *root)
struct extent_buffer *sb;
struct btrfs_disk_key *disk_key;
struct btrfs_chunk *chunk;
u8 *ptr;
unsigned long sb_ptr;
u8 *array_ptr;
unsigned long sb_array_offset;
int ret = 0;
u32 num_stripes;
u32 array_size;
u32 len = 0;
u32 cur;
u32 cur_offset;
struct btrfs_key key;

ASSERT(BTRFS_SUPER_INFO_SIZE <= root->nodesize);
Expand Down Expand Up @@ -6290,20 +6290,21 @@ int btrfs_read_sys_array(struct btrfs_root *root)
write_extent_buffer(sb, super_copy, 0, BTRFS_SUPER_INFO_SIZE);
array_size = btrfs_super_sys_array_size(super_copy);

ptr = super_copy->sys_chunk_array;
sb_ptr = offsetof(struct btrfs_super_block, sys_chunk_array);
cur = 0;
array_ptr = super_copy->sys_chunk_array;
sb_array_offset = offsetof(struct btrfs_super_block, sys_chunk_array);
cur_offset = 0;

while (cur < array_size) {
disk_key = (struct btrfs_disk_key *)ptr;
while (cur_offset < array_size) {
disk_key = (struct btrfs_disk_key *)array_ptr;
btrfs_disk_key_to_cpu(&key, disk_key);

len = sizeof(*disk_key); ptr += len;
sb_ptr += len;
cur += len;
len = sizeof(*disk_key);
array_ptr += len;
sb_array_offset += len;
cur_offset += len;

if (key.type == BTRFS_CHUNK_ITEM_KEY) {
chunk = (struct btrfs_chunk *)sb_ptr;
chunk = (struct btrfs_chunk *)sb_array_offset;
ret = read_one_chunk(root, &key, sb, chunk);
if (ret)
break;
Expand All @@ -6313,9 +6314,9 @@ int btrfs_read_sys_array(struct btrfs_root *root)
ret = -EIO;
break;
}
ptr += len;
sb_ptr += len;
cur += len;
array_ptr += len;
sb_array_offset += len;
cur_offset += len;
}
free_extent_buffer(sb);
return ret;
Expand Down

0 comments on commit 1ffb22c

Please sign in to comment.