fellow_stream_f(): Improve comment and assertion

to make clear that we understand exactly what is happening.
parent a1dbf0fe
......@@ -754,9 +754,6 @@ fellow_stream_f(void *priv, unsigned flush, const void *ptr, ssize_t len)
assert(fs->available >= fs->written);
l = vmin_t(ssize_t, len, fs->available - fs->written);
if (flush & OBJ_ITER_END)
assert(l <= len);
do {
r = fs->func(fs->priv, flush, p, l);
if (r)
......@@ -772,7 +769,15 @@ fellow_stream_f(void *priv, unsigned flush, const void *ptr, ssize_t len)
assert(fs->available >= fs->written);
l = vmin_t(ssize_t, len, fs->available - fs->written);
} while (l > 0); // XXX len > 0 ?
} while (l > 0);
/*
* can only have unsent data if the at the last segment and it was
* FCS_BUSY, so len is the allocation size, not the used size
*/
if (len > 0)
assert(flush & OBJ_ITER_END);
fs->checkpoint = fs->written;
return (r);
}
......
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