lib/ftl: Remove read thread support
There is no need to support read operations on separate thread. Change-Id: I10b595b8eeaf5fd0182f05913fdd5baa4b84961f Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com> Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/471910 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
parent
dcd3fc1fd1
commit
05e4366519
@ -117,8 +117,6 @@ struct spdk_ftl_dev_init_opts {
|
||||
|
||||
/* Thread responsible for core tasks execution */
|
||||
struct spdk_thread *core_thread;
|
||||
/* Thread responsible for read requests */
|
||||
struct spdk_thread *read_thread;
|
||||
|
||||
/* Device's config */
|
||||
const struct spdk_ftl_conf *conf;
|
||||
|
@ -396,23 +396,13 @@ ftl_check_core_thread(const struct spdk_ftl_dev *dev)
|
||||
return dev->core_thread.thread == spdk_get_thread();
|
||||
}
|
||||
|
||||
static bool
|
||||
ftl_check_read_thread(const struct spdk_ftl_dev *dev)
|
||||
{
|
||||
return dev->read_thread.thread == spdk_get_thread();
|
||||
}
|
||||
|
||||
struct spdk_io_channel *
|
||||
ftl_get_io_channel(const struct spdk_ftl_dev *dev)
|
||||
{
|
||||
if (ftl_check_core_thread(dev)) {
|
||||
return dev->core_thread.ioch;
|
||||
}
|
||||
if (ftl_check_read_thread(dev)) {
|
||||
return dev->read_thread.ioch;
|
||||
}
|
||||
|
||||
assert(0);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -2037,10 +2027,10 @@ ftl_io_read(struct ftl_io *io)
|
||||
{
|
||||
struct spdk_ftl_dev *dev = io->dev;
|
||||
|
||||
if (ftl_check_read_thread(dev)) {
|
||||
if (ftl_check_core_thread(dev)) {
|
||||
ftl_io_call_foreach_child(io, ftl_io_read_leaf);
|
||||
} else {
|
||||
spdk_thread_send_msg(ftl_get_read_thread(dev), _ftl_io_read, io);
|
||||
spdk_thread_send_msg(ftl_get_core_thread(dev), _ftl_io_read, io);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2246,27 +2236,6 @@ ftl_process_retry_queue(struct spdk_ftl_dev *dev)
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
ftl_task_read(void *ctx)
|
||||
{
|
||||
struct ftl_thread *thread = ctx;
|
||||
struct spdk_ftl_dev *dev = thread->dev;
|
||||
|
||||
if (dev->halt) {
|
||||
if (ftl_shutdown_complete(dev)) {
|
||||
spdk_poller_unregister(&thread->poller);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (!TAILQ_EMPTY(&dev->retry_queue)) {
|
||||
ftl_process_retry_queue(dev);
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
ftl_task_core(void *ctx)
|
||||
{
|
||||
@ -2283,6 +2252,11 @@ ftl_task_core(void *ctx)
|
||||
ftl_process_writes(dev);
|
||||
ftl_process_relocs(dev);
|
||||
|
||||
if (!TAILQ_EMPTY(&dev->retry_queue)) {
|
||||
ftl_process_retry_queue(dev);
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -229,7 +229,6 @@ struct spdk_ftl_dev {
|
||||
|
||||
/* Threads */
|
||||
struct ftl_thread core_thread;
|
||||
struct ftl_thread read_thread;
|
||||
|
||||
/* Devices' list */
|
||||
STAILQ_ENTRY(spdk_ftl_dev) stailq;
|
||||
@ -301,12 +300,6 @@ ftl_get_core_thread(const struct spdk_ftl_dev *dev)
|
||||
return dev->core_thread.thread;
|
||||
}
|
||||
|
||||
static inline struct spdk_thread *
|
||||
ftl_get_read_thread(const struct spdk_ftl_dev *dev)
|
||||
{
|
||||
return dev->read_thread.thread;
|
||||
}
|
||||
|
||||
static inline size_t
|
||||
ftl_get_num_bands(const struct spdk_ftl_dev *dev)
|
||||
{
|
||||
|
@ -492,7 +492,7 @@ ftl_init_bands_state(struct spdk_ftl_dev *dev)
|
||||
}
|
||||
|
||||
static void
|
||||
_ftl_dev_init_thread(void *ctx)
|
||||
_ftl_dev_init_core_thread(void *ctx)
|
||||
{
|
||||
struct ftl_thread *thread = ctx;
|
||||
struct spdk_ftl_dev *dev = thread->dev;
|
||||
@ -507,35 +507,20 @@ _ftl_dev_init_thread(void *ctx)
|
||||
}
|
||||
|
||||
static int
|
||||
ftl_dev_init_thread(struct spdk_ftl_dev *dev, struct ftl_thread *thread,
|
||||
struct spdk_thread *spdk_thread, spdk_poller_fn fn, uint64_t period_us)
|
||||
ftl_dev_init_core_thread(struct spdk_ftl_dev *dev, const struct spdk_ftl_dev_init_opts *opts)
|
||||
{
|
||||
struct ftl_thread *thread = &dev->core_thread;
|
||||
|
||||
if (!opts->core_thread) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
thread->dev = dev;
|
||||
thread->poller_fn = fn;
|
||||
thread->thread = spdk_thread;
|
||||
thread->period_us = period_us;
|
||||
|
||||
spdk_thread_send_msg(spdk_thread, _ftl_dev_init_thread, thread);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
ftl_dev_init_threads(struct spdk_ftl_dev *dev, const struct spdk_ftl_dev_init_opts *opts)
|
||||
{
|
||||
if (!opts->core_thread || !opts->read_thread) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (ftl_dev_init_thread(dev, &dev->core_thread, opts->core_thread, ftl_task_core, 0)) {
|
||||
SPDK_ERRLOG("Unable to initialize core thread\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (ftl_dev_init_thread(dev, &dev->read_thread, opts->read_thread, ftl_task_read, 0)) {
|
||||
SPDK_ERRLOG("Unable to initialize read thread\n");
|
||||
return -1;
|
||||
}
|
||||
thread->poller_fn = ftl_task_core;
|
||||
thread->thread = opts->core_thread;
|
||||
thread->period_us = 0;
|
||||
|
||||
spdk_thread_send_msg(opts->core_thread, _ftl_dev_init_core_thread, thread);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -834,8 +819,8 @@ ftl_dev_init_state(struct ftl_dev_init_ctx *init_ctx)
|
||||
|
||||
ftl_dev_update_bands(dev);
|
||||
|
||||
if (ftl_dev_init_threads(dev, &init_ctx->opts)) {
|
||||
SPDK_ERRLOG("Unable to initialize device threads\n");
|
||||
if (ftl_dev_init_core_thread(dev, &init_ctx->opts)) {
|
||||
SPDK_ERRLOG("Unable to initialize device thread\n");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
@ -1131,9 +1116,6 @@ ftl_dev_free_sync(struct spdk_ftl_dev *dev)
|
||||
if (dev->core_thread.thread) {
|
||||
ftl_dev_free_thread(dev, &dev->core_thread);
|
||||
}
|
||||
if (dev->read_thread.thread) {
|
||||
ftl_dev_free_thread(dev, &dev->read_thread);
|
||||
}
|
||||
|
||||
if (dev->bands) {
|
||||
for (i = 0; i < ftl_get_num_bands(dev); ++i) {
|
||||
@ -1322,7 +1304,7 @@ ftl_halt_poller(void *ctx)
|
||||
{
|
||||
struct spdk_ftl_dev *dev = ctx;
|
||||
|
||||
if (!dev->core_thread.poller && !dev->read_thread.poller) {
|
||||
if (!dev->core_thread.poller) {
|
||||
spdk_poller_unregister(&dev->fini_ctx.poller);
|
||||
|
||||
if (ftl_dev_has_nv_cache(dev)) {
|
||||
|
@ -592,7 +592,7 @@ bdev_ftl_create_bdev(const struct ftl_bdev_init_opts *bdev_opts,
|
||||
opts.conf = &bdev_opts->ftl_conf;
|
||||
|
||||
/* TODO: set threads based on config */
|
||||
opts.core_thread = opts.read_thread = spdk_get_thread();
|
||||
opts.core_thread = spdk_get_thread();
|
||||
|
||||
rc = spdk_ftl_dev_init(&opts, bdev_ftl_create_cb, ftl_bdev);
|
||||
if (rc) {
|
||||
|
Loading…
Reference in New Issue
Block a user