summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosef 'Jeff' Sipek <josef.sipek@nexenta.com>2014-05-07 01:26:12 -0400
committerRichard Lowe <richlowe@richlowe.net>2014-05-14 19:37:33 -0400
commit7c64340fe7f813fbf9b6874c9422f7765bc54eb8 (patch)
tree43b44c93f3fed5089126a85d03b4cc36a3a9feb5
parent55a3a0ef881a0e1c7da841d46bb5878758497dc1 (diff)
downloadillumos-joyent-7c64340fe7f813fbf9b6874c9422f7765bc54eb8.tar.gz
4781 sd shouldn't abuse ddi_get_time(9f)
Reviewed by: Richard Elling <richard.elling@gmail.com> Reviewed by: Robert Mustacchi <rm@joyent.com> Reviewed by: Hans Rosenfeld <hans.rosenfeld@nexenta.com> Approved by: Richard Lowe <richlowe@richlowe.net>
-rw-r--r--usr/src/uts/common/io/scsi/targets/sd.c12
-rw-r--r--usr/src/uts/common/sys/scsi/targets/sddef.h3
2 files changed, 7 insertions, 8 deletions
diff --git a/usr/src/uts/common/io/scsi/targets/sd.c b/usr/src/uts/common/io/scsi/targets/sd.c
index d9ca686014..ae1e7e0fc3 100644
--- a/usr/src/uts/common/io/scsi/targets/sd.c
+++ b/usr/src/uts/common/io/scsi/targets/sd.c
@@ -25,7 +25,7 @@
/*
* Copyright (c) 2011 Bayard G. Bell. All rights reserved.
* Copyright (c) 2012 by Delphix. All rights reserved.
- * Copyright 2013 Nexenta Systems, Inc. All rights reserved.
+ * Copyright 2014 Nexenta Systems, Inc. All rights reserved.
* Copyright 2012 DEY Storage Systems, Inc. All rights reserved.
*/
/*
@@ -6541,10 +6541,9 @@ sd_pm_state_change(struct sd_lun *un, int level, int flag)
static void
sd_pm_idletimeout_handler(void *arg)
{
+ const hrtime_t idletime = sd_pm_idletime * NANOSEC;
struct sd_lun *un = arg;
- time_t now;
-
mutex_enter(&sd_detach_mutex);
if (un->un_detach_count != 0) {
/* Abort if the instance is detaching */
@@ -6553,14 +6552,13 @@ sd_pm_idletimeout_handler(void *arg)
}
mutex_exit(&sd_detach_mutex);
- now = ddi_get_time();
/*
* Grab both mutexes, in the proper order, since we're accessing
* both PM and softstate variables.
*/
mutex_enter(SD_MUTEX(un));
mutex_enter(&un->un_pm_mutex);
- if (((now - un->un_pm_idle_time) > sd_pm_idletime) &&
+ if (((gethrtime() - un->un_pm_idle_time) > idletime) &&
(un->un_ncmds_in_driver == 0) && (un->un_pm_count == 0)) {
/*
* Update the chain types.
@@ -12461,7 +12459,7 @@ sd_buf_iodone(int index, struct sd_lun *un, struct buf *bp)
* This is for lowering the overhead, and therefore improving
* performance per I/O operation.
*/
- un->un_pm_idle_time = ddi_get_time();
+ un->un_pm_idle_time = gethrtime();
un->un_ncmds_in_driver--;
ASSERT(un->un_ncmds_in_driver >= 0);
@@ -12511,7 +12509,7 @@ sd_uscsi_iodone(int index, struct sd_lun *un, struct buf *bp)
* This is for lowering the overhead, and therefore improving
* performance per I/O operation.
*/
- un->un_pm_idle_time = ddi_get_time();
+ un->un_pm_idle_time = gethrtime();
un->un_ncmds_in_driver--;
ASSERT(un->un_ncmds_in_driver >= 0);
diff --git a/usr/src/uts/common/sys/scsi/targets/sddef.h b/usr/src/uts/common/sys/scsi/targets/sddef.h
index fde714789c..39c0ed9d0f 100644
--- a/usr/src/uts/common/sys/scsi/targets/sddef.h
+++ b/usr/src/uts/common/sys/scsi/targets/sddef.h
@@ -23,6 +23,7 @@
*/
/*
* Copyright 2011 cyril.galibern@opensvc.com
+ * Copyright 2014 Nexenta Systems, Inc. All rights reserved.
*/
#ifndef _SYS_SCSI_TARGETS_SDDEF_H
@@ -516,7 +517,7 @@ struct sd_lun {
timeout_id_t un_retry_timeid;
- time_t un_pm_idle_time;
+ hrtime_t un_pm_idle_time;
timeout_id_t un_pm_idle_timeid;
/*