diff --git a/include/spdk_internal/thread.h b/include/spdk_internal/thread.h index f1ff849d7..ae3b99757 100644 --- a/include/spdk_internal/thread.h +++ b/include/spdk_internal/thread.h @@ -37,49 +37,9 @@ #include "spdk/stdinc.h" #include "spdk/thread.h" -#define SPDK_MAX_POLLER_NAME_LEN 256 #define SPDK_MAX_THREAD_NAME_LEN 256 -enum spdk_poller_state { - /* The poller is registered with a thread but not currently executing its fn. */ - SPDK_POLLER_STATE_WAITING, - - /* The poller is currently running its fn. */ - SPDK_POLLER_STATE_RUNNING, - - /* The poller was unregistered during the execution of its fn. */ - SPDK_POLLER_STATE_UNREGISTERED, - - /* The poller is in the process of being paused. It will be paused - * during the next time it's supposed to be executed. - */ - SPDK_POLLER_STATE_PAUSING, - - /* The poller is registered but currently paused. It's on the - * paused_pollers list. - */ - SPDK_POLLER_STATE_PAUSED, -}; - -struct spdk_poller { - TAILQ_ENTRY(spdk_poller) tailq; - - /* Current state of the poller; should only be accessed from the poller's thread. */ - enum spdk_poller_state state; - - uint64_t period_ticks; - uint64_t next_run_tick; - uint64_t run_count; - uint64_t busy_count; - spdk_poller_fn fn; - void *arg; - struct spdk_thread *thread; - int interruptfd; - spdk_poller_set_interrupt_mode_cb set_intr_cb_fn; - void *set_intr_cb_arg; - - char name[SPDK_MAX_POLLER_NAME_LEN + 1]; -}; +struct spdk_poller; struct spdk_poller_stats { uint64_t run_count; diff --git a/lib/thread/thread.c b/lib/thread/thread.c index d9e39b065..bed569ac3 100644 --- a/lib/thread/thread.c +++ b/lib/thread/thread.c @@ -52,6 +52,48 @@ #define SPDK_MSG_BATCH_SIZE 8 #define SPDK_MAX_DEVICE_NAME_LEN 256 #define SPDK_THREAD_EXIT_TIMEOUT_SEC 5 +#define SPDK_MAX_POLLER_NAME_LEN 256 + +enum spdk_poller_state { + /* The poller is registered with a thread but not currently executing its fn. */ + SPDK_POLLER_STATE_WAITING, + + /* The poller is currently running its fn. */ + SPDK_POLLER_STATE_RUNNING, + + /* The poller was unregistered during the execution of its fn. */ + SPDK_POLLER_STATE_UNREGISTERED, + + /* The poller is in the process of being paused. It will be paused + * during the next time it's supposed to be executed. + */ + SPDK_POLLER_STATE_PAUSING, + + /* The poller is registered but currently paused. It's on the + * paused_pollers list. + */ + SPDK_POLLER_STATE_PAUSED, +}; + +struct spdk_poller { + TAILQ_ENTRY(spdk_poller) tailq; + + /* Current state of the poller; should only be accessed from the poller's thread. */ + enum spdk_poller_state state; + + uint64_t period_ticks; + uint64_t next_run_tick; + uint64_t run_count; + uint64_t busy_count; + spdk_poller_fn fn; + void *arg; + struct spdk_thread *thread; + int interruptfd; + spdk_poller_set_interrupt_mode_cb set_intr_cb_fn; + void *set_intr_cb_arg; + + char name[SPDK_MAX_POLLER_NAME_LEN + 1]; +}; static pthread_mutex_t g_devlist_mutex = PTHREAD_MUTEX_INITIALIZER;