diff options
| -rw-r--r-- | fs/btrfs/compression.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c index bfe42b03eaf9..8ec5d86f1734 100644 --- a/fs/btrfs/compression.c +++ b/fs/btrfs/compression.c | |||
| @@ -338,6 +338,7 @@ int btrfs_submit_compressed_write(struct inode *inode, u64 start, | |||
| 338 | u64 first_byte = disk_start; | 338 | u64 first_byte = disk_start; |
| 339 | struct block_device *bdev; | 339 | struct block_device *bdev; |
| 340 | int ret; | 340 | int ret; |
| 341 | int skip_sum = BTRFS_I(inode)->flags & BTRFS_INODE_NODATASUM; | ||
| 341 | 342 | ||
| 342 | WARN_ON(start & ((u64)PAGE_CACHE_SIZE - 1)); | 343 | WARN_ON(start & ((u64)PAGE_CACHE_SIZE - 1)); |
| 343 | cb = kmalloc(compressed_bio_size(root, compressed_len), GFP_NOFS); | 344 | cb = kmalloc(compressed_bio_size(root, compressed_len), GFP_NOFS); |
| @@ -392,8 +393,11 @@ int btrfs_submit_compressed_write(struct inode *inode, u64 start, | |||
| 392 | ret = btrfs_bio_wq_end_io(root->fs_info, bio, 0); | 393 | ret = btrfs_bio_wq_end_io(root->fs_info, bio, 0); |
| 393 | BUG_ON(ret); | 394 | BUG_ON(ret); |
| 394 | 395 | ||
| 395 | ret = btrfs_csum_one_bio(root, inode, bio, start, 1); | 396 | if (!skip_sum) { |
| 396 | BUG_ON(ret); | 397 | ret = btrfs_csum_one_bio(root, inode, bio, |
| 398 | start, 1); | ||
| 399 | BUG_ON(ret); | ||
| 400 | } | ||
| 397 | 401 | ||
| 398 | ret = btrfs_map_bio(root, WRITE, bio, 0, 1); | 402 | ret = btrfs_map_bio(root, WRITE, bio, 0, 1); |
| 399 | BUG_ON(ret); | 403 | BUG_ON(ret); |
| @@ -418,8 +422,10 @@ int btrfs_submit_compressed_write(struct inode *inode, u64 start, | |||
| 418 | ret = btrfs_bio_wq_end_io(root->fs_info, bio, 0); | 422 | ret = btrfs_bio_wq_end_io(root->fs_info, bio, 0); |
| 419 | BUG_ON(ret); | 423 | BUG_ON(ret); |
| 420 | 424 | ||
| 421 | ret = btrfs_csum_one_bio(root, inode, bio, start, 1); | 425 | if (!skip_sum) { |
| 422 | BUG_ON(ret); | 426 | ret = btrfs_csum_one_bio(root, inode, bio, start, 1); |
| 427 | BUG_ON(ret); | ||
| 428 | } | ||
| 423 | 429 | ||
| 424 | ret = btrfs_map_bio(root, WRITE, bio, 0, 1); | 430 | ret = btrfs_map_bio(root, WRITE, bio, 0, 1); |
| 425 | BUG_ON(ret); | 431 | BUG_ON(ret); |
