[Btrfs-devel][PATCH]Properly update free space cache in __free_extent

Yan Zheng yanzheng at 21cn.com
Fri Nov 2 01:05:23 PDT 2007


Hello,

Please consider this patch,  it's more compact.
---
diff -r bc6bfcf7a158 extent-tree.c
--- a/extent-tree.c	Tue Oct 30 16:56:53 2007 -0400
+++ b/extent-tree.c	Fri Nov 02 16:04:34 2007 +0800
@@ -715,7 +715,7 @@ static int pin_down_bytes(struct btrfs_r
 				    root->fs_info->running_transaction->transid;
 				if (btrfs_header_generation(buf) == transid) {
 					free_extent_buffer(buf);
-					return 0;
+					return 1;
 				}
 			}
 			free_extent_buffer(buf);
@@ -775,7 +775,9 @@ static int __free_extent(struct btrfs_tr

 		if (pin) {
 			ret = pin_down_bytes(root, bytenr, num_bytes, 0);
-			BUG_ON(ret);
+			if (ret > 0)
+				mark_free = 1;
+			BUG_ON(ret < 0);
 		}

 		/* block accounting for super block */



More information about the Btrfs-devel mailing list