Commit 2e9e8dcd authored by Johannes Thumshirn's avatar Johannes Thumshirn Committed by David Sterba

btrfs: pass a reloc_control to relocate_file_extent_cluster()

Instead of passing in a reloc_control's data_inode and
file_extent_cluster members, pass in the whole reloc_control structure.
Reviewed-by: default avatarJosef Bacik <josef@toxicpanda.com>
Signed-off-by: default avatarJohannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent fa4adfc7
...@@ -3084,9 +3084,10 @@ static int relocate_one_folio(struct inode *inode, struct file_ra_state *ra, ...@@ -3084,9 +3084,10 @@ static int relocate_one_folio(struct inode *inode, struct file_ra_state *ra,
return ret; return ret;
} }
static int relocate_file_extent_cluster(struct inode *inode, static int relocate_file_extent_cluster(struct reloc_control *rc)
const struct file_extent_cluster *cluster)
{ {
struct inode *inode = rc->data_inode;
const struct file_extent_cluster *cluster = &rc->cluster;
u64 offset = BTRFS_I(inode)->reloc_block_group_start; u64 offset = BTRFS_I(inode)->reloc_block_group_start;
unsigned long index; unsigned long index;
unsigned long last_index; unsigned long last_index;
...@@ -3132,7 +3133,7 @@ static noinline_for_stack int relocate_data_extent(struct reloc_control *rc, ...@@ -3132,7 +3133,7 @@ static noinline_for_stack int relocate_data_extent(struct reloc_control *rc,
struct btrfs_root *root = BTRFS_I(inode)->root; struct btrfs_root *root = BTRFS_I(inode)->root;
if (cluster->nr > 0 && extent_key->objectid != cluster->end + 1) { if (cluster->nr > 0 && extent_key->objectid != cluster->end + 1) {
ret = relocate_file_extent_cluster(inode, cluster); ret = relocate_file_extent_cluster(rc);
if (ret) if (ret)
return ret; return ret;
cluster->nr = 0; cluster->nr = 0;
...@@ -3158,7 +3159,7 @@ static noinline_for_stack int relocate_data_extent(struct reloc_control *rc, ...@@ -3158,7 +3159,7 @@ static noinline_for_stack int relocate_data_extent(struct reloc_control *rc,
* the cluster we need to relocate. * the cluster we need to relocate.
*/ */
root->relocation_src_root = cluster->owning_root; root->relocation_src_root = cluster->owning_root;
ret = relocate_file_extent_cluster(inode, cluster); ret = relocate_file_extent_cluster(rc);
if (ret) if (ret)
return ret; return ret;
cluster->nr = 0; cluster->nr = 0;
...@@ -3177,7 +3178,7 @@ static noinline_for_stack int relocate_data_extent(struct reloc_control *rc, ...@@ -3177,7 +3178,7 @@ static noinline_for_stack int relocate_data_extent(struct reloc_control *rc,
cluster->nr++; cluster->nr++;
if (cluster->nr >= MAX_EXTENTS) { if (cluster->nr >= MAX_EXTENTS) {
ret = relocate_file_extent_cluster(inode, cluster); ret = relocate_file_extent_cluster(rc);
if (ret) if (ret)
return ret; return ret;
cluster->nr = 0; cluster->nr = 0;
...@@ -3775,8 +3776,7 @@ static noinline_for_stack int relocate_block_group(struct reloc_control *rc) ...@@ -3775,8 +3776,7 @@ static noinline_for_stack int relocate_block_group(struct reloc_control *rc)
} }
if (!err) { if (!err) {
ret = relocate_file_extent_cluster(rc->data_inode, ret = relocate_file_extent_cluster(rc);
&rc->cluster);
if (ret < 0) if (ret < 0)
err = ret; err = ret;
} }
......
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