Skip to content

Commit

Permalink
Btrfs: Some code cleanups
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Mason <chris.mason@oracle.com>
  • Loading branch information
Aneesh authored and David Woodhouse committed Jul 11, 2007
1 parent ec6b910 commit a1f3963
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
8 changes: 6 additions & 2 deletions fs/btrfs/ctree.c
Original file line number Diff line number Diff line change
Expand Up @@ -172,11 +172,13 @@ static int check_node(struct btrfs_root *root, struct btrfs_path *path,

if (path->nodes[level + 1])
parent = btrfs_buffer_node(path->nodes[level + 1]);
parent_slot = path->slots[level + 1];

slot = path->slots[level];
BUG_ON(nritems == 0);
if (parent) {
struct btrfs_disk_key *parent_key;

parent_slot = path->slots[level + 1];
parent_key = &parent->ptrs[parent_slot].key;
BUG_ON(memcmp(parent_key, &node->ptrs[0].key,
sizeof(struct btrfs_disk_key)));
Expand Down Expand Up @@ -208,14 +210,16 @@ static int check_leaf(struct btrfs_root *root, struct btrfs_path *path,

if (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);

if (nritems == 0)
return 0;

if (parent) {
struct btrfs_disk_key *parent_key;

parent_slot = path->slots[level + 1];
parent_key = &parent->ptrs[parent_slot].key;
BUG_ON(memcmp(parent_key, &leaf->items[0].key,
sizeof(struct btrfs_disk_key)));
Expand Down
4 changes: 2 additions & 2 deletions fs/btrfs/root-tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ int btrfs_find_dead_roots(struct btrfs_root *root)
if (btrfs_root_refs(ri) != 0)
goto next;
dead_root = btrfs_read_fs_root_no_radix(root->fs_info, &key);
if (IS_ERR(root)) {
ret = PTR_ERR(root);
if (IS_ERR(dead_root)) {
ret = PTR_ERR(dead_root);
goto err;
}
ret = btrfs_add_dead_root(dead_root,
Expand Down

0 comments on commit a1f3963

Please sign in to comment.