bdev: remove spdk_bdev_poller_start() lcore option

Always start bdev pollers on the calling core.

This removes the lcore concept from the bdev poller abstraction and
simplifies the job of spdk_bdev_initialize() callers providing their own
poller and event implementations.

All callers except the NVMe bdev hotplug poller already used the current
core as the parameter.  The NVMe HotplugPollCore option was undocumented
and unused in any of the tests or example configuration files, so it
should be safe to remove.

Change-Id: I93b466e1e58901b8785c40cbe296fa46c157850f
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/382857
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Daniel Verkamp 2017-10-17 11:21:50 -07:00 committed by Jim Harris
parent ae0f518e4f
commit 8eef5183d3
9 changed files with 25 additions and 27 deletions

View File

@ -129,7 +129,6 @@ static void
spdk_fio_start_poller(struct spdk_bdev_poller **ppoller,
spdk_bdev_poller_fn fn,
void *arg,
uint32_t lcore,
uint64_t period_microseconds)
{
struct spdk_fio_thread *fio_thread;

View File

@ -120,7 +120,6 @@ typedef void (*spdk_bdev_poller_fn)(void *arg);
typedef void (*spdk_bdev_poller_start_cb)(struct spdk_bdev_poller **ppoller,
spdk_bdev_poller_fn fn,
void *arg,
uint32_t lcore,
uint64_t period_microseconds);
typedef void (*spdk_bdev_poller_stop_cb)(struct spdk_bdev_poller **ppoller);

View File

@ -367,12 +367,27 @@ int spdk_bdev_module_claim_bdev(struct spdk_bdev *bdev, struct spdk_bdev_desc *d
struct spdk_bdev_module_if *module);
void spdk_bdev_module_release_bdev(struct spdk_bdev *bdev);
/**
* Start a poller on the current thread to periodically call fn.
*
* \param[out] ppoller Will be filled with initialized poller pointer.
* \param fn Function to run periodically.
* \param arg Argument to be passed to fn.
* \param period_microseconds Delay between calls of the poller function,
* or 0 to call as frequently as possible.
*
* The user must call spdk_bdev_poller_stop() to clean up the resources allocated by this function.
*/
void spdk_bdev_poller_start(struct spdk_bdev_poller **ppoller,
spdk_bdev_poller_fn fn,
void *arg,
uint32_t lcore,
uint64_t period_microseconds);
/**
* Stop a poller started by spdk_bdev_poller_start().
*
* \param ppoller Poller to stop.
*/
void spdk_bdev_poller_stop(struct spdk_bdev_poller **ppoller);
/**

View File

@ -312,8 +312,7 @@ bdev_aio_create_cb(void *io_device, void *ctx_buf)
return -1;
}
spdk_bdev_poller_start(&ch->poller, bdev_aio_poll, ch,
spdk_env_get_current_core(), 0);
spdk_bdev_poller_start(&ch->poller, bdev_aio_poll, ch, 0);
return 0;
}

View File

@ -451,10 +451,9 @@ void
spdk_bdev_poller_start(struct spdk_bdev_poller **ppoller,
spdk_bdev_poller_fn fn,
void *arg,
uint32_t lcore,
uint64_t period_microseconds)
{
g_bdev_mgr.start_poller_fn(ppoller, fn, arg, lcore, period_microseconds);
g_bdev_mgr.start_poller_fn(ppoller, fn, arg, period_microseconds);
}
void

View File

@ -129,7 +129,6 @@ static int g_timeout = 0;
static int g_nvme_adminq_poll_timeout_us = 0;
static bool g_nvme_hotplug_enabled = false;
static int g_nvme_hotplug_poll_timeout_us = 0;
static int g_nvme_hotplug_poll_core = 0;
static struct spdk_bdev_poller *g_hotplug_poller;
static pthread_mutex_t g_bdev_nvme_mutex = PTHREAD_MUTEX_INITIALIZER;
@ -499,8 +498,7 @@ bdev_nvme_create_cb(void *io_device, void *ctx_buf)
return -1;
}
spdk_bdev_poller_start(&ch->poller, bdev_nvme_poll, ch,
spdk_env_get_current_core(), 0);
spdk_bdev_poller_start(&ch->poller, bdev_nvme_poll, ch, 0);
return 0;
}
@ -849,7 +847,7 @@ attach_cb(void *cb_ctx, const struct spdk_nvme_transport_id *trid,
}
spdk_bdev_poller_start(&nvme_ctrlr->adminq_timer_poller, bdev_nvme_poll_adminq, ctrlr,
spdk_env_get_current_core(), g_nvme_adminq_poll_timeout_us);
g_nvme_adminq_poll_timeout_us);
TAILQ_INSERT_TAIL(&g_nvme_ctrlrs, nvme_ctrlr, tailq);
@ -1029,12 +1027,6 @@ bdev_nvme_library_init(void)
g_nvme_hotplug_poll_timeout_us = 100000;
}
g_nvme_hotplug_poll_core = spdk_conf_section_get_intval(sp, "HotplugPollCore");
if (g_nvme_hotplug_poll_core <= 0) {
g_nvme_hotplug_poll_core = spdk_env_get_current_core();
}
for (i = 0; i < NVME_MAX_CONTROLLERS; i++) {
val = spdk_conf_section_get_nmval(sp, "TransportID", i, 0);
if (val == NULL) {
@ -1084,7 +1076,6 @@ bdev_nvme_library_init(void)
if (g_nvme_hotplug_enabled) {
spdk_bdev_poller_start(&g_hotplug_poller, bdev_nvme_hotplug, NULL,
g_nvme_hotplug_poll_core,
g_nvme_hotplug_poll_timeout_us);
}

View File

@ -417,8 +417,7 @@ bdev_rbd_create_cb(void *io_device, void *ctx_buf)
goto err;
}
spdk_bdev_poller_start(&ch->poller, bdev_rbd_io_poll, ch,
spdk_env_get_current_core(), 0);
spdk_bdev_poller_start(&ch->poller, bdev_rbd_io_poll, ch, 0);
return 0;

View File

@ -453,8 +453,7 @@ bdev_virtio_create_cb(void *io_device, void *ctx_buf)
ch->vdev = vdev;
ch->vq = vq;
spdk_bdev_poller_start(&vq->poller, bdev_virtio_poll, ch,
vq->owner_lcore, 0);
spdk_bdev_poller_start(&vq->poller, bdev_virtio_poll, ch, 0);
return 0;
}
@ -876,9 +875,7 @@ bdev_virtio_initialize(void)
vq = vdev->vqs[VIRTIO_SCSI_REQUESTQ];
base->vq = vq;
vq->poller_ctx = base;
spdk_bdev_poller_start(&vq->poller, bdev_scan_poll, base,
vq->owner_lcore, 0);
spdk_bdev_poller_start(&vq->poller, bdev_scan_poll, base, 0);
scan_target(base);
}

View File

@ -34,6 +34,7 @@
#include "spdk/stdinc.h"
#include "spdk/bdev.h"
#include "spdk/env.h"
#include "spdk_internal/event.h"
@ -47,13 +48,12 @@ static void
spdk_bdev_subsystem_start_poller(struct spdk_bdev_poller **ppoller,
spdk_bdev_poller_fn fn,
void *arg,
uint32_t lcore,
uint64_t period_microseconds)
{
spdk_poller_register((struct spdk_poller **)ppoller,
fn,
arg,
lcore,
spdk_env_get_current_core(),
period_microseconds);
}