Commit 01458828 authored by Nikolay Borisov's avatar Nikolay Borisov Committed by David Sterba

btrfs: Remove fs_info from do_chunk_alloc

This function is always called with a valid transaction handle from
where fs_info can be referenced. No functional changes.
Signed-off-by: default avatarNikolay Borisov <nborisov@suse.com>
Reviewed-by: default avatarQu Wenruo <wqu@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent f97806f2
...@@ -66,8 +66,7 @@ static int alloc_reserved_file_extent(struct btrfs_trans_handle *trans, ...@@ -66,8 +66,7 @@ static int alloc_reserved_file_extent(struct btrfs_trans_handle *trans,
static int alloc_reserved_tree_block(struct btrfs_trans_handle *trans, static int alloc_reserved_tree_block(struct btrfs_trans_handle *trans,
struct btrfs_delayed_ref_node *node, struct btrfs_delayed_ref_node *node,
struct btrfs_delayed_extent_op *extent_op); struct btrfs_delayed_extent_op *extent_op);
static int do_chunk_alloc(struct btrfs_trans_handle *trans, static int do_chunk_alloc(struct btrfs_trans_handle *trans, u64 flags,
struct btrfs_fs_info *fs_info, u64 flags,
int force); int force);
static int find_next_key(struct btrfs_path *path, int level, static int find_next_key(struct btrfs_path *path, int level,
struct btrfs_key *key); struct btrfs_key *key);
...@@ -4306,7 +4305,7 @@ int btrfs_alloc_data_chunk_ondemand(struct btrfs_inode *inode, u64 bytes) ...@@ -4306,7 +4305,7 @@ int btrfs_alloc_data_chunk_ondemand(struct btrfs_inode *inode, u64 bytes)
if (IS_ERR(trans)) if (IS_ERR(trans))
return PTR_ERR(trans); return PTR_ERR(trans);
ret = do_chunk_alloc(trans, fs_info, alloc_target, ret = do_chunk_alloc(trans, alloc_target,
CHUNK_ALLOC_NO_FORCE); CHUNK_ALLOC_NO_FORCE);
btrfs_end_transaction(trans); btrfs_end_transaction(trans);
if (ret < 0) { if (ret < 0) {
...@@ -4590,9 +4589,10 @@ void check_system_chunk(struct btrfs_trans_handle *trans, ...@@ -4590,9 +4589,10 @@ void check_system_chunk(struct btrfs_trans_handle *trans,
* - return 1 if it successfully allocates a chunk, * - return 1 if it successfully allocates a chunk,
* - return errors including -ENOSPC otherwise. * - return errors including -ENOSPC otherwise.
*/ */
static int do_chunk_alloc(struct btrfs_trans_handle *trans, static int do_chunk_alloc(struct btrfs_trans_handle *trans, u64 flags,
struct btrfs_fs_info *fs_info, u64 flags, int force) int force)
{ {
struct btrfs_fs_info *fs_info = trans->fs_info;
struct btrfs_space_info *space_info; struct btrfs_space_info *space_info;
int wait_for_alloc = 0; int wait_for_alloc = 0;
int ret = 0; int ret = 0;
...@@ -5001,7 +5001,7 @@ static void flush_space(struct btrfs_fs_info *fs_info, ...@@ -5001,7 +5001,7 @@ static void flush_space(struct btrfs_fs_info *fs_info,
ret = PTR_ERR(trans); ret = PTR_ERR(trans);
break; break;
} }
ret = do_chunk_alloc(trans, fs_info, ret = do_chunk_alloc(trans,
btrfs_metadata_alloc_profile(fs_info), btrfs_metadata_alloc_profile(fs_info),
CHUNK_ALLOC_NO_FORCE); CHUNK_ALLOC_NO_FORCE);
btrfs_end_transaction(trans); btrfs_end_transaction(trans);
...@@ -7842,8 +7842,7 @@ static noinline int find_free_extent(struct btrfs_fs_info *fs_info, ...@@ -7842,8 +7842,7 @@ static noinline int find_free_extent(struct btrfs_fs_info *fs_info,
goto out; goto out;
} }
ret = do_chunk_alloc(trans, fs_info, flags, ret = do_chunk_alloc(trans, flags, CHUNK_ALLOC_FORCE);
CHUNK_ALLOC_FORCE);
/* /*
* If we can't allocate a new chunk we've already looped * If we can't allocate a new chunk we've already looped
...@@ -9469,7 +9468,7 @@ int btrfs_inc_block_group_ro(struct btrfs_fs_info *fs_info, ...@@ -9469,7 +9468,7 @@ int btrfs_inc_block_group_ro(struct btrfs_fs_info *fs_info,
*/ */
alloc_flags = update_block_group_flags(fs_info, cache->flags); alloc_flags = update_block_group_flags(fs_info, cache->flags);
if (alloc_flags != cache->flags) { if (alloc_flags != cache->flags) {
ret = do_chunk_alloc(trans, fs_info, alloc_flags, ret = do_chunk_alloc(trans, alloc_flags,
CHUNK_ALLOC_FORCE); CHUNK_ALLOC_FORCE);
/* /*
* ENOSPC is allowed here, we may have enough space * ENOSPC is allowed here, we may have enough space
...@@ -9486,8 +9485,7 @@ int btrfs_inc_block_group_ro(struct btrfs_fs_info *fs_info, ...@@ -9486,8 +9485,7 @@ int btrfs_inc_block_group_ro(struct btrfs_fs_info *fs_info,
if (!ret) if (!ret)
goto out; goto out;
alloc_flags = get_alloc_profile(fs_info, cache->space_info->flags); alloc_flags = get_alloc_profile(fs_info, cache->space_info->flags);
ret = do_chunk_alloc(trans, fs_info, alloc_flags, ret = do_chunk_alloc(trans, alloc_flags, CHUNK_ALLOC_FORCE);
CHUNK_ALLOC_FORCE);
if (ret < 0) if (ret < 0)
goto out; goto out;
ret = inc_block_group_ro(cache, 0); ret = inc_block_group_ro(cache, 0);
...@@ -9509,7 +9507,7 @@ int btrfs_force_chunk_alloc(struct btrfs_trans_handle *trans, ...@@ -9509,7 +9507,7 @@ int btrfs_force_chunk_alloc(struct btrfs_trans_handle *trans,
{ {
u64 alloc_flags = get_alloc_profile(fs_info, type); u64 alloc_flags = get_alloc_profile(fs_info, type);
return do_chunk_alloc(trans, fs_info, alloc_flags, CHUNK_ALLOC_FORCE); return do_chunk_alloc(trans, alloc_flags, CHUNK_ALLOC_FORCE);
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment