summaryrefslogtreecommitdiff
path: root/usr/src/uts/common/fs
diff options
context:
space:
mode:
authorRafael Vanoni <rafael.vanoni@sun.com>2009-11-13 01:32:32 -0800
committerRafael Vanoni <rafael.vanoni@sun.com>2009-11-13 01:32:32 -0800
commitd3d50737e566cade9a08d73d2af95105ac7cd960 (patch)
tree399b76a3f6bf107e2ff506d8f9c3333654b29fc7 /usr/src/uts/common/fs
parent1eff5f7761619411b3c31280fcd96cefc32968b7 (diff)
downloadillumos-joyent-d3d50737e566cade9a08d73d2af95105ac7cd960.tar.gz
PSARC/2009/396 Tickless Kernel Architecture / lbolt decoupling
6860030 tickless clock requires a clock() decoupled lbolt / lbolt64 Portions contributed by Chad Mynhier <cmynhier@gmail.com>
Diffstat (limited to 'usr/src/uts/common/fs')
-rw-r--r--usr/src/uts/common/fs/autofs/auto_subr.c6
-rw-r--r--usr/src/uts/common/fs/cachefs/cachefs_resource.c32
-rw-r--r--usr/src/uts/common/fs/cachefs/cachefs_subr.c168
-rw-r--r--usr/src/uts/common/fs/dev/sdev_comm.c11
-rw-r--r--usr/src/uts/common/fs/dnlc.c18
-rw-r--r--usr/src/uts/common/fs/fsflush.c4
-rw-r--r--usr/src/uts/common/fs/nfs/nfs4_client.c18
-rw-r--r--usr/src/uts/common/fs/nfs/nfs4_db.c9
-rw-r--r--usr/src/uts/common/fs/nfs/nfs4_deleg_ops.c6
-rw-r--r--usr/src/uts/common/fs/nfs/nfs4_recovery.c4
-rw-r--r--usr/src/uts/common/fs/nfs/nfs4_srv.c4
-rw-r--r--usr/src/uts/common/fs/nfs/nfs4_stub_vnops.c2
-rw-r--r--usr/src/uts/common/fs/nfs/nfs_client.c11
-rw-r--r--usr/src/uts/common/fs/nfs/nfs_dump.c9
-rw-r--r--usr/src/uts/common/fs/smbclnt/netsmb/smb_iod.c25
-rw-r--r--usr/src/uts/common/fs/smbclnt/netsmb/smb_rq.c18
-rw-r--r--usr/src/uts/common/fs/smbsrv/smb_lock.c2
-rw-r--r--usr/src/uts/common/fs/smbsrv/smb_opipe.c2
-rw-r--r--usr/src/uts/common/fs/smbsrv/smb_session.c7
-rw-r--r--usr/src/uts/common/fs/smbsrv/smb_util.c11
-rw-r--r--usr/src/uts/common/fs/sockfs/nl7chttp.c7
-rw-r--r--usr/src/uts/common/fs/sockfs/nl7curi.c3
-rw-r--r--usr/src/uts/common/fs/sockfs/sockcommon_subr.c19
-rw-r--r--usr/src/uts/common/fs/sockfs/sockstr.c7
-rw-r--r--usr/src/uts/common/fs/sockfs/socksyscalls.c6
-rw-r--r--usr/src/uts/common/fs/ufs/lufs.c4
-rw-r--r--usr/src/uts/common/fs/ufs/lufs_log.c4
-rw-r--r--usr/src/uts/common/fs/ufs/lufs_thread.c8
-rw-r--r--usr/src/uts/common/fs/ufs/ufs_alloc.c12
-rw-r--r--usr/src/uts/common/fs/ufs/ufs_directio.c2
-rw-r--r--usr/src/uts/common/fs/ufs/ufs_inode.c4
-rw-r--r--usr/src/uts/common/fs/ufs/ufs_lockfs.c3
-rw-r--r--usr/src/uts/common/fs/ufs/ufs_panic.c9
-rw-r--r--usr/src/uts/common/fs/ufs/ufs_subr.c6
-rw-r--r--usr/src/uts/common/fs/ufs/ufs_thread.c6
-rw-r--r--usr/src/uts/common/fs/ufs/ufs_vfsops.c10
-rw-r--r--usr/src/uts/common/fs/ufs/ufs_vnops.c16
-rw-r--r--usr/src/uts/common/fs/zfs/arc.c40
-rw-r--r--usr/src/uts/common/fs/zfs/dmu_zfetch.c6
-rw-r--r--usr/src/uts/common/fs/zfs/dsl_scrub.c4
-rw-r--r--usr/src/uts/common/fs/zfs/metaslab.c2
-rw-r--r--usr/src/uts/common/fs/zfs/txg.c13
-rw-r--r--usr/src/uts/common/fs/zfs/vdev_cache.c6
-rw-r--r--usr/src/uts/common/fs/zfs/vdev_queue.c5
-rw-r--r--usr/src/uts/common/fs/zfs/zil.c2
-rw-r--r--usr/src/uts/common/fs/zfs/zio_inject.c5
46 files changed, 288 insertions, 288 deletions
diff --git a/usr/src/uts/common/fs/autofs/auto_subr.c b/usr/src/uts/common/fs/autofs/auto_subr.c
index 522bbc38d7..f648b5ed50 100644
--- a/usr/src/uts/common/fs/autofs/auto_subr.c
+++ b/usr/src/uts/common/fs/autofs/auto_subr.c
@@ -20,12 +20,10 @@
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <sys/param.h>
#include <sys/kmem.h>
#include <sys/errno.h>
@@ -2604,7 +2602,7 @@ auto_do_unmount(struct autofs_globals *fngp)
CALLB_CPR_SAFE_BEGIN(&cprinfo);
newthread:
mutex_exit(&fngp->fng_unmount_threads_lock);
- timeleft = zone_status_timedwait(zone, lbolt +
+ timeleft = zone_status_timedwait(zone, ddi_get_lbolt() +
autofs_unmount_thread_timer * hz, ZONE_IS_SHUTTING_DOWN);
mutex_enter(&fngp->fng_unmount_threads_lock);
diff --git a/usr/src/uts/common/fs/cachefs/cachefs_resource.c b/usr/src/uts/common/fs/cachefs/cachefs_resource.c
index 796d352237..7526a5f826 100644
--- a/usr/src/uts/common/fs/cachefs/cachefs_resource.c
+++ b/usr/src/uts/common/fs/cachefs/cachefs_resource.c
@@ -19,10 +19,9 @@
* CDDL HEADER END
*/
/*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/param.h>
#include <sys/types.h>
@@ -257,7 +256,7 @@ cachefs_rl_alloc(struct cachefscache *cachep, rl_entry_t *valp, uint_t *entnop)
entno = lhp->rli_front;
if (entno == 0) {
if (cachep->c_rlinfo.rl_entries >=
- cachep->c_label.cl_maxinodes) {
+ cachep->c_label.cl_maxinodes) {
error = ENOMEM;
goto out;
}
@@ -807,7 +806,7 @@ cachefs_garbage_collect(cachefscache_t *cachep)
cachep->c_gc_after = cachefs_gc_front_atime(cachep);
CACHEFS_TIME_TO_CFS_TIME_COPY(cachep->c_gc_after,
- cachep->c_rlinfo.rl_gctime, error);
+ cachep->c_rlinfo.rl_gctime, error);
}
/*
@@ -978,7 +977,7 @@ cachefs_cachep_worker_thread(cachefscache_t *cachep)
struct flock64 fl;
callb_cpr_t cprinfo;
kmutex_t cpr_lock;
-
+ clock_t wakeup;
/* lock the lock file for exclusive write access */
fl.l_type = F_WRLCK;
@@ -987,8 +986,8 @@ cachefs_cachep_worker_thread(cachefscache_t *cachep)
fl.l_len = (offset_t)1024;
fl.l_sysid = 0;
fl.l_pid = 0;
- error = VOP_FRLOCK(cachep->c_lockvp, F_SETLK, &fl, FWRITE,
- (offset_t)0, NULL, kcred, NULL);
+ error = VOP_FRLOCK(cachep->c_lockvp, F_SETLK, &fl, FWRITE, (offset_t)0,
+ NULL, kcred, NULL);
if (error) {
cmn_err(CE_WARN,
"cachefs: Can't lock Cache Lock File(r); Error %d\n",
@@ -1000,17 +999,16 @@ cachefs_cachep_worker_thread(cachefscache_t *cachep)
mutex_enter(&cpr_lock);
mutex_enter(&cachep->c_contentslock);
+ wakeup = (clock_t)(cachefs_ppend_time * hz);
+
/* loop while the thread is allowed to run */
while ((cachep->c_flags & CACHE_CACHEW_THREADEXIT) == 0) {
- clock_t wakeup;
-
/* wait for a wakeup call */
cachep->c_flags &= ~CACHE_GARBAGE_COLLECT;
CALLB_CPR_SAFE_BEGIN(&cprinfo);
mutex_exit(&cpr_lock);
- wakeup = (clock_t)(lbolt + (cachefs_ppend_time * hz));
- (void) cv_timedwait(&cachep->c_cwcv,
- &cachep->c_contentslock, wakeup);
+ (void) cv_reltimedwait(&cachep->c_cwcv,
+ &cachep->c_contentslock, wakeup, TR_CLOCK_TICK);
mutex_enter(&cpr_lock);
CALLB_CPR_SAFE_END(&cprinfo, &cpr_lock);
@@ -1056,8 +1054,8 @@ cachefs_cachep_worker_thread(cachefscache_t *cachep)
fl.l_len = (offset_t)1024;
fl.l_sysid = 0;
fl.l_pid = 0;
- error = VOP_FRLOCK(cachep->c_lockvp, F_SETLK, &fl,
- FWRITE, (offset_t)0, NULL, kcred, NULL);
+ error = VOP_FRLOCK(cachep->c_lockvp, F_SETLK, &fl, FWRITE, (offset_t)0,
+ NULL, kcred, NULL);
if (error) {
cmn_err(CE_WARN, "cachefs: Can't unlock lock file\n");
}
@@ -1119,7 +1117,7 @@ cachefs_rl_debug_reclaim(void *cdrarg)
int error;
for (cachep = cachefs_cachelist; cachep != NULL;
- cachep = cachep->c_next) {
+ cachep = cachep->c_next) {
mutex_enter(&cachep->c_contentslock);
for (index = 0;
@@ -1147,8 +1145,8 @@ cachefs_rl_debug_save(rl_entry_t *rlent)
if (cachefs_rl_debug_cache == NULL)
cachefs_rl_debug_cache =
kmem_cache_create("cachefs_rl_debug",
- sizeof (rl_debug_t), 0,
- NULL, NULL, cachefs_rl_debug_reclaim, NULL, NULL, 0);
+ sizeof (rl_debug_t), 0,
+ NULL, NULL, cachefs_rl_debug_reclaim, NULL, NULL, 0);
rldb = kmem_cache_alloc(cachefs_rl_debug_cache, KM_SLEEP);
++cachefs_rl_debug_inuse;
diff --git a/usr/src/uts/common/fs/cachefs/cachefs_subr.c b/usr/src/uts/common/fs/cachefs/cachefs_subr.c
index 1f82e638e6..c1ab7f0b05 100644
--- a/usr/src/uts/common/fs/cachefs/cachefs_subr.c
+++ b/usr/src/uts/common/fs/cachefs/cachefs_subr.c
@@ -19,12 +19,10 @@
* CDDL HEADER END
*/
/*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <sys/param.h>
#include <sys/types.h>
#include <sys/systm.h>
@@ -157,11 +155,11 @@ cachefs_cache_create(void)
void
cachefs_cache_destroy(cachefscache_t *cachep)
{
- clock_t tend;
int error = 0;
#ifdef CFSRLDEBUG
uint_t index;
#endif /* CFSRLDEBUG */
+ clock_t wakeup = (60 * hz);
/* stop async threads */
while (cachep->c_workq.wq_thread_count > 0)
@@ -172,9 +170,8 @@ cachefs_cache_destroy(cachefscache_t *cachep)
while (cachep->c_flags & CACHE_CACHEW_THREADRUN) {
cachep->c_flags |= CACHE_CACHEW_THREADEXIT;
cv_signal(&cachep->c_cwcv);
- tend = lbolt + (60 * hz);
- (void) cv_timedwait(&cachep->c_cwhaltcv,
- &cachep->c_contentslock, tend);
+ (void) cv_reltimedwait(&cachep->c_cwhaltcv,
+ &cachep->c_contentslock, wakeup, TR_CLOCK_TICK);
}
if ((cachep->c_flags & CACHE_ALLOC_PENDING) == 0) {
@@ -195,7 +192,7 @@ cachefs_cache_destroy(cachefscache_t *cachep)
rl_entry_t *rlent;
error = cachefs_rl_entry_get(cachep, index,
- rlent);
+ rlent);
/*
* Since we are destroying the cache,
* better to ignore and proceed
@@ -289,29 +286,29 @@ cachefs_cache_activate_ro(cachefscache_t *cachep, vnode_t *cdvp)
/* Get the lock file */
error = VOP_LOOKUP(cdvp, CACHEFS_LOCK_FILE, &lockvp, NULL, 0, NULL,
- kcred, NULL, NULL, NULL);
+ kcred, NULL, NULL, NULL);
if (error) {
cmn_err(CE_WARN, "cachefs: activate_a: cache corruption"
- " run fsck.\n");
+ " run fsck.\n");
goto out;
}
/* Get the label file */
error = VOP_LOOKUP(cdvp, CACHELABEL_NAME, &labelvp, NULL, 0, NULL,
- kcred, NULL, NULL, NULL);
+ kcred, NULL, NULL, NULL);
if (error) {
cmn_err(CE_WARN, "cachefs: activate_b: cache corruption"
- " run fsck.\n");
+ " run fsck.\n");
goto out;
}
/* read in the label */
error = vn_rdwr(UIO_READ, labelvp, (caddr_t)&cachep->c_label,
- sizeof (struct cache_label), 0LL, UIO_SYSSPACE,
- 0, (rlim64_t)0, kcred, NULL);
+ sizeof (struct cache_label), 0LL, UIO_SYSSPACE,
+ 0, (rlim64_t)0, kcred, NULL);
if (error) {
cmn_err(CE_WARN, "cachefs: activate_c: cache corruption"
- " run fsck.\n");
+ " run fsck.\n");
goto out;
}
@@ -327,17 +324,17 @@ cachefs_cache_activate_ro(cachefscache_t *cachep, vnode_t *cdvp)
NULL, NULL, NULL);
if (error) {
cmn_err(CE_WARN, "cachefs: activate_d: cache corruption"
- " run fsck.\n");
+ " run fsck.\n");
goto out;
}
/* Read the usage struct for this cache */
error = vn_rdwr(UIO_READ, rifvp, (caddr_t)&cachep->c_usage,
- sizeof (struct cache_usage), 0LL, UIO_SYSSPACE, 0,
- (rlim64_t)0, kcred, NULL);
+ sizeof (struct cache_usage), 0LL, UIO_SYSSPACE, 0,
+ (rlim64_t)0, kcred, NULL);
if (error) {
cmn_err(CE_WARN, "cachefs: activate_e: cache corruption"
- " run fsck.\n");
+ " run fsck.\n");
goto out;
}
@@ -350,11 +347,11 @@ cachefs_cache_activate_ro(cachefscache_t *cachep, vnode_t *cdvp)
/* Read the rlinfo for this cache */
error = vn_rdwr(UIO_READ, rifvp, (caddr_t)&cachep->c_rlinfo,
- sizeof (cachefs_rl_info_t), (offset_t)sizeof (struct cache_usage),
- UIO_SYSSPACE, 0, 0, kcred, NULL);
+ sizeof (cachefs_rl_info_t), (offset_t)sizeof (struct cache_usage),
+ UIO_SYSSPACE, 0, 0, kcred, NULL);
if (error) {
cmn_err(CE_WARN, "cachefs: activate_f: cache corruption"
- " run fsck.\n");
+ " run fsck.\n");
goto out;
}
@@ -363,7 +360,7 @@ cachefs_cache_activate_ro(cachefscache_t *cachep, vnode_t *cdvp)
NULL, 0, NULL, kcred, NULL, NULL, NULL);
if (error) {
cmn_err(CE_WARN, "cachefs: activate_g: cache corruption"
- " run fsck.\n");
+ " run fsck.\n");
goto out;
}
@@ -441,8 +438,8 @@ cachefs_stop_cache(cnode_t *cp)
cachefscache_t *cachep = fscp->fs_cache;
filegrp_t *fgp;
int i;
- clock_t tend;
int error = 0;
+ clock_t wakeup = (60 * hz);
/* XXX verify lock-ordering for this function */
@@ -497,7 +494,7 @@ cachefs_stop_cache(cnode_t *cp)
for (i = 0; i < CFS_FS_FGP_BUCKET_SIZE; i++) {
for (fgp = fscp->fs_filegrp[i]; fgp != NULL;
- fgp = fgp->fg_next) {
+ fgp = fgp->fg_next) {
mutex_enter(&fgp->fg_mutex);
ASSERT((fgp->fg_flags &
@@ -552,9 +549,8 @@ cachefs_stop_cache(cnode_t *cp)
while (cachep->c_flags & CACHE_CACHEW_THREADRUN) {
cachep->c_flags |= CACHE_CACHEW_THREADEXIT;
cv_signal(&cachep->c_cwcv);
- tend = lbolt + (60 * hz);
- (void) cv_timedwait(&cachep->c_cwhaltcv,
- &cachep->c_contentslock, tend);
+ (void) cv_reltimedwait(&cachep->c_cwhaltcv,
+ &cachep->c_contentslock, wakeup, TR_CLOCK_TICK);
}
if (cachep->c_resfilevp) {
@@ -677,7 +673,7 @@ cachefs_cache_dirty(struct cachefscache *cachep, int lockit)
if (error = vn_rdwr(UIO_WRITE, cachep->c_resfilevp,
(caddr_t)&cachep->c_usage, sizeof (struct cache_usage),
0LL, UIO_SYSSPACE, FSYNC, (rlim64_t)RLIM_INFINITY,
- kcred, NULL)) {
+ kcred, NULL)) {
cmn_err(CE_WARN,
"cachefs: clean flag write error: %d\n", error);
}
@@ -717,24 +713,25 @@ cachefs_cache_rssync(struct cachefscache *cachep)
(offset_t)((cachep->c_rl_window + 1) * MAXBSIZE),
UIO_SYSSPACE, FSYNC, RLIM_INFINITY, kcred, NULL);
if (error)
- cmn_err(CE_WARN, "cachefs: Can't Write rl entries Info\n");
+ cmn_err(CE_WARN,
+ "cachefs: Can't Write rl entries Info\n");
cachefs_kmem_free(cachep->c_rl_entries, MAXBSIZE);
cachep->c_rl_entries = NULL;
}
/* write the usage struct for this cache */
error = vn_rdwr(UIO_WRITE, cachep->c_resfilevp,
- (caddr_t)&cachep->c_usage, sizeof (struct cache_usage),
- 0LL, UIO_SYSSPACE, 0, (rlim64_t)RLIM_INFINITY, kcred, NULL);
+ (caddr_t)&cachep->c_usage, sizeof (struct cache_usage),
+ 0LL, UIO_SYSSPACE, 0, (rlim64_t)RLIM_INFINITY, kcred, NULL);
if (error) {
cmn_err(CE_WARN, "cachefs: Can't Write Cache Usage Info\n");
}
/* write the rlinfo for this cache */
error = vn_rdwr(UIO_WRITE, cachep->c_resfilevp,
- (caddr_t)&cachep->c_rlinfo, sizeof (cachefs_rl_info_t),
- (offset_t)sizeof (struct cache_usage), UIO_SYSSPACE,
- 0, (rlim64_t)RLIM_INFINITY, kcred, NULL);
+ (caddr_t)&cachep->c_rlinfo, sizeof (cachefs_rl_info_t),
+ (offset_t)sizeof (struct cache_usage), UIO_SYSSPACE,
+ 0, (rlim64_t)RLIM_INFINITY, kcred, NULL);
if (error) {
cmn_err(CE_WARN, "cachefs: Can't Write Cache RL Info\n");
}
@@ -822,7 +819,7 @@ cachefs_cache_sync(struct cachefscache *cachep)
done = 1;
} else {
cachep->c_usage.cu_flags |=
- CUSAGE_ACTIVE;
+ CUSAGE_ACTIVE;
}
} else {
done = 1;
@@ -860,7 +857,7 @@ cachefs_cache_unique(cachefscache_t *cachep)
mutex_enter(&cachep->c_contentslock);
if (cachep->c_usage.cu_flags & CUSAGE_NEED_ADJUST ||
- ++(cachep->c_unique) == 0) {
+ ++(cachep->c_unique) == 0) {
cachep->c_usage.cu_unique++;
if (cachep->c_unique == 0)
@@ -893,7 +890,7 @@ cachefs_createfrontfile(cnode_t *cp, struct filegrp *fgp)
#ifdef CFSDEBUG
CFS_DEBUG(CFSDEBUG_FRONT)
printf("c_createfrontfile: ENTER cp %p fgp %p\n",
- (void *)cp, (void *)fgp);
+ (void *)cp, (void *)fgp);
#endif
ASSERT(cp->c_frontvp == NULL);
@@ -1037,7 +1034,7 @@ out:
#ifdef CFSDEBUG
CFS_DEBUG(CFSDEBUG_FRONT)
printf("c_createfrontfile: EXIT error = %d name %s\n", error,
- name);
+ name);
#endif
return (error);
}
@@ -1082,7 +1079,7 @@ cachefs_removefrontfile(cachefs_metadata_t *mdp, cfs_cid_t *cidp,
}
mdp->md_flags &= ~(MD_FILE | MD_POPULATED | MD_ACL | MD_ACLDIR);
bzero(&mdp->md_allocinfo, mdp->md_allocents *
- sizeof (struct cachefs_allocmap));
+ sizeof (struct cachefs_allocmap));
cachefs_freefile(fgp->fg_fscp->fs_cache);
}
@@ -1157,9 +1154,8 @@ cachefs_getfrontfile(cnode_t *cp)
#ifdef CFSDEBUG
if (cp->c_frontvp != NULL)
CFS_DEBUG(CFSDEBUG_FRONT)
- printf(
- "c_getfrontfile: !MD_FILE and frontvp not null cp %p\n",
- (void *)cp);
+ printf("c_getfrontfile: !MD_FILE and frontvp "
+ "not null cp %p\n", (void *)cp);
#endif
if (CTOV(cp)->v_type == VDIR)
ASSERT((cp->c_metadata.md_flags & MD_POPULATED) == 0);
@@ -1174,14 +1170,14 @@ cachefs_getfrontfile(cnode_t *cp)
*/
if (fgp->fg_dirvp == NULL) {
cmn_err(CE_WARN, "cachefs: gff0: corrupted file system"
- " run fsck\n");
+ " run fsck\n");
cachefs_inval_object(cp);
cp->c_flags |= CN_NOCACHE;
error = ESTALE;
goto out;
}
error = VFS_VGET(fgp->fg_dirvp->v_vfsp, &cp->c_frontvp,
- &cp->c_metadata.md_fid);
+ &cp->c_metadata.md_fid);
if (error || (cp->c_frontvp == NULL)) {
#ifdef CFSDEBUG
CFS_DEBUG(CFSDEBUG_FRONT)
@@ -1213,7 +1209,7 @@ cachefs_getfrontfile(cnode_t *cp)
error = VOP_GETATTR(cp->c_frontvp, &va, 0, kcred, NULL);
if (error) {
cmn_err(CE_WARN, "cachefs: gff2: front file"
- " system error %d", error);
+ " system error %d", error);
cachefs_inval_object(cp);
error = (cp->c_flags & CN_NOCACHE) ? ESTALE : 0;
goto out;
@@ -1228,11 +1224,11 @@ cachefs_getfrontfile(cnode_t *cp)
sec = cp->c_metadata.md_timestamp.tv_sec;
nsec = cp->c_metadata.md_timestamp.tv_nsec;
printf("c_getfrontfile: timestamps don't"
- " match fileno %lld va %lx %lx"
- " meta %lx %lx\n",
- (u_longlong_t)cp->c_id.cid_fileno,
- va.va_mtime.tv_sec,
- va.va_mtime.tv_nsec, sec, nsec);
+ " match fileno %lld va %lx %lx"
+ " meta %lx %lx\n",
+ (u_longlong_t)cp->c_id.cid_fileno,
+ va.va_mtime.tv_sec,
+ va.va_mtime.tv_nsec, sec, nsec);
}
#endif
cachefs_inval_object(cp);
@@ -1240,7 +1236,6 @@ cachefs_getfrontfile(cnode_t *cp)
}
}
out:
-
#ifdef CFSDEBUG
CFS_DEBUG(CFSDEBUG_FRONT)
printf("c_getfrontfile: EXIT error = %d\n", error);
@@ -1258,7 +1253,7 @@ cachefs_inval_object(cnode_t *cp)
ASSERT(CFS_ISFS_BACKFS_NFSV4(C_TO_FSCACHE(cp)) == 0);
ASSERT(MUTEX_HELD(&cp->c_statelock));
ASSERT((cp->c_flags & CN_ASYNC_POP_WORKING) == 0 ||
- cp->c_popthrp == curthread);
+ cp->c_popthrp == curthread);
#if 0
CFS_DEBUG(CFSDEBUG_SUBR)
printf("c_inval_object: ENTER cp %p\n", (void *)cp);
@@ -1282,7 +1277,7 @@ cachefs_inval_object(cnode_t *cp)
if (cp->c_frontvp == NULL) {
error = VFS_VGET(fgp->fg_dirvp->v_vfsp, &cp->c_frontvp,
- &cp->c_metadata.md_fid);
+ &cp->c_metadata.md_fid);
if (error || (cp->c_frontvp == NULL)) {
#ifdef CFSDEBUG
CFS_DEBUG(CFSDEBUG_FRONT)
@@ -1463,7 +1458,7 @@ cachefs_check_allocmap(cnode_t *cp, u_offset_t off)
for (i = 0; i < cp->c_metadata.md_allocents; i++) {
struct cachefs_allocmap *allocp =
- cp->c_metadata.md_allocinfo + i;
+ cp->c_metadata.md_allocinfo + i;
if (off >= allocp->am_start_off) {
if ((off + size_to_look) <=
@@ -1508,7 +1503,7 @@ cachefs_coalesce_allocmap(struct cachefs_metadata *cmd)
allocp++;
for (i = 1; i < cmd->md_allocents; i++, allocp++) {
if (nallocp->am_start_off + nallocp->am_size ==
- allocp->am_start_off) {
+ allocp->am_start_off) {
nallocp->am_size += allocp->am_size;
reduced++;
} else {
@@ -1552,7 +1547,7 @@ again:
endoff = off + size;
if (endoff >= allocp->am_start_off) {
tmpendoff = allocp->am_start_off +
- allocp->am_size;
+ allocp->am_size;
if (endoff < tmpendoff)
endoff = tmpendoff;
allocp->am_size = endoff - off;
@@ -1657,7 +1652,7 @@ cachefs_populate(cnode_t *cp, u_offset_t off, size_t popsize, vnode_t *frontvp,
size = MAXBSIZE - n;
error = fbread(backvp, (offset_t)blkoff, n + size,
- S_OTHER, &fbp);
+ S_OTHER, &fbp);
if (CFS_TIMEOUT(C_TO_FSCACHE(cp), error))
goto out;
else if (error) {
@@ -1683,8 +1678,8 @@ cachefs_populate(cnode_t *cp, u_offset_t off, size_t popsize, vnode_t *frontvp,
}
resid = 0;
error = vn_rdwr(UIO_WRITE, frontvp, buf + n, size,
- (offset_t)from, UIO_SYSSPACE, 0,
- (rlim64_t)RLIM64_INFINITY, cr, &resid);
+ (offset_t)from, UIO_SYSSPACE, 0,
+ (rlim64_t)RLIM64_INFINITY, cr, &resid);
if (error) {
#ifdef CFSDEBUG
CFS_DEBUG(CFSDEBUG_FRONT)
@@ -1724,8 +1719,8 @@ out:
* occurred during large files project - XXX.
*/
void
-cachefs_cluster_allocmap(u_offset_t off, u_offset_t *popoffp,
- size_t *popsizep, size_t size, struct cnode *cp)
+cachefs_cluster_allocmap(u_offset_t off, u_offset_t *popoffp, size_t *popsizep,
+ size_t size, struct cnode *cp)
{
int i;
u_offset_t lastoff = 0;
@@ -1737,11 +1732,11 @@ cachefs_cluster_allocmap(u_offset_t off, u_offset_t *popoffp,
#ifdef CFSDEBUG
CFS_DEBUG(CFSDEBUG_SUBR)
printf("cachefs_cluster_allocmap: off %llx, size %llx, "
- "c_size %llx\n", off, size, (longlong_t)cp->c_size);
+ "c_size %llx\n", off, size, (longlong_t)cp->c_size);
#endif /* CFSDEBUG */
for (i = 0; i < cp->c_metadata.md_allocents; i++) {
struct cachefs_allocmap *allocp =
- cp->c_metadata.md_allocinfo + i;
+ cp->c_metadata.md_allocinfo + i;
if (allocp->am_start_off > off) {
if ((off + size) > allocp->am_start_off) {
@@ -1756,7 +1751,7 @@ cachefs_cluster_allocmap(u_offset_t off, u_offset_t *popoffp,
}
*popoffp = (off - backward_diff) & (offset_t)PAGEMASK;
*popsizep = ((off + forward_diff) - *popoffp) &
- (offset_t)PAGEMASK;
+ (offset_t)PAGEMASK;
return;
} else {
lastoff = allocp->am_start_off + allocp->am_size;
@@ -1765,7 +1760,7 @@ cachefs_cluster_allocmap(u_offset_t off, u_offset_t *popoffp,
if ((lastoff + size) > off) {
*popoffp = (lastoff & (offset_t)PAGEMASK);
} else {
- *popoffp = off & (offset_t)PAGEMASK;
+ *popoffp = off & (offset_t)PAGEMASK;
}
/*
@@ -1774,17 +1769,16 @@ cachefs_cluster_allocmap(u_offset_t off, u_offset_t *popoffp,
*/
if ((*popoffp + size) > cp->c_size)
*popsizep = (cp->c_size - *popoffp + PAGEOFFSET) &
- (offset_t)PAGEMASK;
+ (offset_t)PAGEMASK;
else if (size < PAGESIZE)
- *popsizep = (size + PAGEOFFSET) &
- (offset_t)PAGEMASK;
+ *popsizep = (size + PAGEOFFSET) & (offset_t)PAGEMASK;
else
*popsizep = size & (offset_t)PAGEMASK;
#ifdef CFSDEBUG
CFS_DEBUG(CFSDEBUG_SUBR)
printf("cachefs_cluster_allocmap: popoff %llx, popsize %llx\n",
- (u_longlong_t)(*popoffp), (u_longlong_t)(*popsizep));
+ (u_longlong_t)(*popoffp), (u_longlong_t)(*popsizep));
#endif /* CFSDEBUG */
}
@@ -1909,8 +1903,8 @@ cachefs_readlink_back(cnode_t *cp, cred_t *cr, caddr_t *bufp, int *buflenp)
/* get the link data */
CFS_DPRINT_BACKFS_NFSV4(fscp,
- ("cachefs_readlink (nfsv4): cnode %p, backvp %p\n",
- cp, cp->c_backvp));
+ ("cachefs_readlink (nfsv4): cnode %p, backvp %p\n",
+ cp, cp->c_backvp));
error = VOP_READLINK(cp->c_backvp, &uio, cr, NULL);
if (error) {
cachefs_kmem_free(buf, MAXPATHLEN);
@@ -2138,10 +2132,10 @@ cachefs_async_start(struct cachefs_workq *qp)
CALLB_CPR_SAFE_BEGIN(&cprinfo);
/* sleep until there is something to do */
- left = cv_timedwait(&qp->wq_req_cv,
- &qp->wq_queue_lock, CFS_ASYNC_TIMEOUT + lbolt);
- CALLB_CPR_SAFE_END(&cprinfo,
- &qp->wq_queue_lock);
+ left = cv_reltimedwait(&qp->wq_req_cv,
+ &qp->wq_queue_lock, CFS_ASYNC_TIMEOUT,
+ TR_CLOCK_TICK);
+ CALLB_CPR_SAFE_END(&cprinfo, &qp->wq_queue_lock);
if ((qp->wq_head == NULL) && (qp->wq_logwork == 0))
continue;
}
@@ -2188,7 +2182,6 @@ int
cachefs_async_halt(struct cachefs_workq *qp, int force)
{
int error = 0;
- clock_t tend;
mutex_enter(&qp->wq_queue_lock);
if (force)
@@ -2197,9 +2190,8 @@ cachefs_async_halt(struct cachefs_workq *qp, int force)
if (qp->wq_thread_count > 0) {
qp->wq_halt_request++;
cv_broadcast(&qp->wq_req_cv);
- tend = lbolt + (60 * hz);
- (void) cv_timedwait(&qp->wq_halt_cv,
- &qp->wq_queue_lock, tend);
+ (void) cv_reltimedwait(&qp->wq_halt_cv,
+ &qp->wq_queue_lock, (60 * hz), TR_CLOCK_TICK);
qp->wq_halt_request--;
if (qp->wq_thread_count > 0) {
if ((qp->wq_thread_count == 1) &&
@@ -2254,7 +2246,7 @@ cachefs_async_putpage(struct cachefs_putpage_req *prp, cred_t *cr)
ASSERT(CFS_ISFS_BACKFS_NFSV4(C_TO_FSCACHE(cp)) == 0);
(void) VOP_PUTPAGE(prp->cp_vp, prp->cp_off, prp->cp_len,
- prp->cp_flags, cr, NULL);
+ prp->cp_flags, cr, NULL);
mutex_enter(&cp->c_iomutex);
if (--cp->c_nio == 0)
@@ -2666,7 +2658,7 @@ cachefs_kmem_free(void *mp, size_t size)
ASSERT(n >= (size + 8));
front_kwp = (struct km_wrap *)((uintptr_t)mp - sizeof (struct km_wrap));
back_kwp = (struct km_wrap *)
- ((uintptr_t)front_kwp + n - sizeof (struct km_wrap));
+ ((uintptr_t)front_kwp + n - sizeof (struct km_wrap));
ASSERT(front_kwp->kw_other == back_kwp);
ASSERT(front_kwp->kw_size == n);
@@ -2711,21 +2703,21 @@ cachefs_stats_kstat_snapshot(kstat_t *ksp, void *buf, int rw)
bcopy(buf, &fscp->fs_stats, sizeof (fscp->fs_stats));
cachep->c_gc_count = fscp->fs_stats.st_gc_count;
CACHEFS_CFS_TIME_TO_TIME_COPY(fscp->fs_stats.st_gc_time,
- cachep->c_gc_time);
+ cachep->c_gc_time);
CACHEFS_CFS_TIME_TO_TIME_COPY(fscp->fs_stats.st_gc_before_atime,
- cachep->c_gc_before);
+ cachep->c_gc_before);
CACHEFS_CFS_TIME_TO_TIME_COPY(fscp->fs_stats.st_gc_after_atime,
- cachep->c_gc_after);
+ cachep->c_gc_after);
return (error);
}
fscp->fs_stats.st_gc_count = cachep->c_gc_count;
CACHEFS_TIME_TO_CFS_TIME_COPY(cachep->c_gc_time,
- fscp->fs_stats.st_gc_time, error);
+ fscp->fs_stats.st_gc_time, error);
CACHEFS_TIME_TO_CFS_TIME_COPY(cachep->c_gc_before,
- fscp->fs_stats.st_gc_before_atime, error);
+ fscp->fs_stats.st_gc_before_atime, error);
CACHEFS_TIME_TO_CFS_TIME_COPY(cachep->c_gc_after,
- fscp->fs_stats.st_gc_after_atime, error);
+ fscp->fs_stats.st_gc_after_atime, error);
bcopy(&fscp->fs_stats, buf, sizeof (fscp->fs_stats));
return (error);
diff --git a/usr/src/uts/common/fs/dev/sdev_comm.c b/usr/src/uts/common/fs/dev/sdev_comm.c
index 226e323149..2cf5b37db7 100644
--- a/usr/src/uts/common/fs/dev/sdev_comm.c
+++ b/usr/src/uts/common/fs/dev/sdev_comm.c
@@ -110,6 +110,7 @@ sdev_wait4lookup(struct sdev_node *dv, int cmd)
{
clock_t expire;
clock_t rv;
+ clock_t wakeup = drv_usectohz(2 * 1000000);
int rval = ENOENT;
int is_lookup = (cmd == SDEV_LOOKUP);
@@ -129,9 +130,8 @@ sdev_wait4lookup(struct sdev_node *dv, int cmd)
while (DEVNAME_DEVFSADM_IS_RUNNING(devfsadm_state) &&
!sdev_devfsadm_revoked()) {
/* wait 2 sec and check devfsadm completion */
- rv = cv_timedwait_sig(&dv->sdev_lookup_cv,
- &dv->sdev_lookup_lock, ddi_get_lbolt() +
- drv_usectohz(2 * 1000000));
+ rv = cv_reltimedwait_sig(&dv->sdev_lookup_cv,
+ &dv->sdev_lookup_lock, wakeup, TR_CLOCK_TICK);
if (is_lookup && (rv > 0)) {
/* was this node constructed ? */
@@ -233,9 +233,8 @@ sdev_open_upcall_door()
ASSERT(sdev_upcall_door == NULL);
- /* tick value at which wait expires */
- expire = ddi_get_lbolt() +
- drv_usectohz(dev_devfsadm_startup * 1000000);
+ /* timeout expires this many ticks in the future */
+ expire = ddi_get_lbolt() + drv_usectohz(dev_devfsadm_startup * 1000000);
if (sdev_door_upcall_filename == NULL) {
if ((error = sdev_start_devfsadmd()) != 0) {
diff --git a/usr/src/uts/common/fs/dnlc.c b/usr/src/uts/common/fs/dnlc.c
index ef44a25622..0941dfb9ac 100644
--- a/usr/src/uts/common/fs/dnlc.c
+++ b/usr/src/uts/common/fs/dnlc.c
@@ -19,7 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -36,8 +36,6 @@
* contributors.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <sys/types.h>
#include <sys/systm.h>
#include <sys/param.h>
@@ -1166,7 +1164,7 @@ dnlc_dir_lookup(dcanchor_t *dcap, char *name, uint64_t *handle)
mutex_enter(&dcap->dca_lock);
dcp = (dircache_t *)dcap->dca_dircache;
if (VALID_DIR_CACHE(dcp)) {
- dcp->dc_actime = lbolt64;
+ dcp->dc_actime = ddi_get_lbolt64();
DNLC_DIR_HASH(name, hash, namlen);
dep = dcp->dc_namehash[hash & dcp->dc_nhash_mask];
while (dep != NULL) {
@@ -1385,7 +1383,7 @@ ok:
bcopy(name, dep->de_name, namlen);
dep->de_next = *hp;
*hp = dep;
- dcp->dc_actime = lbolt64;
+ dcp->dc_actime = ddi_get_lbolt64();
mutex_exit(&dcap->dca_lock);
ncs.ncs_dir_num_ents.value.ui64++;
return (DOK);
@@ -1474,7 +1472,7 @@ ok:
*/
dfp->df_handle = handle;
dfp->df_len = len;
- dcp->dc_actime = lbolt64;
+ dcp->dc_actime = ddi_get_lbolt64();
hp = &(dcp->dc_freehash[DDFHASH(handle, dcp)]);
dfp->df_next = *hp;
*hp = dfp;
@@ -1601,7 +1599,7 @@ dnlc_dir_rem_entry(dcanchor_t *dcap, char *name, uint64_t *handlep)
mutex_enter(&dcap->dca_lock);
dcp = (dircache_t *)dcap->dca_dircache;
if (VALID_DIR_CACHE(dcp)) {
- dcp->dc_actime = lbolt64;
+ dcp->dc_actime = ddi_get_lbolt64();
if (dcp->dc_nhash_mask > 0) { /* ie not minimum */
capacity = (dcp->dc_nhash_mask + 1) <<
dnlc_dir_hash_size_shift;
@@ -1677,7 +1675,7 @@ dnlc_dir_rem_space_by_len(dcanchor_t *dcap, uint_t len, uint64_t *handlep)
mutex_enter(&dcap->dca_lock);
dcp = (dircache_t *)dcap->dca_dircache;
if (VALID_DIR_CACHE(dcp)) {
- dcp->dc_actime = lbolt64;
+ dcp->dc_actime = ddi_get_lbolt64();
if (dcp->dc_fhash_mask > 0) { /* ie not minimum */
capacity = (dcp->dc_fhash_mask + 1) <<
dnlc_dir_hash_size_shift;
@@ -1740,7 +1738,7 @@ dnlc_dir_rem_space_by_handle(dcanchor_t *dcap, uint64_t handle)
mutex_enter(&dcap->dca_lock);
dcp = (dircache_t *)dcap->dca_dircache;
if (VALID_DIR_CACHE(dcp)) {
- dcp->dc_actime = lbolt64;
+ dcp->dc_actime = ddi_get_lbolt64();
if (dcp->dc_fhash_mask > 0) { /* ie not minimum */
capacity = (dcp->dc_fhash_mask + 1) <<
dnlc_dir_hash_size_shift;
@@ -1799,7 +1797,7 @@ dnlc_dir_update(dcanchor_t *dcap, char *name, uint64_t handle)
mutex_enter(&dcap->dca_lock);
dcp = (dircache_t *)dcap->dca_dircache;
if (VALID_DIR_CACHE(dcp)) {
- dcp->dc_actime = lbolt64;
+ dcp->dc_actime = ddi_get_lbolt64();
DNLC_DIR_HASH(name, hash, namlen);
dep = dcp->dc_namehash[hash & dcp->dc_nhash_mask];
while (dep != NULL) {
diff --git a/usr/src/uts/common/fs/fsflush.c b/usr/src/uts/common/fs/fsflush.c
index f83409ac13..0e0fbe0c50 100644
--- a/usr/src/uts/common/fs/fsflush.c
+++ b/usr/src/uts/common/fs/fsflush.c
@@ -422,7 +422,7 @@ loop:
ASSERT(bp->b_flags & B_DELWRI);
if ((bp->b_flags & B_DELWRI) &&
- (lbolt - bp->b_start >= autoup) &&
+ (ddi_get_lbolt() - bp->b_start >= autoup) &&
sema_tryp(&bp->b_sem)) {
bp->b_flags |= B_ASYNC;
hp->b_length--;
@@ -461,7 +461,7 @@ loop:
* inode flushing until after fsflush_iflush_delay secs have elapsed.
*/
if ((boothowto & RB_SINGLE) == 0 &&
- (lbolt64 / hz) < fsflush_iflush_delay)
+ (ddi_get_lbolt64() / hz) < fsflush_iflush_delay)
goto loop;
/*
diff --git a/usr/src/uts/common/fs/nfs/nfs4_client.c b/usr/src/uts/common/fs/nfs/nfs4_client.c
index 7335f83616..9ed69f7eed 100644
--- a/usr/src/uts/common/fs/nfs/nfs4_client.c
+++ b/usr/src/uts/common/fs/nfs/nfs4_client.c
@@ -1412,8 +1412,9 @@ nfs4_async_start(struct vfs *vfsp)
zthread_exit();
/* NOTREACHED */
}
- time_left = cv_timedwait(&mi->mi_async_work_cv,
- &mi->mi_async_lock, nfs_async_timeout + lbolt);
+ time_left = cv_reltimedwait(&mi->mi_async_work_cv,
+ &mi->mi_async_lock, nfs_async_timeout,
+ TR_CLOCK_TICK);
CALLB_CPR_SAFE_END(&cprinfo, &mi->mi_async_lock);
@@ -2619,6 +2620,7 @@ void
nfs4_write_error(vnode_t *vp, int error, cred_t *cr)
{
mntinfo4_t *mi;
+ clock_t now = ddi_get_lbolt();
mi = VTOMI4(vp);
/*
@@ -2640,7 +2642,7 @@ nfs4_write_error(vnode_t *vp, int error, cred_t *cr)
* messages from the same file system.
*/
if ((error != ENOSPC && error != EDQUOT) ||
- lbolt - mi->mi_printftime > 0) {
+ now - mi->mi_printftime > 0) {
zoneid_t zoneid = mi->mi_zone->zone_id;
#ifdef DEBUG
@@ -2661,7 +2663,7 @@ nfs4_write_error(vnode_t *vp, int error, cred_t *cr)
crgetuid(curthread->t_cred),
crgetgid(curthread->t_cred));
}
- mi->mi_printftime = lbolt +
+ mi->mi_printftime = now +
nfs_write_error_interval * hz;
}
sfh4_printfhandle(VTOR4(vp)->r_fh);
@@ -3225,8 +3227,8 @@ nfs4_renew_lease_thread(nfs4_server_t *sp)
mutex_enter(&cpr_lock);
CALLB_CPR_SAFE_BEGIN(&cpr_info);
mutex_exit(&cpr_lock);
- time_left = cv_timedwait(&sp->cv_thread_exit,
- &sp->s_lock, tick_delay + lbolt);
+ time_left = cv_reltimedwait(&sp->cv_thread_exit,
+ &sp->s_lock, tick_delay, TR_CLOCK_TICK);
mutex_enter(&cpr_lock);
CALLB_CPR_SAFE_END(&cpr_info, &cpr_lock);
mutex_exit(&cpr_lock);
@@ -3261,8 +3263,8 @@ nfs4_renew_lease_thread(nfs4_server_t *sp)
mutex_enter(&cpr_lock);
CALLB_CPR_SAFE_BEGIN(&cpr_info);
mutex_exit(&cpr_lock);
- time_left = cv_timedwait(&sp->cv_thread_exit, &sp->s_lock,
- tick_delay + lbolt);
+ time_left = cv_reltimedwait(&sp->cv_thread_exit, &sp->s_lock,
+ tick_delay, TR_CLOCK_TICK);
mutex_enter(&cpr_lock);
CALLB_CPR_SAFE_END(&cpr_info, &cpr_lock);
mutex_exit(&cpr_lock);
diff --git a/usr/src/uts/common/fs/nfs/nfs4_db.c b/usr/src/uts/common/fs/nfs/nfs4_db.c
index 13accb9eac..98685a5938 100644
--- a/usr/src/uts/common/fs/nfs/nfs4_db.c
+++ b/usr/src/uts/common/fs/nfs/nfs4_db.c
@@ -804,7 +804,7 @@ static void
reaper_thread(caddr_t *arg)
{
rfs4_table_t *table = (rfs4_table_t *)arg;
- clock_t rc, time;
+ clock_t rc, time, wakeup;
NFS4_DEBUG(table->dbt_debug,
(CE_NOTE, "rfs4_reaper_thread starting for %s", table->dbt_name));
@@ -813,12 +813,13 @@ reaper_thread(caddr_t *arg)
callb_generic_cpr, "nfsv4Reaper");
time = MIN(rfs4_reap_interval, table->dbt_max_cache_time);
+ wakeup = SEC_TO_TICK(time);
+
mutex_enter(&table->dbt_reaper_cv_lock);
do {
CALLB_CPR_SAFE_BEGIN(&table->dbt_reaper_cpr_info);
- rc = cv_timedwait_sig(&table->dbt_reaper_wait,
- &table->dbt_reaper_cv_lock,
- lbolt + SEC_TO_TICK(time));
+ rc = cv_reltimedwait_sig(&table->dbt_reaper_wait,
+ &table->dbt_reaper_cv_lock, wakeup, TR_CLOCK_TICK);
CALLB_CPR_SAFE_END(&table->dbt_reaper_cpr_info,
&table->dbt_reaper_cv_lock);
rfs4_dbe_reap(table, table->dbt_max_cache_time, 0);
diff --git a/usr/src/uts/common/fs/nfs/nfs4_deleg_ops.c b/usr/src/uts/common/fs/nfs/nfs4_deleg_ops.c
index 696e060c63..bc29ee8ae7 100644
--- a/usr/src/uts/common/fs/nfs/nfs4_deleg_ops.c
+++ b/usr/src/uts/common/fs/nfs/nfs4_deleg_ops.c
@@ -84,7 +84,7 @@ recall_all_delegations(rfs4_file_t *fp, bool_t trunc, caller_context_t *ct)
while (fp->rf_dinfo.rd_dtype != OPEN_DELEGATE_NONE) {
rc = rfs4_dbe_twait(fp->rf_dbe,
- lbolt + SEC_TO_TICK(rfs4_lease_time));
+ ddi_get_lbolt() + SEC_TO_TICK(rfs4_lease_time));
if (rc == -1) { /* timed out */
rfs4_dbe_unlock(fp->rf_dbe);
rfs4_recall_deleg(fp, trunc, NULL);
@@ -377,7 +377,7 @@ deleg_rd_vnevent(femarg_t *arg, vnevent_t vnevent, vnode_t *dvp, char *name,
rfs4_dbe_lock(fp->rf_dbe);
while (fp->rf_dinfo.rd_dtype != OPEN_DELEGATE_NONE) {
rc = rfs4_dbe_twait(fp->rf_dbe,
- lbolt + SEC_TO_TICK(rfs4_lease_time));
+ ddi_get_lbolt() + SEC_TO_TICK(rfs4_lease_time));
if (rc == -1) { /* timed out */
rfs4_dbe_unlock(fp->rf_dbe);
rfs4_recall_deleg(fp, trunc, NULL);
@@ -414,7 +414,7 @@ deleg_wr_vnevent(femarg_t *arg, vnevent_t vnevent, vnode_t *dvp, char *name,
rfs4_dbe_lock(fp->rf_dbe);
while (fp->rf_dinfo.rd_dtype != OPEN_DELEGATE_NONE) {
rc = rfs4_dbe_twait(fp->rf_dbe,
- lbolt + SEC_TO_TICK(rfs4_lease_time));
+ ddi_get_lbolt() + SEC_TO_TICK(rfs4_lease_time));
if (rc == -1) { /* timed out */
rfs4_dbe_unlock(fp->rf_dbe);
rfs4_recall_deleg(fp, trunc, NULL);
diff --git a/usr/src/uts/common/fs/nfs/nfs4_recovery.c b/usr/src/uts/common/fs/nfs/nfs4_recovery.c
index f107519eda..9d2ef14175 100644
--- a/usr/src/uts/common/fs/nfs/nfs4_recovery.c
+++ b/usr/src/uts/common/fs/nfs/nfs4_recovery.c
@@ -2479,8 +2479,8 @@ recov_openfiles(recov_info_t *recovp, nfs4_server_t *sp)
mutex_enter(&sp->s_lock);
if ((sp->s_flags & (N4S_CB_PINGED | N4S_CB_WAITER)) == 0) {
sp->s_flags |= N4S_CB_WAITER;
- (void) cv_timedwait(&sp->wait_cb_null, &sp->s_lock,
- (lbolt + drv_usectohz(N4S_CB_PAUSE_TIME)));
+ (void) cv_reltimedwait(&sp->wait_cb_null, &sp->s_lock,
+ drv_usectohz(N4S_CB_PAUSE_TIME), TR_CLOCK_TICK);
}
mutex_exit(&sp->s_lock);
diff --git a/usr/src/uts/common/fs/nfs/nfs4_srv.c b/usr/src/uts/common/fs/nfs/nfs4_srv.c
index 27eb457b05..d7f71fa380 100644
--- a/usr/src/uts/common/fs/nfs/nfs4_srv.c
+++ b/usr/src/uts/common/fs/nfs/nfs4_srv.c
@@ -597,7 +597,7 @@ void
rfs4_grace_start(rfs4_servinst_t *sip)
{
rw_enter(&sip->rwlock, RW_WRITER);
- sip->start_time = (time_t)TICK_TO_SEC(lbolt);
+ sip->start_time = (time_t)TICK_TO_SEC(ddi_get_lbolt());
sip->grace_period = rfs4_grace_period;
rw_exit(&sip->rwlock);
}
@@ -630,7 +630,7 @@ rfs4_servinst_in_grace(rfs4_servinst_t *sip)
grace_expiry = sip->start_time + sip->grace_period;
rw_exit(&sip->rwlock);
- return (((time_t)TICK_TO_SEC(lbolt)) < grace_expiry);
+ return (((time_t)TICK_TO_SEC(ddi_get_lbolt())) < grace_expiry);
}
int
diff --git a/usr/src/uts/common/fs/nfs/nfs4_stub_vnops.c b/usr/src/uts/common/fs/nfs/nfs4_stub_vnops.c
index e26f15264c..37bc502b0b 100644
--- a/usr/src/uts/common/fs/nfs/nfs4_stub_vnops.c
+++ b/usr/src/uts/common/fs/nfs/nfs4_stub_vnops.c
@@ -2370,7 +2370,7 @@ nfs4_ephemeral_harvester(nfs4_trigger_globals_t *ntg)
zone_t *zone = curproc->p_zone;
for (;;) {
- timeleft = zone_status_timedwait(zone, lbolt +
+ timeleft = zone_status_timedwait(zone, ddi_get_lbolt() +
nfs4_trigger_thread_timer * hz, ZONE_IS_SHUTTING_DOWN);
/*
diff --git a/usr/src/uts/common/fs/nfs/nfs_client.c b/usr/src/uts/common/fs/nfs/nfs_client.c
index 3c5d02fad9..a32d730ea7 100644
--- a/usr/src/uts/common/fs/nfs/nfs_client.c
+++ b/usr/src/uts/common/fs/nfs/nfs_client.c
@@ -2050,8 +2050,9 @@ nfs_async_start(struct vfs *vfsp)
zthread_exit();
/* NOTREACHED */
}
- time_left = cv_timedwait(&mi->mi_async_work_cv,
- &mi->mi_async_lock, nfs_async_timeout + lbolt);
+ time_left = cv_reltimedwait(&mi->mi_async_work_cv,
+ &mi->mi_async_lock, nfs_async_timeout,
+ TR_CLOCK_TICK);
CALLB_CPR_SAFE_END(&cprinfo, &mi->mi_async_lock);
@@ -2554,6 +2555,7 @@ void
nfs_write_error(vnode_t *vp, int error, cred_t *cr)
{
mntinfo_t *mi;
+ clock_t now;
mi = VTOMI(vp);
/*
@@ -2567,8 +2569,9 @@ nfs_write_error(vnode_t *vp, int error, cred_t *cr)
* No use in flooding the console with ENOSPC
* messages from the same file system.
*/
+ now = ddi_get_lbolt();
if ((error != ENOSPC && error != EDQUOT) ||
- lbolt - mi->mi_printftime > 0) {
+ now - mi->mi_printftime > 0) {
zoneid_t zoneid = mi->mi_zone->zone_id;
#ifdef DEBUG
@@ -2588,7 +2591,7 @@ nfs_write_error(vnode_t *vp, int error, cred_t *cr)
MSG("^User: userid=%d, groupid=%d\n"),
crgetuid(CRED()), crgetgid(CRED()));
}
- mi->mi_printftime = lbolt +
+ mi->mi_printftime = now +
nfs_write_error_interval * hz;
}
nfs_printfhandle(&VTOR(vp)->r_fh);
diff --git a/usr/src/uts/common/fs/nfs/nfs_dump.c b/usr/src/uts/common/fs/nfs/nfs_dump.c
index 98a69cca50..9b570716d8 100644
--- a/usr/src/uts/common/fs/nfs/nfs_dump.c
+++ b/usr/src/uts/common/fs/nfs/nfs_dump.c
@@ -19,16 +19,15 @@
* CDDL HEADER END
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/*
* Dump memory to NFS swap file after a panic.
* We have no timeouts, context switches, etc.
*/
+
#include <rpc/types.h>
#include <sys/param.h>
#include <sys/errno.h>
@@ -452,7 +451,7 @@ nd_get_reply(TIUSER *tiptr, XDR *xdrp, uint32_t call_xid, int *badmsg)
static int
nd_poll(TIUSER *tiptr, int retry, int *eventp)
{
- clock_t start_bolt = lbolt;
+ clock_t start_bolt = ddi_get_lbolt();
clock_t timout = TIMEOUT * (retry + 1);
int error;
@@ -460,7 +459,7 @@ nd_poll(TIUSER *tiptr, int retry, int *eventp)
*eventp = 0;
- while (!*eventp && ((lbolt - start_bolt) < timout)) {
+ while (!*eventp && ((ddi_get_lbolt() - start_bolt) < timout)) {
/*
* Briefly enable interrupts before checking for a reply;
* the network transports do not yet support do_polled_io.
diff --git a/usr/src/uts/common/fs/smbclnt/netsmb/smb_iod.c b/usr/src/uts/common/fs/smbclnt/netsmb/smb_iod.c
index 8f6e95de23..f6bba8380a 100644
--- a/usr/src/uts/common/fs/smbclnt/netsmb/smb_iod.c
+++ b/usr/src/uts/common/fs/smbclnt/netsmb/smb_iod.c
@@ -786,10 +786,11 @@ smb_iod_waitrq(struct smb_rq *rqp)
* start the timer(s) after the request is sent.
*/
if (smb_timo_notice && (smb_timo_notice < rqp->sr_timo))
- tmo1 = lbolt + SEC_TO_TICK(smb_timo_notice);
+ tmo1 = SEC_TO_TICK(smb_timo_notice);
else
tmo1 = 0;
- tmo2 = lbolt + SEC_TO_TICK(rqp->sr_timo);
+
+ tmo2 = ddi_get_lbolt() + SEC_TO_TICK(rqp->sr_timo);
/*
* As above, we don't want to allow interrupt for some
@@ -802,11 +803,11 @@ smb_iod_waitrq(struct smb_rq *rqp)
*/
if (tmo1 && rqp->sr_rpgen == rqp->sr_rplast) {
if (rqp->sr_flags & SMBR_NOINTR_RECV)
- tr = cv_timedwait(&rqp->sr_cond,
- &rqp->sr_lock, tmo1);
+ tr = cv_reltimedwait(&rqp->sr_cond,
+ &rqp->sr_lock, tmo1, TR_CLOCK_TICK);
else
- tr = cv_timedwait_sig(&rqp->sr_cond,
- &rqp->sr_lock, tmo1);
+ tr = cv_reltimedwait_sig(&rqp->sr_cond,
+ &rqp->sr_lock, tmo1, TR_CLOCK_TICK);
if (tr == 0) {
error = EINTR;
goto out;
@@ -1064,7 +1065,7 @@ out:
int
smb_iod_vc_idle(struct smb_vc *vcp)
{
- clock_t tr, tmo;
+ clock_t tr, delta = SEC_TO_TICK(15);
int err = 0;
/*
@@ -1075,8 +1076,8 @@ smb_iod_vc_idle(struct smb_vc *vcp)
SMB_VC_LOCK(vcp);
while (vcp->vc_state == SMBIOD_ST_IDLE) {
- tmo = lbolt + SEC_TO_TICK(15);
- tr = cv_timedwait_sig(&vcp->iod_idle, &vcp->vc_lock, tmo);
+ tr = cv_reltimedwait_sig(&vcp->iod_idle, &vcp->vc_lock,
+ delta, TR_CLOCK_TICK);
if (tr == 0) {
err = EINTR;
break;
@@ -1103,7 +1104,7 @@ smb_iod_vc_idle(struct smb_vc *vcp)
int
smb_iod_vc_rcfail(struct smb_vc *vcp)
{
- clock_t tr, tmo;
+ clock_t tr;
int err = 0;
/*
@@ -1125,8 +1126,8 @@ smb_iod_vc_rcfail(struct smb_vc *vcp)
* (1) Give requests a chance to error out.
* (2) Prevent immediate retry.
*/
- tmo = lbolt + SEC_TO_TICK(5);
- tr = cv_timedwait_sig(&vcp->iod_idle, &vcp->vc_lock, tmo);
+ tr = cv_reltimedwait_sig(&vcp->iod_idle, &vcp->vc_lock,
+ SEC_TO_TICK(5), TR_CLOCK_TICK);
if (tr == 0)
err = EINTR;
diff --git a/usr/src/uts/common/fs/smbclnt/netsmb/smb_rq.c b/usr/src/uts/common/fs/smbclnt/netsmb/smb_rq.c
index 5199127d47..0985d58ff4 100644
--- a/usr/src/uts/common/fs/smbclnt/netsmb/smb_rq.c
+++ b/usr/src/uts/common/fs/smbclnt/netsmb/smb_rq.c
@@ -261,11 +261,11 @@ smb_rq_simple_timed(struct smb_rq *rqp, int timeout)
break;
SMBRQ_LOCK(rqp);
if (rqp->sr_share) {
- cv_timedwait(&rqp->sr_cond, &(rqp)->sr_lock,
- lbolt + (hz * SMB_RCNDELAY));
+ cv_reltimedwait(&rqp->sr_cond, &(rqp)->sr_lock,
+ (hz * SMB_RCNDELAY), TR_CLOCK_TICK);
} else {
- delay(lbolt + (hz * SMB_RCNDELAY));
+ delay(ddi_get_lbolt() + (hz * SMB_RCNDELAY));
}
SMBRQ_UNLOCK(rqp);
rqp->sr_rexmit--;
@@ -1409,10 +1409,10 @@ smb_t2_request(struct smb_t2rq *t2p)
break;
mutex_enter(&(t2p)->t2_lock);
if (t2p->t2_share) {
- cv_timedwait(&t2p->t2_cond, &(t2p)->t2_lock,
- lbolt + (hz * SMB_RCNDELAY));
+ cv_reltimedwait(&t2p->t2_cond, &(t2p)->t2_lock,
+ (hz * SMB_RCNDELAY), TR_CLOCK_TICK);
} else {
- delay(lbolt + (hz * SMB_RCNDELAY));
+ delay(ddi_get_lbolt() + (hz * SMB_RCNDELAY));
}
mutex_exit(&(t2p)->t2_lock);
}
@@ -1442,11 +1442,11 @@ smb_nt_request(struct smb_ntrq *ntp)
break;
mutex_enter(&(ntp)->nt_lock);
if (ntp->nt_share) {
- cv_timedwait(&ntp->nt_cond, &(ntp)->nt_lock,
- lbolt + (hz * SMB_RCNDELAY));
+ cv_reltimedwait(&ntp->nt_cond, &(ntp)->nt_lock,
+ (hz * SMB_RCNDELAY), TR_CLOCK_TICK);
} else {
- delay(lbolt + (hz * SMB_RCNDELAY));
+ delay(ddi_get_lbolt() + (hz * SMB_RCNDELAY));
}
mutex_exit(&(ntp)->nt_lock);
}
diff --git a/usr/src/uts/common/fs/smbsrv/smb_lock.c b/usr/src/uts/common/fs/smbsrv/smb_lock.c
index d74aa0be32..5032bac80b 100644
--- a/usr/src/uts/common/fs/smbsrv/smb_lock.c
+++ b/usr/src/uts/common/fs/smbsrv/smb_lock.c
@@ -725,7 +725,7 @@ smb_lock_create(
* Calculate the absolute end time so that we can use it
* in cv_timedwait.
*/
- lock->l_end_time = lbolt + MSEC_TO_TICK(timeout);
+ lock->l_end_time = ddi_get_lbolt() + MSEC_TO_TICK(timeout);
if (timeout == UINT_MAX)
lock->l_flags |= SMB_LOCK_FLAG_INDEFINITE;
diff --git a/usr/src/uts/common/fs/smbsrv/smb_opipe.c b/usr/src/uts/common/fs/smbsrv/smb_opipe.c
index 3048e034e7..092f726535 100644
--- a/usr/src/uts/common/fs/smbsrv/smb_opipe.c
+++ b/usr/src/uts/common/fs/smbsrv/smb_opipe.c
@@ -232,7 +232,7 @@ smb_opipe_fid(void)
mutex_enter(&smb_opipe_fid_mutex);
if (opipe_fid == 0)
- opipe_fid = lbolt << 11;
+ opipe_fid = ddi_get_lbolt() << 11;
do {
++opipe_fid;
diff --git a/usr/src/uts/common/fs/smbsrv/smb_session.c b/usr/src/uts/common/fs/smbsrv/smb_session.c
index 14971d067e..6d31a3d2a4 100644
--- a/usr/src/uts/common/fs/smbsrv/smb_session.c
+++ b/usr/src/uts/common/fs/smbsrv/smb_session.c
@@ -640,6 +640,7 @@ smb_session_create(ksocket_t new_so, uint16_t port, smb_server_t *sv,
socklen_t slen;
struct sockaddr_in6 sin6;
smb_session_t *session;
+ int64_t now;
session = kmem_cache_alloc(sv->si_cache_session, KM_SLEEP);
bzero(session, sizeof (smb_session_t));
@@ -649,12 +650,14 @@ smb_session_create(ksocket_t new_so, uint16_t port, smb_server_t *sv,
return (NULL);
}
+ now = ddi_get_lbolt64();
+
session->s_kid = SMB_NEW_KID();
session->s_state = SMB_SESSION_STATE_INITIALIZED;
session->native_os = NATIVE_OS_UNKNOWN;
- session->opentime = lbolt64;
+ session->opentime = now;
session->keep_alive = smb_keep_alive;
- session->activity_timestamp = lbolt64;
+ session->activity_timestamp = now;
smb_slist_constructor(&session->s_req_list, sizeof (smb_request_t),
offsetof(smb_request_t, sr_session_lnd));
diff --git a/usr/src/uts/common/fs/smbsrv/smb_util.c b/usr/src/uts/common/fs/smbsrv/smb_util.c
index cfc1264fb4..01d6fdd3bb 100644
--- a/usr/src/uts/common/fs/smbsrv/smb_util.c
+++ b/usr/src/uts/common/fs/smbsrv/smb_util.c
@@ -392,7 +392,7 @@ microtime(timestruc_t *tvp)
int32_t
clock_get_milli_uptime()
{
- return (TICK_TO_MSEC(lbolt));
+ return (TICK_TO_MSEC(ddi_get_lbolt()));
}
int /*ARGSUSED*/
@@ -1105,15 +1105,14 @@ static boolean_t
smb_thread_continue_timedwait_locked(smb_thread_t *thread, int ticks)
{
boolean_t result;
- clock_t finish_time = lbolt + ticks;
/* -1 means don't block */
if (ticks != -1 && !thread->sth_kill) {
if (ticks == 0) {
cv_wait(&thread->sth_cv, &thread->sth_mtx);
} else {
- (void) cv_timedwait(&thread->sth_cv, &thread->sth_mtx,
- finish_time);
+ (void) cv_reltimedwait(&thread->sth_cv,
+ &thread->sth_mtx, (clock_t)ticks, TR_CLOCK_TICK);
}
}
result = (thread->sth_kill == 0);
@@ -1258,8 +1257,8 @@ smb_rwx_rwwait(
rc = 1;
cv_wait(&rwx->rwx_cv, &rwx->rwx_mutex);
} else {
- rc = cv_timedwait(&rwx->rwx_cv, &rwx->rwx_mutex,
- lbolt + timeout);
+ rc = cv_reltimedwait(&rwx->rwx_cv, &rwx->rwx_mutex,
+ timeout, TR_CLOCK_TICK);
}
}
mutex_exit(&rwx->rwx_mutex);
diff --git a/usr/src/uts/common/fs/sockfs/nl7chttp.c b/usr/src/uts/common/fs/sockfs/nl7chttp.c
index 81dd8a99a5..8019295836 100644
--- a/usr/src/uts/common/fs/sockfs/nl7chttp.c
+++ b/usr/src/uts/common/fs/sockfs/nl7chttp.c
@@ -19,7 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -1797,10 +1797,11 @@ done:
goto pass;
}
/* Have a valid expire and date so calc an lbolt expire */
- uri->expire = lbolt + SEC_TO_TICK(http->expire - http->date);
+ uri->expire = ddi_get_lbolt() + SEC_TO_TICK(http->expire -
+ http->date);
} else if (nl7c_uri_ttl != -1) {
/* No valid expire speced and we have a TTL */
- uri->expire = lbolt + SEC_TO_TICK(nl7c_uri_ttl);
+ uri->expire = ddi_get_lbolt() + SEC_TO_TICK(nl7c_uri_ttl);
}
chunked:
diff --git a/usr/src/uts/common/fs/sockfs/nl7curi.c b/usr/src/uts/common/fs/sockfs/nl7curi.c
index f0ba55de87..ae133979fa 100644
--- a/usr/src/uts/common/fs/sockfs/nl7curi.c
+++ b/usr/src/uts/common/fs/sockfs/nl7curi.c
@@ -821,7 +821,8 @@ nexthash:
* of requested URI, check for expire or request no cache
* purge.
*/
- if (uri->expire >= 0 && uri->expire <= lbolt || ruri->nocache) {
+ if (uri->expire >= 0 && uri->expire <= ddi_get_lbolt() ||
+ ruri->nocache) {
/*
* URI has expired or request specified to not use
* the cached version, unlink the URI from the hash
diff --git a/usr/src/uts/common/fs/sockfs/sockcommon_subr.c b/usr/src/uts/common/fs/sockfs/sockcommon_subr.c
index 9b806d0a4a..98cb194037 100644
--- a/usr/src/uts/common/fs/sockfs/sockcommon_subr.c
+++ b/usr/src/uts/common/fs/sockfs/sockcommon_subr.c
@@ -311,11 +311,8 @@ so_snd_wait_qnotfull_locked(struct sonode *so, boolean_t dontblock)
*/
error = cv_wait_sig(&so->so_snd_cv, &so->so_lock);
} else {
- clock_t now;
-
- time_to_wait(&now, so->so_sndtimeo);
- error = cv_timedwait_sig(&so->so_snd_cv, &so->so_lock,
- now);
+ error = cv_reltimedwait_sig(&so->so_snd_cv,
+ &so->so_lock, so->so_sndtimeo, TR_CLOCK_TICK);
}
if (error == 0)
return (EINTR);
@@ -971,10 +968,9 @@ try_again:
error = cv_wait_sig(&so->so_rcv_cv,
&so->so_lock);
} else {
- clock_t now;
- time_to_wait(&now, so->so_rcvtimeo);
- error = cv_timedwait_sig(&so->so_rcv_cv,
- &so->so_lock, now);
+ error = cv_reltimedwait_sig(
+ &so->so_rcv_cv, &so->so_lock,
+ so->so_rcvtimeo, TR_CLOCK_TICK);
}
so->so_rcv_wakeup = B_FALSE;
so->so_rcv_wanted = 0;
@@ -1558,6 +1554,7 @@ so_strioc_nread(struct sonode *so, intptr_t arg, int mode, int32_t *rvalp)
int retval;
int count = 0;
mblk_t *mp;
+ clock_t wakeup = drv_usectohz(10);
if (so->so_downcalls == NULL ||
so->so_downcalls->sd_recv_uio != NULL)
@@ -1575,8 +1572,8 @@ so_strioc_nread(struct sonode *so, intptr_t arg, int mode, int32_t *rvalp)
so->so_flag |= SOWANT;
/* Do a timed sleep, in case the reader goes to sleep. */
- (void) cv_timedwait(&so->so_state_cv, &so->so_lock,
- lbolt + drv_usectohz(10));
+ (void) cv_reltimedwait(&so->so_state_cv, &so->so_lock, wakeup,
+ TR_CLOCK_TICK);
}
/*
diff --git a/usr/src/uts/common/fs/sockfs/sockstr.c b/usr/src/uts/common/fs/sockfs/sockstr.c
index 26f3d4bd91..dc2af07a93 100644
--- a/usr/src/uts/common/fs/sockfs/sockstr.c
+++ b/usr/src/uts/common/fs/sockfs/sockstr.c
@@ -1078,11 +1078,8 @@ sowaitack(struct sonode *so, mblk_t **mpp, clock_t wait)
/*
* Only wait for the time limit.
*/
- clock_t now;
-
- time_to_wait(&now, wait);
- if (cv_timedwait(&sti->sti_ack_cv, &so->so_lock,
- now) == -1) {
+ if (cv_reltimedwait(&sti->sti_ack_cv, &so->so_lock,
+ wait, TR_CLOCK_TICK) == -1) {
eprintsoline(so, ETIME);
return (ETIME);
}
diff --git a/usr/src/uts/common/fs/sockfs/socksyscalls.c b/usr/src/uts/common/fs/sockfs/socksyscalls.c
index bab4753591..9a25a7362d 100644
--- a/usr/src/uts/common/fs/sockfs/socksyscalls.c
+++ b/usr/src/uts/common/fs/sockfs/socksyscalls.c
@@ -1986,7 +1986,6 @@ snf_async_thread(void)
snf_req_t *sr;
callb_cpr_t cprinfo;
clock_t time_left = 1;
- clock_t now;
CALLB_CPR_INIT(&cprinfo, &snfq->snfq_lock, callb_generic_cpr, "snfq");
@@ -2006,9 +2005,8 @@ snf_async_thread(void)
}
snfq->snfq_idle_cnt++;
- time_to_wait(&now, snfq_timeout);
- time_left = cv_timedwait(&snfq->snfq_cv,
- &snfq->snfq_lock, now);
+ time_left = cv_reltimedwait(&snfq->snfq_cv,
+ &snfq->snfq_lock, snfq_timeout, TR_CLOCK_TICK);
snfq->snfq_idle_cnt--;
CALLB_CPR_SAFE_END(&cprinfo, &snfq->snfq_lock);
diff --git a/usr/src/uts/common/fs/ufs/lufs.c b/usr/src/uts/common/fs/ufs/lufs.c
index 8d49b12ac0..301bb09c01 100644
--- a/usr/src/uts/common/fs/ufs/lufs.c
+++ b/usr/src/uts/common/fs/ufs/lufs.c
@@ -1299,7 +1299,7 @@ lufs_read_strategy(ml_unit_t *ul, buf_t *bp)
bp->b_error = EIO;
biodone(bp);
} else {
- ul->un_ufsvfs->vfs_iotstamp = lbolt;
+ ul->un_ufsvfs->vfs_iotstamp = ddi_get_lbolt();
logstats.ls_lreads.value.ui64++;
(void) bdev_strategy(bp);
lwp_stat_update(LWP_STAT_INBLK, 1);
@@ -1401,7 +1401,7 @@ lufs_write_strategy(ml_unit_t *ul, buf_t *bp)
!(matamap_overlap(ul->un_matamap, mof, nb) &&
((bp->b_flags & B_PHYS) == 0)));
- ul->un_ufsvfs->vfs_iotstamp = lbolt;
+ ul->un_ufsvfs->vfs_iotstamp = ddi_get_lbolt();
logstats.ls_lwrites.value.ui64++;
/* If snapshots are enabled, write through the snapshot driver */
diff --git a/usr/src/uts/common/fs/ufs/lufs_log.c b/usr/src/uts/common/fs/ufs/lufs_log.c
index faec6f915e..2ec3f7907c 100644
--- a/usr/src/uts/common/fs/ufs/lufs_log.c
+++ b/usr/src/uts/common/fs/ufs/lufs_log.c
@@ -19,7 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -205,7 +205,7 @@ ldl_strategy(ml_unit_t *ul, buf_t *pb)
} else {
if (read) {
logstats.ls_ldlreads.value.ui64++;
- ufsvfsp->vfs_iotstamp = lbolt;
+ ufsvfsp->vfs_iotstamp = ddi_get_lbolt();
lwp_stat_update(LWP_STAT_INBLK, 1);
} else {
logstats.ls_ldlwrites.value.ui64++;
diff --git a/usr/src/uts/common/fs/ufs/lufs_thread.c b/usr/src/uts/common/fs/ufs/lufs_thread.c
index fba11199a6..da37db94df 100644
--- a/usr/src/uts/common/fs/ufs/lufs_thread.c
+++ b/usr/src/uts/common/fs/ufs/lufs_thread.c
@@ -19,12 +19,10 @@
* CDDL HEADER END
*/
/*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <sys/systm.h>
#include <sys/types.h>
#include <sys/vnode.h>
@@ -92,8 +90,8 @@ trans_roll_wait(mt_map_t *logmap, callb_cpr_t *cprinfop)
}
logmap->mtm_flags &= ~(MTM_FORCE_ROLL | MTM_ROLLING);
CALLB_CPR_SAFE_BEGIN(cprinfop);
- (void) cv_timedwait(&logmap->mtm_to_roll_cv, &logmap->mtm_mutex,
- lbolt + trans_roll_tics);
+ (void) cv_reltimedwait(&logmap->mtm_to_roll_cv, &logmap->mtm_mutex,
+ trans_roll_tics, TR_CLOCK_TICK);
CALLB_CPR_SAFE_END(cprinfop, &logmap->mtm_mutex);
logmap->mtm_flags |= MTM_ROLLING;
mutex_exit(&logmap->mtm_mutex);
diff --git a/usr/src/uts/common/fs/ufs/ufs_alloc.c b/usr/src/uts/common/fs/ufs/ufs_alloc.c
index d446ddc1e3..3e4d38a9b2 100644
--- a/usr/src/uts/common/fs/ufs/ufs_alloc.c
+++ b/usr/src/uts/common/fs/ufs/ufs_alloc.c
@@ -111,6 +111,7 @@ alloc(struct inode *ip, daddr_t bpref, int size, daddr_t *bnp, cred_t *cr)
int err;
char *errmsg = NULL;
size_t len;
+ clock_t now;
ufsvfsp = ip->i_ufsvfs;
fs = ufsvfsp->vfs_fs;
@@ -158,10 +159,11 @@ alloc(struct inode *ip, daddr_t bpref, int size, daddr_t *bnp, cred_t *cr)
(size_t *)NULL);
nospace:
+ now = ddi_get_lbolt();
mutex_enter(&ufsvfsp->vfs_lock);
- if ((lbolt - ufsvfsp->vfs_lastwhinetime) > (hz << 2) &&
+ if ((now - ufsvfsp->vfs_lastwhinetime) > (hz << 2) &&
(!(TRANS_ISTRANS(ufsvfsp)) || !(ip->i_flag & IQUIET))) {
- ufsvfsp->vfs_lastwhinetime = lbolt;
+ ufsvfsp->vfs_lastwhinetime = now;
cmn_err(CE_NOTE, "alloc: %s: file system full", fs->fs_fsmnt);
}
mutex_exit(&ufsvfsp->vfs_lock);
@@ -187,6 +189,7 @@ realloccg(struct inode *ip, daddr_t bprev, daddr_t bpref, int osize,
int err;
char *errmsg = NULL;
size_t len;
+ clock_t now;
ufsvfsp = ip->i_ufsvfs;
fs = ufsvfsp->vfs_fs;
@@ -260,10 +263,11 @@ realloccg(struct inode *ip, daddr_t bprev, daddr_t bpref, int osize,
(size_t *)NULL);
nospace:
+ now = ddi_get_lbolt();
mutex_enter(&ufsvfsp->vfs_lock);
- if ((lbolt - ufsvfsp->vfs_lastwhinetime) > (hz << 2) &&
+ if ((now - ufsvfsp->vfs_lastwhinetime) > (hz << 2) &&
(!(TRANS_ISTRANS(ufsvfsp)) || !(ip->i_flag & IQUIET))) {
- ufsvfsp->vfs_lastwhinetime = lbolt;
+ ufsvfsp->vfs_lastwhinetime = now;
cmn_err(CE_NOTE,
"realloccg %s: file system full", fs->fs_fsmnt);
}
diff --git a/usr/src/uts/common/fs/ufs/ufs_directio.c b/usr/src/uts/common/fs/ufs/ufs_directio.c
index 05afd6d25f..86f7f559eb 100644
--- a/usr/src/uts/common/fs/ufs/ufs_directio.c
+++ b/usr/src/uts/common/fs/ufs/ufs_directio.c
@@ -314,7 +314,7 @@ directio_start(struct ufsvfs *ufsvfsp, struct inode *ip, size_t nbytes,
/*
* Issue I/O request.
*/
- ufsvfsp->vfs_iotstamp = lbolt;
+ ufsvfsp->vfs_iotstamp = ddi_get_lbolt();
if (ufsvfsp->vfs_snapshot)
fssnap_strategy(&ufsvfsp->vfs_snapshot, bp);
else
diff --git a/usr/src/uts/common/fs/ufs/ufs_inode.c b/usr/src/uts/common/fs/ufs/ufs_inode.c
index 760043a2d9..40e051005a 100644
--- a/usr/src/uts/common/fs/ufs/ufs_inode.c
+++ b/usr/src/uts/common/fs/ufs/ufs_inode.c
@@ -19,7 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -1192,7 +1192,7 @@ ufs_itrunc(struct inode *oip, u_offset_t length, int flags, cred_t *cr)
if (flags & I_FREE) {
i_genrand *= 16843009; /* turns into shift and adds */
i_genrand++;
- oip->i_gen += ((i_genrand + lbolt) & 0xffff) + 1;
+ oip->i_gen += ((i_genrand + ddi_get_lbolt()) & 0xffff) + 1;
oip->i_flag |= ICHG |IUPD;
oip->i_seq++;
if (length == oip->i_size)
diff --git a/usr/src/uts/common/fs/ufs/ufs_lockfs.c b/usr/src/uts/common/fs/ufs/ufs_lockfs.c
index 78836c6335..bbcad8883b 100644
--- a/usr/src/uts/common/fs/ufs/ufs_lockfs.c
+++ b/usr/src/uts/common/fs/ufs/ufs_lockfs.c
@@ -277,7 +277,8 @@ ufs_quiesce(struct ulockfs *ulp)
if (!ulp->ul_vnops_cnt && !ULOCKFS_IS_FWLOCK(ulp))
goto out;
}
- if (!cv_timedwait_sig(&ulp->ul_cv, &ulp->ul_lock, lbolt + hz)) {
+ if (!cv_reltimedwait_sig(&ulp->ul_cv, &ulp->ul_lock, hz,
+ TR_CLOCK_TICK)) {
error = EINTR;
goto out;
}
diff --git a/usr/src/uts/common/fs/ufs/ufs_panic.c b/usr/src/uts/common/fs/ufs/ufs_panic.c
index 5dbb1add54..ced31d8a70 100644
--- a/usr/src/uts/common/fs/ufs/ufs_panic.c
+++ b/usr/src/uts/common/fs/ufs/ufs_panic.c
@@ -19,12 +19,10 @@
* CDDL HEADER END
*/
/*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <sys/types.h>
#include <sys/param.h>
#include <sys/systm.h>
@@ -1089,8 +1087,9 @@ ufsfx_thread_fix_failures(void *ignored)
if (retry) {
mutex_enter(&ufs_fix.uq_mutex);
CALLB_CPR_SAFE_BEGIN(&cprinfo);
- (void) cv_timedwait(&ufs_fix.uq_cv,
- &ufs_fix.uq_mutex, lbolt + (hz * retry));
+ (void) cv_reltimedwait(&ufs_fix.uq_cv,
+ &ufs_fix.uq_mutex, (hz * retry),
+ TR_CLOCK_TICK);
CALLB_CPR_SAFE_END(&cprinfo,
&ufs_fix.uq_mutex);
mutex_exit(&ufs_fix.uq_mutex);
diff --git a/usr/src/uts/common/fs/ufs/ufs_subr.c b/usr/src/uts/common/fs/ufs/ufs_subr.c
index d8d4090ea8..0ef1f8280d 100644
--- a/usr/src/uts/common/fs/ufs/ufs_subr.c
+++ b/usr/src/uts/common/fs/ufs/ufs_subr.c
@@ -19,7 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -424,7 +424,7 @@ ufs_sync_inode(struct inode *ip, void *arg)
* flushed when I/Os start again.
*/
if (cheap && (ufsvfsp->vfs_dfritime & UFS_DFRATIME) &&
- (ufsvfsp->vfs_iotstamp + ufs_iowait < lbolt))
+ (ufsvfsp->vfs_iotstamp + ufs_iowait < ddi_get_lbolt()))
return (0);
/*
* an app issueing a sync() can take forever on a trans device
@@ -1103,7 +1103,7 @@ ufs_fbiwrite(struct fbuf *fbp, struct inode *ip, daddr_t bn, long bsize)
} else if (ufsvfsp->vfs_snapshot) {
fssnap_strategy(&ufsvfsp->vfs_snapshot, bp);
} else {
- ufsvfsp->vfs_iotstamp = lbolt;
+ ufsvfsp->vfs_iotstamp = ddi_get_lbolt();
ub.ub_fbiwrites.value.ul++;
(void) bdev_strategy(bp);
lwp_stat_update(LWP_STAT_OUBLK, 1);
diff --git a/usr/src/uts/common/fs/ufs/ufs_thread.c b/usr/src/uts/common/fs/ufs/ufs_thread.c
index 1ea7d1f1b3..9ea1d8c980 100644
--- a/usr/src/uts/common/fs/ufs/ufs_thread.c
+++ b/usr/src/uts/common/fs/ufs/ufs_thread.c
@@ -19,7 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -1154,8 +1154,8 @@ ufs_thread_hlock(void *ignore)
if (retry) {
mutex_enter(&ufs_hlock.uq_mutex);
CALLB_CPR_SAFE_BEGIN(&cprinfo);
- (void) cv_timedwait(&ufs_hlock.uq_cv,
- &ufs_hlock.uq_mutex, lbolt + hz);
+ (void) cv_reltimedwait(&ufs_hlock.uq_cv,
+ &ufs_hlock.uq_mutex, hz, TR_CLOCK_TICK);
CALLB_CPR_SAFE_END(&cprinfo,
&ufs_hlock.uq_mutex);
mutex_exit(&ufs_hlock.uq_mutex);
diff --git a/usr/src/uts/common/fs/ufs/ufs_vfsops.c b/usr/src/uts/common/fs/ufs/ufs_vfsops.c
index a2bfd32f52..b41947eeb1 100644
--- a/usr/src/uts/common/fs/ufs/ufs_vfsops.c
+++ b/usr/src/uts/common/fs/ufs/ufs_vfsops.c
@@ -36,7 +36,6 @@
* contributors.
*/
-
#include <sys/types.h>
#include <sys/t_lock.h>
#include <sys/param.h>
@@ -617,7 +616,7 @@ remountfs(struct vfs *vfsp, dev_t dev, void *raw_argsp, int args_len)
ufsvfsp->vfs_forcedirectio = 1;
else /* default is no direct I/O */
ufsvfsp->vfs_forcedirectio = 0;
- ufsvfsp->vfs_iotstamp = lbolt;
+ ufsvfsp->vfs_iotstamp = ddi_get_lbolt();
/*
* set largefiles flag in ufsvfs equal to the
@@ -646,7 +645,8 @@ remountfs(struct vfs *vfsp, dev_t dev, void *raw_argsp, int args_len)
* XXX UFSMNT_ONERROR_RDONLY rather than UFSMNT_ONERROR_PANIC
*/
#define BOOT_TIME_LIMIT (180*hz)
- if (!(flags & UFSMNT_ONERROR_FLGMASK) && lbolt < BOOT_TIME_LIMIT) {
+ if (!(flags & UFSMNT_ONERROR_FLGMASK) &&
+ ddi_get_lbolt() < BOOT_TIME_LIMIT) {
cmn_err(CE_WARN, "%s is required to be mounted onerror=%s",
ufsvfsp->vfs_fs->fs_fsmnt, UFSMNT_ONERROR_PANIC_STR);
flags |= UFSMNT_ONERROR_PANIC;
@@ -1185,7 +1185,7 @@ mountfs(struct vfs *vfsp, enum whymountroot why, struct vnode *devvp,
ufsvfsp->vfs_forcedirectio = 1;
else if (flags & UFSMNT_NOFORCEDIRECTIO)
ufsvfsp->vfs_forcedirectio = 0;
- ufsvfsp->vfs_iotstamp = lbolt;
+ ufsvfsp->vfs_iotstamp = ddi_get_lbolt();
ufsvfsp->vfs_nindiroffset = fsp->fs_nindir - 1;
ufsvfsp->vfs_nindirshift = highbit(ufsvfsp->vfs_nindiroffset);
@@ -1444,7 +1444,7 @@ ufs_unmount(struct vfs *vfsp, int fflag, struct cred *cr)
}
/* let all types of writes go through */
- ufsvfsp->vfs_iotstamp = lbolt;
+ ufsvfsp->vfs_iotstamp = ddi_get_lbolt();
/* coordinate with global hlock thread */
if (TRANS_ISTRANS(ufsvfsp) && (ufsvfsp->vfs_validfs == UT_HLOCKING)) {
diff --git a/usr/src/uts/common/fs/ufs/ufs_vnops.c b/usr/src/uts/common/fs/ufs/ufs_vnops.c
index 03faaab8ec..ff4632806d 100644
--- a/usr/src/uts/common/fs/ufs/ufs_vnops.c
+++ b/usr/src/uts/common/fs/ufs/ufs_vnops.c
@@ -1351,6 +1351,7 @@ rdip(struct inode *ip, struct uio *uio, int ioflag, cred_t *cr)
int dofree, directio_status;
krw_t rwtype;
o_mode_t type;
+ clock_t now;
vp = ITOV(ip);
@@ -1419,7 +1420,8 @@ rdip(struct inode *ip, struct uio *uio, int ioflag, cred_t *cr)
/*
* We update smallfile2 and smallfile1 at most every second.
*/
- if (lbolt >= smallfile_update) {
+ now = ddi_get_lbolt();
+ if (now >= smallfile_update) {
uint64_t percpufreeb;
if (smallfile1_d == 0) smallfile1_d = SMALLFILE1_D;
if (smallfile2_d == 0) smallfile2_d = SMALLFILE2_D;
@@ -1429,7 +1431,7 @@ rdip(struct inode *ip, struct uio *uio, int ioflag, cred_t *cr)
smallfile1 = MAX(smallfile1, smallfile);
smallfile1 = MAX(smallfile1, smallfile64);
smallfile2 = MAX(smallfile1, smallfile2);
- smallfile_update = lbolt + hz;
+ smallfile_update = now + hz;
}
dofree = freebehind &&
@@ -4965,7 +4967,7 @@ ufs_getpage_miss(struct vnode *vp, u_offset_t off, size_t len, struct seg *seg,
} else if (ufsvfsp->vfs_snapshot) {
fssnap_strategy(&ufsvfsp->vfs_snapshot, bp);
} else {
- ufsvfsp->vfs_iotstamp = lbolt;
+ ufsvfsp->vfs_iotstamp = ddi_get_lbolt();
ub.ub_getpages.value.ul++;
(void) bdev_strategy(bp);
lwp_stat_update(LWP_STAT_INBLK, 1);
@@ -5068,7 +5070,7 @@ ufs_getpage_ra(struct vnode *vp, u_offset_t off, struct seg *seg, caddr_t addr)
} else if (ufsvfsp->vfs_snapshot) {
fssnap_strategy(&ufsvfsp->vfs_snapshot, bp);
} else {
- ufsvfsp->vfs_iotstamp = lbolt;
+ ufsvfsp->vfs_iotstamp = ddi_get_lbolt();
ub.ub_getras.value.ul++;
(void) bdev_strategy(bp);
lwp_stat_update(LWP_STAT_INBLK, 1);
@@ -5542,7 +5544,7 @@ ufs_putapage(
} else if (ufsvfsp->vfs_snapshot) {
fssnap_strategy(&ufsvfsp->vfs_snapshot, bp);
} else {
- ufsvfsp->vfs_iotstamp = lbolt;
+ ufsvfsp->vfs_iotstamp = ddi_get_lbolt();
ub.ub_putasyncs.value.ul++;
(void) bdev_strategy(bp);
lwp_stat_update(LWP_STAT_OUBLK, 1);
@@ -5553,7 +5555,7 @@ ufs_putapage(
} else if (ufsvfsp->vfs_snapshot) {
fssnap_strategy(&ufsvfsp->vfs_snapshot, bp);
} else {
- ufsvfsp->vfs_iotstamp = lbolt;
+ ufsvfsp->vfs_iotstamp = ddi_get_lbolt();
ub.ub_putsyncs.value.ul++;
(void) bdev_strategy(bp);
lwp_stat_update(LWP_STAT_OUBLK, 1);
@@ -6065,7 +6067,7 @@ ufs_pageio(struct vnode *vp, page_t *pp, u_offset_t io_off, size_t io_len,
bp->b_un.b_addr = (caddr_t)0;
bp->b_file = ip->i_vnode;
- ufsvfsp->vfs_iotstamp = lbolt;
+ ufsvfsp->vfs_iotstamp = ddi_get_lbolt();
ub.ub_pageios.value.ul++;
if (ufsvfsp->vfs_snapshot)
fssnap_strategy(&(ufsvfsp->vfs_snapshot), bp);
diff --git a/usr/src/uts/common/fs/zfs/arc.c b/usr/src/uts/common/fs/zfs/arc.c
index 8cc845ffeb..9c4fb291ca 100644
--- a/usr/src/uts/common/fs/zfs/arc.c
+++ b/usr/src/uts/common/fs/zfs/arc.c
@@ -1580,7 +1580,8 @@ arc_evict(arc_state_t *state, uint64_t spa, int64_t bytes, boolean_t recycle,
if (HDR_IO_IN_PROGRESS(ab) ||
(spa && ab->b_spa != spa) ||
(ab->b_flags & (ARC_PREFETCH|ARC_INDIRECT) &&
- lbolt - ab->b_arc_access < arc_min_prefetch_lifespan)) {
+ ddi_get_lbolt() - ab->b_arc_access <
+ arc_min_prefetch_lifespan)) {
skipped++;
continue;
}
@@ -2051,12 +2052,12 @@ arc_reclaim_thread(void)
}
/* reset the growth delay for every reclaim */
- growtime = lbolt + (arc_grow_retry * hz);
+ growtime = ddi_get_lbolt() + (arc_grow_retry * hz);
arc_kmem_reap_now(last_reclaim);
arc_warm = B_TRUE;
- } else if (arc_no_grow && lbolt >= growtime) {
+ } else if (arc_no_grow && ddi_get_lbolt() >= growtime) {
arc_no_grow = FALSE;
}
@@ -2070,7 +2071,7 @@ arc_reclaim_thread(void)
/* block until needed, or one second, whichever is shorter */
CALLB_CPR_SAFE_BEGIN(&cpr);
(void) cv_timedwait(&arc_reclaim_thr_cv,
- &arc_reclaim_thr_lock, (lbolt + hz));
+ &arc_reclaim_thr_lock, (ddi_get_lbolt() + hz));
CALLB_CPR_SAFE_END(&cpr, &arc_reclaim_thr_lock);
}
@@ -2285,6 +2286,8 @@ out:
static void
arc_access(arc_buf_hdr_t *buf, kmutex_t *hash_lock)
{
+ clock_t now;
+
ASSERT(MUTEX_HELD(hash_lock));
if (buf->b_state == arc_anon) {
@@ -2295,11 +2298,13 @@ arc_access(arc_buf_hdr_t *buf, kmutex_t *hash_lock)
*/
ASSERT(buf->b_arc_access == 0);
- buf->b_arc_access = lbolt;
+ buf->b_arc_access = ddi_get_lbolt();
DTRACE_PROBE1(new_state__mru, arc_buf_hdr_t *, buf);
arc_change_state(arc_mru, buf, hash_lock);
} else if (buf->b_state == arc_mru) {
+ now = ddi_get_lbolt();
+
/*
* If this buffer is here because of a prefetch, then either:
* - clear the flag if this is a "referencing" read
@@ -2315,7 +2320,7 @@ arc_access(arc_buf_hdr_t *buf, kmutex_t *hash_lock)
buf->b_flags &= ~ARC_PREFETCH;
ARCSTAT_BUMP(arcstat_mru_hits);
}
- buf->b_arc_access = lbolt;
+ buf->b_arc_access = now;
return;
}
@@ -2324,13 +2329,13 @@ arc_access(arc_buf_hdr_t *buf, kmutex_t *hash_lock)
* but it is still in the cache. Move it to the MFU
* state.
*/
- if (lbolt > buf->b_arc_access + ARC_MINTIME) {
+ if (now > buf->b_arc_access + ARC_MINTIME) {
/*
* More than 125ms have passed since we
* instantiated this buffer. Move it to the
* most frequently used state.
*/
- buf->b_arc_access = lbolt;
+ buf->b_arc_access = now;
DTRACE_PROBE1(new_state__mfu, arc_buf_hdr_t *, buf);
arc_change_state(arc_mfu, buf, hash_lock);
}
@@ -2353,7 +2358,7 @@ arc_access(arc_buf_hdr_t *buf, kmutex_t *hash_lock)
DTRACE_PROBE1(new_state__mfu, arc_buf_hdr_t *, buf);
}
- buf->b_arc_access = lbolt;
+ buf->b_arc_access = ddi_get_lbolt();
arc_change_state(new_state, buf, hash_lock);
ARCSTAT_BUMP(arcstat_mru_ghost_hits);
@@ -2372,7 +2377,7 @@ arc_access(arc_buf_hdr_t *buf, kmutex_t *hash_lock)
ASSERT(list_link_active(&buf->b_arc_node));
}
ARCSTAT_BUMP(arcstat_mfu_hits);
- buf->b_arc_access = lbolt;
+ buf->b_arc_access = ddi_get_lbolt();
} else if (buf->b_state == arc_mfu_ghost) {
arc_state_t *new_state = arc_mfu;
/*
@@ -2390,7 +2395,7 @@ arc_access(arc_buf_hdr_t *buf, kmutex_t *hash_lock)
new_state = arc_mru;
}
- buf->b_arc_access = lbolt;
+ buf->b_arc_access = ddi_get_lbolt();
DTRACE_PROBE1(new_state__mfu, arc_buf_hdr_t *, buf);
arc_change_state(new_state, buf, hash_lock);
@@ -2400,7 +2405,7 @@ arc_access(arc_buf_hdr_t *buf, kmutex_t *hash_lock)
* This buffer is on the 2nd Level ARC.
*/
- buf->b_arc_access = lbolt;
+ buf->b_arc_access = ddi_get_lbolt();
DTRACE_PROBE1(new_state__mfu, arc_buf_hdr_t *, buf);
arc_change_state(arc_mfu, buf, hash_lock);
} else {
@@ -3741,7 +3746,7 @@ l2arc_write_size(l2arc_dev_t *dev)
static clock_t
l2arc_write_interval(clock_t began, uint64_t wanted, uint64_t wrote)
{
- clock_t interval, next;
+ clock_t interval, next, now;
/*
* If the ARC lists are busy, increase our write rate; if the
@@ -3754,7 +3759,8 @@ l2arc_write_interval(clock_t began, uint64_t wanted, uint64_t wrote)
else
interval = hz * l2arc_feed_secs;
- next = MAX(lbolt, MIN(lbolt + interval, began + interval));
+ now = ddi_get_lbolt();
+ next = MAX(now, MIN(now + interval, began + interval));
return (next);
}
@@ -4365,7 +4371,7 @@ l2arc_feed_thread(void)
l2arc_dev_t *dev;
spa_t *spa;
uint64_t size, wrote;
- clock_t begin, next = lbolt;
+ clock_t begin, next = ddi_get_lbolt();
CALLB_CPR_INIT(&cpr, &l2arc_feed_thr_lock, callb_generic_cpr, FTAG);
@@ -4376,7 +4382,7 @@ l2arc_feed_thread(void)
(void) cv_timedwait(&l2arc_feed_thr_cv, &l2arc_feed_thr_lock,
next);
CALLB_CPR_SAFE_END(&cpr, &l2arc_feed_thr_lock);
- next = lbolt + hz;
+ next = ddi_get_lbolt() + hz;
/*
* Quick check for L2ARC devices.
@@ -4387,7 +4393,7 @@ l2arc_feed_thread(void)
continue;
}
mutex_exit(&l2arc_dev_mtx);
- begin = lbolt;
+ begin = ddi_get_lbolt();
/*
* This selects the next l2arc device to write to, and in
diff --git a/usr/src/uts/common/fs/zfs/dmu_zfetch.c b/usr/src/uts/common/fs/zfs/dmu_zfetch.c
index c51ba2a0b6..37037c30f6 100644
--- a/usr/src/uts/common/fs/zfs/dmu_zfetch.c
+++ b/usr/src/uts/common/fs/zfs/dmu_zfetch.c
@@ -226,7 +226,7 @@ dmu_zfetch_dofetch(zfetch_t *zf, zstream_t *zs)
break;
}
zs->zst_ph_offset = prefetch_tail;
- zs->zst_last = lbolt;
+ zs->zst_last = ddi_get_lbolt();
}
void
@@ -577,7 +577,7 @@ dmu_zfetch_stream_reclaim(zfetch_t *zf)
for (zs = list_head(&zf->zf_stream); zs;
zs = list_next(&zf->zf_stream, zs)) {
- if (((lbolt - zs->zst_last) / hz) > zfetch_min_sec_reap)
+ if (((ddi_get_lbolt() - zs->zst_last)/hz) > zfetch_min_sec_reap)
break;
}
@@ -708,7 +708,7 @@ dmu_zfetch(zfetch_t *zf, uint64_t offset, uint64_t size, int prefetched)
newstream->zst_ph_offset = zst.zst_len + zst.zst_offset;
newstream->zst_cap = zst.zst_len;
newstream->zst_direction = ZFETCH_FORWARD;
- newstream->zst_last = lbolt;
+ newstream->zst_last = ddi_get_lbolt();
mutex_init(&newstream->zst_lock, NULL, MUTEX_DEFAULT, NULL);
diff --git a/usr/src/uts/common/fs/zfs/dsl_scrub.c b/usr/src/uts/common/fs/zfs/dsl_scrub.c
index d1fb3d2e52..d511bb841a 100644
--- a/usr/src/uts/common/fs/zfs/dsl_scrub.c
+++ b/usr/src/uts/common/fs/zfs/dsl_scrub.c
@@ -313,7 +313,7 @@ scrub_pause(dsl_pool_t *dp, const zbookmark_t *zb)
mintime = dp->dp_scrub_isresilver ? zfs_resilver_min_time :
zfs_scrub_min_time;
- elapsed_ticks = lbolt64 - dp->dp_scrub_start_time;
+ elapsed_ticks = ddi_get_lbolt64() - dp->dp_scrub_start_time;
if (elapsed_ticks > hz * zfs_txg_timeout ||
(elapsed_ticks > hz * mintime && txg_sync_waiting(dp))) {
dprintf("pausing at %llx/%llx/%llx/%llx\n",
@@ -836,7 +836,7 @@ dsl_pool_scrub_sync(dsl_pool_t *dp, dmu_tx_t *tx)
}
dp->dp_scrub_pausing = B_FALSE;
- dp->dp_scrub_start_time = lbolt64;
+ dp->dp_scrub_start_time = ddi_get_lbolt64();
dp->dp_scrub_isresilver = (dp->dp_scrub_min_txg != 0);
spa->spa_scrub_active = B_TRUE;
diff --git a/usr/src/uts/common/fs/zfs/metaslab.c b/usr/src/uts/common/fs/zfs/metaslab.c
index cdbed0144c..27dc2e4fd5 100644
--- a/usr/src/uts/common/fs/zfs/metaslab.c
+++ b/usr/src/uts/common/fs/zfs/metaslab.c
@@ -1040,7 +1040,7 @@ metaslab_alloc_dva(spa_t *spa, metaslab_class_t *mc, uint64_t psize,
/*
* For testing, make some blocks above a certain size be gang blocks.
*/
- if (psize >= metaslab_gang_bang && (lbolt & 3) == 0)
+ if (psize >= metaslab_gang_bang && (ddi_get_lbolt() & 3) == 0)
return (ENOSPC);
/*
diff --git a/usr/src/uts/common/fs/zfs/txg.c b/usr/src/uts/common/fs/zfs/txg.c
index 344dcb7722..ceed1200ca 100644
--- a/usr/src/uts/common/fs/zfs/txg.c
+++ b/usr/src/uts/common/fs/zfs/txg.c
@@ -166,7 +166,8 @@ txg_thread_wait(tx_state_t *tx, callb_cpr_t *cpr, kcondvar_t *cv, uint64_t time)
CALLB_CPR_SAFE_BEGIN(cpr);
if (time)
- (void) cv_timedwait(cv, &tx->tx_sync_lock, lbolt + time);
+ (void) cv_timedwait(cv, &tx->tx_sync_lock,
+ ddi_get_lbolt() + time);
else
cv_wait(cv, &tx->tx_sync_lock);
@@ -377,7 +378,7 @@ txg_sync_thread(dsl_pool_t *dp)
dprintf("waiting; tx_synced=%llu waiting=%llu dp=%p\n",
tx->tx_synced_txg, tx->tx_sync_txg_waiting, dp);
txg_thread_wait(tx, &cpr, &tx->tx_sync_more_cv, timer);
- delta = lbolt - start;
+ delta = ddi_get_lbolt() - start;
timer = (delta > timeout ? 0 : timeout - delta);
}
@@ -409,9 +410,9 @@ txg_sync_thread(dsl_pool_t *dp)
txg, tx->tx_quiesce_txg_waiting, tx->tx_sync_txg_waiting);
mutex_exit(&tx->tx_sync_lock);
- start = lbolt;
+ start = ddi_get_lbolt();
spa_sync(dp->dp_spa, txg);
- delta = lbolt - start;
+ delta = ddi_get_lbolt() - start;
mutex_enter(&tx->tx_sync_lock);
tx->tx_synced_txg = txg;
@@ -478,7 +479,7 @@ void
txg_delay(dsl_pool_t *dp, uint64_t txg, int ticks)
{
tx_state_t *tx = &dp->dp_tx;
- int timeout = lbolt + ticks;
+ int timeout = ddi_get_lbolt() + ticks;
/* don't delay if this txg could transition to quiesing immediately */
if (tx->tx_open_txg > txg ||
@@ -491,7 +492,7 @@ txg_delay(dsl_pool_t *dp, uint64_t txg, int ticks)
return;
}
- while (lbolt < timeout &&
+ while (ddi_get_lbolt() < timeout &&
tx->tx_syncing_txg < txg-1 && !txg_stalled(dp))
(void) cv_timedwait(&tx->tx_quiesce_more_cv, &tx->tx_sync_lock,
timeout);
diff --git a/usr/src/uts/common/fs/zfs/vdev_cache.c b/usr/src/uts/common/fs/zfs/vdev_cache.c
index 9b3a9f5a26..688d541344 100644
--- a/usr/src/uts/common/fs/zfs/vdev_cache.c
+++ b/usr/src/uts/common/fs/zfs/vdev_cache.c
@@ -172,7 +172,7 @@ vdev_cache_allocate(zio_t *zio)
ve = kmem_zalloc(sizeof (vdev_cache_entry_t), KM_SLEEP);
ve->ve_offset = offset;
- ve->ve_lastused = lbolt;
+ ve->ve_lastused = ddi_get_lbolt();
ve->ve_data = zio_buf_alloc(VCBS);
avl_add(&vc->vc_offset_tree, ve);
@@ -189,9 +189,9 @@ vdev_cache_hit(vdev_cache_t *vc, vdev_cache_entry_t *ve, zio_t *zio)
ASSERT(MUTEX_HELD(&vc->vc_lock));
ASSERT(ve->ve_fill_io == NULL);
- if (ve->ve_lastused != lbolt) {
+ if (ve->ve_lastused != ddi_get_lbolt()) {
avl_remove(&vc->vc_lastused_tree, ve);
- ve->ve_lastused = lbolt;
+ ve->ve_lastused = ddi_get_lbolt();
avl_add(&vc->vc_lastused_tree, ve);
}
diff --git a/usr/src/uts/common/fs/zfs/vdev_queue.c b/usr/src/uts/common/fs/zfs/vdev_queue.c
index d98278ddef..21e60ce843 100644
--- a/usr/src/uts/common/fs/zfs/vdev_queue.c
+++ b/usr/src/uts/common/fs/zfs/vdev_queue.c
@@ -40,7 +40,7 @@
int zfs_vdev_max_pending = 10;
int zfs_vdev_min_pending = 4;
-/* deadline = pri + (lbolt >> time_shift) */
+/* deadline = pri + ddi_get_lbolt64() >> time_shift) */
int zfs_vdev_time_shift = 6;
/* exponential I/O issue ramp-up rate */
@@ -359,7 +359,8 @@ vdev_queue_io(zio_t *zio)
mutex_enter(&vq->vq_lock);
- zio->io_deadline = (lbolt64 >> zfs_vdev_time_shift) + zio->io_priority;
+ zio->io_deadline = (ddi_get_lbolt64() >> zfs_vdev_time_shift) +
+ zio->io_priority;
vdev_queue_io_add(vq, zio);
diff --git a/usr/src/uts/common/fs/zfs/zil.c b/usr/src/uts/common/fs/zfs/zil.c
index dba690bbaf..40ba1a2d68 100644
--- a/usr/src/uts/common/fs/zfs/zil.c
+++ b/usr/src/uts/common/fs/zfs/zil.c
@@ -1647,7 +1647,7 @@ zil_replay(objset_t *os, void *arg, zil_replay_func_t *replay_func[TX_MAX_TYPE])
txg_wait_synced(zilog->zl_dmu_pool, 0);
zilog->zl_replay = B_TRUE;
- zilog->zl_replay_time = lbolt;
+ zilog->zl_replay_time = ddi_get_lbolt();
ASSERT(zilog->zl_replay_blks == 0);
(void) zil_parse(zilog, zil_incr_blks, zil_replay_log_record, &zr,
zh->zh_claim_txg);
diff --git a/usr/src/uts/common/fs/zfs/zio_inject.c b/usr/src/uts/common/fs/zfs/zio_inject.c
index 5c4a6c3df6..e8f8f7b723 100644
--- a/usr/src/uts/common/fs/zfs/zio_inject.c
+++ b/usr/src/uts/common/fs/zfs/zio_inject.c
@@ -318,7 +318,7 @@ zio_handle_ignored_writes(zio_t *zio)
*/
if (handler->zi_record.zi_timer == 0) {
if (handler->zi_record.zi_duration > 0)
- handler->zi_record.zi_timer = lbolt64;
+ handler->zi_record.zi_timer = ddi_get_lbolt64();
else
handler->zi_record.zi_timer = zio->io_txg;
}
@@ -355,7 +355,8 @@ spa_handle_ignored_writes(spa_t *spa)
if (handler->zi_record.zi_duration > 0) {
VERIFY(handler->zi_record.zi_timer == 0 ||
handler->zi_record.zi_timer +
- handler->zi_record.zi_duration * hz > lbolt64);
+ handler->zi_record.zi_duration * hz >
+ ddi_get_lbolt64());
} else {
/* duration is negative so the subtraction here adds */
VERIFY(handler->zi_record.zi_timer == 0 ||