mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-04 16:25:34 +00:00
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>
This commit is contained in:
parent
2e70d126f9
commit
19eaf5fd8c
1 changed files with 6 additions and 12 deletions
|
@ -1633,9 +1633,8 @@ int load_free_space_tree(struct btrfs_caching_control *caching_ctl)
|
|||
{
|
||||
struct btrfs_block_group *block_group;
|
||||
struct btrfs_free_space_info *info;
|
||||
struct btrfs_path *path;
|
||||
BTRFS_PATH_AUTO_FREE(path);
|
||||
u32 extent_count, flags;
|
||||
int ret;
|
||||
|
||||
block_group = caching_ctl->block_group;
|
||||
|
||||
|
@ -1652,10 +1651,9 @@ int load_free_space_tree(struct btrfs_caching_control *caching_ctl)
|
|||
path->reada = READA_FORWARD;
|
||||
|
||||
info = search_free_space_info(NULL, block_group, path, 0);
|
||||
if (IS_ERR(info)) {
|
||||
ret = PTR_ERR(info);
|
||||
goto out;
|
||||
}
|
||||
if (IS_ERR(info))
|
||||
return PTR_ERR(info);
|
||||
|
||||
extent_count = btrfs_free_space_extent_count(path->nodes[0], info);
|
||||
flags = btrfs_free_space_flags(path->nodes[0], info);
|
||||
|
||||
|
@ -1665,11 +1663,7 @@ int load_free_space_tree(struct btrfs_caching_control *caching_ctl)
|
|||
* there.
|
||||
*/
|
||||
if (flags & BTRFS_FREE_SPACE_USING_BITMAPS)
|
||||
ret = load_free_space_bitmaps(caching_ctl, path, extent_count);
|
||||
return load_free_space_bitmaps(caching_ctl, path, extent_count);
|
||||
else
|
||||
ret = load_free_space_extents(caching_ctl, path, extent_count);
|
||||
|
||||
out:
|
||||
btrfs_free_path(path);
|
||||
return ret;
|
||||
return load_free_space_extents(caching_ctl, path, extent_count);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue