diff options
author | Chris Mason <chris.mason@oracle.com> | 2008-10-30 14:23:13 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2008-10-30 14:23:13 -0400 |
commit | 19b9bdb054895ba07086f0264641c9f80e0eb2c4 (patch) | |
tree | 8cacc7e2fc9f1a84e975b2e9c193ef9b2d7fbcf7 /fs/btrfs/inode.c | |
parent | cfbc246eaae2a1089911016094b74b3055e8a906 (diff) |
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.c | 21 |
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, | |||
833 | { | 833 | { |
834 | struct btrfs_root *root = BTRFS_I(inode)->root; | 834 | struct btrfs_root *root = BTRFS_I(inode)->root; |
835 | int ret = 0; | 835 | int ret = 0; |
836 | int skip_sum; | ||
836 | 837 | ||
837 | ret = btrfs_bio_wq_end_io(root->fs_info, bio, 0); | 838 | ret = btrfs_bio_wq_end_io(root->fs_info, bio, 0); |
838 | BUG_ON(ret); | 839 | BUG_ON(ret); |
839 | 840 | ||
840 | if (btrfs_test_opt(root, NODATASUM) || | 841 | skip_sum = btrfs_test_opt(root, NODATASUM) || |
841 | btrfs_test_flag(inode, NODATASUM)) { | 842 | btrfs_test_flag(inode, NODATASUM); |
842 | goto mapit; | ||
843 | } | ||
844 | 843 | ||
845 | if (!(rw & (1 << BIO_RW))) { | 844 | if (!(rw & (1 << BIO_RW))) { |
846 | btrfs_lookup_bio_sums(root, inode, bio); | 845 | if (!skip_sum) |
846 | btrfs_lookup_bio_sums(root, inode, bio); | ||
847 | 847 | ||
848 | if (bio_flags & EXTENT_BIO_COMPRESSED) { | 848 | if (bio_flags & EXTENT_BIO_COMPRESSED) |
849 | return btrfs_submit_compressed_read(inode, bio, | 849 | return btrfs_submit_compressed_read(inode, bio, |
850 | mirror_num, bio_flags); | 850 | mirror_num, bio_flags); |
851 | } | ||
852 | |||
853 | goto mapit; | 851 | goto mapit; |
854 | } | 852 | } else if (!skip_sum) { |
855 | return btrfs_wq_submit_bio(BTRFS_I(inode)->root->fs_info, | 853 | /* we're doing a write, do the async checksumming */ |
854 | return btrfs_wq_submit_bio(BTRFS_I(inode)->root->fs_info, | ||
856 | inode, rw, bio, mirror_num, | 855 | inode, rw, bio, mirror_num, |
857 | bio_flags, __btrfs_submit_bio_hook); | 856 | bio_flags, __btrfs_submit_bio_hook); |
857 | } | ||
858 | |||
858 | mapit: | 859 | mapit: |
859 | return btrfs_map_bio(root, rw, bio, mirror_num, 0); | 860 | return btrfs_map_bio(root, rw, bio, mirror_num, 0); |
860 | } | 861 | } |