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);