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 <wojciech.malikowski@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/554
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
Wojciech Malikowski 2020-01-30 05:53:21 -05:00 committed by Tomasz Zawadzki
parent 97f3ad2d8b
commit 149511c1a0
2 changed files with 4 additions and 4 deletions

View File

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

View File

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