nvme: add function to get ZNS max active zones
Add a function to get the number of max active zones for a zoned namespace. The value inside the identify namespace struct is a 0's based value, where 0xffffffff means unlimited. If unlimited, the addition will overflow and return 0, which is the intended value to represent unlimited for this API. Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com> Change-Id: Ia09e3db157ca0afadbd3ca4032eedd7bcd88248c Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6443 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: sunshihao <sunshihao@huawei.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
parent
bb5330c06d
commit
9d79d27e49
@ -113,6 +113,23 @@ uint64_t spdk_nvme_zns_ns_get_num_zones(struct spdk_nvme_ns *ns);
|
||||
*/
|
||||
uint32_t spdk_nvme_zns_ns_get_max_open_zones(struct spdk_nvme_ns *ns);
|
||||
|
||||
/**
|
||||
* Get the maximum number of active zones for the given namespace.
|
||||
*
|
||||
* An active zone is a zone in any of the zone states:
|
||||
* EXPLICIT OPEN, IMPLICIT OPEN or CLOSED.
|
||||
*
|
||||
* If this value is 0, there is no limit.
|
||||
*
|
||||
* This function is thread safe and can be called at any point while the controller
|
||||
* is attached to the SPDK NVMe driver.
|
||||
*
|
||||
* \param ns Namespace to query.
|
||||
*
|
||||
* \return the maximum number of active zones.
|
||||
*/
|
||||
uint32_t spdk_nvme_zns_ns_get_max_active_zones(struct spdk_nvme_ns *ns);
|
||||
|
||||
/**
|
||||
* Get the Zoned Namespace Command Set Specific Identify Controller data
|
||||
* as defined by the NVMe Zoned Namespace Command Set Specification.
|
||||
|
@ -68,6 +68,14 @@ spdk_nvme_zns_ns_get_max_open_zones(struct spdk_nvme_ns *ns)
|
||||
return nsdata_zns->mor + 1;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
spdk_nvme_zns_ns_get_max_active_zones(struct spdk_nvme_ns *ns)
|
||||
{
|
||||
const struct spdk_nvme_zns_ns_data *nsdata_zns = spdk_nvme_zns_ns_get_data(ns);
|
||||
|
||||
return nsdata_zns->mar + 1;
|
||||
}
|
||||
|
||||
const struct spdk_nvme_zns_ctrlr_data *
|
||||
spdk_nvme_zns_ctrlr_get_data(struct spdk_nvme_ctrlr *ctrlr)
|
||||
{
|
||||
|
@ -174,6 +174,7 @@
|
||||
spdk_nvme_zns_ns_get_zone_size;
|
||||
spdk_nvme_zns_ns_get_num_zones;
|
||||
spdk_nvme_zns_ns_get_max_open_zones;
|
||||
spdk_nvme_zns_ns_get_max_active_zones;
|
||||
spdk_nvme_zns_ctrlr_get_data;
|
||||
spdk_nvme_zns_ctrlr_get_max_zone_append_size;
|
||||
spdk_nvme_zns_zone_append;
|
||||
|
Loading…
Reference in New Issue
Block a user