mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00
btrfs: use BTRFS_PATH_AUTO_FREE in clear_free_space_tree()
This is the trivial pattern for path auto free, initialize at the beginning and free at the end with simple goto -> return conversions. Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
3bfd9ead81
commit
2e70d126f9
1 changed files with 4 additions and 7 deletions
|
@ -1215,7 +1215,7 @@ out_clear:
|
|||
static int clear_free_space_tree(struct btrfs_trans_handle *trans,
|
||||
struct btrfs_root *root)
|
||||
{
|
||||
struct btrfs_path *path;
|
||||
BTRFS_PATH_AUTO_FREE(path);
|
||||
struct btrfs_key key;
|
||||
int nr;
|
||||
int ret;
|
||||
|
@ -1231,7 +1231,7 @@ static int clear_free_space_tree(struct btrfs_trans_handle *trans,
|
|||
while (1) {
|
||||
ret = btrfs_search_slot(trans, root, &key, path, -1, 1);
|
||||
if (ret < 0)
|
||||
goto out;
|
||||
return ret;
|
||||
|
||||
nr = btrfs_header_nritems(path->nodes[0]);
|
||||
if (!nr)
|
||||
|
@ -1240,15 +1240,12 @@ static int clear_free_space_tree(struct btrfs_trans_handle *trans,
|
|||
path->slots[0] = 0;
|
||||
ret = btrfs_del_items(trans, root, path, 0, nr);
|
||||
if (ret)
|
||||
goto out;
|
||||
return ret;
|
||||
|
||||
btrfs_release_path(path);
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
out:
|
||||
btrfs_free_path(path);
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int btrfs_delete_free_space_tree(struct btrfs_fs_info *fs_info)
|
||||
|
|
Loading…
Add table
Reference in a new issue