Thanks for the analysis and the fix.
I guess highbit64() is not cheap, so likely the fix can be simplified.
How about this:
<pre>
static boolean_t
zio_wait_for_children(zio_t *zio, uint32_t children_bits, enum zio_wait_type
wait)
{
boolean_t waiting = B_FALSE;
mutex_enter(&zio->io_lock);
for (int child = 0; child < ZIO_CHILD_TYPES; child++) {
if (!(children_bits & (1 << child)))
continue;
uint64_t *countp = &zio->io_children[child][wait];
ASSERT(zio->io_stall == NULL);
if (*countp != 0) {
zio->io_stage >>= 1;
ASSERT3U(zio->io_stage, !=, ZIO_STAGE_OPEN);
zio->io_stall = countp;
waiting = B_TRUE;
break;
}
}
mutex_exit(&zio->io_lock);
return (waiting);
}
</pre>
and then call the function like:
<pre>
zio_wait_for_children(zio, 1 << ZIO_CHILD_GANG | 1 << ZIO_CHILD_LOGICAL,
ZIO_WAIT_READY)
</pre>
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/openzfs/openzfs/pull/505#issuecomment-352228820
------------------------------------------
openzfs-developer
Archives:
https://openzfs.topicbox.com/groups/developer/discussions/Td0adf1bfacf39ae0-M274963b52ef07f25e0e78b79
Powered by Topicbox: https://topicbox.com