nvme: track submit time instead of timeout time

This removes one addition from the submission path (negligible, but a
nice side effect), but also opens up the possibility of reporting the
total time an I/O took - since we are always tracking the submission
time anyway, there is no extra cost to report it in the completion
callback.

Change-Id: I7129e7c09d20da8082042a7622d045846461dd9c
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
Daniel Verkamp 2017-02-07 14:16:05 -07:00
parent 4a1d47ebea
commit ff0047816d

View File

@ -124,7 +124,9 @@ struct nvme_tracker {
uint32_t rsvd2;
uint64_t timeout_tick;
/* The value of spdk_get_ticks() when the tracker was submitted to the hardware. */
uint64_t submit_tick;
uint64_t prp_sgl_bus_addr;
union {
@ -1011,7 +1013,7 @@ nvme_pcie_qpair_submit_tracker(struct spdk_nvme_qpair *qpair, struct nvme_tracke
struct nvme_pcie_qpair *pqpair = nvme_pcie_qpair(qpair);
struct nvme_pcie_ctrlr *pctrlr = nvme_pcie_ctrlr(qpair->ctrlr);
tr->timeout_tick = spdk_get_ticks() + qpair->ctrlr->timeout_ticks;
tr->submit_tick = spdk_get_ticks();
req = tr->req;
pqpair->tr[tr->cid].active = true;
@ -1834,7 +1836,7 @@ nvme_pcie_qpair_check_timeout(struct spdk_nvme_qpair *qpair)
}
t02 = spdk_get_ticks();
if (tr->timeout_tick <= t02) {
if (tr->submit_tick + ctrlr->timeout_ticks <= t02) {
/*
* Request has timed out. This could be i/o or admin request.
* Call the registered timeout function for user to take action.