svn commit: r303040 - in head/sys/dev: nvd nvme
Scott Long
scottl at FreeBSD.org
Tue Jul 19 19:09:25 UTC 2016
Author: scottl
Date: Tue Jul 19 19:09:23 2016
New Revision: 303040
URL: https://svnweb.freebsd.org/changeset/base/303040
Log:
Supporting flushing the dump before returning, and simplify/combine the
logic. Switch to a 5us delay since most NVME devices can easily do 200,000
iops.
Submitted by: imp
MFC after: 3 days
Sponsored by: Netflix, Inc.
Modified:
head/sys/dev/nvd/nvd.c
head/sys/dev/nvme/nvme_ns_cmd.c
Modified: head/sys/dev/nvd/nvd.c
==============================================================================
--- head/sys/dev/nvd/nvd.c Tue Jul 19 19:00:22 2016 (r303039)
+++ head/sys/dev/nvd/nvd.c Tue Jul 19 19:09:23 2016 (r303040)
@@ -237,14 +237,7 @@ nvd_dump(void *arg, void *virt, vm_offse
dp = arg;
ndisk = dp->d_drv1;
- if (len > 0) {
- if ((error = nvme_ns_dump(ndisk->ns, virt, offset, len)) != 0)
- return (error);
- } else {
- /* XXX sync to stable storage */
- }
-
- return (0);
+ return (nvme_ns_dump(ndisk->ns, virt, offset, len));
}
static void
Modified: head/sys/dev/nvme/nvme_ns_cmd.c
==============================================================================
--- head/sys/dev/nvme/nvme_ns_cmd.c Tue Jul 19 19:00:22 2016 (r303039)
+++ head/sys/dev/nvme/nvme_ns_cmd.c Tue Jul 19 19:09:23 2016 (r303040)
@@ -153,7 +153,7 @@ nvme_ns_cmd_flush(struct nvme_namespace
}
/* Timeout = 1 sec */
-#define NVD_DUMP_TIMEOUT 100000
+#define NVD_DUMP_TIMEOUT 200000
int
nvme_ns_dump(struct nvme_namespace *ns, void *virt, off_t offset, size_t len)
@@ -171,14 +171,13 @@ nvme_ns_dump(struct nvme_namespace *ns,
return (ENOMEM);
cmd = &req->cmd;
- cmd->opc = NVME_OPC_WRITE;
- cmd->nsid = ns->id;
- lba = offset / nvme_ns_get_sector_size(ns);
- lba_count = len / nvme_ns_get_sector_size(ns);
-
- *(uint64_t *)&cmd->cdw10 = lba;
- cmd->cdw12 = lba_count - 1;
+ if (len > 0) {
+ lba = offset / nvme_ns_get_sector_size(ns);
+ lba_count = len / nvme_ns_get_sector_size(ns);
+ nvme_ns_write_cmd(cmd, ns->id, lba, lba_count);
+ } else
+ nvme_ns_flush_cmd(cmd, ns->id);
nvme_ctrlr_submit_io_request(ns->ctrlr, req);
if (req->qpair == NULL)
@@ -186,7 +185,7 @@ nvme_ns_dump(struct nvme_namespace *ns,
i = 0;
while ((i++ < NVD_DUMP_TIMEOUT) && (status.done == FALSE)) {
- DELAY(10);
+ DELAY(5);
nvme_qpair_process_completions(req->qpair);
}
More information about the svn-src-head
mailing list