[Btrfs-devel] [PATCH] Some code cleanups

Aneesh Kumar K.V aneesh.kumar at gmail.com
Sat Jun 30 09:51:12 PDT 2007


The roo-tree.c change is important.

diff -r 080c0640a527 ctree.c
--- a/ctree.c	Thu Jun 28 15:57:36 2007 -0400
+++ b/ctree.c	Sat Jun 30 13:21:35 2007 +0530
@@ -171,9 +171,10 @@ static int check_node(struct btrfs_root 
 	struct btrfs_key cpukey;
 	u32 nritems = btrfs_header_nritems(&node->header);
 
-	if (path->nodes[level + 1])
+	if (path->nodes[level + 1]) {
 		parent = btrfs_buffer_node(path->nodes[level + 1]);
-	parent_slot = path->slots[level + 1];
+		parent_slot = path->slots[level + 1];
+	}
 	slot = path->slots[level];
 	BUG_ON(nritems == 0);
 	if (parent) {
@@ -207,9 +208,10 @@ static int check_leaf(struct btrfs_root 
 
 	u32 nritems = btrfs_header_nritems(&leaf->header);
 
-	if (path->nodes[level + 1])
+	if (path->nodes[level + 1]) {
 		parent = btrfs_buffer_node(path->nodes[level + 1]);
-	parent_slot = path->slots[level + 1];
+		parent_slot = path->slots[level + 1];
+	}
 	BUG_ON(btrfs_leaf_free_space(root, leaf) < 0);
 
 	if (nritems == 0)
diff -r 080c0640a527 root-tree.c
--- a/root-tree.c	Thu Jun 28 15:57:36 2007 -0400
+++ b/root-tree.c	Sat Jun 30 14:20:53 2007 +0530
@@ -136,8 +136,8 @@ int btrfs_find_dead_roots(struct btrfs_r
 		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,



More information about the Btrfs-devel mailing list