bdev/zone: add zone state explicit open

Add a new zone state to represent an explicit open zone.

Many zoned specifications like ZBC/ZAC/ZNS have two different
zone states to represent an open zone: explicit open and
implicit open.

In e.g. ZNS, a zone is transitioned to explicit open when a
Zone Management Send is sent with a zone send action of open zone.

In ZNS, writing to e.g. an empty or closed zone, without first
sending a zone send action of open zone, will instead transition
the zone to implicit open.

The OCSSD specification only has a single open zone state.
In OCSSD, you can only transition to the open state by doing a write.
There is no separate function call to transition a zone to the open
state. Therefore, the OCSSD open state is most similar to the ZNS
implicit open state.

Since we cannot remove the SPDK_BDEV_ZONE_STATE_OPEN identifier,
for backwards compatibility reasons, make the SPDK_BDEV_ZONE_STATE_OPEN
identifier an alias to the new SPDK_BDEV_ZONE_STATE_IMP_OPEN identifier.

Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Change-Id: I98f3a280cd9e595100155568a3c0332c667a834b
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6907
Community-CI: Broadcom CI
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: Changpeng Liu <changpeng.liu@intel.com>
This commit is contained in:
Niklas Cassel 2021-03-11 16:30:21 +00:00 committed by Tomasz Zawadzki
parent 409cc6ecbc
commit 82d797af1a

View File

@ -58,11 +58,14 @@ enum spdk_bdev_zone_action {
enum spdk_bdev_zone_state {
SPDK_BDEV_ZONE_STATE_EMPTY = 0x0,
SPDK_BDEV_ZONE_STATE_OPEN = 0x1,
SPDK_BDEV_ZONE_STATE_IMP_OPEN = 0x1,
/* OPEN is an alias for IMP_OPEN. OPEN is kept for backwards compatibility. */
SPDK_BDEV_ZONE_STATE_OPEN = SPDK_BDEV_ZONE_STATE_IMP_OPEN,
SPDK_BDEV_ZONE_STATE_FULL = 0x2,
SPDK_BDEV_ZONE_STATE_CLOSED = 0x3,
SPDK_BDEV_ZONE_STATE_READ_ONLY = 0x4,
SPDK_BDEV_ZONE_STATE_OFFLINE = 0x5,
SPDK_BDEV_ZONE_STATE_EXP_OPEN = 0x6,
};
struct spdk_bdev_zone_info {
@ -83,6 +86,9 @@ uint64_t spdk_bdev_get_zone_size(const struct spdk_bdev *bdev);
/**
* Get device maximum number of open zones.
*
* An open zone is defined as a zone being in zone state
* SPDK_BDEV_ZONE_STATE_IMP_OPEN or SPDK_BDEV_ZONE_STATE_EXP_OPEN.
*
* If this value is 0, there is no limit.
*
* \param bdev Block device to query.