Commit 5e00f193 authored by Jeff Mahoney's avatar Jeff Mahoney Committed by David Sterba

btrfs: convert btrfs_inc_block_group_ro to accept fs_info

btrfs_inc_block_group_ro is either passed the extent root or the dev
root, but it doesn't do anything with the dev tree.  Let's convert
to passing an fs_info and using the extent root.
Signed-off-by: default avatarJeff Mahoney <jeffm@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 0c9ab349
...@@ -2729,7 +2729,7 @@ int btrfs_cond_migrate_bytes(struct btrfs_fs_info *fs_info, ...@@ -2729,7 +2729,7 @@ int btrfs_cond_migrate_bytes(struct btrfs_fs_info *fs_info,
void btrfs_block_rsv_release(struct btrfs_fs_info *fs_info, void btrfs_block_rsv_release(struct btrfs_fs_info *fs_info,
struct btrfs_block_rsv *block_rsv, struct btrfs_block_rsv *block_rsv,
u64 num_bytes); u64 num_bytes);
int btrfs_inc_block_group_ro(struct btrfs_root *root, int btrfs_inc_block_group_ro(struct btrfs_fs_info *fs_info,
struct btrfs_block_group_cache *cache); struct btrfs_block_group_cache *cache);
void btrfs_dec_block_group_ro(struct btrfs_block_group_cache *cache); void btrfs_dec_block_group_ro(struct btrfs_block_group_cache *cache);
void btrfs_put_block_group_cache(struct btrfs_fs_info *info); void btrfs_put_block_group_cache(struct btrfs_fs_info *info);
......
...@@ -9359,17 +9359,16 @@ static int inc_block_group_ro(struct btrfs_block_group_cache *cache, int force) ...@@ -9359,17 +9359,16 @@ static int inc_block_group_ro(struct btrfs_block_group_cache *cache, int force)
return ret; return ret;
} }
int btrfs_inc_block_group_ro(struct btrfs_root *root, int btrfs_inc_block_group_ro(struct btrfs_fs_info *fs_info,
struct btrfs_block_group_cache *cache) struct btrfs_block_group_cache *cache)
{ {
struct btrfs_fs_info *fs_info = root->fs_info;
struct btrfs_trans_handle *trans; struct btrfs_trans_handle *trans;
u64 alloc_flags; u64 alloc_flags;
int ret; int ret;
again: again:
trans = btrfs_join_transaction(root); trans = btrfs_join_transaction(fs_info->extent_root);
if (IS_ERR(trans)) if (IS_ERR(trans))
return PTR_ERR(trans); return PTR_ERR(trans);
......
...@@ -4334,7 +4334,7 @@ int btrfs_relocate_block_group(struct btrfs_fs_info *fs_info, u64 group_start) ...@@ -4334,7 +4334,7 @@ int btrfs_relocate_block_group(struct btrfs_fs_info *fs_info, u64 group_start)
rc->block_group = btrfs_lookup_block_group(fs_info, group_start); rc->block_group = btrfs_lookup_block_group(fs_info, group_start);
BUG_ON(!rc->block_group); BUG_ON(!rc->block_group);
ret = btrfs_inc_block_group_ro(extent_root, rc->block_group); ret = btrfs_inc_block_group_ro(fs_info, rc->block_group);
if (ret) { if (ret) {
err = ret; err = ret;
goto out; goto out;
......
...@@ -3582,7 +3582,7 @@ int scrub_enumerate_chunks(struct scrub_ctx *sctx, ...@@ -3582,7 +3582,7 @@ int scrub_enumerate_chunks(struct scrub_ctx *sctx,
* -> btrfs_scrub_pause() * -> btrfs_scrub_pause()
*/ */
scrub_pause_on(fs_info); scrub_pause_on(fs_info);
ret = btrfs_inc_block_group_ro(root, cache); ret = btrfs_inc_block_group_ro(fs_info, cache);
if (!ret && is_dev_replace) { if (!ret && is_dev_replace) {
/* /*
* If we are doing a device replace wait for any tasks * If we are doing a device replace wait for any tasks
......
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