summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/file-item.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2008-07-22 23:06:42 -0400
committerChris Mason <chris.mason@oracle.com>2008-09-25 11:04:05 -0400
commited98b56a6393c5e150fd5095b9eb7fd7d3cfb041 (patch)
tree1e69d882a08d089d083132b2b10fcf385d857620 /fs/btrfs/file-item.c
parentc286ac48ed7aaf53586f575af6053ae2a0f8554a (diff)
downloadlinux-ed98b56a6393c5e150fd5095b9eb7fd7d3cfb041.tar.bz2
Btrfs: Take the csum mutex while reading checksums
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/file-item.c')
-rw-r--r--fs/btrfs/file-item.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/fs/btrfs/file-item.c b/fs/btrfs/file-item.c
index 45127e4797c8..afe42d00b5a6 100644
--- a/fs/btrfs/file-item.c
+++ b/fs/btrfs/file-item.c
@@ -152,7 +152,7 @@ int btrfs_csum_one_bio(struct btrfs_root *root, struct inode *inode,
if (!sums)
return -ENOMEM;
- sector_sum = &sums->sums;
+ sector_sum = sums->sums;
sums->file_offset = page_offset(bvec->bv_page) + bvec->bv_offset;
sums->len = bio->bi_size;
INIT_LIST_HEAD(&sums->list);
@@ -174,7 +174,7 @@ int btrfs_csum_one_bio(struct btrfs_root *root, struct inode *inode,
sums = kzalloc(btrfs_ordered_sum_size(root, bytes_left),
GFP_NOFS);
BUG_ON(!sums);
- sector_sum = &sums->sums;
+ sector_sum = sums->sums;
sums->len = bytes_left;
sums->file_offset = offset;
ordered = btrfs_lookup_ordered_extent(inode,
@@ -193,12 +193,14 @@ int btrfs_csum_one_bio(struct btrfs_root *root, struct inode *inode,
(char *)&sector_sum->sum);
sector_sum->offset = page_offset(bvec->bv_page) +
bvec->bv_offset;
+
sector_sum++;
bio_index++;
total_bytes += bvec->bv_len;
this_sum_bytes += bvec->bv_len;
bvec++;
}
+ this_sum_bytes = 0;
btrfs_add_ordered_sum(inode, ordered, sums);
btrfs_put_ordered_extent(ordered);
return 0;
@@ -231,7 +233,7 @@ int btrfs_csum_file_blocks(struct btrfs_trans_handle *trans,
path = btrfs_alloc_path();
BUG_ON(!path);
- sector_sum = &sums->sums;
+ sector_sum = sums->sums;
again:
next_offset = (u64)-1;
found_next = 0;