fio_plugin: Poll qpairs on the same thread in round-robin manner

With this change, the polling qpairs can be in round-robin manner.

Change-Id: I1926468dc596de2a43f42451525650356f44fbbd
Signed-off-by: Ziye Yang <optimistyzy@gmail.com>
Reviewed-on: https://review.gerrithub.io/375707
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Ziye Yang 2017-08-25 16:25:57 +08:00 committed by Jim Harris
parent bab64051de
commit 9e8853953a

View File

@ -80,6 +80,7 @@ struct spdk_fio_thread {
struct thread_data *td;
struct spdk_fio_qpair *fio_qpair;
struct spdk_fio_qpair *fio_qpair_current; // the current fio_qpair to be handled.
struct io_u **iocq; // io completion queue
unsigned int iocq_count; // number of iocq entries filled by last getevents
@ -413,7 +414,7 @@ static int spdk_fio_getevents(struct thread_data *td, unsigned int min,
unsigned int max, const struct timespec *t)
{
struct spdk_fio_thread *fio_thread = td->io_ops_data;
struct spdk_fio_qpair *fio_qpair;
struct spdk_fio_qpair *fio_qpair = NULL;
struct timespec t0, t1;
uint64_t timeout = 0;
@ -424,12 +425,22 @@ static int spdk_fio_getevents(struct thread_data *td, unsigned int min,
fio_thread->iocq_count = 0;
/* fetch the next qpair */
if (fio_thread->fio_qpair_current) {
fio_qpair = fio_thread->fio_qpair_current->next;
}
for (;;) {
fio_qpair = fio_thread->fio_qpair;
if (fio_qpair == NULL) {
fio_qpair = fio_thread->fio_qpair;
}
while (fio_qpair != NULL) {
spdk_nvme_qpair_process_completions(fio_qpair->qpair, max - fio_thread->iocq_count);
if (fio_thread->iocq_count >= min) {
/* reset the currrent handling qpair */
fio_thread->fio_qpair_current = fio_qpair;
return fio_thread->iocq_count;
}
@ -448,6 +459,8 @@ static int spdk_fio_getevents(struct thread_data *td, unsigned int min,
}
}
/* reset the currrent handling qpair */
fio_thread->fio_qpair_current = fio_qpair;
return fio_thread->iocq_count;
}