summaryrefslogtreecommitdiff
path: root/fs/btrfs/extent-tree.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2008-05-12 12:59:19 -0400
committerChris Mason <chris.mason@oracle.com>2008-09-25 11:04:03 -0400
commitca7a79ad8dbe24669a8ced01f9fc0126b872745d (patch)
tree0d53d8e6fd9ff9aece4e703581918c7817175d5d /fs/btrfs/extent-tree.c
parent188de649c51f03df3f8a601aea0110a3870815c2 (diff)
Btrfs: Pass down the expected generation number when reading tree blocks
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/extent-tree.c')
-rw-r--r--fs/btrfs/extent-tree.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index df95fb660d49..db07dde4a870 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -1338,7 +1338,8 @@ static int finish_current_insert(struct btrfs_trans_handle *trans,
&extent_item, sizeof(extent_item));
clear_extent_bits(&info->extent_ins, start, end, EXTENT_LOCKED,
GFP_NOFS);
- eb = read_tree_block(extent_root, ins.objectid, ins.offset);
+ eb = read_tree_block(extent_root, ins.objectid, ins.offset,
+ trans->transid);
level = btrfs_header_level(eb);
if (level == 0) {
btrfs_item_key(eb, &first, 0);
@@ -2076,7 +2077,8 @@ static void noinline reada_walk_down(struct btrfs_root *root,
}
}
mutex_unlock(&root->fs_info->fs_mutex);
- ret = readahead_tree_block(root, bytenr, blocksize);
+ ret = readahead_tree_block(root, bytenr, blocksize,
+ btrfs_node_ptr_generation(node, i));
last = bytenr + blocksize;
cond_resched();
mutex_lock(&root->fs_info->fs_mutex);
@@ -2096,6 +2098,7 @@ static int noinline walk_down_tree(struct btrfs_trans_handle *trans,
u64 root_owner;
u64 root_gen;
u64 bytenr;
+ u64 ptr_gen;
struct extent_buffer *next;
struct extent_buffer *cur;
struct extent_buffer *parent;
@@ -2132,6 +2135,7 @@ static int noinline walk_down_tree(struct btrfs_trans_handle *trans,
break;
}
bytenr = btrfs_node_blockptr(cur, path->slots[*level]);
+ ptr_gen = btrfs_node_ptr_generation(cur, path->slots[*level]);
blocksize = btrfs_level_size(root, *level - 1);
ret = lookup_extent_ref(trans, root, bytenr, blocksize, &refs);
BUG_ON(ret);
@@ -2152,7 +2156,8 @@ static int noinline walk_down_tree(struct btrfs_trans_handle *trans,
reada_walk_down(root, cur, path->slots[*level]);
mutex_unlock(&root->fs_info->fs_mutex);
- next = read_tree_block(root, bytenr, blocksize);
+ next = read_tree_block(root, bytenr, blocksize,
+ ptr_gen);
mutex_lock(&root->fs_info->fs_mutex);
/* we've dropped the lock, double check */
@@ -2173,8 +2178,6 @@ static int noinline walk_down_tree(struct btrfs_trans_handle *trans,
BUG_ON(ret);
continue;
}
- } else if (next) {
- btrfs_verify_block_csum(root, next);
}
WARN_ON(*level <= 0);
if (path->nodes[*level-1])
@@ -2609,7 +2612,7 @@ static int noinline relocate_one_reference(struct btrfs_root *extent_root,
int i;
eb = read_tree_block(found_root, extent_key->objectid,
- extent_key->offset);
+ extent_key->offset, 0);
level = btrfs_header_level(eb);
if (level == 0)