Polish fellow_busy_body_seg_next()

The previous code

-       if (fdsl->nsegs == fcsl->lsegs ||
-           fcsl->segs[fdsl->nsegs].state == FCS_INIT) {

was confusing, it relied on the fact that, when an fcsl has more
segments than an fdsl, the first "surplus" segment has state FCS_INIT,
when it makes much more sense to just check fdsl->nsegs against
fdsl->lsegs.
parent f40079aa
......@@ -3986,15 +3986,17 @@ fellow_busy_body_seg_next(struct fellow_busy *fbo)
CHECK_OBJ_NOTNULL(fcsl, FELLOW_CACHE_SEGLIST_MAGIC);
fdsl = fcsl->fdsl;
CHECK_OBJ_NOTNULL(fdsl, FELLOW_DISK_SEGLIST_MAGIC);
assert(fdsl->nsegs <= fcsl->lsegs);
if (fdsl->nsegs == fcsl->lsegs ||
fcsl->segs[fdsl->nsegs].state == FCS_INIT) {
assert(fdsl->nsegs <= fdsl->lsegs);
if (fdsl->nsegs == fdsl->lsegs) {
fcr = fellow_busy_body_seglist_alloc(fbo, fcsl);
if (fcr.status != fcr_ok)
return (fcr);
CAST_OBJ_NOTNULL(fcsl, fcr.r.ptr, FELLOW_CACHE_SEGLIST_MAGIC);
fbo->body_seglist = fcsl;
fdsl = fcsl->fdsl;
AZ(fdsl->nsegs);
AN(fdsl->lsegs);
}
CHECK_OBJ_NOTNULL(fdsl, FELLOW_DISK_SEGLIST_MAGIC);
......
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