bdev/fio_plugin: Keep polling the admin queue while running
This allows NVMe-oF to process keep alive requests. Change-Id: I8f090cf3de894e00e85121ac2fb207266979e08d Signed-off-by: Ben Walker <benjamin.walker@intel.com> Reviewed-on: https://review.gerrithub.io/414481 Tested-by: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
This commit is contained in:
parent
ca88f46a2d
commit
45afbff73f
@ -95,6 +95,7 @@ struct spdk_fio_thread {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static struct spdk_fio_thread *g_init_thread = NULL;
|
static struct spdk_fio_thread *g_init_thread = NULL;
|
||||||
|
static pthread_t g_init_thread_id = 0;
|
||||||
static bool g_spdk_env_initialized = false;
|
static bool g_spdk_env_initialized = false;
|
||||||
|
|
||||||
static int spdk_fio_init(struct thread_data *td);
|
static int spdk_fio_init(struct thread_data *td);
|
||||||
@ -207,6 +208,36 @@ spdk_fio_init_thread(struct thread_data *td)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void *
|
||||||
|
spdk_init_thread_poll(void *arg)
|
||||||
|
{
|
||||||
|
struct spdk_fio_thread *thread = arg;
|
||||||
|
int oldstate;
|
||||||
|
int rc;
|
||||||
|
|
||||||
|
/* Loop until the thread is cancelled */
|
||||||
|
while (true) {
|
||||||
|
rc = pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &oldstate);
|
||||||
|
if (rc != 0) {
|
||||||
|
SPDK_ERRLOG("Unable to set cancel state disabled on g_init_thread (%d): %s\n",
|
||||||
|
rc, spdk_strerror(rc));
|
||||||
|
}
|
||||||
|
|
||||||
|
spdk_fio_poll_thread(thread);
|
||||||
|
|
||||||
|
rc = pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, &oldstate);
|
||||||
|
if (rc != 0) {
|
||||||
|
SPDK_ERRLOG("Unable to set cancel state enabled on g_init_thread (%d): %s\n",
|
||||||
|
rc, spdk_strerror(rc));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* This is a pthread cancellation point and cannot be removed. */
|
||||||
|
sleep(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
spdk_fio_init_env(struct thread_data *td)
|
spdk_fio_init_env(struct thread_data *td)
|
||||||
{
|
{
|
||||||
@ -288,6 +319,16 @@ spdk_fio_init_env(struct thread_data *td)
|
|||||||
count = spdk_fio_poll_thread(fio_thread);
|
count = spdk_fio_poll_thread(fio_thread);
|
||||||
} while (count > 0);
|
} while (count > 0);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Spawn a thread to continue polling this thread
|
||||||
|
* occasionally.
|
||||||
|
*/
|
||||||
|
|
||||||
|
rc = pthread_create(&g_init_thread_id, NULL, &spdk_init_thread_poll, fio_thread);
|
||||||
|
if (rc != 0) {
|
||||||
|
SPDK_ERRLOG("Unable to spawn thread to poll admin queue. It won't be polled.\n");
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -700,6 +741,10 @@ spdk_fio_finish_env(void)
|
|||||||
/* the same thread that called spdk_fio_init_env */
|
/* the same thread that called spdk_fio_init_env */
|
||||||
fio_thread = g_init_thread;
|
fio_thread = g_init_thread;
|
||||||
|
|
||||||
|
if (pthread_cancel(g_init_thread_id) == 0) {
|
||||||
|
pthread_join(g_init_thread_id, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
spdk_bdev_finish(spdk_fio_module_finish_done, &done);
|
spdk_bdev_finish(spdk_fio_module_finish_done, &done);
|
||||||
|
|
||||||
do {
|
do {
|
||||||
|
Loading…
Reference in New Issue
Block a user