hw/block/nvme: rename __nvme_zrm_open

Get rid of the (reserved) double underscore use. Rename the "generic"
zone open function to nvme_zrm_open_flags() and add a generic `int
flags` argument instead which allows more flags to be easily added in
the future. There is at least one TP under standardization that would
add an additional flag.

Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
Cc: Thomas Huth <thuth@redhat.com>
Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Keith Busch <kbusch@kernel.org>
This commit is contained in:
Klaus Jensen 2021-04-15 08:37:36 +02:00
parent 312c3531bb
commit c6dfa9d6b4
1 changed files with 10 additions and 6 deletions

View File

@ -1694,8 +1694,12 @@ static void nvme_zrm_auto_transition_zone(NvmeNamespace *ns)
}
}
static uint16_t __nvme_zrm_open(NvmeNamespace *ns, NvmeZone *zone,
bool implicit)
enum {
NVME_ZRM_AUTO = 1 << 0,
};
static uint16_t nvme_zrm_open_flags(NvmeNamespace *ns, NvmeZone *zone,
int flags)
{
int act = 0;
uint16_t status;
@ -1719,7 +1723,7 @@ static uint16_t __nvme_zrm_open(NvmeNamespace *ns, NvmeZone *zone,
nvme_aor_inc_open(ns);
if (implicit) {
if (flags & NVME_ZRM_AUTO) {
nvme_assign_zone_state(ns, zone, NVME_ZONE_STATE_IMPLICITLY_OPEN);
return NVME_SUCCESS;
}
@ -1727,7 +1731,7 @@ static uint16_t __nvme_zrm_open(NvmeNamespace *ns, NvmeZone *zone,
/* fallthrough */
case NVME_ZONE_STATE_IMPLICITLY_OPEN:
if (implicit) {
if (flags & NVME_ZRM_AUTO) {
return NVME_SUCCESS;
}
@ -1745,12 +1749,12 @@ static uint16_t __nvme_zrm_open(NvmeNamespace *ns, NvmeZone *zone,
static inline uint16_t nvme_zrm_auto(NvmeNamespace *ns, NvmeZone *zone)
{
return __nvme_zrm_open(ns, zone, true);
return nvme_zrm_open_flags(ns, zone, NVME_ZRM_AUTO);
}
static inline uint16_t nvme_zrm_open(NvmeNamespace *ns, NvmeZone *zone)
{
return __nvme_zrm_open(ns, zone, false);
return nvme_zrm_open_flags(ns, zone, 0);
}
static void __nvme_advance_zone_wp(NvmeNamespace *ns, NvmeZone *zone,