[Tux3] [PATCH] Fix bugs in group split when there are more than one extent per entry
Shapor Naghibzadeh
shapor at gmail.com
Sun Aug 3 10:52:37 PDT 2008
# HG changeset patch
# User shapor at yzf.shapor.com
# Date 1217785888 25200
# Node ID 3c814025786eac746144d4d3e956c06ae5c25069
# Parent 180270b47712ac8ff875c7e75d0b44266cdc1187
Fix bugs in group split when there are more than one extent per entry.
diff -r 180270b47712 -r 3c814025786e test/fleaf.c
--- a/test/fleaf.c Sun Aug 03 10:16:26 2008 -0700
+++ b/test/fleaf.c Sun Aug 03 10:51:28 2008 -0700
@@ -230,7 +230,7 @@ int leaf_insert(struct leaf *leaf, block
/* insert new group if no match */
if (group == grbase || loghi < group->loghi || (entries - group->count)->limit == grouplim) {
- int split = group != grbase && group->count == grouplim;
+ int split = group != grbase && loghi == group->loghi;
printf("new group at %i\n", group - grbase);
memmove(used - sizeof(*group), used, (void *)(group + 1) - used);
*group = (struct group){ .loghi = loghi, .count = 0 };
@@ -239,12 +239,12 @@ int leaf_insert(struct leaf *leaf, block
entries--;
leaf->groups++;
if (split) {
- unsigned at = (grouplim + 1) / 2;
- printf(">>> split group with count %i at %i\n", grouplim, at);
- (group - 1)->count = grouplim - at;
+ unsigned at = ((group - 1)->count+ 1) / 2;
+ printf(">>> split group with count %i at %i\n", (group - 1)->count, at);
+ (group - 1)->count -= at;
group->count = at;
/* decrease entry limits for successor group */
- for (int i = at + 1; i <= grouplim; i++)
+ for (int i = at + 1; i < at + 1 + (group - 1)->count; i++)
(entries - i)->limit -= (entries - at)->limit;
if (loglo > (entries - group->count - 1)->loglo) {
//printf("insert into successor group\n");
_______________________________________________
Tux3 mailing list
Tux3 at tux3.org
http://tux3.org/cgi-bin/mailman/listinfo/tux3
More information about the Tux3
mailing list