Commit 2e70d126 authored by David Sterba's avatar David Sterba
Browse files

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: default avatarJohannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 3bfd9ead
Loading
Loading
Loading
Loading
+4 −7
Original line number Diff line number Diff line
@@ -1215,7 +1215,7 @@ int btrfs_create_free_space_tree(struct btrfs_fs_info *fs_info)
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)