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.
This commit is contained in:
parent
ddda1a9c2f
commit
49e20d2420
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=303040
@ -237,14 +237,7 @@ nvd_dump(void *arg, void *virt, vm_offset_t phys, off_t offset, size_t len)
|
||||
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
|
||||
|
@ -153,7 +153,7 @@ nvme_ns_cmd_flush(struct nvme_namespace *ns, nvme_cb_fn_t cb_fn, void *cb_arg)
|
||||
}
|
||||
|
||||
/* 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, void *virt, off_t offset, size_t len)
|
||||
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, void *virt, off_t offset, size_t len)
|
||||
|
||||
i = 0;
|
||||
while ((i++ < NVD_DUMP_TIMEOUT) && (status.done == FALSE)) {
|
||||
DELAY(10);
|
||||
DELAY(5);
|
||||
nvme_qpair_process_completions(req->qpair);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user