diff options
Diffstat (limited to 'fs/btrfs/inode.c')
-rw-r--r-- | fs/btrfs/inode.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index e010000d4bc9..570cd44fe91b 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -5944,6 +5944,7 @@ static int btrfs_submit_direct_hook(int rw, struct btrfs_dio_private *dip, | |||
5944 | int nr_pages = 0; | 5944 | int nr_pages = 0; |
5945 | u32 *csums = dip->csums; | 5945 | u32 *csums = dip->csums; |
5946 | int ret = 0; | 5946 | int ret = 0; |
5947 | int write = rw & REQ_WRITE; | ||
5947 | 5948 | ||
5948 | bio = btrfs_dio_bio_alloc(orig_bio->bi_bdev, start_sector, GFP_NOFS); | 5949 | bio = btrfs_dio_bio_alloc(orig_bio->bi_bdev, start_sector, GFP_NOFS); |
5949 | if (!bio) | 5950 | if (!bio) |
@@ -5980,7 +5981,8 @@ static int btrfs_submit_direct_hook(int rw, struct btrfs_dio_private *dip, | |||
5980 | goto out_err; | 5981 | goto out_err; |
5981 | } | 5982 | } |
5982 | 5983 | ||
5983 | if (!skip_sum) | 5984 | /* Write's use the ordered csums */ |
5985 | if (!write && !skip_sum) | ||
5984 | csums = csums + nr_pages; | 5986 | csums = csums + nr_pages; |
5985 | start_sector += submit_len >> 9; | 5987 | start_sector += submit_len >> 9; |
5986 | file_offset += submit_len; | 5988 | file_offset += submit_len; |
@@ -6048,7 +6050,8 @@ static void btrfs_submit_direct(int rw, struct bio *bio, struct inode *inode, | |||
6048 | } | 6050 | } |
6049 | dip->csums = NULL; | 6051 | dip->csums = NULL; |
6050 | 6052 | ||
6051 | if (!skip_sum) { | 6053 | /* Write's use the ordered csum stuff, so we don't need dip->csums */ |
6054 | if (!write && !skip_sum) { | ||
6052 | dip->csums = kmalloc(sizeof(u32) * bio->bi_vcnt, GFP_NOFS); | 6055 | dip->csums = kmalloc(sizeof(u32) * bio->bi_vcnt, GFP_NOFS); |
6053 | if (!dip->csums) { | 6056 | if (!dip->csums) { |
6054 | kfree(dip); | 6057 | kfree(dip); |