Strengthen assertions in fellow_busy_obj_trimstore()

assert that the FCS_BUSY segment to be trimmed is in fact contained in
the current body region.
parent 5dadf7fa
......@@ -4271,6 +4271,21 @@ fellow_busy_obj_trim_seglists(struct fellow_busy *fbo)
fellow_cache_seglist_free(fbo->fc, fbo->body_seglist);
}
static inline int
fdr_contains(
const struct buddy_off_extent *outer,
const struct buddy_off_extent *inner)
{
assert(outer->off > 0);
assert(inner->off > 0);
return (
inner->off >= outer->off &&
(typeof(inner->size))inner->off + inner->size <=
(typeof(outer->size))outer->off + outer->size);
}
/*
* we need to write full disk blocks and if the membuddy minsize is less than
* the dskbuddy minsize, we could trim to under the blocksize
......@@ -4310,6 +4325,15 @@ fellow_busy_obj_trimstore(struct fellow_busy *fbo)
if (fcs->state == FCS_BUSY) {
assert(fcs->len <= fcs->alloc.size);
AN(fdr);
/*
* fcs must be contained in the fdr, there can
* be a free region behind it
*/
assert(fcs->disk_seg->seg.off > 0);
assert(fcs->disk_seg->seg.size > 0);
assert(fdr_contains(fdr, &fcs->disk_seg->seg));
} else {
assert(fcs->state == FCS_USABLE);
AZ(fcs->alloc.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