]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - fs/btrfs/compression.c
Merge branch 'tools-release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb...
[karo-tx-linux.git] / fs / btrfs / compression.c
index bfe42b03eaf9b3cc0bdf14b3975300e9a30b8584..8ec5d86f173471a7c51177ae7473fb494dcc8f29 100644 (file)
@@ -338,6 +338,7 @@ int btrfs_submit_compressed_write(struct inode *inode, u64 start,
        u64 first_byte = disk_start;
        struct block_device *bdev;
        int ret;
+       int skip_sum = BTRFS_I(inode)->flags & BTRFS_INODE_NODATASUM;
 
        WARN_ON(start & ((u64)PAGE_CACHE_SIZE - 1));
        cb = kmalloc(compressed_bio_size(root, compressed_len), GFP_NOFS);
@@ -392,8 +393,11 @@ int btrfs_submit_compressed_write(struct inode *inode, u64 start,
                        ret = btrfs_bio_wq_end_io(root->fs_info, bio, 0);
                        BUG_ON(ret);
 
-                       ret = btrfs_csum_one_bio(root, inode, bio, start, 1);
-                       BUG_ON(ret);
+                       if (!skip_sum) {
+                               ret = btrfs_csum_one_bio(root, inode, bio,
+                                                        start, 1);
+                               BUG_ON(ret);
+                       }
 
                        ret = btrfs_map_bio(root, WRITE, bio, 0, 1);
                        BUG_ON(ret);
@@ -418,8 +422,10 @@ int btrfs_submit_compressed_write(struct inode *inode, u64 start,
        ret = btrfs_bio_wq_end_io(root->fs_info, bio, 0);
        BUG_ON(ret);
 
-       ret = btrfs_csum_one_bio(root, inode, bio, start, 1);
-       BUG_ON(ret);
+       if (!skip_sum) {
+               ret = btrfs_csum_one_bio(root, inode, bio, start, 1);
+               BUG_ON(ret);
+       }
 
        ret = btrfs_map_bio(root, WRITE, bio, 0, 1);
        BUG_ON(ret);