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

btrfs: Remove root argument from cow_file_range_inline

This argument is always set to the root of the inode, which is also
passed. So let's get a reference inside the function and simplify
the arg list.
Signed-off-by: default avatarNikolay Borisov <nborisov@suse.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 895a72be
...@@ -276,12 +276,12 @@ static int insert_inline_extent(struct btrfs_trans_handle *trans, ...@@ -276,12 +276,12 @@ static int insert_inline_extent(struct btrfs_trans_handle *trans,
* does the checks required to make sure the data is small enough * does the checks required to make sure the data is small enough
* to fit as an inline extent. * to fit as an inline extent.
*/ */
static noinline int cow_file_range_inline(struct btrfs_root *root, static noinline int cow_file_range_inline(struct inode *inode, u64 start,
struct inode *inode, u64 start,
u64 end, size_t compressed_size, u64 end, size_t compressed_size,
int compress_type, int compress_type,
struct page **compressed_pages) struct page **compressed_pages)
{ {
struct btrfs_root *root = BTRFS_I(inode)->root;
struct btrfs_fs_info *fs_info = root->fs_info; struct btrfs_fs_info *fs_info = root->fs_info;
struct btrfs_trans_handle *trans; struct btrfs_trans_handle *trans;
u64 isize = i_size_read(inode); u64 isize = i_size_read(inode);
...@@ -457,7 +457,6 @@ static noinline void compress_file_range(struct inode *inode, ...@@ -457,7 +457,6 @@ static noinline void compress_file_range(struct inode *inode,
int *num_added) int *num_added)
{ {
struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb); struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
struct btrfs_root *root = BTRFS_I(inode)->root;
u64 blocksize = fs_info->sectorsize; u64 blocksize = fs_info->sectorsize;
u64 actual_end; u64 actual_end;
u64 isize = i_size_read(inode); u64 isize = i_size_read(inode);
...@@ -579,11 +578,11 @@ static noinline void compress_file_range(struct inode *inode, ...@@ -579,11 +578,11 @@ static noinline void compress_file_range(struct inode *inode,
/* we didn't compress the entire range, try /* we didn't compress the entire range, try
* to make an uncompressed inline extent. * to make an uncompressed inline extent.
*/ */
ret = cow_file_range_inline(root, inode, start, end, ret = cow_file_range_inline(inode, start, end, 0,
0, BTRFS_COMPRESS_NONE, NULL); BTRFS_COMPRESS_NONE, NULL);
} else { } else {
/* try making a compressed inline extent */ /* try making a compressed inline extent */
ret = cow_file_range_inline(root, inode, start, end, ret = cow_file_range_inline(inode, start, end,
total_compressed, total_compressed,
compress_type, pages); compress_type, pages);
} }
...@@ -983,8 +982,8 @@ static noinline int cow_file_range(struct inode *inode, ...@@ -983,8 +982,8 @@ static noinline int cow_file_range(struct inode *inode,
if (start == 0) { if (start == 0) {
/* lets try to make an inline extent */ /* lets try to make an inline extent */
ret = cow_file_range_inline(root, inode, start, end, 0, ret = cow_file_range_inline(inode, start, end, 0,
BTRFS_COMPRESS_NONE, NULL); BTRFS_COMPRESS_NONE, NULL);
if (ret == 0) { if (ret == 0) {
/* /*
* We use DO_ACCOUNTING here because we need the * We use DO_ACCOUNTING here because we need the
......
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