bdev/zone: add support for max active zones
The NVMe Zoned Namespace Command Set Specification has, in addition to a Max Open Resources limit, a Max Active Resources limit. An active resource is defined as zone being in zone state implicit open, explicit open, or closed. Create a function spdk_bdev_get_max_active_zones() in the generic SPDK zone layer, so that this limit can be exposed to the user. Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com> Change-Id: I6f61fc45e1dc38689dc54d5649c35fa9b91dbdfc Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6908 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:
parent
82d797af1a
commit
ee4868de68
@ -366,6 +366,11 @@ struct spdk_bdev {
|
||||
*/
|
||||
uint32_t max_open_zones;
|
||||
|
||||
/**
|
||||
* Maximum number of active zones.
|
||||
*/
|
||||
uint32_t max_active_zones;
|
||||
|
||||
/**
|
||||
* Optimal number of open zones.
|
||||
*/
|
||||
|
@ -96,6 +96,20 @@ uint64_t spdk_bdev_get_zone_size(const struct spdk_bdev *bdev);
|
||||
*/
|
||||
uint32_t spdk_bdev_get_max_open_zones(const struct spdk_bdev *bdev);
|
||||
|
||||
/**
|
||||
* Get device maximum number of active zones.
|
||||
*
|
||||
* An active zone is defined as a zone being in zone state
|
||||
* SPDK_BDEV_ZONE_STATE_IMP_OPEN, SPDK_BDEV_ZONE_STATE_EXP_OPEN or
|
||||
* SPDK_BDEV_ZONE_STATE_CLOSED.
|
||||
*
|
||||
* If this value is 0, there is no limit.
|
||||
*
|
||||
* \param bdev Block device to query.
|
||||
* \return Maximum number of active zones for this zoned device.
|
||||
*/
|
||||
uint32_t spdk_bdev_get_max_active_zones(const struct spdk_bdev *bdev);
|
||||
|
||||
/**
|
||||
* Get device optimal number of open zones.
|
||||
*
|
||||
|
@ -50,6 +50,12 @@ spdk_bdev_get_max_open_zones(const struct spdk_bdev *bdev)
|
||||
return bdev->max_open_zones;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
spdk_bdev_get_max_active_zones(const struct spdk_bdev *bdev)
|
||||
{
|
||||
return bdev->max_active_zones;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
spdk_bdev_get_optimal_open_zones(const struct spdk_bdev *bdev)
|
||||
{
|
||||
|
@ -144,6 +144,7 @@
|
||||
# Public functions in bdev_zone.h
|
||||
spdk_bdev_get_zone_size;
|
||||
spdk_bdev_get_max_open_zones;
|
||||
spdk_bdev_get_max_active_zones;
|
||||
spdk_bdev_get_optimal_open_zones;
|
||||
spdk_bdev_get_zone_info;
|
||||
spdk_bdev_zone_management;
|
||||
|
@ -266,6 +266,18 @@ test_get_max_open_zones(void)
|
||||
CU_ASSERT(get_max_open_zones == 8192);
|
||||
}
|
||||
|
||||
static void
|
||||
test_get_max_active_zones(void)
|
||||
{
|
||||
struct spdk_bdev bdev = {};
|
||||
uint32_t get_max_active_zones;
|
||||
|
||||
bdev.max_active_zones = 9216;
|
||||
|
||||
get_max_active_zones = spdk_bdev_get_max_active_zones(&bdev);
|
||||
CU_ASSERT(get_max_active_zones == 9216);
|
||||
}
|
||||
|
||||
static void
|
||||
test_get_optimal_open_zones(void)
|
||||
{
|
||||
@ -295,6 +307,7 @@ test_zone_get_operation(void)
|
||||
{
|
||||
test_get_zone_size();
|
||||
test_get_max_open_zones();
|
||||
test_get_max_active_zones();
|
||||
test_get_optimal_open_zones();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user