[btrfs-devel][patch]Cache blocks in the hole at beginning of a block group

Yan Zheng yanzheng at 21cn.com
Tue Sep 11 08:26:40 PDT 2007


Hi

When first extent item in a block group isn't at beginning of that
block group,  blocks in the hole (at beginning of a block group) is
free.

Regards
YZ

diff -r 9cb5f0f5c713 extent-tree.c
--- a/extent-tree.c	Thu Aug 30 12:16:51 2007 -0400
+++ b/extent-tree.c	Tue Sep 11 22:59:56 2007 +0800
@@ -102,15 +102,14 @@ static int cache_block_group(struct btrf
 		}
 		if (btrfs_key_type(&key) == BTRFS_EXTENT_ITEM_KEY) {
 			if (!found) {
-				last = key.objectid + key.offset;
+				last = block_group->key.objectid;
 				found = 1;
-			} else {
-				hole_size = key.objectid - last;
-				for (i = 0; i < hole_size; i++) {
-					set_radix_bit(extent_radix, last + i);
-				}
-				last = key.objectid + key.offset;
-			}
+			}
+			hole_size = key.objectid - last;
+			for (i = 0; i < hole_size; i++) {
+				set_radix_bit(extent_radix, last + i);
+			}
+			last = key.objectid + key.offset;
 		}
 		path->slots[0]++;
 	}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: extent-tree.patch
Type: text/x-patch
Size: 758 bytes
Desc: not available
Url : http://oss.oracle.com/pipermail/btrfs-devel/attachments/20070911/0e40e7e9/extent-tree.bin


More information about the Btrfs-devel mailing list