Skip to content

Commit 19eaf5f

Browse files
committed
btrfs: use BTRFS_PATH_AUTO_FREE in load_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>
1 parent 2e70d12 commit 19eaf5f

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

fs/btrfs/free-space-tree.c

+6-12
Original file line numberDiff line numberDiff line change
@@ -1633,9 +1633,8 @@ int load_free_space_tree(struct btrfs_caching_control *caching_ctl)
16331633
{
16341634
struct btrfs_block_group *block_group;
16351635
struct btrfs_free_space_info *info;
1636-
struct btrfs_path *path;
1636+
BTRFS_PATH_AUTO_FREE(path);
16371637
u32 extent_count, flags;
1638-
int ret;
16391638

16401639
block_group = caching_ctl->block_group;
16411640

@@ -1652,10 +1651,9 @@ int load_free_space_tree(struct btrfs_caching_control *caching_ctl)
16521651
path->reada = READA_FORWARD;
16531652

16541653
info = search_free_space_info(NULL, block_group, path, 0);
1655-
if (IS_ERR(info)) {
1656-
ret = PTR_ERR(info);
1657-
goto out;
1658-
}
1654+
if (IS_ERR(info))
1655+
return PTR_ERR(info);
1656+
16591657
extent_count = btrfs_free_space_extent_count(path->nodes[0], info);
16601658
flags = btrfs_free_space_flags(path->nodes[0], info);
16611659

@@ -1665,11 +1663,7 @@ int load_free_space_tree(struct btrfs_caching_control *caching_ctl)
16651663
* there.
16661664
*/
16671665
if (flags & BTRFS_FREE_SPACE_USING_BITMAPS)
1668-
ret = load_free_space_bitmaps(caching_ctl, path, extent_count);
1666+
return load_free_space_bitmaps(caching_ctl, path, extent_count);
16691667
else
1670-
ret = load_free_space_extents(caching_ctl, path, extent_count);
1671-
1672-
out:
1673-
btrfs_free_path(path);
1674-
return ret;
1668+
return load_free_space_extents(caching_ctl, path, extent_count);
16751669
}

0 commit comments

Comments
 (0)