nvme: add function to get ZNS max open zones
Add a function to get the number of max open 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: I4223146bc1ddf90486892a0af5fe5ce006dc5fd3 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6442 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
74c43a7446
commit
bb5330c06d
@ -96,6 +96,23 @@ uint64_t spdk_nvme_zns_ns_get_zone_size(struct spdk_nvme_ns *ns);
|
||||
*/
|
||||
uint64_t spdk_nvme_zns_ns_get_num_zones(struct spdk_nvme_ns *ns);
|
||||
|
||||
/**
|
||||
* Get the maximum number of open zones for the given namespace.
|
||||
*
|
||||
* An open zone is a zone in any of the zone states:
|
||||
* EXPLICIT OPEN or IMPLICIT OPEN.
|
||||
*
|
||||
* 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 open zones.
|
||||
*/
|
||||
uint32_t spdk_nvme_zns_ns_get_max_open_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.
|
||||
|
@ -60,6 +60,14 @@ spdk_nvme_zns_ns_get_num_zones(struct spdk_nvme_ns *ns)
|
||||
return spdk_nvme_ns_get_num_sectors(ns) / spdk_nvme_zns_ns_get_zone_size_sectors(ns);
|
||||
}
|
||||
|
||||
uint32_t
|
||||
spdk_nvme_zns_ns_get_max_open_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->mor + 1;
|
||||
}
|
||||
|
||||
const struct spdk_nvme_zns_ctrlr_data *
|
||||
spdk_nvme_zns_ctrlr_get_data(struct spdk_nvme_ctrlr *ctrlr)
|
||||
{
|
||||
|
@ -173,6 +173,7 @@
|
||||
spdk_nvme_zns_ns_get_zone_size_sectors;
|
||||
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_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