From 9579995cb3e73291927481663dbf66a7c644c445 Mon Sep 17 00:00:00 2001 From: Amir Haroush Date: Sun, 5 Mar 2023 22:57:30 +0200 Subject: [PATCH] bdev/ocf: Remove cleaner queue, use mngt queue instead Remove unused cleaner IO queue which is not kicked on creation. While it is not a problem to have it, the latest OCF code has new parallelize mechanism that uses all the IO queues. Using an IO queue which is not kicked will hang the system. After this change SPDK glue is somewhat closer to OCL glue, both not using a dedicated cleaner IO queue. Signed-off-by: Amir Haroush Signed-off-by: Shai Fultheim Change-Id: I2e8ef0aaf11061d511151865c6062922d7934df2 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/17065 Reviewed-by: Jim Harris Tested-by: SPDK CI Jenkins Reviewed-by: Ben Walker --- module/bdev/ocf/ctx.c | 54 ++++++---------------------------------- module/bdev/ocf/ctx.h | 1 - module/bdev/ocf/volume.c | 2 +- 3 files changed, 9 insertions(+), 48 deletions(-) diff --git a/module/bdev/ocf/ctx.c b/module/bdev/ocf/ctx.c index f22ed1588..906c28856 100644 --- a/module/bdev/ocf/ctx.c +++ b/module/bdev/ocf/ctx.c @@ -300,7 +300,7 @@ vbdev_ocf_cache_ctx_get(struct vbdev_ocf_cache_ctx *ctx) struct cleaner_priv { struct spdk_poller *poller; - ocf_queue_t queue; + ocf_queue_t mngt_queue; uint64_t next_run; }; @@ -309,23 +309,13 @@ cleaner_poll(void *arg) { ocf_cleaner_t cleaner = arg; struct cleaner_priv *priv = ocf_cleaner_get_priv(cleaner); - uint32_t iono = ocf_queue_pending_io(priv->queue); - int i, max = spdk_min(32, iono); - - for (i = 0; i < max; i++) { - ocf_queue_run_single(priv->queue); - } if (spdk_get_ticks() >= priv->next_run) { - ocf_cleaner_run(cleaner, priv->queue); + ocf_cleaner_run(cleaner, priv->mngt_queue); return SPDK_POLLER_BUSY; } - if (iono > 0) { - return SPDK_POLLER_BUSY; - } else { - return SPDK_POLLER_IDLE; - } + return SPDK_POLLER_IDLE; } static void @@ -336,32 +326,9 @@ cleaner_cmpl(ocf_cleaner_t c, uint32_t interval) priv->next_run = spdk_get_ticks() + ((interval * spdk_get_ticks_hz()) / 1000); } -static void -cleaner_queue_kick(ocf_queue_t q) -{ -} - -static void -cleaner_queue_stop(ocf_queue_t q) -{ - struct cleaner_priv *cpriv = ocf_queue_get_priv(q); - - if (cpriv) { - spdk_poller_unregister(&cpriv->poller); - free(cpriv); - } -} - -const struct ocf_queue_ops cleaner_queue_ops = { - .kick_sync = cleaner_queue_kick, - .kick = cleaner_queue_kick, - .stop = cleaner_queue_stop, -}; - static int vbdev_ocf_ctx_cleaner_init(ocf_cleaner_t c) { - int rc; struct cleaner_priv *priv = calloc(1, sizeof(*priv)); ocf_cache_t cache = ocf_cleaner_get_cache(c); struct vbdev_ocf_cache_ctx *cctx = ocf_cache_get_priv(cache); @@ -370,15 +337,7 @@ vbdev_ocf_ctx_cleaner_init(ocf_cleaner_t c) return -ENOMEM; } - rc = vbdev_ocf_queue_create(cache, &priv->queue, &cleaner_queue_ops); - if (rc) { - free(priv); - return rc; - } - - ocf_queue_set_priv(priv->queue, priv); - - cctx->cleaner_queue = priv->queue; + priv->mngt_queue = cctx->mngt_queue; ocf_cleaner_set_cmpl(c, cleaner_cmpl); ocf_cleaner_set_priv(c, priv); @@ -391,7 +350,10 @@ vbdev_ocf_ctx_cleaner_stop(ocf_cleaner_t c) { struct cleaner_priv *priv = ocf_cleaner_get_priv(c); - vbdev_ocf_queue_put(priv->queue); + if (priv) { + spdk_poller_unregister(&priv->poller); + free(priv); + } } static void diff --git a/module/bdev/ocf/ctx.h b/module/bdev/ocf/ctx.h index 730e1cb0d..3c4395655 100644 --- a/module/bdev/ocf/ctx.h +++ b/module/bdev/ocf/ctx.h @@ -19,7 +19,6 @@ extern ocf_ctx_t vbdev_ocf_ctx; /* Context of cache instance */ struct vbdev_ocf_cache_ctx { ocf_queue_t mngt_queue; - ocf_queue_t cleaner_queue; pthread_mutex_t lock; env_atomic refcnt; }; diff --git a/module/bdev/ocf/volume.c b/module/bdev/ocf/volume.c index 4d606dcbc..b2f618e0e 100644 --- a/module/bdev/ocf/volume.c +++ b/module/bdev/ocf/volume.c @@ -208,7 +208,7 @@ prepare_submit(struct ocf_io *io) return -EFAULT; } - if (q == cctx->cleaner_queue || q == cctx->mngt_queue) { + if (q == cctx->mngt_queue) { io_ctx->ch = base->management_channel; return 0; }