[Btrfs-devel][PATCH]Call btrfs_cow_block while lowering tree level.

Yan Zheng yanzheng at 21cn.com
Fri Feb 1 08:27:42 PST 2008


Hello,

When freeing root block of a tree,  btrfs_free_extent' parameter
'ref_generation' is from root block itseft.  When freeing non-root
block,  'ref_generation' is from its parent. so when converting a
non-root block to root block, we must guarantee its generation is
equal to its parent's generation.

Regards
YZ
---
diff -r e28d2b80d0f4 ctree.c
--- a/ctree.c	Thu Jan 31 16:45:07 2008 -0500
+++ b/ctree.c	Sat Feb 02 00:24:53 2008 +0800
@@ -720,6 +720,9 @@ static int balance_level(struct btrfs_tr
 		/* promote the child to a root */
 		child = read_node_slot(root, mid, 0);
 		BUG_ON(!child);
+		ret = btrfs_cow_block(trans, root, child, mid, 0, &child);
+		BUG_ON(ret);
+
 		root->node = child;
 		path->nodes[level] = NULL;
 		clean_tree_block(trans, root, mid);



More information about the Btrfs-devel mailing list