summaryrefslogtreecommitdiff
path: root/fs/btrfs/relocation.c
diff options
context:
space:
mode:
authorNikolay Borisov <nborisov@suse.com>2020-06-03 08:55:44 +0300
committerDavid Sterba <dsterba@suse.com>2020-07-27 13:55:37 +0300
commit056d9beca3e5052134f9834dd2a159f3f113981c (patch)
tree7131904feb439983176224c98531f4b0349d9d26 /fs/btrfs/relocation.c
parent65d87f7918ef11a4040f87393cba7b8dff0d9fc8 (diff)
downloadlinux-056d9beca3e5052134f9834dd2a159f3f113981c.tar.xz
btrfs: make prealloc_file_extent_cluster take btrfs_inode
The vfs inode is only used for a pair of inode_lock/unlock calls all other uses call for btrfs_inode. Signed-off-by: Nikolay Borisov <nborisov@suse.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/relocation.c')
-rw-r--r--fs/btrfs/relocation.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c
index 4a2959ebece4..523d2e5fab8f 100644
--- a/fs/btrfs/relocation.c
+++ b/fs/btrfs/relocation.c
@@ -2571,14 +2571,14 @@ out_free_blocks:
return err;
}
-static noinline_for_stack
-int prealloc_file_extent_cluster(struct inode *inode,
- struct file_extent_cluster *cluster)
+static noinline_for_stack int prealloc_file_extent_cluster(
+ struct btrfs_inode *inode,
+ struct file_extent_cluster *cluster)
{
u64 alloc_hint = 0;
u64 start;
u64 end;
- u64 offset = BTRFS_I(inode)->index_cnt;
+ u64 offset = inode->index_cnt;
u64 num_bytes;
int nr;
int ret = 0;
@@ -2587,12 +2587,12 @@ int prealloc_file_extent_cluster(struct inode *inode,
u64 cur_offset = prealloc_start;
BUG_ON(cluster->start != cluster->boundary[0]);
- ret = btrfs_alloc_data_chunk_ondemand(BTRFS_I(inode),
+ ret = btrfs_alloc_data_chunk_ondemand(inode,
prealloc_end + 1 - prealloc_start);
if (ret)
return ret;
- inode_lock(inode);
+ inode_lock(&inode->vfs_inode);
for (nr = 0; nr < cluster->nr; nr++) {
start = cluster->boundary[nr] - offset;
if (nr + 1 < cluster->nr)
@@ -2600,20 +2600,20 @@ int prealloc_file_extent_cluster(struct inode *inode,
else
end = cluster->end - offset;
- lock_extent(&BTRFS_I(inode)->io_tree, start, end);
+ lock_extent(&inode->io_tree, start, end);
num_bytes = end + 1 - start;
- ret = btrfs_prealloc_file_range(inode, 0, start,
+ ret = btrfs_prealloc_file_range(&inode->vfs_inode, 0, start,
num_bytes, num_bytes,
end + 1, &alloc_hint);
cur_offset = end + 1;
- unlock_extent(&BTRFS_I(inode)->io_tree, start, end);
+ unlock_extent(&inode->io_tree, start, end);
if (ret)
break;
}
- inode_unlock(inode);
+ inode_unlock(&inode->vfs_inode);
if (cur_offset < prealloc_end)
- btrfs_free_reserved_data_space_noquota(btrfs_sb(inode->i_sb),
+ btrfs_free_reserved_data_space_noquota(inode->root->fs_info,
prealloc_end + 1 - cur_offset);
return ret;
}
@@ -2682,7 +2682,7 @@ static int relocate_file_extent_cluster(struct inode *inode,
if (!ra)
return -ENOMEM;
- ret = prealloc_file_extent_cluster(inode, cluster);
+ ret = prealloc_file_extent_cluster(BTRFS_I(inode), cluster);
if (ret)
goto out;