lib/ftl: Set write pointer for zone in full state during initialization

Zone in full state should have write pointer set to
the last block plus one to be consistent with internal
ftl write pointer tracking.

Change-Id: Ib81124e7a8451f8daec82d3d41dc55f6ed328ba2
Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1437
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
This commit is contained in:
Wojciech Malikowski 2020-03-24 07:02:34 -04:00 committed by Tomasz Zawadzki
parent 9da404699e
commit ead6c54c75

View File

@ -923,6 +923,11 @@ ftl_dev_get_zone_info_cb(struct spdk_bdev_io *bdev_io, bool success, void *cb_ar
"zone id: %"PRIu64"\n", init_ctx->zone_id);
}
/* Set write pointer to the last block plus one for zone in full state */
if (zone->info.state == SPDK_BDEV_ZONE_STATE_FULL) {
zone->info.write_pointer = zone->info.zone_id + zone->info.capacity;
}
if (zone->info.state != SPDK_BDEV_ZONE_STATE_OFFLINE) {
band->num_zones++;
CIRCLEQ_INSERT_TAIL(&band->zones, zone, circleq);