Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 128841
b: refs/heads/master
c: ed98b56
h: refs/heads/master
i:
  128839: b2034a6
v: v3
  • Loading branch information
Chris Mason committed Sep 25, 2008
1 parent a059d33 commit ee79ad6
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c286ac48ed7aaf53586f575af6053ae2a0f8554a
refs/heads/master: ed98b56a6393c5e150fd5095b9eb7fd7d3cfb041
8 changes: 5 additions & 3 deletions trunk/fs/btrfs/file-item.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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,
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions trunk/fs/btrfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,7 @@ int btrfs_readpage_io_hook(struct page *page, u64 start, u64 end)
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)) {
/*
Expand Down Expand Up @@ -640,6 +641,7 @@ int btrfs_readpage_io_hook(struct page *page, u64 start, u64 end)
found:
set_state_private(io_tree, start, csum);
out:
mutex_unlock(&BTRFS_I(inode)->csum_mutex);
if (path)
btrfs_free_path(path);
return ret;
Expand Down
2 changes: 1 addition & 1 deletion trunk/fs/btrfs/ordered-data.c
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ int btrfs_find_ordered_sum(struct inode *inode, u64 offset, u32 *sum)
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;
Expand Down
2 changes: 1 addition & 1 deletion trunk/fs/btrfs/ordered-data.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ struct btrfs_ordered_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[];
};

/*
Expand Down
3 changes: 3 additions & 0 deletions trunk/fs/btrfs/transaction.c
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,9 @@ static noinline int add_dirty_roots(struct btrfs_trans_handle *trans,
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;
Expand Down

0 comments on commit ee79ad6

Please sign in to comment.