[Tux3] [PATCH] Check for leaf full
Shapor Naghibzadeh
shapor at gmail.com
Sat Aug 2 15:27:41 PDT 2008
# HG changeset patch
# User shapor at yzf.shapor.com
# Date 1217715726 25200
# Node ID 1586642d110c4a0f8d6919bad6fdd7d51eaf70a2
# Parent c23a601a39db5c6081b848ef398882e9faebcad2
Check for leaf full.
For now we test for worst case. We may fit one less extent in the leaf
(worst case) to simplify by not checking for new entry creation in
advance.
diff -r c23a601a39db -r 1586642d110c test/leaf.c
--- a/test/leaf.c Sat Aug 02 15:16:41 2008 -0700
+++ b/test/leaf.c Sat Aug 02 15:22:06 2008 -0700
@@ -200,6 +200,8 @@ int leaf_insert(struct leaf *leaf, block
unsigned loglo = target & 0xffffff, loghi = target >> 24;
void *used = leaf->used + (void *)leaf;
// need room for one extent + maybe one group + maybe one entry
+ if (leaf_free(leaf) < sizeof(struct extent) + sizeof(struct group) + sizeof(struct entry) )
+ return -1;
/* find group position */
struct group *group;
_______________________________________________
Tux3 mailing list
Tux3 at tux3.org
http://tux3.org/cgi-bin/mailman/listinfo/tux3
More information about the Tux3
mailing list