nvme/hello_world: don't print message for inactive namespaces
Some SSDs have inactive namespaces under normal circumstances, especially those that support namespace management. Printing error messages for these can be confusing to users. So just remove that log message. This removes the only usage of cdata in register_ns(). But that cdata assignment was prefaced with a useful comment for readers of this example code. So move that comment to attach_cb() and restructure the code there a little bit. Signed-off-by: Jim Harris <james.r.harris@intel.com> Change-Id: I844e860ea0856d73ca535b6fcbd14279b96da4f1 Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/466797 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-by: Tom Nabarro <tom.nabarro@intel.com>
This commit is contained in:
parent
d71cfefcba
commit
760ecb0a6f
@ -59,22 +59,8 @@ static void
|
||||
register_ns(struct spdk_nvme_ctrlr *ctrlr, struct spdk_nvme_ns *ns)
|
||||
{
|
||||
struct ns_entry *entry;
|
||||
const struct spdk_nvme_ctrlr_data *cdata;
|
||||
|
||||
/*
|
||||
* spdk_nvme_ctrlr is the logical abstraction in SPDK for an NVMe
|
||||
* controller. During initialization, the IDENTIFY data for the
|
||||
* controller is read using an NVMe admin command, and that data
|
||||
* can be retrieved using spdk_nvme_ctrlr_get_data() to get
|
||||
* detailed information on the controller. Refer to the NVMe
|
||||
* specification for more details on IDENTIFY for NVMe controllers.
|
||||
*/
|
||||
cdata = spdk_nvme_ctrlr_get_data(ctrlr);
|
||||
|
||||
if (!spdk_nvme_ns_is_active(ns)) {
|
||||
printf("Controller %-20.20s (%-20.20s): Skipping inactive NS %u\n",
|
||||
cdata->mn, cdata->sn,
|
||||
spdk_nvme_ns_get_id(ns));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -292,7 +278,7 @@ attach_cb(void *cb_ctx, const struct spdk_nvme_transport_id *trid,
|
||||
int nsid, num_ns;
|
||||
struct ctrlr_entry *entry;
|
||||
struct spdk_nvme_ns *ns;
|
||||
const struct spdk_nvme_ctrlr_data *cdata = spdk_nvme_ctrlr_get_data(ctrlr);
|
||||
const struct spdk_nvme_ctrlr_data *cdata;
|
||||
|
||||
entry = malloc(sizeof(struct ctrlr_entry));
|
||||
if (entry == NULL) {
|
||||
@ -302,6 +288,16 @@ attach_cb(void *cb_ctx, const struct spdk_nvme_transport_id *trid,
|
||||
|
||||
printf("Attached to %s\n", trid->traddr);
|
||||
|
||||
/*
|
||||
* spdk_nvme_ctrlr is the logical abstraction in SPDK for an NVMe
|
||||
* controller. During initialization, the IDENTIFY data for the
|
||||
* controller is read using an NVMe admin command, and that data
|
||||
* can be retrieved using spdk_nvme_ctrlr_get_data() to get
|
||||
* detailed information on the controller. Refer to the NVMe
|
||||
* specification for more details on IDENTIFY for NVMe controllers.
|
||||
*/
|
||||
cdata = spdk_nvme_ctrlr_get_data(ctrlr);
|
||||
|
||||
snprintf(entry->name, sizeof(entry->name), "%-20.20s (%-20.20s)", cdata->mn, cdata->sn);
|
||||
|
||||
entry->ctrlr = ctrlr;
|
||||
|
Loading…
x
Reference in New Issue
Block a user