提交 a1f39630 编写于 作者: A Aneesh 提交者: David Woodhouse

Btrfs: Some code cleanups

Signed-off-by: NChris Mason <chris.mason@oracle.com>
上级 ec6b910f
...@@ -172,11 +172,13 @@ static int check_node(struct btrfs_root *root, struct btrfs_path *path, ...@@ -172,11 +172,13 @@ static int check_node(struct btrfs_root *root, struct btrfs_path *path,
if (path->nodes[level + 1]) if (path->nodes[level + 1])
parent = btrfs_buffer_node(path->nodes[level + 1]); parent = btrfs_buffer_node(path->nodes[level + 1]);
parent_slot = path->slots[level + 1];
slot = path->slots[level]; slot = path->slots[level];
BUG_ON(nritems == 0); BUG_ON(nritems == 0);
if (parent) { if (parent) {
struct btrfs_disk_key *parent_key; struct btrfs_disk_key *parent_key;
parent_slot = path->slots[level + 1];
parent_key = &parent->ptrs[parent_slot].key; parent_key = &parent->ptrs[parent_slot].key;
BUG_ON(memcmp(parent_key, &node->ptrs[0].key, BUG_ON(memcmp(parent_key, &node->ptrs[0].key,
sizeof(struct btrfs_disk_key))); sizeof(struct btrfs_disk_key)));
...@@ -208,7 +210,7 @@ static int check_leaf(struct btrfs_root *root, struct btrfs_path *path, ...@@ -208,7 +210,7 @@ static int check_leaf(struct btrfs_root *root, struct btrfs_path *path,
if (path->nodes[level + 1]) if (path->nodes[level + 1])
parent = btrfs_buffer_node(path->nodes[level + 1]); parent = btrfs_buffer_node(path->nodes[level + 1]);
parent_slot = path->slots[level + 1];
BUG_ON(btrfs_leaf_free_space(root, leaf) < 0); BUG_ON(btrfs_leaf_free_space(root, leaf) < 0);
if (nritems == 0) if (nritems == 0)
...@@ -216,6 +218,8 @@ static int check_leaf(struct btrfs_root *root, struct btrfs_path *path, ...@@ -216,6 +218,8 @@ static int check_leaf(struct btrfs_root *root, struct btrfs_path *path,
if (parent) { if (parent) {
struct btrfs_disk_key *parent_key; struct btrfs_disk_key *parent_key;
parent_slot = path->slots[level + 1];
parent_key = &parent->ptrs[parent_slot].key; parent_key = &parent->ptrs[parent_slot].key;
BUG_ON(memcmp(parent_key, &leaf->items[0].key, BUG_ON(memcmp(parent_key, &leaf->items[0].key,
sizeof(struct btrfs_disk_key))); sizeof(struct btrfs_disk_key)));
......
...@@ -135,8 +135,8 @@ int btrfs_find_dead_roots(struct btrfs_root *root) ...@@ -135,8 +135,8 @@ int btrfs_find_dead_roots(struct btrfs_root *root)
if (btrfs_root_refs(ri) != 0) if (btrfs_root_refs(ri) != 0)
goto next; goto next;
dead_root = btrfs_read_fs_root_no_radix(root->fs_info, &key); dead_root = btrfs_read_fs_root_no_radix(root->fs_info, &key);
if (IS_ERR(root)) { if (IS_ERR(dead_root)) {
ret = PTR_ERR(root); ret = PTR_ERR(dead_root);
goto err; goto err;
} }
ret = btrfs_add_dead_root(dead_root, ret = btrfs_add_dead_root(dead_root,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册