fellow_cache: Support pointers not from fbo->region in _busy_region_free

parent 5042ec81
......@@ -2727,10 +2727,16 @@ fellow_busy_region_free(struct fellow_busy *fbo, struct buddy_off_extent *fdr)
CHECK_OBJ_NOTNULL(fc, FELLOW_CACHE_MAGIC);
u = fdr - &fbo->region[0];
assert(u >= 0);
assert(u < fbo->nregion);
// obviously: assert(&fbo->region[u] == fdr);
if (! (u >= 0 && u < fbo->nregion)) {
for (u = 0; u < fbo->nregion; u++)
if (fbo->region[u].off == fdr->off)
break;
assert(u < fbo->nregion);
assert(fbo->region[u].size == fdr->size);
fbo->region[u] = buddy_off_extent_nil;
}
else
assert(&fbo->region[u] == fdr);
buddy_return1_off_extent(fellow_dskbuddy(fc->ffd), fdr);
......
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