All of lore.kernel.org
 help / color / mirror / Atom feed
From: sagi@grimberg.me (Sagi Grimberg)
Subject: [PATCH nvme-cli rfc 4/6] fabrics: add --quiet option
Date: Fri, 22 Feb 2019 18:32:55 -0800	[thread overview]
Message-ID: <20190223023257.21227-5-sagi@grimberg.me> (raw)
In-Reply-To: <20190223023257.21227-1-sagi@grimberg.me>

Now we are going to have discovery log change events, so
instead of trying to figure out which NVM subsystem ports
are already connected, we let the driver do that and
only suppress the failure messages.

This option will be used by the discovery log change corresponding
udev rule.

Signed-off-by: Sagi Grimberg <sagi at grimberg.me>
---
 fabrics.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/fabrics.c b/fabrics.c
index 702f928cd8ed..f08fe3f9a0be 100644
--- a/fabrics.c
+++ b/fabrics.c
@@ -66,6 +66,7 @@ static struct config {
 	int  hdr_digest;
 	int  data_digest;
 	bool persistent;
+	bool quiet;
 } cfg = { NULL };
 
 #define BUF_SIZE		4096
@@ -216,9 +217,11 @@ static int add_ctrl(const char *argstr)
 		goto out;
 	}
 
-	if (write(fd, argstr, len) != len) {
-		fprintf(stderr, "Failed to write to %s: %s\n",
-			 PATH_NVME_FABRICS, strerror(errno));
+	ret = write(fd, argstr, len);
+	if (ret != len) {
+		if (errno != EALREADY || !cfg.quiet)
+			fprintf(stderr, "Failed to write to %s: %s\n",
+				 PATH_NVME_FABRICS, strerror(errno));
 		ret = -errno;
 		goto out_close;
 	}
@@ -840,6 +843,10 @@ static int connect_ctrls(struct nvmf_disc_rsp_page_hdr *log, int numrec)
 		/* already connected print message	*/
 		if (instance == -EALREADY) {
 			const char *traddr = log->entries[i].traddr;
+
+			if (cfg.quiet)
+				continue;
+
 			fprintf(stderr,
 				"traddr=%.*s is already connected\n",
 				space_strip_len(NVMF_TRADDR_SIZE, traddr),
@@ -996,6 +1003,7 @@ int discover(const char *desc, int argc, char **argv, bool connect)
 		{"nr-poll-queues",  'P', "LIST", CFG_INT, &cfg.nr_poll_queues,    required_argument, "number of poll queues to use (default 0)" },
 		{"queue-size",      'Q', "LIST", CFG_INT, &cfg.queue_size,      required_argument, "number of io queue elements to use (default 128)" },
 		{"persistent",  'p', "LIST", CFG_NONE, &cfg.persistent,  no_argument, "persistent discovery connection" },
+		{"quiet",       'Q', "LIST", CFG_NONE, &cfg.quiet,  no_argument, "suppress already connected errors" },
 		{NULL},
 	};
 
-- 
2.17.1

  parent reply	other threads:[~2019-02-23  2:32 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-23  2:32 [PATCH nvme-cli rfc 0/6] Support discovery log change events Sagi Grimberg
2019-02-23  2:32 ` [PATCH nvme-cli rfc 1/6] fabrics: ignore arguments that pass in "none" Sagi Grimberg
2019-05-07  9:17   ` Max Gurtovoy
2019-05-07 17:04     ` James Smart
2019-02-23  2:32 ` [PATCH nvme-cli rfc 2/6] fabrics: support persistent connections to a discovery controller Sagi Grimberg
2019-05-07  9:22   ` Max Gurtovoy
2019-02-23  2:32 ` [PATCH nvme-cli rfc 3/6] fabrics: allow user to retrieve discovery log from existing " Sagi Grimberg
2019-05-07  9:27   ` Max Gurtovoy
2019-02-23  2:32 ` Sagi Grimberg [this message]
2019-05-07  9:35   ` [PATCH nvme-cli rfc 4/6] fabrics: add --quiet option Max Gurtovoy
2019-05-07 17:12     ` James Smart
2019-05-07 18:54       ` Max Gurtovoy
2019-02-23  2:32 ` [PATCH nvme-cli rfc 5/6] fabrics: systemd and udev support for automatic discovery log changes Sagi Grimberg
2019-02-23  2:32 ` [PATCH nvme-cli rfc 6/6] fc: add autoconnect systemd service and udev rule for fc " Sagi Grimberg
2019-02-24 17:17 ` [PATCH nvme-cli rfc 0/6] Support discovery log change events Hannes Reinecke
2019-02-24 22:33   ` Sagi Grimberg
2019-03-09  2:18     ` Sagi Grimberg
2019-03-13 21:04     ` James Smart
2019-03-14  0:00       ` Sagi Grimberg
2019-03-14 20:43         ` James Smart
2019-03-14 20:50           ` James Smart
2019-03-15 12:40             ` Hannes Reinecke
2019-03-15 20:38               ` Sagi Grimberg
2019-04-25 19:10                 ` Sagi Grimberg
2019-04-26 14:19                   ` Hannes Reinecke
2019-04-26 15:46                     ` Sagi Grimberg
2019-04-26 16:17                       ` James Smart
2019-04-26 19:10                         ` Sagi Grimberg
2019-04-26 20:14                           ` James Smart
2019-05-06 22:38                             ` Arun Easi
2019-05-07 16:47                               ` James Smart
2019-04-27 11:05                           ` Hannes Reinecke
2019-04-27 10:53                       ` Hannes Reinecke
2019-03-14 21:41           ` Sagi Grimberg

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=20190223023257.21227-5-sagi@grimberg.me \
    --to=sagi@grimberg.me \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.