Linux Device Mapper development
 help / color / mirror / Atom feed
From: Martin Wilck <mwilck@suse.com>
To: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: dm-devel@redhat.com, Martin Wilck <mwilck@suse.com>
Subject: [PATCH 2/5] libmultipath: nvme: shorter topology output
Date: Fri, 14 Sep 2018 14:51:00 +0200	[thread overview]
Message-ID: <20180914125103.1154-2-mwilck@suse.com> (raw)
In-Reply-To: <20180914125103.1154-1-mwilck@suse.com>

The nvme foreign code maps the NVMe subsys NQN to the "%n"
wildcard ("alias"). Some real-world devices use very lengthy
expressions for the subsys NQN (counted 95 characters on one
system here), making the "multipath -ll" output hardly readable
for humans. Use a shorter and more concise printout instead,
based on the WWID only.

The subsys NQN is still available via the "%n" wildcard:
"multipathd show maps format %n".

Signed-off-by: Martin Wilck <mwilck@suse.com>
---
 libmultipath/foreign/nvme.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/libmultipath/foreign/nvme.c b/libmultipath/foreign/nvme.c
index fca3235f..8887a755 100644
--- a/libmultipath/foreign/nvme.c
+++ b/libmultipath/foreign/nvme.c
@@ -286,10 +286,18 @@ static int snprint_nvme_path(const struct gen_path *gp,
 	return 0;
 }
 
+static int nvme_style(const struct gen_multipath* gm,
+		      char *buf, int len, int verbosity)
+{
+	int n = snprintf(buf, len, "%%w [%%G]:%%d %%s");
+
+	return (n < len ? n : len - 1);
+}
+
 static const struct gen_multipath_ops nvme_map_ops = {
 	.get_pathgroups = nvme_mp_get_pgs,
 	.rel_pathgroups = nvme_mp_rel_pgs,
-	.style = generic_style,
+	.style = nvme_style,
 	.snprint = snprint_nvme_map,
 };
 
-- 
2.18.0

  reply	other threads:[~2018-09-14 12:51 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-14 12:50 [PATCH 1/5] libmultipath: nvme: fix path detection for kernel 4.16 Martin Wilck
2018-09-14 12:51 ` Martin Wilck [this message]
2018-09-21 22:51   ` [PATCH 2/5] libmultipath: nvme: shorter topology output Benjamin Marzinski
2018-09-14 12:51 ` [PATCH 3/5] libmultipath: pathinfo: skip hidden devices Martin Wilck
2018-09-21 22:52   ` Benjamin Marzinski
2018-09-14 12:51 ` [PATCH 4/5] multipathd: fix version check for DM_DEV_ARM_POLL ioctl Martin Wilck
2018-09-21 22:52   ` Benjamin Marzinski
2018-09-14 12:51 ` [PATCH 5/5] multipathd: decrease log level of uevent messages Martin Wilck
2018-09-21 23:00   ` Benjamin Marzinski
2018-09-21 22:51 ` [PATCH 1/5] libmultipath: nvme: fix path detection for kernel 4.16 Benjamin Marzinski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180914125103.1154-2-mwilck@suse.com \
    --to=mwilck@suse.com \
    --cc=christophe.varoqui@opensvc.com \
    --cc=dm-devel@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox