summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorChunwei Chen <[email protected]>2014-02-25 17:32:21 +0800
committerBrian Behlendorf <[email protected]>2014-04-14 13:27:56 -0700
commit0b75bdb369df4e0dab96b2778a6421773268df21 (patch)
tree2b8184592909819f2657e96f6090b9410c76be64 /include
parent888f7141a3fcb73e2ec254de7628eee12022c4fc (diff)
Use ddi_time_after and friends to compare time
Also, make sure we use clock_t for ddi_get_lbolt to prevent type conversion from screwing things. Signed-off-by: Chunwei Chen <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #2142
Diffstat (limited to 'include')
-rw-r--r--include/sys/vdev_impl.h2
-rw-r--r--include/sys/zfs_context.h10
2 files changed, 11 insertions, 1 deletions
diff --git a/include/sys/vdev_impl.h b/include/sys/vdev_impl.h
index 4b465d295..703dd65da 100644
--- a/include/sys/vdev_impl.h
+++ b/include/sys/vdev_impl.h
@@ -86,7 +86,7 @@ typedef const struct vdev_ops {
struct vdev_cache_entry {
char *ve_data;
uint64_t ve_offset;
- uint64_t ve_lastused;
+ clock_t ve_lastused;
avl_node_t ve_offset_node;
avl_node_t ve_lastused_node;
uint32_t ve_hits;
diff --git a/include/sys/zfs_context.h b/include/sys/zfs_context.h
index fa12cea53..1861b845d 100644
--- a/include/sys/zfs_context.h
+++ b/include/sys/zfs_context.h
@@ -584,6 +584,16 @@ extern vnode_t *rootdir;
#define ddi_get_lbolt64() (gethrtime() >> 23)
#define hz 119 /* frequency when using gethrtime() >> 23 for lbolt */
+#define ddi_time_before(a, b) (a < b)
+#define ddi_time_after(a, b) ddi_time_before(b, a)
+#define ddi_time_before_eq(a, b) (!ddi_time_after(a, b))
+#define ddi_time_after_eq(a, b) ddi_time_before_eq(b, a)
+
+#define ddi_time_before64(a, b) (a < b)
+#define ddi_time_after64(a, b) ddi_time_before64(b, a)
+#define ddi_time_before_eq64(a, b) (!ddi_time_after64(a, b))
+#define ddi_time_after_eq64(a, b) ddi_time_before_eq64(b, a)
+
extern void delay(clock_t ticks);
#define SEC_TO_TICK(sec) ((sec) * hz)