Commit 7056bf69 authored by Nikolay Borisov's avatar Nikolay Borisov Committed by David Sterba

btrfs: consolidate btrfs_previous_item ret val handling in btrfs_shrink_device

Instead of having three 'if' to handle non-NULL return value consolidate
this in one 'if (ret)'. That way the code is more obvious:

 - Always drop delete_unused_bgs_mutex if ret is not NULL
 - If ret is negative -> goto done
 - If it's 1 -> reset ret to 0, release the path and finish the loop.
Reviewed-by: default avatarJosef Bacik <josef@toxicpanda.com>
Signed-off-by: default avatarNikolay Borisov <nborisov@suse.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 1478143a
...@@ -4668,11 +4668,10 @@ int btrfs_shrink_device(struct btrfs_device *device, u64 new_size) ...@@ -4668,11 +4668,10 @@ int btrfs_shrink_device(struct btrfs_device *device, u64 new_size)
} }
ret = btrfs_previous_item(root, path, 0, key.type); ret = btrfs_previous_item(root, path, 0, key.type);
if (ret) if (ret) {
mutex_unlock(&fs_info->delete_unused_bgs_mutex); mutex_unlock(&fs_info->delete_unused_bgs_mutex);
if (ret < 0) if (ret < 0)
goto done; goto done;
if (ret) {
ret = 0; ret = 0;
btrfs_release_path(path); btrfs_release_path(path);
break; break;
......
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