diff options
-rw-r--r-- | fs/btrfs/ctree.c | 8 | ||||
-rw-r--r-- | fs/btrfs/root-tree.c | 4 |
2 files changed, 8 insertions, 4 deletions
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c index eace2ee76448..19a30b7c3a28 100644 --- a/fs/btrfs/ctree.c +++ b/fs/btrfs/ctree.c | |||
@@ -172,11 +172,13 @@ static int check_node(struct btrfs_root *root, struct btrfs_path *path, | |||
172 | 172 | ||
173 | if (path->nodes[level + 1]) | 173 | if (path->nodes[level + 1]) |
174 | parent = btrfs_buffer_node(path->nodes[level + 1]); | 174 | parent = btrfs_buffer_node(path->nodes[level + 1]); |
175 | parent_slot = path->slots[level + 1]; | 175 | |
176 | slot = path->slots[level]; | 176 | slot = path->slots[level]; |
177 | BUG_ON(nritems == 0); | 177 | BUG_ON(nritems == 0); |
178 | if (parent) { | 178 | if (parent) { |
179 | struct btrfs_disk_key *parent_key; | 179 | struct btrfs_disk_key *parent_key; |
180 | |||
181 | parent_slot = path->slots[level + 1]; | ||
180 | parent_key = &parent->ptrs[parent_slot].key; | 182 | parent_key = &parent->ptrs[parent_slot].key; |
181 | BUG_ON(memcmp(parent_key, &node->ptrs[0].key, | 183 | BUG_ON(memcmp(parent_key, &node->ptrs[0].key, |
182 | sizeof(struct btrfs_disk_key))); | 184 | sizeof(struct btrfs_disk_key))); |
@@ -208,7 +210,7 @@ static int check_leaf(struct btrfs_root *root, struct btrfs_path *path, | |||
208 | 210 | ||
209 | if (path->nodes[level + 1]) | 211 | if (path->nodes[level + 1]) |
210 | parent = btrfs_buffer_node(path->nodes[level + 1]); | 212 | parent = btrfs_buffer_node(path->nodes[level + 1]); |
211 | parent_slot = path->slots[level + 1]; | 213 | |
212 | BUG_ON(btrfs_leaf_free_space(root, leaf) < 0); | 214 | BUG_ON(btrfs_leaf_free_space(root, leaf) < 0); |
213 | 215 | ||
214 | if (nritems == 0) | 216 | if (nritems == 0) |
@@ -216,6 +218,8 @@ static int check_leaf(struct btrfs_root *root, struct btrfs_path *path, | |||
216 | 218 | ||
217 | if (parent) { | 219 | if (parent) { |
218 | struct btrfs_disk_key *parent_key; | 220 | struct btrfs_disk_key *parent_key; |
221 | |||
222 | parent_slot = path->slots[level + 1]; | ||
219 | parent_key = &parent->ptrs[parent_slot].key; | 223 | parent_key = &parent->ptrs[parent_slot].key; |
220 | BUG_ON(memcmp(parent_key, &leaf->items[0].key, | 224 | BUG_ON(memcmp(parent_key, &leaf->items[0].key, |
221 | sizeof(struct btrfs_disk_key))); | 225 | sizeof(struct btrfs_disk_key))); |
diff --git a/fs/btrfs/root-tree.c b/fs/btrfs/root-tree.c index 271dd2b5c321..402f67821c14 100644 --- a/fs/btrfs/root-tree.c +++ b/fs/btrfs/root-tree.c | |||
@@ -135,8 +135,8 @@ int btrfs_find_dead_roots(struct btrfs_root *root) | |||
135 | if (btrfs_root_refs(ri) != 0) | 135 | if (btrfs_root_refs(ri) != 0) |
136 | goto next; | 136 | goto next; |
137 | dead_root = btrfs_read_fs_root_no_radix(root->fs_info, &key); | 137 | dead_root = btrfs_read_fs_root_no_radix(root->fs_info, &key); |
138 | if (IS_ERR(root)) { | 138 | if (IS_ERR(dead_root)) { |
139 | ret = PTR_ERR(root); | 139 | ret = PTR_ERR(dead_root); |
140 | goto err; | 140 | goto err; |
141 | } | 141 | } |
142 | ret = btrfs_add_dead_root(dead_root, | 142 | ret = btrfs_add_dead_root(dead_root, |