From 646b851e754fd1380df1af5ab0d2627102907d77 Mon Sep 17 00:00:00 2001 From: Kozlowski Mateusz Date: Fri, 21 Oct 2022 08:40:06 +0200 Subject: [PATCH] lib/ftl: Update FTL IO activity statistics Bumping the IO activity statistics during relocation, compaction, L2P cache processing and user IO handling. This makes sure poller busy counter is more accurate. Signed-off-by: Kozlowski Mateusz Change-Id: Iabf8ec7ca41c01d7a00d3a70825b8d5283ab2bf1 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15257 Tested-by: SPDK CI Jenkins Reviewed-by: Jim Harris Reviewed-by: Tomasz Zawadzki Community-CI: Mellanox Build Bot --- lib/ftl/ftl_core.c | 4 ++++ lib/ftl/ftl_core.h | 6 ++++++ lib/ftl/ftl_l2p_cache.c | 4 ++++ lib/ftl/ftl_nv_cache.c | 2 ++ lib/ftl/ftl_reloc.c | 2 ++ 5 files changed, 18 insertions(+) diff --git a/lib/ftl/ftl_core.c b/lib/ftl/ftl_core.c index 4371a319f..e0556ffef 100644 --- a/lib/ftl/ftl_core.c +++ b/lib/ftl/ftl_core.c @@ -644,6 +644,7 @@ ftl_process_io_queue(struct spdk_ftl_dev *dev) TAILQ_REMOVE(&dev->rd_sq, io, queue_entry); assert(io->type == FTL_IO_READ); ftl_io_pin(io); + ftl_add_io_activity(dev); } while (!TAILQ_EMPTY(&dev->wr_sq) && !ftl_nv_cache_throttle(dev)) { @@ -654,6 +655,7 @@ ftl_process_io_queue(struct spdk_ftl_dev *dev) TAILQ_INSERT_HEAD(&dev->wr_sq, io, queue_entry); break; } + ftl_add_io_activity(dev); } if (!TAILQ_EMPTY(&dev->unmap_sq) && dev->unmap_qd == 0) { @@ -669,6 +671,8 @@ ftl_process_io_queue(struct spdk_ftl_dev *dev) */ if (!ftl_process_unmap(io)) { TAILQ_INSERT_HEAD(&dev->unmap_sq, io, queue_entry); + } else { + ftl_add_io_activity(dev); } } diff --git a/lib/ftl/ftl_core.h b/lib/ftl/ftl_core.h index b24cfafc6..5ca4f631b 100644 --- a/lib/ftl/ftl_core.h +++ b/lib/ftl/ftl_core.h @@ -233,6 +233,12 @@ ftl_get_core_thread(const struct spdk_ftl_dev *dev) return dev->core_thread; } +static inline void +ftl_add_io_activity(struct spdk_ftl_dev *dev) +{ + dev->stats.io_activity_total++; +} + static inline uint64_t ftl_get_num_bands(const struct spdk_ftl_dev *dev) { diff --git a/lib/ftl/ftl_l2p_cache.c b/lib/ftl/ftl_l2p_cache.c index 981a644f9..92f88f86f 100644 --- a/lib/ftl/ftl_l2p_cache.c +++ b/lib/ftl/ftl_l2p_cache.c @@ -1332,6 +1332,8 @@ ftl_l2p_cache_process_page_sets(struct spdk_ftl_dev *dev, struct ftl_l2p_cache * return -EBUSY; } + ftl_add_io_activity(dev); + TAILQ_REMOVE(&cache->deferred_page_set_list, page_set, list_entry); page_set->deferred = 0; page_set->locked = 1; @@ -1477,6 +1479,8 @@ ftl_l2p_cache_process_eviction(struct spdk_ftl_dev *dev, struct ftl_l2p_cache *c return; } + ftl_add_io_activity(dev); + page = eviction_get_page(dev, cache); if (spdk_unlikely(!page)) { return; diff --git a/lib/ftl/ftl_nv_cache.c b/lib/ftl/ftl_nv_cache.c index a99a19fed..a3c656392 100644 --- a/lib/ftl/ftl_nv_cache.c +++ b/lib/ftl/ftl_nv_cache.c @@ -1329,6 +1329,7 @@ ftl_nv_cache_process(struct spdk_ftl_dev *dev) nv_cache->chunk_free_count--; chunk->md->seq_id = ftl_get_next_seq_id(dev); ftl_chunk_open(chunk); + ftl_add_io_activity(dev); } if (is_compaction_required(nv_cache) && !TAILQ_EMPTY(&nv_cache->compactor_list)) { @@ -1338,6 +1339,7 @@ ftl_nv_cache_process(struct spdk_ftl_dev *dev) TAILQ_REMOVE(&nv_cache->compactor_list, comp, entry); compaction_process_start(comp); + ftl_add_io_activity(dev); } ftl_chunk_persist_free_state(nv_cache); diff --git a/lib/ftl/ftl_reloc.c b/lib/ftl/ftl_reloc.c index 894f32a2c..9dfbe0380 100644 --- a/lib/ftl/ftl_reloc.c +++ b/lib/ftl/ftl_reloc.c @@ -568,6 +568,7 @@ move_run(struct ftl_reloc *reloc, struct ftl_reloc_move *mv) case FTL_RELOC_STATE_PIN: move_pin(mv); + ftl_add_io_activity(reloc->dev); break; case FTL_RELOC_STATE_WRITE: @@ -577,6 +578,7 @@ move_run(struct ftl_reloc *reloc, struct ftl_reloc_move *mv) break; } + ftl_add_io_activity(reloc->dev); move_write(reloc, mv); break;