From: Ming Lin <minggr at gmail.com>
To: spdk@lists.01.org
Subject: [SPDK] [RFC PATCH 3/4] Add ScanTarget to optimize spdk app start time
Date: Thu, 10 May 2018 20:25:53 -0700 [thread overview]
Message-ID: <1526009154-5492-4-git-send-email-minggr@gmail.com> (raw)
In-Reply-To: 1526009154-5492-1-git-send-email-minggr@gmail.com
[-- Attachment #1: Type: text/plain, Size: 2732 bytes --]
From: Ming Lin <ming.lin(a)alibaba-inc.com>
For example,
[VirtioUser0]
Path /var/run/vhost.nvme0
Queues 3
Name nvme0
ScanTarget 0
"ScanTarget 0" tells virtio scsi only scans vhost target 0.
If not specified, will do a full scan.
Signed-off-by: Ming Lin <ming.lin(a)alibaba-inc.com>
---
lib/bdev/virtio/bdev_virtio_scsi.c | 29 +++++++++++++++++++++++------
1 file changed, 23 insertions(+), 6 deletions(-)
diff --git a/lib/bdev/virtio/bdev_virtio_scsi.c b/lib/bdev/virtio/bdev_virtio_scsi.c
index 0602597..e677a50 100644
--- a/lib/bdev/virtio/bdev_virtio_scsi.c
+++ b/lib/bdev/virtio/bdev_virtio_scsi.c
@@ -97,6 +97,8 @@ struct virtio_scsi_dev {
/** protect reconnect process */
pthread_mutex_t reconn_mutex;
+
+ int scan_target;
};
struct virtio_scsi_io_ctx {
@@ -351,6 +353,8 @@ virtio_user_scsi_dev_create(const char *name, const char *path,
return NULL;
}
+ svdev->scan_target = -1;
+
vdev = &svdev->vdev;
rc = virtio_user_dev_init(vdev, name, path, queue_size);
if (rc != 0) {
@@ -869,8 +873,13 @@ bdev_virtio_poll(void *arg)
if (scan_ctx->restart) {
scan_ctx->restart = false;
- scan_ctx->full_scan = true;
- _virtio_scsi_dev_scan_tgt(scan_ctx, 0);
+ if (svdev->scan_target == -1) {
+ scan_ctx->full_scan = true;
+ _virtio_scsi_dev_scan_tgt(scan_ctx, 0);
+ } else {
+ scan_ctx->full_scan = false;
+ _virtio_scsi_dev_scan_tgt(scan_ctx, svdev->scan_target);
+ }
continue;
}
@@ -1588,6 +1597,7 @@ bdev_virtio_process_config(void)
char *path, *name;
unsigned vdev_num;
int num_queues;
+ int scan_target;
bool enable_pci;
int rc = 0;
@@ -1629,6 +1639,9 @@ bdev_virtio_process_config(void)
rc = -1;
goto out;
}
+
+ scan_target = spdk_conf_section_get_intval(sp, "ScanTarget");
+ svdev->scan_target = scan_target;
}
sp = spdk_conf_find_section(NULL, "VirtioPci");
@@ -1734,9 +1747,13 @@ virtio_scsi_dev_scan(struct virtio_scsi_dev *svdev, bdev_virtio_create_cb cb_fn,
base = svdev->scan_ctx;
base->cb_fn = cb_fn;
base->cb_arg = cb_arg;
- base->full_scan = true;
-
- _virtio_scsi_dev_scan_tgt(base, 0);
+ if (svdev->scan_target == -1) {
+ base->full_scan = true;
+ _virtio_scsi_dev_scan_tgt(base, 0);
+ } else {
+ base->full_scan = false;
+ _virtio_scsi_dev_scan_tgt(base, svdev->scan_target);
+ }
return 0;
}
@@ -1766,7 +1783,7 @@ virtio_scsi_dev_scan_tgt(struct virtio_scsi_dev *svdev, uint8_t target)
}
base = svdev->scan_ctx;
- base->full_scan = true;
+ base->full_scan = (svdev->scan_target == -1) ? true : false;
_virtio_scsi_dev_scan_tgt(base, target);
return 0;
}
--
1.9.1
reply other threads:[~2018-05-11 3:25 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1526009154-5492-4-git-send-email-minggr@gmail.com \
--to=spdk@lists.01.org \
/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