summaryrefslogtreecommitdiff
path: root/fs/btrfs/tree-defrag.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/tree-defrag.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/tree-defrag.c')
-rw-r--r--fs/btrfs/tree-defrag.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/fs/btrfs/tree-defrag.c b/fs/btrfs/tree-defrag.c
index 256af1870eef..5085e9e693b9 100644
--- a/fs/btrfs/tree-defrag.c
+++ b/fs/btrfs/tree-defrag.c
@@ -28,6 +28,7 @@ static void reada_defrag(struct btrfs_root *root,
int i;
u32 nritems;
u64 bytenr;
+ u64 gen;
u32 blocksize;
int ret;
@@ -35,7 +36,8 @@ static void reada_defrag(struct btrfs_root *root,
nritems = btrfs_header_nritems(node);
for (i = 0; i < nritems; i++) {
bytenr = btrfs_node_blockptr(node, i);
- ret = readahead_tree_block(root, bytenr, blocksize);
+ gen = btrfs_node_ptr_generation(node, i);
+ ret = readahead_tree_block(root, bytenr, blocksize, gen);
if (ret)
break;
}
@@ -101,10 +103,11 @@ static int defrag_walk_down(struct btrfs_trans_handle *trans,
path->slots[*level]++;
continue;
}
- btrfs_verify_block_csum(root, next);
} else {
next = read_tree_block(root, bytenr,
- btrfs_level_size(root, *level - 1));
+ btrfs_level_size(root, *level - 1),
+ btrfs_node_ptr_generation(cur,
+ path->slots[*level]));
}
ret = btrfs_cow_block(trans, root, next, path->nodes[*level],
path->slots[*level], &next);