3 Aug 08:44
[PATCH] Fix entry table overflow (by splitting groups)
Shapor Naghibzadeh <shapor <at> gmail.com>
2008-08-03 06:44:56 GMT
2008-08-03 06:44:56 GMT
# HG changeset patch
# User shapor <at> yzf.shapor.com
# Date 1217745661 25200
# Node ID 2c679288390fb11949fa30625be33b257db9ba02
# Parent e0d569213df6ba1ed4e8d2029b8de596f71403ca
Fix entry table overflow (by splitting groups).
Add ENOSPC check for leaf.
diff -r e0d569213df6 -r 2c679288390f test/fleaf.c
--- a/test/fleaf.c Sat Aug 02 13:52:11 2008 -0700
+++ b/test/fleaf.c Sat Aug 02 23:41:01 2008 -0700
@@ -199,18 +199,20 @@ 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;
for (group = groups; group > grbase; group--) {
- if (loghi <= group->loghi)
+ if (loghi < group->loghi || loghi == group->loghi && (group - 1 <= grbase || loghi != (group - 1)->loghi ||
loglo <= (entries - group->count)->loglo))
break;
extents += (entries - group->count)->limit;
entries -= group->count;
}
- /* insert new group if no match */
(Continue reading)
> You are right though, I forgot to advance to the next group if necessary.
Ah perfection, she is elusive.
Daniel
RSS Feed