]> git.proxmox.com Git - mirror_spl.git/blobdiff - module/splat/splat-taskq.c
Fix bug in SPLAT taskq:front
[mirror_spl.git] / module / splat / splat-taskq.c
index e4793d4578dcc074ee32798f3fa218ac816c9486..33e49b2f124516f5c1927a51c58b2298397d414f 100644 (file)
@@ -82,7 +82,7 @@ typedef struct splat_taskq_arg {
        atomic_t *count;
        int order[SPLAT_TASKQ_ORDER_MAX];
        unsigned int depth;
-       unsigned long expire;
+       clock_t expire;
        taskq_t *tq;
        taskq_ent_t *tqe;
        spinlock_t lock;
@@ -814,10 +814,11 @@ splat_taskq_test6_func(void *arg)
        spin_lock(&tq_arg->lock);
        tq_arg->order[tq_arg->flag] = tq_id->id;
        tq_arg->flag++;
+       spin_unlock(&tq_arg->lock);
+
        splat_vprint(tq_arg->file, tq_arg->name,
                     "Taskqid %d complete for taskq '%s'\n",
                     tq_id->id, tq_arg->name);
-       spin_unlock(&tq_arg->lock);
 }
 
 static int
@@ -1140,7 +1141,7 @@ splat_taskq_test9_func(void *arg)
        splat_taskq_arg_t *tq_arg = (splat_taskq_arg_t *)arg;
        ASSERT(tq_arg);
 
-       if (ddi_get_lbolt() >= tq_arg->expire)
+       if (ddi_time_after_eq(ddi_get_lbolt(), tq_arg->expire))
                atomic_inc(tq_arg->count);
 
        kmem_free(tq_arg, sizeof(splat_taskq_arg_t));
@@ -1228,7 +1229,7 @@ splat_taskq_test10_func(void *arg)
        splat_taskq_arg_t *tq_arg = (splat_taskq_arg_t *)arg;
        uint8_t rnd;
 
-       if (ddi_get_lbolt() >= tq_arg->expire)
+       if (ddi_time_after_eq(ddi_get_lbolt(), tq_arg->expire))
                atomic_inc(tq_arg->count);
 
        /* Randomly sleep to further perturb the system */
@@ -1249,7 +1250,7 @@ splat_taskq_test10(struct file *file, void *arg)
        int canceled = 0;
        int completed = 0;
        int blocked = 0;
-       unsigned long start, cancel;
+       clock_t start, cancel;
 
        tqas = vmalloc(sizeof(*tqas) * nr_tasks);
        if (tqas == NULL)
@@ -1327,7 +1328,7 @@ splat_taskq_test10(struct file *file, void *arg)
        start = ddi_get_lbolt();
        i = 0;
 
-       while (ddi_get_lbolt() < start + 5 * HZ) {
+       while (ddi_time_before(ddi_get_lbolt(), start + 5 * HZ)) {
                taskqid_t id;
                uint32_t rnd;