diff options
author | Chris Mason <chris.mason@oracle.com> | 2008-05-12 12:59:19 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2008-09-25 11:04:03 -0400 |
commit | ca7a79ad8dbe24669a8ced01f9fc0126b872745d (patch) | |
tree | 0d53d8e6fd9ff9aece4e703581918c7817175d5d /fs/btrfs/extent-tree.c | |
parent | 188de649c51f03df3f8a601aea0110a3870815c2 (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.c | 15 |
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, | |||
1338 | &extent_item, sizeof(extent_item)); | 1338 | &extent_item, sizeof(extent_item)); |
1339 | clear_extent_bits(&info->extent_ins, start, end, EXTENT_LOCKED, | 1339 | clear_extent_bits(&info->extent_ins, start, end, EXTENT_LOCKED, |
1340 | GFP_NOFS); | 1340 | GFP_NOFS); |
1341 | eb = read_tree_block(extent_root, ins.objectid, ins.offset); | 1341 | eb = read_tree_block(extent_root, ins.objectid, ins.offset, |
1342 | trans->transid); | ||
1342 | level = btrfs_header_level(eb); | 1343 | level = btrfs_header_level(eb); |
1343 | if (level == 0) { | 1344 | if (level == 0) { |
1344 | btrfs_item_key(eb, &first, 0); | 1345 | btrfs_item_key(eb, &first, 0); |
@@ -2076,7 +2077,8 @@ static void noinline reada_walk_down(struct btrfs_root *root, | |||
2076 | } | 2077 | } |
2077 | } | 2078 | } |
2078 | mutex_unlock(&root->fs_info->fs_mutex); | 2079 | mutex_unlock(&root->fs_info->fs_mutex); |
2079 | ret = readahead_tree_block(root, bytenr, blocksize); | 2080 | ret = readahead_tree_block(root, bytenr, blocksize, |
2081 | btrfs_node_ptr_generation(node, i)); | ||
2080 | last = bytenr + blocksize; | 2082 | last = bytenr + blocksize; |
2081 | cond_resched(); | 2083 | cond_resched(); |
2082 | mutex_lock(&root->fs_info->fs_mutex); | 2084 | mutex_lock(&root->fs_info->fs_mutex); |
@@ -2096,6 +2098,7 @@ static int noinline walk_down_tree(struct btrfs_trans_handle *trans, | |||
2096 | u64 root_owner; | 2098 | u64 root_owner; |
2097 | u64 root_gen; | 2099 | u64 root_gen; |
2098 | u64 bytenr; | 2100 | u64 bytenr; |
2101 | u64 ptr_gen; | ||
2099 | struct extent_buffer *next; | 2102 | struct extent_buffer *next; |
2100 | struct extent_buffer *cur; | 2103 | struct extent_buffer *cur; |
2101 | struct extent_buffer *parent; | 2104 | struct extent_buffer *parent; |
@@ -2132,6 +2135,7 @@ static int noinline walk_down_tree(struct btrfs_trans_handle *trans, | |||
2132 | break; | 2135 | break; |
2133 | } | 2136 | } |
2134 | bytenr = btrfs_node_blockptr(cur, path->slots[*level]); | 2137 | bytenr = btrfs_node_blockptr(cur, path->slots[*level]); |
2138 | ptr_gen = btrfs_node_ptr_generation(cur, path->slots[*level]); | ||
2135 | blocksize = btrfs_level_size(root, *level - 1); | 2139 | blocksize = btrfs_level_size(root, *level - 1); |
2136 | ret = lookup_extent_ref(trans, root, bytenr, blocksize, &refs); | 2140 | ret = lookup_extent_ref(trans, root, bytenr, blocksize, &refs); |
2137 | BUG_ON(ret); | 2141 | BUG_ON(ret); |
@@ -2152,7 +2156,8 @@ static int noinline walk_down_tree(struct btrfs_trans_handle *trans, | |||
2152 | reada_walk_down(root, cur, path->slots[*level]); | 2156 | reada_walk_down(root, cur, path->slots[*level]); |
2153 | 2157 | ||
2154 | mutex_unlock(&root->fs_info->fs_mutex); | 2158 | mutex_unlock(&root->fs_info->fs_mutex); |
2155 | next = read_tree_block(root, bytenr, blocksize); | 2159 | next = read_tree_block(root, bytenr, blocksize, |
2160 | ptr_gen); | ||
2156 | mutex_lock(&root->fs_info->fs_mutex); | 2161 | mutex_lock(&root->fs_info->fs_mutex); |
2157 | 2162 | ||
2158 | /* we've dropped the lock, double check */ | 2163 | /* we've dropped the lock, double check */ |
@@ -2173,8 +2178,6 @@ static int noinline walk_down_tree(struct btrfs_trans_handle *trans, | |||
2173 | BUG_ON(ret); | 2178 | BUG_ON(ret); |
2174 | continue; | 2179 | continue; |
2175 | } | 2180 | } |
2176 | } else if (next) { | ||
2177 | btrfs_verify_block_csum(root, next); | ||
2178 | } | 2181 | } |
2179 | WARN_ON(*level <= 0); | 2182 | WARN_ON(*level <= 0); |
2180 | if (path->nodes[*level-1]) | 2183 | if (path->nodes[*level-1]) |
@@ -2609,7 +2612,7 @@ static int noinline relocate_one_reference(struct btrfs_root *extent_root, | |||
2609 | int i; | 2612 | int i; |
2610 | 2613 | ||
2611 | eb = read_tree_block(found_root, extent_key->objectid, | 2614 | eb = read_tree_block(found_root, extent_key->objectid, |
2612 | extent_key->offset); | 2615 | extent_key->offset, 0); |
2613 | level = btrfs_header_level(eb); | 2616 | level = btrfs_header_level(eb); |
2614 | 2617 | ||
2615 | if (level == 0) | 2618 | if (level == 0) |