aboutsummaryrefslogtreecommitdiffstats
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,
28 int i; 28 int i;
29 u32 nritems; 29 u32 nritems;
30 u64 bytenr; 30 u64 bytenr;
31 u64 gen;
31 u32 blocksize; 32 u32 blocksize;
32 int ret; 33 int ret;
33 34
@@ -35,7 +36,8 @@ static void reada_defrag(struct btrfs_root *root,
35 nritems = btrfs_header_nritems(node); 36 nritems = btrfs_header_nritems(node);
36 for (i = 0; i < nritems; i++) { 37 for (i = 0; i < nritems; i++) {
37 bytenr = btrfs_node_blockptr(node, i); 38 bytenr = btrfs_node_blockptr(node, i);
38 ret = readahead_tree_block(root, bytenr, blocksize); 39 gen = btrfs_node_ptr_generation(node, i);
40 ret = readahead_tree_block(root, bytenr, blocksize, gen);
39 if (ret) 41 if (ret)
40 break; 42 break;
41 } 43 }
@@ -101,10 +103,11 @@ static int defrag_walk_down(struct btrfs_trans_handle *trans,
101 path->slots[*level]++; 103 path->slots[*level]++;
102 continue; 104 continue;
103 } 105 }
104 btrfs_verify_block_csum(root, next);
105 } else { 106 } else {
106 next = read_tree_block(root, bytenr, 107 next = read_tree_block(root, bytenr,
107 btrfs_level_size(root, *level - 1)); 108 btrfs_level_size(root, *level - 1),
109 btrfs_node_ptr_generation(cur,
110 path->slots[*level]));
108 } 111 }
109 ret = btrfs_cow_block(trans, root, next, path->nodes[*level], 112 ret = btrfs_cow_block(trans, root, next, path->nodes[*level],
110 path->slots[*level], &next); 113 path->slots[*level], &next);