Commit 7949f339 authored by David Sterba's avatar David Sterba
Browse files

btrfs: get fs_info from block group in lookup_free_space_inode



We can read fs_info from the block group cache structure and can drop it
from the parameters.

Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent fdf08605
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -3312,7 +3312,7 @@ static int cache_save_setup(struct btrfs_block_group_cache *block_group,
	if (trans->aborted)
		return 0;
again:
	inode = lookup_free_space_inode(fs_info, block_group, path);
	inode = lookup_free_space_inode(block_group, path);
	if (IS_ERR(inode) && PTR_ERR(inode) != -ENOENT) {
		ret = PTR_ERR(inode);
		btrfs_release_path(path);
@@ -10699,7 +10699,7 @@ int btrfs_remove_block_group(struct btrfs_trans_handle *trans,
	 * get the inode first so any iput calls done for the io_list
	 * aren't the final iput (no unlinks allowed now)
	 */
	inode = lookup_free_space_inode(fs_info, block_group, path);
	inode = lookup_free_space_inode(block_group, path);

	mutex_lock(&trans->transaction->cache_write_mutex);
	/*
+6 −5
Original line number Diff line number Diff line
@@ -88,10 +88,11 @@ static struct inode *__lookup_free_space_inode(struct btrfs_root *root,
	return inode;
}

struct inode *lookup_free_space_inode(struct btrfs_fs_info *fs_info,
				      struct btrfs_block_group_cache
				      *block_group, struct btrfs_path *path)
struct inode *lookup_free_space_inode(
		struct btrfs_block_group_cache *block_group,
		struct btrfs_path *path)
{
	struct btrfs_fs_info *fs_info = block_group->fs_info;
	struct inode *inode = NULL;
	u32 flags = BTRFS_INODE_NODATASUM | BTRFS_INODE_NODATACOW;

@@ -857,7 +858,7 @@ int load_free_space_cache(struct btrfs_fs_info *fs_info,
	 * once created get their ->cached field set to BTRFS_CACHE_FINISHED so
	 * we will never try to read their inode item while the fs is mounted.
	 */
	inode = lookup_free_space_inode(fs_info, block_group, path);
	inode = lookup_free_space_inode(block_group, path);
	if (IS_ERR(inode)) {
		btrfs_free_path(path);
		return 0;
@@ -1385,7 +1386,7 @@ int btrfs_write_out_cache(struct btrfs_trans_handle *trans,
	}
	spin_unlock(&block_group->lock);

	inode = lookup_free_space_inode(fs_info, block_group, path);
	inode = lookup_free_space_inode(block_group, path);
	if (IS_ERR(inode))
		return 0;

+3 −3
Original line number Diff line number Diff line
@@ -38,9 +38,9 @@ struct btrfs_free_space_op {

struct btrfs_io_ctl;

struct inode *lookup_free_space_inode(struct btrfs_fs_info *fs_info,
				      struct btrfs_block_group_cache
				      *block_group, struct btrfs_path *path);
struct inode *lookup_free_space_inode(
		struct btrfs_block_group_cache *block_group,
		struct btrfs_path *path);
int create_free_space_inode(struct btrfs_trans_handle *trans,
			    struct btrfs_block_group_cache *block_group,
			    struct btrfs_path *path);
+1 −1
Original line number Diff line number Diff line
@@ -4299,7 +4299,7 @@ int btrfs_relocate_block_group(struct btrfs_fs_info *fs_info, u64 group_start)
		goto out;
	}

	inode = lookup_free_space_inode(fs_info, rc->block_group, path);
	inode = lookup_free_space_inode(rc->block_group, path);
	btrfs_free_path(path);

	if (!IS_ERR(inode))