lib/thread: Rename timer_poller by timed_poller
Rename all variables and comments related with timed poller from timer_poller to timed_poller. This patch was originally to count poller and add the current value to thread_get_stats RPC. This will be realized to add thread_get_pollers RPC instead but renaming will be valuable itself. So keep only renaming in this patch. Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Change-Id: I73880b8df6ed35391383e0890f76b4e509690e06 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/479 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
This commit is contained in:
parent
242a899573
commit
2be78638d4
@ -137,7 +137,7 @@ struct spdk_thread {
|
|||||||
/**
|
/**
|
||||||
* Contains pollers running on this thread with a periodic timer.
|
* Contains pollers running on this thread with a periodic timer.
|
||||||
*/
|
*/
|
||||||
TAILQ_HEAD(timer_pollers_head, spdk_poller) timer_pollers;
|
TAILQ_HEAD(timed_pollers_head, spdk_poller) timed_pollers;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Contains paused pollers. Pollers on this queue are waiting until
|
* Contains paused pollers. Pollers on this queue are waiting until
|
||||||
@ -227,19 +227,16 @@ _free_thread(struct spdk_thread *thread)
|
|||||||
SPDK_WARNLOG("poller %p still registered at thread exit\n",
|
SPDK_WARNLOG("poller %p still registered at thread exit\n",
|
||||||
poller);
|
poller);
|
||||||
}
|
}
|
||||||
|
|
||||||
TAILQ_REMOVE(&thread->active_pollers, poller, tailq);
|
TAILQ_REMOVE(&thread->active_pollers, poller, tailq);
|
||||||
free(poller);
|
free(poller);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TAILQ_FOREACH_SAFE(poller, &thread->timed_pollers, tailq, ptmp) {
|
||||||
TAILQ_FOREACH_SAFE(poller, &thread->timer_pollers, tailq, ptmp) {
|
|
||||||
if (poller->state != SPDK_POLLER_STATE_UNREGISTERED) {
|
if (poller->state != SPDK_POLLER_STATE_UNREGISTERED) {
|
||||||
SPDK_WARNLOG("poller %p still registered at thread exit\n",
|
SPDK_WARNLOG("poller %p still registered at thread exit\n",
|
||||||
poller);
|
poller);
|
||||||
}
|
}
|
||||||
|
TAILQ_REMOVE(&thread->timed_pollers, poller, tailq);
|
||||||
TAILQ_REMOVE(&thread->timer_pollers, poller, tailq);
|
|
||||||
free(poller);
|
free(poller);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -293,7 +290,7 @@ spdk_thread_create(const char *name, struct spdk_cpuset *cpumask)
|
|||||||
|
|
||||||
TAILQ_INIT(&thread->io_channels);
|
TAILQ_INIT(&thread->io_channels);
|
||||||
TAILQ_INIT(&thread->active_pollers);
|
TAILQ_INIT(&thread->active_pollers);
|
||||||
TAILQ_INIT(&thread->timer_pollers);
|
TAILQ_INIT(&thread->timed_pollers);
|
||||||
TAILQ_INIT(&thread->paused_pollers);
|
TAILQ_INIT(&thread->paused_pollers);
|
||||||
SLIST_INIT(&thread->msg_cache);
|
SLIST_INIT(&thread->msg_cache);
|
||||||
thread->msg_cache_count = 0;
|
thread->msg_cache_count = 0;
|
||||||
@ -458,18 +455,18 @@ _spdk_poller_insert_timer(struct spdk_thread *thread, struct spdk_poller *poller
|
|||||||
poller->next_run_tick = now + poller->period_ticks;
|
poller->next_run_tick = now + poller->period_ticks;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Insert poller in the thread's timer_pollers list in sorted order by next scheduled
|
* Insert poller in the thread's timed_pollers list in sorted order by next scheduled
|
||||||
* run time.
|
* run time.
|
||||||
*/
|
*/
|
||||||
TAILQ_FOREACH_REVERSE(iter, &thread->timer_pollers, timer_pollers_head, tailq) {
|
TAILQ_FOREACH_REVERSE(iter, &thread->timed_pollers, timed_pollers_head, tailq) {
|
||||||
if (iter->next_run_tick <= poller->next_run_tick) {
|
if (iter->next_run_tick <= poller->next_run_tick) {
|
||||||
TAILQ_INSERT_AFTER(&thread->timer_pollers, iter, poller, tailq);
|
TAILQ_INSERT_AFTER(&thread->timed_pollers, iter, poller, tailq);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* No earlier pollers were found, so this poller must be the new head */
|
/* No earlier pollers were found, so this poller must be the new head */
|
||||||
TAILQ_INSERT_HEAD(&thread->timer_pollers, poller, tailq);
|
TAILQ_INSERT_HEAD(&thread->timed_pollers, poller, tailq);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -549,7 +546,7 @@ spdk_thread_poll(struct spdk_thread *thread, uint32_t max_msgs, uint64_t now)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TAILQ_FOREACH_SAFE(poller, &thread->timer_pollers, tailq, tmp) {
|
TAILQ_FOREACH_SAFE(poller, &thread->timed_pollers, tailq, tmp) {
|
||||||
int timer_rc = 0;
|
int timer_rc = 0;
|
||||||
|
|
||||||
if (thread->exit) {
|
if (thread->exit) {
|
||||||
@ -557,11 +554,11 @@ spdk_thread_poll(struct spdk_thread *thread, uint32_t max_msgs, uint64_t now)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (poller->state == SPDK_POLLER_STATE_UNREGISTERED) {
|
if (poller->state == SPDK_POLLER_STATE_UNREGISTERED) {
|
||||||
TAILQ_REMOVE(&thread->timer_pollers, poller, tailq);
|
TAILQ_REMOVE(&thread->timed_pollers, poller, tailq);
|
||||||
free(poller);
|
free(poller);
|
||||||
continue;
|
continue;
|
||||||
} else if (poller->state == SPDK_POLLER_STATE_PAUSING) {
|
} else if (poller->state == SPDK_POLLER_STATE_PAUSING) {
|
||||||
TAILQ_REMOVE(&thread->timer_pollers, poller, tailq);
|
TAILQ_REMOVE(&thread->timed_pollers, poller, tailq);
|
||||||
TAILQ_INSERT_TAIL(&thread->paused_pollers, poller, tailq);
|
TAILQ_INSERT_TAIL(&thread->paused_pollers, poller, tailq);
|
||||||
poller->state = SPDK_POLLER_STATE_PAUSED;
|
poller->state = SPDK_POLLER_STATE_PAUSED;
|
||||||
continue;
|
continue;
|
||||||
@ -581,11 +578,11 @@ spdk_thread_poll(struct spdk_thread *thread, uint32_t max_msgs, uint64_t now)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (poller->state == SPDK_POLLER_STATE_UNREGISTERED) {
|
if (poller->state == SPDK_POLLER_STATE_UNREGISTERED) {
|
||||||
TAILQ_REMOVE(&thread->timer_pollers, poller, tailq);
|
TAILQ_REMOVE(&thread->timed_pollers, poller, tailq);
|
||||||
free(poller);
|
free(poller);
|
||||||
} else if (poller->state != SPDK_POLLER_STATE_PAUSED) {
|
} else if (poller->state != SPDK_POLLER_STATE_PAUSED) {
|
||||||
poller->state = SPDK_POLLER_STATE_WAITING;
|
poller->state = SPDK_POLLER_STATE_WAITING;
|
||||||
TAILQ_REMOVE(&thread->timer_pollers, poller, tailq);
|
TAILQ_REMOVE(&thread->timed_pollers, poller, tailq);
|
||||||
_spdk_poller_insert_timer(thread, poller, now);
|
_spdk_poller_insert_timer(thread, poller, now);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -613,7 +610,7 @@ spdk_thread_next_poller_expiration(struct spdk_thread *thread)
|
|||||||
{
|
{
|
||||||
struct spdk_poller *poller;
|
struct spdk_poller *poller;
|
||||||
|
|
||||||
poller = TAILQ_FIRST(&thread->timer_pollers);
|
poller = TAILQ_FIRST(&thread->timed_pollers);
|
||||||
if (poller) {
|
if (poller) {
|
||||||
return poller->next_run_tick;
|
return poller->next_run_tick;
|
||||||
}
|
}
|
||||||
@ -631,7 +628,7 @@ static bool
|
|||||||
_spdk_thread_has_unpaused_pollers(struct spdk_thread *thread)
|
_spdk_thread_has_unpaused_pollers(struct spdk_thread *thread)
|
||||||
{
|
{
|
||||||
if (TAILQ_EMPTY(&thread->active_pollers) &&
|
if (TAILQ_EMPTY(&thread->active_pollers) &&
|
||||||
TAILQ_EMPTY(&thread->timer_pollers)) {
|
TAILQ_EMPTY(&thread->timed_pollers)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -866,7 +863,7 @@ spdk_poller_pause(struct spdk_poller *poller)
|
|||||||
poller->state = SPDK_POLLER_STATE_PAUSING;
|
poller->state = SPDK_POLLER_STATE_PAUSING;
|
||||||
} else {
|
} else {
|
||||||
if (poller->period_ticks > 0) {
|
if (poller->period_ticks > 0) {
|
||||||
TAILQ_REMOVE(&thread->timer_pollers, poller, tailq);
|
TAILQ_REMOVE(&thread->timed_pollers, poller, tailq);
|
||||||
} else {
|
} else {
|
||||||
TAILQ_REMOVE(&thread->active_pollers, poller, tailq);
|
TAILQ_REMOVE(&thread->active_pollers, poller, tailq);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user