diff options
author | Chris Mason <chris.mason@oracle.com> | 2008-07-22 23:06:42 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2008-09-25 11:04:05 -0400 |
commit | ed98b56a6393c5e150fd5095b9eb7fd7d3cfb041 (patch) | |
tree | 1e69d882a08d089d083132b2b10fcf385d857620 /fs/btrfs/file-item.c | |
parent | c286ac48ed7aaf53586f575af6053ae2a0f8554a (diff) |
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.c | 8 |
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, | |||
152 | if (!sums) | 152 | if (!sums) |
153 | return -ENOMEM; | 153 | return -ENOMEM; |
154 | 154 | ||
155 | sector_sum = &sums->sums; | 155 | sector_sum = sums->sums; |
156 | sums->file_offset = page_offset(bvec->bv_page) + bvec->bv_offset; | 156 | sums->file_offset = page_offset(bvec->bv_page) + bvec->bv_offset; |
157 | sums->len = bio->bi_size; | 157 | sums->len = bio->bi_size; |
158 | INIT_LIST_HEAD(&sums->list); | 158 | INIT_LIST_HEAD(&sums->list); |
@@ -174,7 +174,7 @@ int btrfs_csum_one_bio(struct btrfs_root *root, struct inode *inode, | |||
174 | sums = kzalloc(btrfs_ordered_sum_size(root, bytes_left), | 174 | sums = kzalloc(btrfs_ordered_sum_size(root, bytes_left), |
175 | GFP_NOFS); | 175 | GFP_NOFS); |
176 | BUG_ON(!sums); | 176 | BUG_ON(!sums); |
177 | sector_sum = &sums->sums; | 177 | sector_sum = sums->sums; |
178 | sums->len = bytes_left; | 178 | sums->len = bytes_left; |
179 | sums->file_offset = offset; | 179 | sums->file_offset = offset; |
180 | ordered = btrfs_lookup_ordered_extent(inode, | 180 | ordered = btrfs_lookup_ordered_extent(inode, |
@@ -193,12 +193,14 @@ int btrfs_csum_one_bio(struct btrfs_root *root, struct inode *inode, | |||
193 | (char *)§or_sum->sum); | 193 | (char *)§or_sum->sum); |
194 | sector_sum->offset = page_offset(bvec->bv_page) + | 194 | sector_sum->offset = page_offset(bvec->bv_page) + |
195 | bvec->bv_offset; | 195 | bvec->bv_offset; |
196 | |||
196 | sector_sum++; | 197 | sector_sum++; |
197 | bio_index++; | 198 | bio_index++; |
198 | total_bytes += bvec->bv_len; | 199 | total_bytes += bvec->bv_len; |
199 | this_sum_bytes += bvec->bv_len; | 200 | this_sum_bytes += bvec->bv_len; |
200 | bvec++; | 201 | bvec++; |
201 | } | 202 | } |
203 | this_sum_bytes = 0; | ||
202 | btrfs_add_ordered_sum(inode, ordered, sums); | 204 | btrfs_add_ordered_sum(inode, ordered, sums); |
203 | btrfs_put_ordered_extent(ordered); | 205 | btrfs_put_ordered_extent(ordered); |
204 | return 0; | 206 | return 0; |
@@ -231,7 +233,7 @@ int btrfs_csum_file_blocks(struct btrfs_trans_handle *trans, | |||
231 | 233 | ||
232 | path = btrfs_alloc_path(); | 234 | path = btrfs_alloc_path(); |
233 | BUG_ON(!path); | 235 | BUG_ON(!path); |
234 | sector_sum = &sums->sums; | 236 | sector_sum = sums->sums; |
235 | again: | 237 | again: |
236 | next_offset = (u64)-1; | 238 | next_offset = (u64)-1; |
237 | found_next = 0; | 239 | found_next = 0; |