On Thu, May 12, 2016 at 09:27:42AM -0500, Huaicheng Li wrote: > My goal is to add latency for each I/O without blocking the submission path. > Now > I can know how long each I/O should wait before it’s submitted to the AIO > queue > via a model. Now the question is how can I make the I/O wait for that long > time > before it’s finally handled by worker threads.
The "null" block driver supports latency simulation but the driver does not perform real I/O. The Linux kernel also offer latency simulation. Take a look at the dm-delay and scsi_debug drivers. > I’m thinking about adding a timer for each block I/O and its callback > function will > do the submission job. Below is some of my thought and questions about this > idea: The way it's done in the "null" block driver is: static coroutine_fn int null_co_common(BlockDriverState *bs) { BDRVNullState *s = bs->opaque; if (s->latency_ns) { co_aio_sleep_ns(bdrv_get_aio_context(bs), QEMU_CLOCK_REALTIME, s->latency_ns); } return 0; }
signature.asc
Description: PGP signature