nvme: save timeout_tsc in nvme_completion_poll_status
This is needed to enable using the nvme_completion_poll machinery in an asynchronous mode. Signed-off-by: Jim Harris <james.r.harris@intel.com> Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com> Change-Id: I8009ab81bcc02cba685f560be3d6540aab7ef3f3 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8600 Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com> Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
parent
45d63e9882
commit
20e6c821dc
@ -285,11 +285,13 @@ nvme_wait_for_completion_robust_lock_timeout(
|
||||
pthread_mutex_t *robust_mutex,
|
||||
uint64_t timeout_in_usecs)
|
||||
{
|
||||
uint64_t timeout_tsc = 0;
|
||||
int rc = 0;
|
||||
|
||||
if (timeout_in_usecs) {
|
||||
timeout_tsc = spdk_get_ticks() + timeout_in_usecs * spdk_get_ticks_hz() / SPDK_SEC_TO_USEC;
|
||||
status->timeout_tsc = spdk_get_ticks() + timeout_in_usecs *
|
||||
spdk_get_ticks_hz() / SPDK_SEC_TO_USEC;
|
||||
} else {
|
||||
status->timeout_tsc = 0;
|
||||
}
|
||||
|
||||
while (status->done == false) {
|
||||
@ -313,7 +315,7 @@ nvme_wait_for_completion_robust_lock_timeout(
|
||||
status->cpl.status.sc = SPDK_NVME_SC_ABORTED_SQ_DELETION;
|
||||
break;
|
||||
}
|
||||
if (timeout_tsc && spdk_get_ticks() > timeout_tsc) {
|
||||
if (status->timeout_tsc && spdk_get_ticks() > status->timeout_tsc) {
|
||||
rc = -1;
|
||||
break;
|
||||
}
|
||||
|
@ -382,6 +382,7 @@ struct nvme_request {
|
||||
|
||||
struct nvme_completion_poll_status {
|
||||
struct spdk_nvme_cpl cpl;
|
||||
uint64_t timeout_tsc;
|
||||
bool done;
|
||||
/* This flag indicates that the request has been timed out and the memory
|
||||
must be freed in a completion callback */
|
||||
|
Loading…
Reference in New Issue
Block a user