From 074cdb4d06f976fc26c3e0a59c8554b886acd918 Mon Sep 17 00:00:00 2001 From: Wojciech Malikowski Date: Fri, 17 Apr 2020 11:39:09 +0200 Subject: [PATCH] lib/ftl: Do not check busy flag when appending In append case checking if zone is not busy before submitting to it is unnecessary. This patch improves append performance. Signed-off-by: Wojciech Malikowski Change-Id: I42f3b31815aa10aed6b0374c2247f857683822f3 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1923 Tested-by: SPDK CI Jenkins Reviewed-by: Konrad Sztyber Reviewed-by: Jim Harris Reviewed-by: Shuhei Matsumoto --- lib/ftl/ftl_band.h | 8 +++++--- lib/ftl/ftl_core.c | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/ftl/ftl_band.h b/lib/ftl/ftl_band.h index a7f6e65e7..109b369a5 100644 --- a/lib/ftl/ftl_band.h +++ b/lib/ftl/ftl_band.h @@ -41,7 +41,7 @@ #include "ftl_io.h" #include "ftl_addr.h" -#include "ftl_io.h" +#include "ftl_core.h" /* Number of LBAs that could be stored in a single block */ #define FTL_NUM_LBA_IN_BLOCK (FTL_BLOCK_SIZE / sizeof(uint64_t)) @@ -275,11 +275,13 @@ ftl_band_zone_is_first(struct ftl_band *band, struct ftl_zone *zone) } static inline int -ftl_zone_is_writable(const struct ftl_zone *zone) +ftl_zone_is_writable(const struct spdk_ftl_dev *dev, const struct ftl_zone *zone) { + bool busy = ftl_is_append_supported(dev) ? false : zone->busy; + return (zone->info.state == SPDK_BDEV_ZONE_STATE_OPEN || zone->info.state == SPDK_BDEV_ZONE_STATE_EMPTY) && - !zone->busy; + !busy; } #endif /* FTL_BAND_H */ diff --git a/lib/ftl/ftl_core.c b/lib/ftl/ftl_core.c index b7deefd7d..69721f01a 100644 --- a/lib/ftl/ftl_core.c +++ b/lib/ftl/ftl_core.c @@ -820,7 +820,7 @@ ftl_wptr_ready(struct ftl_wptr *wptr) /* TODO: add handling of empty bands */ - if (spdk_unlikely(!ftl_zone_is_writable(wptr->zone))) { + if (spdk_unlikely(!ftl_zone_is_writable(wptr->dev, wptr->zone))) { /* Erasing band may fail after it was assigned to wptr. */ if (spdk_unlikely(wptr->zone->info.state == SPDK_BDEV_ZONE_STATE_OFFLINE)) { ftl_wptr_advance(wptr, wptr->dev->xfer_size);