From 149511c1a01462a9957245645f470d49ea3f3c43 Mon Sep 17 00:00:00 2001 From: Wojciech Malikowski Date: Thu, 30 Jan 2020 05:53:21 -0500 Subject: [PATCH] lib/ftl: Set zone state to "full" when all writes to it are completed Zone state should be changed to "full" when zone is fully written. Change-Id: Ib9ad29d1a0e788fba8a7eae881e07d384fa90548 Signed-off-by: Wojciech Malikowski Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/554 Tested-by: SPDK CI Jenkins Reviewed-by: Konrad Sztyber Reviewed-by: Jim Harris Reviewed-by: Shuhei Matsumoto --- lib/ftl/ftl_band.c | 4 ---- lib/ftl/ftl_core.c | 4 ++++ 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/ftl/ftl_band.c b/lib/ftl/ftl_band.c index 74a98d3b6..20c8e5b56 100644 --- a/lib/ftl/ftl_band.c +++ b/lib/ftl/ftl_band.c @@ -224,7 +224,6 @@ static void _ftl_band_set_closed(struct ftl_band *band) { struct spdk_ftl_dev *dev = band->dev; - struct ftl_zone *zone; /* Set the state as free_md() checks for that */ band->state = FTL_BAND_STATE_CLOSED; @@ -234,9 +233,6 @@ _ftl_band_set_closed(struct ftl_band *band) if (spdk_likely(band->num_zones)) { LIST_INSERT_HEAD(&dev->shut_bands, band, list_entry); - CIRCLEQ_FOREACH(zone, &band->zones, circleq) { - zone->info.state = SPDK_BDEV_ZONE_STATE_FULL; - } } else { LIST_REMOVE(band, list_entry); } diff --git a/lib/ftl/ftl_core.c b/lib/ftl/ftl_core.c index 59ce113c4..a00d20171 100644 --- a/lib/ftl/ftl_core.c +++ b/lib/ftl/ftl_core.c @@ -1562,6 +1562,10 @@ ftl_io_child_write_cb(struct ftl_io *io, void *ctx, int status) zone->busy = false; zone->info.write_pointer += io->num_blocks; + if (zone->info.write_pointer == zone->info.capacity) { + zone->info.state = SPDK_BDEV_ZONE_STATE_FULL; + } + /* If some other write on the same band failed the write pointer would already be freed */ if (spdk_likely(wptr)) { wptr->num_outstanding--;