I changed pgaio_worker_request_grow() not to bother the postmaster
unless nworkers < io_max_workers.
I move that code you wanted outside the loop and did:
/* Choose one worker to wake for this batch. */
if (nsync < num_staged_ios)
worker = pgaio_worker_choose_idle(-1);
I took your suggestion for the names hist_wakeups and hist_ios.
For the location of the following line, I preferred not to separate
the pre-existing tests of StartWorkerNeeded and HaveCrashedWorker,
since they belong together as bgworker concerns.
next_wakeup = maybe_start_io_workers_scheduled_at();
I think I've run out of reasons not to commit this, unless your
pondering of the grow-trigger heuristics revealed a problem?