Commit 5ae21692 authored by Johannes Thumshirn's avatar Johannes Thumshirn Committed by David Sterba

btrfs: reduce indentation in btrfs_may_alloc_data_chunk

In btrfs_may_alloc_data_chunk() we're checking if the chunk type is of
type BTRFS_BLOCK_GROUP_DATA and if it is we process it.

Instead of checking if the chunk type is a BTRFS_BLOCK_GROUP_DATA chunk
we can negate the check and bail out early if it isn't.

This makes the code a bit more readable.
Reviewed-by: default avatarNikolay Borisov <nborisov@suse.com>
Signed-off-by: default avatarJohannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 721860d5
...@@ -2982,7 +2982,9 @@ static int btrfs_may_alloc_data_chunk(struct btrfs_fs_info *fs_info, ...@@ -2982,7 +2982,9 @@ static int btrfs_may_alloc_data_chunk(struct btrfs_fs_info *fs_info,
chunk_type = cache->flags; chunk_type = cache->flags;
btrfs_put_block_group(cache); btrfs_put_block_group(cache);
if (chunk_type & BTRFS_BLOCK_GROUP_DATA) { if (!(chunk_type & BTRFS_BLOCK_GROUP_DATA))
return 0;
spin_lock(&fs_info->data_sinfo->lock); spin_lock(&fs_info->data_sinfo->lock);
bytes_used = fs_info->data_sinfo->bytes_used; bytes_used = fs_info->data_sinfo->bytes_used;
spin_unlock(&fs_info->data_sinfo->lock); spin_unlock(&fs_info->data_sinfo->lock);
...@@ -2995,14 +2997,13 @@ static int btrfs_may_alloc_data_chunk(struct btrfs_fs_info *fs_info, ...@@ -2995,14 +2997,13 @@ static int btrfs_may_alloc_data_chunk(struct btrfs_fs_info *fs_info,
if (IS_ERR(trans)) if (IS_ERR(trans))
return PTR_ERR(trans); return PTR_ERR(trans);
ret = btrfs_force_chunk_alloc(trans, ret = btrfs_force_chunk_alloc(trans, BTRFS_BLOCK_GROUP_DATA);
BTRFS_BLOCK_GROUP_DATA);
btrfs_end_transaction(trans); btrfs_end_transaction(trans);
if (ret < 0) if (ret < 0)
return ret; return ret;
return 1; return 1;
} }
}
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment