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);
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,
(char *)§or_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;
path = btrfs_alloc_path();
BUG_ON(!path);
- sector_sum = &sums->sums;
+ sector_sum = sums->sums;
again:
next_offset = (u64)-1;
found_next = 0;
return 0;
path = btrfs_alloc_path();
+ mutex_lock(&BTRFS_I(inode)->csum_mutex);
item = btrfs_lookup_csum(NULL, root, path, inode->i_ino, start, 0);
if (IS_ERR(item)) {
/*
found:
set_state_private(io_tree, start, csum);
out:
+ mutex_unlock(&BTRFS_I(inode)->csum_mutex);
if (path)
btrfs_free_path(path);
return ret;
ordered_sum = list_entry(cur, struct btrfs_ordered_sum, list);
if (offset >= ordered_sum->file_offset) {
num_sectors = ordered_sum->len / sectorsize;
- sector_sums = &ordered_sum->sums;
+ sector_sums = ordered_sum->sums;
for (i = 0; i < num_sectors; i++) {
if (sector_sums[i].offset == offset) {
*sum = sector_sums[i].sum;
unsigned long len;
struct list_head list;
/* last field is a variable length array of btrfs_sector_sums */
- struct btrfs_sector_sum sums;
+ struct btrfs_sector_sum sums[];
};
/*
memcpy(dirty->root, root, sizeof(*root));
dirty->root->node = root->commit_root;
dirty->latest_root = root;
+ spin_lock_init(&dirty->root->node_lock);
+ mutex_init(&dirty->root->objectid_mutex);
+
root->commit_root = NULL;
root->root_key.offset = root->fs_info->generation;