From 7fc67cd2481712e372e659f1b86e059731c3f969 Mon Sep 17 00:00:00 2001 From: Wojciech Malikowski Date: Thu, 21 Nov 2019 13:31:56 +0100 Subject: [PATCH] bdev/ftl: Complete IO immediately There is no need to have separate IO poller for FTL bdev. Signed-off-by: Wojciech Malikowski Change-Id: I19d42f3dc1faad6bb0094681bfe90ad29b88aae4 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/545 Reviewed-by: Shuhei Matsumoto Reviewed-by: Jim Harris Reviewed-by: Konrad Sztyber Tested-by: SPDK CI Jenkins --- module/bdev/ftl/bdev_ftl.c | 51 +------------------------------------- 1 file changed, 1 insertion(+), 50 deletions(-) diff --git a/module/bdev/ftl/bdev_ftl.c b/module/bdev/ftl/bdev_ftl.c index 02e754bfea2..45fddd8eab0 100644 --- a/module/bdev/ftl/bdev_ftl.c +++ b/module/bdev/ftl/bdev_ftl.c @@ -46,8 +46,6 @@ #include "bdev_ftl.h" -#define FTL_COMPLETION_RING_SIZE 4096 - struct ftl_bdev { struct spdk_bdev bdev; @@ -61,22 +59,12 @@ struct ftl_bdev { struct ftl_io_channel { struct spdk_ftl_dev *dev; - struct spdk_poller *poller; - -#define FTL_MAX_COMPLETIONS 64 - struct ftl_bdev_io *io[FTL_MAX_COMPLETIONS]; - - /* Completion ring */ - struct spdk_ring *ring; - struct spdk_io_channel *ioch; }; struct ftl_bdev_io { struct ftl_bdev *bdev; - struct spdk_ring *ring; - int status; }; @@ -154,24 +142,17 @@ static void bdev_ftl_cb(void *arg, int status) { struct ftl_bdev_io *io = arg; - size_t cnt __attribute__((unused)); - - io->status = status; - cnt = spdk_ring_enqueue(io->ring, (void **)&io, 1, NULL); - assert(cnt == 1); + bdev_ftl_complete_io(io, status); } static int bdev_ftl_fill_bio(struct ftl_bdev *ftl_bdev, struct spdk_io_channel *ch, struct ftl_bdev_io *io) { - struct ftl_io_channel *ioch = spdk_io_channel_get_ctx(ch); - memset(io, 0, sizeof(*io)); io->status = SPDK_BDEV_IO_STATUS_SUCCESS; - io->ring = ioch->ring; io->bdev = ftl_bdev; return 0; } @@ -393,21 +374,6 @@ static const struct spdk_bdev_fn_table ftl_fn_table = { .dump_info_json = bdev_ftl_dump_info_json, }; -static int -bdev_ftl_poll(void *arg) -{ - struct ftl_io_channel *ch = arg; - size_t cnt, i; - - cnt = spdk_ring_dequeue(ch->ring, (void **)&ch->io, FTL_MAX_COMPLETIONS); - - for (i = 0; i < cnt; ++i) { - bdev_ftl_complete_io(ch->io[i], ch->io[i]->status); - } - - return cnt; -} - static int bdev_ftl_io_channel_create_cb(void *io_device, void *ctx) { @@ -415,19 +381,6 @@ bdev_ftl_io_channel_create_cb(void *io_device, void *ctx) struct ftl_bdev *ftl_bdev = (struct ftl_bdev *)io_device; ch->dev = ftl_bdev->dev; - ch->ring = spdk_ring_create(SPDK_RING_TYPE_MP_SC, FTL_COMPLETION_RING_SIZE, - SPDK_ENV_SOCKET_ID_ANY); - - if (!ch->ring) { - return -ENOMEM; - } - - ch->poller = spdk_poller_register(bdev_ftl_poll, ch, 0); - if (!ch->poller) { - spdk_ring_free(ch->ring); - return -ENOMEM; - } - ch->ioch = spdk_get_io_channel(ftl_bdev->dev); return 0; @@ -438,8 +391,6 @@ bdev_ftl_io_channel_destroy_cb(void *io_device, void *ctx_buf) { struct ftl_io_channel *ch = ctx_buf; - spdk_ring_free(ch->ring); - spdk_poller_unregister(&ch->poller); spdk_put_io_channel(ch->ioch); }