bdev/zone_block: check for unmap support in zone reset

Sending the unmap in zone reset is optional (it's only a hint), so if
the base bdev doesn't support it, the reset is completed immediately.

Fixes #2064.

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: If2c57eadc20d352a71853d7023599503330e1252
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9154
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
This commit is contained in:
Konrad Sztyber 2021-08-11 10:59:19 +02:00 committed by Tomasz Zawadzki
parent 7abf75c2b5
commit aa51757648

View File

@ -292,6 +292,14 @@ zone_block_reset_zone(struct bdev_zone_block *bdev_node, struct zone_block_io_ch
zone->zone_info.state = SPDK_BDEV_ZONE_STATE_EMPTY;
zone->zone_info.write_pointer = zone->zone_info.zone_id;
pthread_spin_unlock(&zone->lock);
/* The unmap isn't necessary, so if the base bdev doesn't support it, we're done */
if (!spdk_bdev_io_type_supported(spdk_bdev_desc_get_bdev(bdev_node->base_desc),
SPDK_BDEV_IO_TYPE_UNMAP)) {
spdk_bdev_io_complete(bdev_io, SPDK_BDEV_IO_STATUS_SUCCESS);
return 0;
}
return spdk_bdev_unmap_blocks(bdev_node->base_desc, ch->base_ch,
zone->zone_info.zone_id, zone->zone_info.capacity,
_zone_block_complete_unmap, bdev_io);