summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/inode.c
diff options
context:
space:
mode:
authorChris Mason2008-10-30 19:23:13 +0100
committerChris Mason2008-10-30 19:23:13 +0100
commit19b9bdb054895ba07086f0264641c9f80e0eb2c4 (patch)
tree8cacc7e2fc9f1a84e975b2e9c193ef9b2d7fbcf7 /fs/btrfs/inode.c
parentBtrfs: walk compressed pages based on the nr_pages count instead of bytes (diff)
downloadkernel-qcow2-linux-19b9bdb054895ba07086f0264641c9f80e0eb2c4.tar.gz
kernel-qcow2-linux-19b9bdb054895ba07086f0264641c9f80e0eb2c4.tar.xz
kernel-qcow2-linux-19b9bdb054895ba07086f0264641c9f80e0eb2c4.zip
Btrfs: Fix logic to avoid reading checksums for -o nodatasum,compress
When compression was on, we were improperly ignoring -o nodatasum. This reworks the logic a bit to properly honor all the flags. Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/inode.c')
-rw-r--r--fs/btrfs/inode.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 6739424c0fe6..dd9cd01042b8 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -833,28 +833,29 @@ int btrfs_submit_bio_hook(struct inode *inode, int rw, struct bio *bio,
{
struct btrfs_root *root = BTRFS_I(inode)->root;
int ret = 0;
+ int skip_sum;
ret = btrfs_bio_wq_end_io(root->fs_info, bio, 0);
BUG_ON(ret);
- if (btrfs_test_opt(root, NODATASUM) ||
- btrfs_test_flag(inode, NODATASUM)) {
- goto mapit;
- }
+ skip_sum = btrfs_test_opt(root, NODATASUM) ||
+ btrfs_test_flag(inode, NODATASUM);
if (!(rw & (1 << BIO_RW))) {
- btrfs_lookup_bio_sums(root, inode, bio);
+ if (!skip_sum)
+ btrfs_lookup_bio_sums(root, inode, bio);
- if (bio_flags & EXTENT_BIO_COMPRESSED) {
+ if (bio_flags & EXTENT_BIO_COMPRESSED)
return btrfs_submit_compressed_read(inode, bio,
mirror_num, bio_flags);
- }
-
goto mapit;
- }
- return btrfs_wq_submit_bio(BTRFS_I(inode)->root->fs_info,
+ } else if (!skip_sum) {
+ /* we're doing a write, do the async checksumming */
+ return btrfs_wq_submit_bio(BTRFS_I(inode)->root->fs_info,
inode, rw, bio, mirror_num,
bio_flags, __btrfs_submit_bio_hook);
+ }
+
mapit:
return btrfs_map_bio(root, rw, bio, mirror_num, 0);
}