diff options
author | Wang Shilong <wangsl.fnst@cn.fujitsu.com> | 2014-07-17 11:44:10 +0800 |
---|---|---|
committer | Chris Mason <clm@fb.com> | 2014-09-17 13:37:38 -0700 |
commit | 7816030eb48e00a36ecdc23d484b960922feee67 (patch) | |
tree | 5c3146946fc4935281c3a3a27971ea1d08a0639a /fs/btrfs/inode.c | |
parent | f79707b092caff665a8a77e8e31fe4ab18b4d109 (diff) | |
download | op-kernel-dev-7816030eb48e00a36ecdc23d484b960922feee67.zip op-kernel-dev-7816030eb48e00a36ecdc23d484b960922feee67.tar.gz |
Btrfs: fall into nocompression codes quickly if possible
If flag NOCOMPRESS is set which means bad compression ratio,
we could avoid call cow_file_range_async() for this case earlier.
Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
Reviewed-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <clm@fb.com>
Diffstat (limited to 'fs/btrfs/inode.c')
-rw-r--r-- | fs/btrfs/inode.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 48a2886..d1c69be 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -1488,7 +1488,6 @@ static int run_delalloc_range(struct inode *inode, struct page *locked_page, unsigned long *nr_written) { int ret; - struct btrfs_root *root = BTRFS_I(inode)->root; int force_cow = need_force_cow(inode, start, end); if (BTRFS_I(inode)->flags & BTRFS_INODE_NODATACOW && !force_cow) { @@ -1497,9 +1496,7 @@ static int run_delalloc_range(struct inode *inode, struct page *locked_page, } else if (BTRFS_I(inode)->flags & BTRFS_INODE_PREALLOC && !force_cow) { ret = run_delalloc_nocow(inode, locked_page, start, end, page_started, 0, nr_written); - } else if (!btrfs_test_opt(root, COMPRESS) && - !(BTRFS_I(inode)->force_compress) && - !(BTRFS_I(inode)->flags & BTRFS_INODE_COMPRESS)) { + } else if (!inode_need_compress(inode)) { ret = cow_file_range(inode, locked_page, start, end, page_started, nr_written, 1); } else { |