bdev/nvme: Add ANA state per namespace into JSON info dump
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Change-Id: Idc0e783a2a4373a4269276aab8b1d857ed73caae Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7509 Reviewed-by: Paul Luse <paul.e.luse@intel.com> Reviewed-by: <dongx.yi@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com> Reviewed-by: Monica Kenguva <monica.kenguva@intel.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Community-CI: Mellanox Build Bot
This commit is contained in:
parent
8c2738a8fe
commit
924bfd067e
@ -1151,6 +1151,25 @@ bdev_nvme_get_module_ctx(void *ctx)
|
||||
return bdev_nvme_get_ctrlr(&nvme_bdev->disk);
|
||||
}
|
||||
|
||||
static const char *
|
||||
_nvme_ana_state_str(enum spdk_nvme_ana_state ana_state)
|
||||
{
|
||||
switch (ana_state) {
|
||||
case SPDK_NVME_ANA_OPTIMIZED_STATE:
|
||||
return "optimized";
|
||||
case SPDK_NVME_ANA_NON_OPTIMIZED_STATE:
|
||||
return "non_optimized";
|
||||
case SPDK_NVME_ANA_INACCESSIBLE_STATE:
|
||||
return "inaccessible";
|
||||
case SPDK_NVME_ANA_PERSISTENT_LOSS_STATE:
|
||||
return "persistent_loss";
|
||||
case SPDK_NVME_ANA_CHANGE_STATE:
|
||||
return "change";
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
bdev_nvme_dump_info_json(void *ctx, struct spdk_json_write_ctx *w)
|
||||
{
|
||||
@ -1250,6 +1269,11 @@ bdev_nvme_dump_info_json(void *ctx, struct spdk_json_write_ctx *w)
|
||||
|
||||
spdk_json_write_named_uint32(w, "id", spdk_nvme_ns_get_id(ns));
|
||||
|
||||
if (cdata->cmic.ana_reporting) {
|
||||
spdk_json_write_named_string(w, "ana_state",
|
||||
_nvme_ana_state_str(spdk_nvme_ns_get_ana_state(ns)));
|
||||
}
|
||||
|
||||
spdk_json_write_object_end(w);
|
||||
|
||||
if (cdata->oacs.security) {
|
||||
|
@ -127,6 +127,9 @@ DEFINE_STUB(spdk_nvme_ns_get_dealloc_logical_block_read_value,
|
||||
|
||||
DEFINE_STUB(spdk_nvme_ns_get_optimal_io_boundary, uint32_t, (struct spdk_nvme_ns *ns), 0);
|
||||
|
||||
DEFINE_STUB(spdk_nvme_ns_get_ana_state, enum spdk_nvme_ana_state,
|
||||
(const struct spdk_nvme_ns *ns), 0);
|
||||
|
||||
DEFINE_STUB(spdk_nvme_ns_get_csi, enum spdk_nvme_csi,
|
||||
(const struct spdk_nvme_ns *ns), 0);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user