Fix nit in logblocks_alloc_from_logregion() with already allocated blocks

When some blocks were already allocated, we would fail to
use all of the log region, that is, the newly added assertion

	if (n > 0) AZ(logreg->free_n);

would fail

This left some blocks of the logregion unused, but was insignificant
otherwise.
parent 7201a3a4
......@@ -2099,10 +2099,10 @@ logblocks_alloc_from_logregion(struct fellow_log_region *logreg,
AN(logreg->free_off);
assert(region_contains(logreg->region, logreg->free_off));
if (logreg->free_n < n)
n = logreg->free_n;
for (i = 0; i < n; i++, arr++) {
for (i = 0;
n > 0 && logreg->free_n > 0;
n--, arr++) {
i++;
if (arr->off != 0)
continue;
AN(logreg->free_n);
......@@ -2112,6 +2112,9 @@ logblocks_alloc_from_logregion(struct fellow_log_region *logreg,
logreg->free_n--;
}
if (n > 0)
AZ(logreg->free_n);
if (logreg->free_n == 0) {
assert(logreg->free_off ==
logreg->region->off + (off_t)logreg->region->size);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment