Print this page
4779 vhci shouldn't abuse ddi_get_time(9f)
Reviewed by: Robert Mustacchi <rm@joyent.com>
@@ -19,10 +19,13 @@
* CDDL HEADER END
*/
/*
* Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
*/
+/*
+ * Copyright 2014 Nexenta Systems, Inc. All rights reserved.
+ */
/*
* Multiplexed I/O SCSI vHCI implementation
*/
@@ -2224,11 +2227,10 @@
int rval = -1;
int pgr_sema_held = 0;
int held;
int mps_flag = MDI_SELECT_ONLINE_PATH;
struct scsi_vhci_lun *vlun;
- time_t tnow;
int path_instance = 0;
vlun = ADDR2VLUN(ap);
ASSERT(vlun != 0);
@@ -2362,11 +2364,11 @@
rval = mdi_select_path(cdip, vpkt->vpkt_tgt_init_bp,
mps_flag, NULL, &pip);
if ((rval != MDI_SUCCESS) || (pip == NULL)) {
if (vlun->svl_waiting_for_activepath == 0) {
vlun->svl_waiting_for_activepath = 1;
- vlun->svl_wfa_time = ddi_get_time();
+ vlun->svl_wfa_time = gethrtime();
}
mps_flag |= MDI_SELECT_STANDBY_PATH;
rval = mdi_select_path(cdip,
vpkt->vpkt_tgt_init_bp,
mps_flag, NULL, &pip);
@@ -2394,12 +2396,12 @@
* passive path; lets wait for a little
* bit, hopefully an active path will
* show up obviating the need for a
* failover
*/
- tnow = ddi_get_time();
- if (tnow - vlun->svl_wfa_time >= 60) {
+ if ((gethrtime() - vlun->svl_wfa_time) >=
+ (60 * NANOSEC)) {
vlun->svl_waiting_for_activepath = 0;
} else {
drv_usecwait(1000);
if (vlun->svl_waiting_for_activepath
== 0) {
@@ -3622,11 +3624,11 @@
vlun->svl_lun_wwn));
VHCI_RELEASE_LUN(vlun);
return (PKT_RETURN);
}
swarg->svs_svp = svp;
- swarg->svs_tos = ddi_get_time();
+ swarg->svs_tos = gethrtime();
swarg->svs_pi = vpkt->vpkt_path;
swarg->svs_release_lun = 0;
swarg->svs_done = 0;
/*
* place a hold on the path...we don't want it to
@@ -3683,11 +3685,11 @@
ddi_get_instance(vdip));
updt_paths = 0;
if (pkt->pkt_reason != CMD_CMPLT) {
- if ((ddi_get_time() - swarg->svs_tos) >= VHCI_EXTFO_TIMEOUT) {
+ if ((gethrtime() - swarg->svs_tos) >= VHCI_EXTFO_TIMEOUT) {
swarg->svs_release_lun = 1;
goto done;
}
return (0);
}
@@ -3705,11 +3707,11 @@
case SCSI_SENSE_INACTIVE:
case SCSI_SENSE_NOFAILOVER:
updt_paths = 1;
break;
default:
- if ((ddi_get_time() - swarg->svs_tos)
+ if ((gethrtime() - swarg->svs_tos)
>= VHCI_EXTFO_TIMEOUT) {
swarg->svs_release_lun = 1;
goto done;
}
return (0);
@@ -3737,11 +3739,11 @@
(void) taskq_dispatch(vhci->vhci_update_pathstates_taskq,
vhci_update_pathstates, (void *)vlun,
KM_SLEEP);
return (0);
}
- if ((ddi_get_time() - swarg->svs_tos) >= VHCI_EXTFO_TIMEOUT) {
+ if ((gethrtime() - swarg->svs_tos) >= VHCI_EXTFO_TIMEOUT) {
swarg->svs_release_lun = 1;
goto done;
}
return (0);
done: