Commit 0c494225 authored by Nikolay Borisov's avatar Nikolay Borisov Committed by David Sterba

btrfs: make need_force_cow take btrfs_inode

Gets rid of superfulous BTRFS_I() calls and prepare for converting
btrfs_run_delalloc_range to using btrfs_inode.
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 808a1292
......@@ -1790,11 +1790,11 @@ static noinline int run_delalloc_nocow(struct btrfs_inode *inode,
return ret;
}
static inline int need_force_cow(struct inode *inode, u64 start, u64 end)
static inline int need_force_cow(struct btrfs_inode *inode, u64 start, u64 end)
{
if (!(BTRFS_I(inode)->flags & BTRFS_INODE_NODATACOW) &&
!(BTRFS_I(inode)->flags & BTRFS_INODE_PREALLOC))
if (!(inode->flags & BTRFS_INODE_NODATACOW) &&
!(inode->flags & BTRFS_INODE_PREALLOC))
return 0;
/*
......@@ -1802,9 +1802,8 @@ static inline int need_force_cow(struct inode *inode, u64 start, u64 end)
* if is not zero, it means the file is defragging.
* Force cow if given extent needs to be defragged.
*/
if (BTRFS_I(inode)->defrag_bytes &&
test_range_bit(&BTRFS_I(inode)->io_tree, start, end,
EXTENT_DEFRAG, 0, NULL))
if (inode->defrag_bytes &&
test_range_bit(&inode->io_tree, start, end, EXTENT_DEFRAG, 0, NULL))
return 1;
return 0;
......@@ -1819,7 +1818,7 @@ int btrfs_run_delalloc_range(struct inode *inode, struct page *locked_page,
struct writeback_control *wbc)
{
int ret;
int force_cow = need_force_cow(inode, start, end);
int force_cow = need_force_cow(BTRFS_I(inode), start, end);
if (BTRFS_I(inode)->flags & BTRFS_INODE_NODATACOW && !force_cow) {
ret = run_delalloc_nocow(BTRFS_I(inode), locked_page, start, end,
......
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