summaryrefslogtreecommitdiffstats
path: root/module/zfs
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2016-10-28 22:40:14 +0000
committerBrian Behlendorf <[email protected]>2016-11-02 12:14:45 -0700
commit48d3eb40c71e5840e4d9e9af7addcfef7c382511 (patch)
treef8832b7512bcdb948ab48d9fcfd145a91bac7ca6 /module/zfs
parentb3c159fee4ab92832e6a735431b8b5f930665fab (diff)
Add TASKQID_INVALID
Add the TASKQID_INVALID macros and update callers to use the macro instead of testing against 0. There is no functional change even though the functions in zfs_ctldir.c incorrectly used -1 instead of 0. Reviewed-by: Tom Caputi <[email protected]> Reviewed-by: Tim Chase <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Issue #5347
Diffstat (limited to 'module/zfs')
-rw-r--r--module/zfs/arc.c2
-rw-r--r--module/zfs/dmu_objset.c2
-rw-r--r--module/zfs/dmu_traverse.c4
-rw-r--r--module/zfs/metaslab.c2
-rw-r--r--module/zfs/vdev.c2
-rw-r--r--module/zfs/vdev_file.c5
-rw-r--r--module/zfs/zfs_ctldir.c8
-rw-r--r--module/zfs/zfs_vnops.c2
-rw-r--r--module/zfs/zio.c2
-rw-r--r--module/zfs/zvol.c6
10 files changed, 18 insertions, 17 deletions
diff --git a/module/zfs/arc.c b/module/zfs/arc.c
index 5825d3300..b855c1c71 100644
--- a/module/zfs/arc.c
+++ b/module/zfs/arc.c
@@ -3479,7 +3479,7 @@ arc_prune_async(int64_t adjust)
refcount_add(&ap->p_refcnt, ap->p_pfunc);
ap->p_adjust = adjust;
if (taskq_dispatch(arc_prune_taskq, arc_prune_task,
- ap, TQ_SLEEP) == 0) {
+ ap, TQ_SLEEP) == TASKQID_INVALID) {
refcount_remove(&ap->p_refcnt, ap->p_pfunc);
continue;
}
diff --git a/module/zfs/dmu_objset.c b/module/zfs/dmu_objset.c
index ac60008a3..c1f2d8430 100644
--- a/module/zfs/dmu_objset.c
+++ b/module/zfs/dmu_objset.c
@@ -1118,7 +1118,7 @@ dmu_objset_upgrade(objset_t *os, dmu_objset_upgrade_cb_t cb)
os->os_upgrade_id = taskq_dispatch(
os->os_spa->spa_upgrade_taskq,
dmu_objset_upgrade_task_cb, os, TQ_SLEEP);
- if (os->os_upgrade_id == 0)
+ if (os->os_upgrade_id == TASKQID_INVALID)
os->os_upgrade_status = ENOMEM;
}
mutex_exit(&os->os_upgrade_lock);
diff --git a/module/zfs/dmu_traverse.c b/module/zfs/dmu_traverse.c
index a2566ced3..c78228d74 100644
--- a/module/zfs/dmu_traverse.c
+++ b/module/zfs/dmu_traverse.c
@@ -615,8 +615,8 @@ traverse_impl(spa_t *spa, dsl_dataset_t *ds, uint64_t objset, blkptr_t *rootbp,
}
if (!(flags & TRAVERSE_PREFETCH_DATA) ||
- 0 == taskq_dispatch(system_taskq, traverse_prefetch_thread,
- td, TQ_NOQUEUE))
+ taskq_dispatch(system_taskq, traverse_prefetch_thread,
+ td, TQ_NOQUEUE) == TASKQID_INVALID)
pd->pd_exited = B_TRUE;
err = traverse_visitbp(td, NULL, rootbp, czb);
diff --git a/module/zfs/metaslab.c b/module/zfs/metaslab.c
index e54eeeae2..37fa9a7a3 100644
--- a/module/zfs/metaslab.c
+++ b/module/zfs/metaslab.c
@@ -1724,7 +1724,7 @@ metaslab_group_preload(metaslab_group_t *mg)
*/
mutex_exit(&mg->mg_lock);
VERIFY(taskq_dispatch(mg->mg_taskq, metaslab_preload,
- msp, TQ_SLEEP) != 0);
+ msp, TQ_SLEEP) != TASKQID_INVALID);
mutex_enter(&mg->mg_lock);
msp = msp_next;
}
diff --git a/module/zfs/vdev.c b/module/zfs/vdev.c
index e3a9da2d5..c51ed43e6 100644
--- a/module/zfs/vdev.c
+++ b/module/zfs/vdev.c
@@ -1191,7 +1191,7 @@ retry_sync:
for (c = 0; c < children; c++)
VERIFY(taskq_dispatch(tq, vdev_open_child,
- vd->vdev_child[c], TQ_SLEEP) != 0);
+ vd->vdev_child[c], TQ_SLEEP) != TASKQID_INVALID);
taskq_destroy(tq);
}
diff --git a/module/zfs/vdev_file.c b/module/zfs/vdev_file.c
index bca4175a6..a0a23598b 100644
--- a/module/zfs/vdev_file.c
+++ b/module/zfs/vdev_file.c
@@ -202,7 +202,8 @@ vdev_file_io_start(zio_t *zio)
*/
if (spl_fstrans_check()) {
VERIFY3U(taskq_dispatch(system_taskq,
- vdev_file_io_fsync, zio, TQ_SLEEP), !=, 0);
+ vdev_file_io_fsync, zio, TQ_SLEEP), !=,
+ TASKQID_INVALID);
return;
}
@@ -220,7 +221,7 @@ vdev_file_io_start(zio_t *zio)
zio->io_target_timestamp = zio_handle_io_delay(zio);
VERIFY3U(taskq_dispatch(system_taskq, vdev_file_io_strategy, zio,
- TQ_SLEEP), !=, 0);
+ TQ_SLEEP), !=, TASKQID_INVALID);
}
/* ARGSUSED */
diff --git a/module/zfs/zfs_ctldir.c b/module/zfs/zfs_ctldir.c
index 44003a5a6..78bc79740 100644
--- a/module/zfs/zfs_ctldir.c
+++ b/module/zfs/zfs_ctldir.c
@@ -147,7 +147,7 @@ zfsctl_snapshot_alloc(char *full_name, char *full_path, spa_t *spa,
se->se_spa = spa;
se->se_objsetid = objsetid;
se->se_root_dentry = root_dentry;
- se->se_taskqid = -1;
+ se->se_taskqid = TASKQID_INVALID;
refcount_create(&se->se_refcount);
@@ -339,7 +339,7 @@ snapentry_expire(void *data)
return;
}
- se->se_taskqid = -1;
+ se->se_taskqid = TASKQID_INVALID;
(void) zfsctl_snapshot_unmount(se->se_name, MNT_EXPIRE);
zfsctl_snapshot_rele(se);
@@ -366,7 +366,7 @@ zfsctl_snapshot_unmount_cancel(zfs_snapentry_t *se)
ASSERT(RW_LOCK_HELD(&zfs_snapshot_lock));
if (taskq_cancel_id(zfs_expire_taskq, se->se_taskqid) == 0) {
- se->se_taskqid = -1;
+ se->se_taskqid = TASKQID_INVALID;
zfsctl_snapshot_rele(se);
}
}
@@ -377,7 +377,7 @@ zfsctl_snapshot_unmount_cancel(zfs_snapentry_t *se)
static void
zfsctl_snapshot_unmount_delay_impl(zfs_snapentry_t *se, int delay)
{
- ASSERT3S(se->se_taskqid, ==, -1);
+ ASSERT3S(se->se_taskqid, ==, TASKQID_INVALID);
if (delay <= 0)
return;
diff --git a/module/zfs/zfs_vnops.c b/module/zfs/zfs_vnops.c
index 8ac14df00..5b2099efb 100644
--- a/module/zfs/zfs_vnops.c
+++ b/module/zfs/zfs_vnops.c
@@ -952,7 +952,7 @@ zfs_iput_async(struct inode *ip)
if (atomic_read(&ip->i_count) == 1)
VERIFY(taskq_dispatch(dsl_pool_iput_taskq(dmu_objset_pool(os)),
- (task_func_t *)iput, ip, TQ_SLEEP) != 0);
+ (task_func_t *)iput, ip, TQ_SLEEP) != TASKQID_INVALID);
else
iput(ip);
}
diff --git a/module/zfs/zio.c b/module/zfs/zio.c
index c149b4ff2..638e3d805 100644
--- a/module/zfs/zio.c
+++ b/module/zfs/zio.c
@@ -1557,7 +1557,7 @@ zio_delay_interrupt(zio_t *zio)
tid = taskq_dispatch_delay(system_taskq,
(task_func_t *) zio_interrupt,
zio, TQ_NOSLEEP, expire_at_tick);
- if (!tid) {
+ if (tid == TASKQID_INVALID) {
/*
* Couldn't allocate a task. Just
* finish the zio without a delay.
diff --git a/module/zfs/zvol.c b/module/zfs/zvol.c
index 72a6bc5e2..b5169baf4 100644
--- a/module/zfs/zvol.c
+++ b/module/zfs/zvol.c
@@ -1895,7 +1895,7 @@ zvol_create_minors(spa_t *spa, const char *name, boolean_t async)
return;
id = taskq_dispatch(spa->spa_zvol_taskq, zvol_task_cb, task, TQ_SLEEP);
- if ((async == B_FALSE) && (id != 0))
+ if ((async == B_FALSE) && (id != TASKQID_INVALID))
taskq_wait_id(spa->spa_zvol_taskq, id);
}
@@ -1910,7 +1910,7 @@ zvol_remove_minors(spa_t *spa, const char *name, boolean_t async)
return;
id = taskq_dispatch(spa->spa_zvol_taskq, zvol_task_cb, task, TQ_SLEEP);
- if ((async == B_FALSE) && (id != 0))
+ if ((async == B_FALSE) && (id != TASKQID_INVALID))
taskq_wait_id(spa->spa_zvol_taskq, id);
}
@@ -1926,7 +1926,7 @@ zvol_rename_minors(spa_t *spa, const char *name1, const char *name2,
return;
id = taskq_dispatch(spa->spa_zvol_taskq, zvol_task_cb, task, TQ_SLEEP);
- if ((async == B_FALSE) && (id != 0))
+ if ((async == B_FALSE) && (id != TASKQID_INVALID))
taskq_wait_id(spa->spa_zvol_taskq, id);
}