diff options
author | Nikolay Borisov <nborisov@suse.com> | 2020-06-03 08:55:41 +0300 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2020-07-27 13:55:36 +0300 |
commit | 36ea6f3e931391c2adbb38af8c5dd4a043d26ac5 (patch) | |
tree | f8f79d2a1be47de1e934e241fa1a311343820a93 | |
parent | 86d52921a2ba51a78e5bfb71c75aedcbd9e61a5c (diff) | |
download | linux-36ea6f3e931391c2adbb38af8c5dd4a043d26ac5.tar.xz |
btrfs: make btrfs_check_data_free_space take btrfs_inode
Instead of calling BTRFS_I on the passed vfs_inode take btrfs_inode
directly.
Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
-rw-r--r-- | fs/btrfs/block-group.c | 3 | ||||
-rw-r--r-- | fs/btrfs/delalloc-space.c | 10 | ||||
-rw-r--r-- | fs/btrfs/delalloc-space.h | 2 | ||||
-rw-r--r-- | fs/btrfs/file.c | 3 | ||||
-rw-r--r-- | fs/btrfs/inode.c | 4 |
5 files changed, 12 insertions, 10 deletions
diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c index 31ca2cfb7e3e..6ade9d345e66 100644 --- a/fs/btrfs/block-group.c +++ b/fs/btrfs/block-group.c @@ -2508,7 +2508,8 @@ again: num_pages *= 16; num_pages *= PAGE_SIZE; - ret = btrfs_check_data_free_space(inode, &data_reserved, 0, num_pages); + ret = btrfs_check_data_free_space(BTRFS_I(inode), &data_reserved, 0, + num_pages); if (ret) goto out_put; diff --git a/fs/btrfs/delalloc-space.c b/fs/btrfs/delalloc-space.c index aabc883489c1..0073123342d5 100644 --- a/fs/btrfs/delalloc-space.c +++ b/fs/btrfs/delalloc-space.c @@ -237,10 +237,10 @@ commit_trans: return 0; } -int btrfs_check_data_free_space(struct inode *inode, +int btrfs_check_data_free_space(struct btrfs_inode *inode, struct extent_changeset **reserved, u64 start, u64 len) { - struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb); + struct btrfs_fs_info *fs_info = inode->root->fs_info; int ret; /* align the range */ @@ -248,12 +248,12 @@ int btrfs_check_data_free_space(struct inode *inode, round_down(start, fs_info->sectorsize); start = round_down(start, fs_info->sectorsize); - ret = btrfs_alloc_data_chunk_ondemand(BTRFS_I(inode), len); + ret = btrfs_alloc_data_chunk_ondemand(inode, len); if (ret < 0) return ret; /* Use new btrfs_qgroup_reserve_data to reserve precious data space. */ - ret = btrfs_qgroup_reserve_data(BTRFS_I(inode), reserved, start, len); + ret = btrfs_qgroup_reserve_data(inode, reserved, start, len); if (ret < 0) btrfs_free_reserved_data_space_noquota(fs_info, len); else @@ -558,7 +558,7 @@ int btrfs_delalloc_reserve_space(struct inode *inode, { int ret; - ret = btrfs_check_data_free_space(inode, reserved, start, len); + ret = btrfs_check_data_free_space(BTRFS_I(inode), reserved, start, len); if (ret < 0) return ret; ret = btrfs_delalloc_reserve_metadata(BTRFS_I(inode), len); diff --git a/fs/btrfs/delalloc-space.h b/fs/btrfs/delalloc-space.h index 656807a8afa6..582ba26dbe6c 100644 --- a/fs/btrfs/delalloc-space.h +++ b/fs/btrfs/delalloc-space.h @@ -6,7 +6,7 @@ struct extent_changeset; int btrfs_alloc_data_chunk_ondemand(struct btrfs_inode *inode, u64 bytes); -int btrfs_check_data_free_space(struct inode *inode, +int btrfs_check_data_free_space(struct btrfs_inode *inode, struct extent_changeset **reserved, u64 start, u64 len); void btrfs_free_reserved_data_space(struct btrfs_inode *inode, struct extent_changeset *reserved, u64 start, u64 len); diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index f6c5d94f30f9..841c516079a9 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c @@ -1681,7 +1681,8 @@ static noinline ssize_t btrfs_buffered_write(struct kiocb *iocb, fs_info->sectorsize); extent_changeset_release(data_reserved); - ret = btrfs_check_data_free_space(inode, &data_reserved, pos, + ret = btrfs_check_data_free_space(BTRFS_I(inode), + &data_reserved, pos, write_bytes); if (ret < 0) { if (btrfs_check_nocow_lock(BTRFS_I(inode), pos, diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 5a1dfbb45734..1cc2c68206a7 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -4519,8 +4519,8 @@ int btrfs_truncate_block(struct inode *inode, loff_t from, loff_t len, block_end = block_start + blocksize - 1; - ret = btrfs_check_data_free_space(inode, &data_reserved, block_start, - blocksize); + ret = btrfs_check_data_free_space(BTRFS_I(inode), &data_reserved, + block_start, blocksize); if (ret < 0) { if (btrfs_check_nocow_lock(BTRFS_I(inode), block_start, &write_bytes) > 0) { |