From: jsmart2021@gmail.com (James Smart)
Subject: [PATCH rfc 2/6] nvme-cli: support persistent connections to a discovery controller
Date: Wed, 10 Jul 2019 16:27:36 -0700 [thread overview]
Message-ID: <20190710232740.26734-3-jsmart2021@gmail.com> (raw)
In-Reply-To: <20190710232740.26734-1-jsmart2021@gmail.com>
From: Sagi Grimberg <sagi@grimberg.me>
Simply don't destroy the discovery controller after getting the
log pages. Note that persistent connection to a discovery subsystem
require to pass in a non-zero kato value, so if not provided we
simply use a default of 30 seconds kato.
Example:
nvme connect-all ... --persistent
Signed-off-by: Sagi Grimberg <sagi at grimberg.me>
Reviewed-by: James Smart <jsmart2021 at gmail.com>
Reviewed-by: Hannes Reinecke <hare at suse.com>
Reviewed-by: Max Gurtovoy <maxg at mellanox.com>
---
resolved merge error
---
fabrics.c | 15 ++++++++++++---
fabrics.h | 2 ++
2 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/fabrics.c b/fabrics.c
index cc91d00..c4bbe2c 100644
--- a/fabrics.c
+++ b/fabrics.c
@@ -65,6 +65,7 @@ static struct config {
int disable_sqflow;
int hdr_digest;
int data_digest;
+ bool persistent;
} cfg = { NULL };
#define BUF_SIZE 4096
@@ -858,9 +859,11 @@ static int do_discover(char *argstr, bool connect)
return -errno;
ret = nvmf_get_log_page_discovery(dev_name, &log, &numrec);
free(dev_name);
- err = remove_ctrl(instance);
- if (err)
- return err;
+ if (!cfg.persistent) {
+ err = remove_ctrl(instance);
+ if (err)
+ return err;
+ }
switch (ret) {
case DISC_OK:
@@ -936,6 +939,9 @@ static int discover_from_conf_file(const char *desc, char *argstr,
if (err)
continue;
+ if (cfg.persistent && !cfg.keep_alive_tmo)
+ cfg.keep_alive_tmo = NVMF_DEF_DISC_TMO;
+
err = build_options(argstr, BUF_SIZE);
if (err) {
ret = err;
@@ -978,6 +984,7 @@ int discover(const char *desc, int argc, char **argv, bool connect)
{"nr-write-queues", 'W', "LIST", CFG_INT, &cfg.nr_write_queues, required_argument, "number of write queues to use (default 0)" },
{"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" },
{NULL},
};
@@ -992,6 +999,8 @@ int discover(const char *desc, int argc, char **argv, bool connect)
return discover_from_conf_file(desc, argstr,
command_line_options, connect);
} else {
+ if (cfg.persistent && !cfg.keep_alive_tmo)
+ cfg.keep_alive_tmo = NVMF_DEF_DISC_TMO;
ret = build_options(argstr, BUF_SIZE);
if (ret)
return ret;
diff --git a/fabrics.h b/fabrics.h
index 988f3ef..7c1664b 100644
--- a/fabrics.h
+++ b/fabrics.h
@@ -1,6 +1,8 @@
#ifndef _DISCOVER_H
#define _DISCOVER_H
+#define NVMF_DEF_DISC_TMO 30
+
extern int discover(const char *desc, int argc, char **argv, bool connect);
extern int connect(const char *desc, int argc, char **argv);
extern int disconnect(const char *desc, int argc, char **argv);
--
2.13.7
next prev parent reply other threads:[~2019-07-10 23:27 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-10 23:27 [PATCH rfc 0/6] nvme-cli: nvmf auto-connect scripts James Smart
2019-07-10 23:27 ` [PATCH rfc 1/6] nvme-cli: ignore arguments that pass in "none" James Smart
2019-07-11 12:28 ` Minwoo Im
2019-07-10 23:27 ` James Smart [this message]
2019-07-11 12:33 ` [PATCH rfc 2/6] nvme-cli: support persistent connections to a discovery controller Minwoo Im
2019-07-10 23:27 ` [PATCH rfc 3/6] nvme-cli: allow discover to address discovery controller by persistent name James Smart
2019-07-11 12:41 ` Minwoo Im
2019-07-11 16:16 ` James Smart
2019-07-11 17:11 ` Minwoo Im
2019-07-10 23:27 ` [PATCH rfc 4/6] nvme-cli: expand --device argument processing James Smart
2019-07-11 0:43 ` Sagi Grimberg
2019-07-11 23:54 ` Sagi Grimberg
2019-07-10 23:27 ` [PATCH rfc 5/6] nvme-cli: add --quiet option James Smart
2019-07-11 12:53 ` Minwoo Im
2019-07-10 23:27 ` [PATCH rfc 6/6] nvme-cli: nvmf auto-connect scripts James Smart
2019-07-11 0:42 ` Sagi Grimberg
2019-07-11 16:18 ` James Smart
2019-07-11 23:47 ` 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=20190710232740.26734-3-jsmart2021@gmail.com \
--to=jsmart2021@gmail.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