diff options
| -rw-r--r-- | fs/btrfs/inode.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 13a17477c4f4..c427011dc453 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
| @@ -204,7 +204,7 @@ fail: | |||
| 204 | * does the checks required to make sure the data is small enough | 204 | * does the checks required to make sure the data is small enough |
| 205 | * to fit as an inline extent. | 205 | * to fit as an inline extent. |
| 206 | */ | 206 | */ |
| 207 | static int cow_file_range_inline(struct btrfs_trans_handle *trans, | 207 | static noinline int cow_file_range_inline(struct btrfs_trans_handle *trans, |
| 208 | struct btrfs_root *root, | 208 | struct btrfs_root *root, |
| 209 | struct inode *inode, u64 start, u64 end, | 209 | struct inode *inode, u64 start, u64 end, |
| 210 | size_t compressed_size, | 210 | size_t compressed_size, |
| @@ -854,11 +854,6 @@ static int cow_file_range_async(struct inode *inode, struct page *locked_page, | |||
| 854 | u64 cur_end; | 854 | u64 cur_end; |
| 855 | int limit = 10 * 1024 * 1042; | 855 | int limit = 10 * 1024 * 1042; |
| 856 | 856 | ||
| 857 | if (!btrfs_test_opt(root, COMPRESS)) { | ||
| 858 | return cow_file_range(inode, locked_page, start, end, | ||
| 859 | page_started, nr_written, 1); | ||
| 860 | } | ||
| 861 | |||
| 862 | clear_extent_bit(&BTRFS_I(inode)->io_tree, start, end, EXTENT_LOCKED | | 857 | clear_extent_bit(&BTRFS_I(inode)->io_tree, start, end, EXTENT_LOCKED | |
| 863 | EXTENT_DELALLOC, 1, 0, GFP_NOFS); | 858 | EXTENT_DELALLOC, 1, 0, GFP_NOFS); |
| 864 | while (start < end) { | 859 | while (start < end) { |
| @@ -935,7 +930,8 @@ static noinline int csum_exist_in_range(struct btrfs_root *root, | |||
| 935 | * If no cow copies or snapshots exist, we write directly to the existing | 930 | * If no cow copies or snapshots exist, we write directly to the existing |
| 936 | * blocks on disk | 931 | * blocks on disk |
| 937 | */ | 932 | */ |
| 938 | static int run_delalloc_nocow(struct inode *inode, struct page *locked_page, | 933 | static noinline int run_delalloc_nocow(struct inode *inode, |
| 934 | struct page *locked_page, | ||
| 939 | u64 start, u64 end, int *page_started, int force, | 935 | u64 start, u64 end, int *page_started, int force, |
| 940 | unsigned long *nr_written) | 936 | unsigned long *nr_written) |
| 941 | { | 937 | { |
| @@ -1133,6 +1129,7 @@ static int run_delalloc_range(struct inode *inode, struct page *locked_page, | |||
| 1133 | unsigned long *nr_written) | 1129 | unsigned long *nr_written) |
| 1134 | { | 1130 | { |
| 1135 | int ret; | 1131 | int ret; |
| 1132 | struct btrfs_root *root = BTRFS_I(inode)->root; | ||
| 1136 | 1133 | ||
| 1137 | if (btrfs_test_flag(inode, NODATACOW)) | 1134 | if (btrfs_test_flag(inode, NODATACOW)) |
| 1138 | ret = run_delalloc_nocow(inode, locked_page, start, end, | 1135 | ret = run_delalloc_nocow(inode, locked_page, start, end, |
| @@ -1140,10 +1137,12 @@ static int run_delalloc_range(struct inode *inode, struct page *locked_page, | |||
| 1140 | else if (btrfs_test_flag(inode, PREALLOC)) | 1137 | else if (btrfs_test_flag(inode, PREALLOC)) |
| 1141 | ret = run_delalloc_nocow(inode, locked_page, start, end, | 1138 | ret = run_delalloc_nocow(inode, locked_page, start, end, |
| 1142 | page_started, 0, nr_written); | 1139 | page_started, 0, nr_written); |
| 1140 | else if (!btrfs_test_opt(root, COMPRESS)) | ||
| 1141 | ret = cow_file_range(inode, locked_page, start, end, | ||
| 1142 | page_started, nr_written, 1); | ||
| 1143 | else | 1143 | else |
| 1144 | ret = cow_file_range_async(inode, locked_page, start, end, | 1144 | ret = cow_file_range_async(inode, locked_page, start, end, |
| 1145 | page_started, nr_written); | 1145 | page_started, nr_written); |
| 1146 | |||
| 1147 | return ret; | 1146 | return ret; |
| 1148 | } | 1147 | } |
| 1149 | 1148 | ||
