Commit ba69f42a authored by Anand Jain's avatar Anand Jain Committed by David Sterba

btrfs: rename ret to err in btrfs_recover_relocation()

In the function btrfs_recover_relocation(), currently the variable 'err'
carries the return value and 'ret' holds the intermediary return value.
However, in some lines, we don't need this two-step approach; we can
directly use 'err'. So, optimize them, which requires reinitializing 'err'
to zero at two locations.

This is a preparatory patch to fix the code style by renaming 'err'
to 'ret'.
Signed-off-by: default avatarAnand Jain <anand.jain@oracle.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 53d6c0da
......@@ -4233,17 +4233,16 @@ int btrfs_recover_relocation(struct btrfs_fs_info *fs_info)
key.offset = (u64)-1;
while (1) {
ret = btrfs_search_slot(NULL, fs_info->tree_root, &key,
err = btrfs_search_slot(NULL, fs_info->tree_root, &key,
path, 0, 0);
if (ret < 0) {
err = ret;
if (err < 0)
goto out;
}
if (ret > 0) {
if (err > 0) {
if (path->slots[0] == 0)
break;
path->slots[0]--;
}
err = 0;
leaf = path->nodes[0];
btrfs_item_key_to_cpu(leaf, &key, path->slots[0]);
btrfs_release_path(path);
......@@ -4265,16 +4264,13 @@ int btrfs_recover_relocation(struct btrfs_fs_info *fs_info)
fs_root = btrfs_get_fs_root(fs_info,
reloc_root->root_key.offset, false);
if (IS_ERR(fs_root)) {
ret = PTR_ERR(fs_root);
if (ret != -ENOENT) {
err = ret;
err = PTR_ERR(fs_root);
if (err != -ENOENT)
goto out;
}
ret = mark_garbage_root(reloc_root);
if (ret < 0) {
err = ret;
err = mark_garbage_root(reloc_root);
if (err < 0)
goto out;
}
err = 0;
} else {
btrfs_put_root(fs_root);
}
......@@ -4296,11 +4292,9 @@ int btrfs_recover_relocation(struct btrfs_fs_info *fs_info)
goto out;
}
ret = reloc_chunk_start(fs_info);
if (ret < 0) {
err = ret;
err = reloc_chunk_start(fs_info);
if (err < 0)
goto out_end;
}
rc->extent_root = btrfs_extent_root(fs_info, 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