stub: remove use of max_delay_us
Ben's having to work around all of the max_delay_us code in his thread/reactor refactoring. Once we have a real scheduler, this whole idea will need to be rethought. So for now, let's get existing code off of the max_delay_us mechanism, so that we can remove it. For the stub app, just add a poller that does a usleep. This will have the same effect as the current behavior. Signed-off-by: Jim Harris <james.r.harris@intel.com> Change-Id: Iabfba6e0c5a15a688f65ba33a788bd346359d072 Reviewed-on: https://review.gerrithub.io/c/444303 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
parent
514358e5d3
commit
05130f2d40
@ -36,8 +36,10 @@
|
|||||||
#include "spdk/event.h"
|
#include "spdk/event.h"
|
||||||
#include "spdk/nvme.h"
|
#include "spdk/nvme.h"
|
||||||
#include "spdk/string.h"
|
#include "spdk/string.h"
|
||||||
|
#include "spdk/thread.h"
|
||||||
|
|
||||||
static char g_path[256];
|
static char g_path[256];
|
||||||
|
static struct spdk_poller *g_poller;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
usage(char *executable_name)
|
usage(char *executable_name)
|
||||||
@ -70,6 +72,13 @@ attach_cb(void *cb_ctx, const struct spdk_nvme_transport_id *trid,
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
stub_sleep(void *arg)
|
||||||
|
{
|
||||||
|
usleep(1000 * 1000);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
stub_start(void *arg1, void *arg2)
|
stub_start(void *arg1, void *arg2)
|
||||||
{
|
{
|
||||||
@ -87,11 +96,14 @@ stub_start(void *arg1, void *arg2)
|
|||||||
fprintf(stderr, "could not create sentinel file %s\n", g_path);
|
fprintf(stderr, "could not create sentinel file %s\n", g_path);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_poller = spdk_poller_register(stub_sleep, NULL, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
stub_shutdown(void)
|
stub_shutdown(void)
|
||||||
{
|
{
|
||||||
|
spdk_poller_unregister(&g_poller);
|
||||||
unlink(g_path);
|
unlink(g_path);
|
||||||
spdk_app_stop(0);
|
spdk_app_stop(0);
|
||||||
}
|
}
|
||||||
@ -149,7 +161,6 @@ main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
opts.shutdown_cb = stub_shutdown;
|
opts.shutdown_cb = stub_shutdown;
|
||||||
opts.max_delay_us = 1000 * 1000;
|
|
||||||
|
|
||||||
ch = spdk_app_start(&opts, stub_start, (void *)(intptr_t)opts.shm_id, NULL);
|
ch = spdk_app_start(&opts, stub_start, (void *)(intptr_t)opts.shm_id, NULL);
|
||||||
spdk_app_fini();
|
spdk_app_fini();
|
||||||
|
Loading…
Reference in New Issue
Block a user