From cf669d0217813b190971639718af9dd898067863 Mon Sep 17 00:00:00 2001 From: Shuhei Matsumoto Date: Thu, 20 Feb 2020 19:20:45 -0500 Subject: [PATCH] lib/thread: Move struct spdk_poller public in SPDK internal thread_get_pollers RPC which will be added in the upcoming patches will need to access internal of all pollers. Following the last patch, expose struct spdk_poller internally among SPDK libraries. Signed-off-by: Shuhei Matsumoto Change-Id: I6844fc70165b4f127c49680ce592ac7b8c326cac Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/594 Tested-by: SPDK CI Jenkins Reviewed-by: Changpeng Liu Reviewed-by: Aleksey Marchuk --- include/spdk_internal/thread.h | 34 ++++++++++++++++++++++++++++++++++ lib/thread/thread.c | 34 ---------------------------------- 2 files changed, 34 insertions(+), 34 deletions(-) diff --git a/include/spdk_internal/thread.h b/include/spdk_internal/thread.h index 0ae001fbe..93fc918c8 100644 --- a/include/spdk_internal/thread.h +++ b/include/spdk_internal/thread.h @@ -39,6 +39,40 @@ #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; + spdk_poller_fn fn; + void *arg; + struct spdk_thread *thread; +}; + struct spdk_thread { TAILQ_HEAD(, spdk_io_channel) io_channels; TAILQ_ENTRY(spdk_thread) tailq; diff --git a/lib/thread/thread.c b/lib/thread/thread.c index f25378cc8..e82fefb49 100644 --- a/lib/thread/thread.c +++ b/lib/thread/thread.c @@ -86,40 +86,6 @@ struct spdk_msg { #define SPDK_MSG_MEMPOOL_CACHE_SIZE 1024 static struct spdk_mempool *g_spdk_msg_mempool = NULL; -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; - spdk_poller_fn fn; - void *arg; - struct spdk_thread *thread; -}; - static TAILQ_HEAD(, spdk_thread) g_threads = TAILQ_HEAD_INITIALIZER(g_threads); static uint32_t g_thread_count = 0;