From c28d6ab08b9ecbd12bd9dffcc788649f1d8161b0 Mon Sep 17 00:00:00 2001 From: Jorgen Lundman Date: Thu, 10 Feb 2022 07:04:26 +0900 Subject: [PATCH] Rename EMPTY_TASKQ into taskq_empty To follow a change in illumos taskq Reviewed-by: Brian Behlendorf Reviewed-by: Tony Nguyen Signed-off-by: Jorgen Lundman Closes #12802 --- include/os/linux/spl/sys/taskq.h | 2 ++ include/sys/zfs_context.h | 1 + lib/libzpool/taskq.c | 6 ++++++ module/icp/core/kcf_sched.c | 13 ++----------- module/os/linux/spl/spl-taskq.c | 7 +++++++ 5 files changed, 18 insertions(+), 11 deletions(-) diff --git a/include/os/linux/spl/sys/taskq.h b/include/os/linux/spl/sys/taskq.h index 2a6cd8283d..5f8eb19dce 100644 --- a/include/os/linux/spl/sys/taskq.h +++ b/include/os/linux/spl/sys/taskq.h @@ -163,6 +163,8 @@ extern taskq_t *taskq_of_curthread(void); ((void) sizeof (dc), \ taskq_create(name, nthreads, maxclsyspri, min, max, flags)) +extern boolean_t taskq_empty(taskq_t *); + int spl_taskq_init(void); void spl_taskq_fini(void); diff --git a/include/sys/zfs_context.h b/include/sys/zfs_context.h index 6d1fd83df5..d53b2c3a0b 100644 --- a/include/sys/zfs_context.h +++ b/include/sys/zfs_context.h @@ -509,6 +509,7 @@ extern taskq_t *taskq_of_curthread(void); extern int taskq_cancel_id(taskq_t *, taskqid_t); extern void system_taskq_init(void); extern void system_taskq_fini(void); +extern boolean_t taskq_empty(taskq_t *); #define XVA_MAPSIZE 3 #define XVA_MAGIC 0x78766174 diff --git a/lib/libzpool/taskq.c b/lib/libzpool/taskq.c index 8a61130911..b72ca3d399 100644 --- a/lib/libzpool/taskq.c +++ b/lib/libzpool/taskq.c @@ -363,6 +363,12 @@ taskq_cancel_id(taskq_t *tq, taskqid_t id) return (ENOENT); } +boolean_t +taskq_empty(taskq_t *tq) +{ + return (tq->tq_task.tqent_next == &tq->tq_task || tq->tq_active == 0); +} + void system_taskq_init(void) { diff --git a/module/icp/core/kcf_sched.c b/module/icp/core/kcf_sched.c index 062e96059f..ee0fe0ac63 100644 --- a/module/icp/core/kcf_sched.c +++ b/module/icp/core/kcf_sched.c @@ -573,15 +573,6 @@ kcf_resubmit_request(kcf_areq_node_t *areq) return (error); } -static inline int EMPTY_TASKQ(taskq_t *tq) -{ -#ifdef _KERNEL - return (tq->tq_lowest_id == tq->tq_next_id); -#else - return (tq->tq_task.tqent_next == &tq->tq_task || tq->tq_active == 0); -#endif -} - /* * Routine called by both ioctl and k-api. The consumer should * bundle the parameters into a kcf_req_params_t structure. A bunch @@ -622,7 +613,7 @@ kcf_submit_request(kcf_provider_desc_t *pd, crypto_ctx_t *ctx, * request allocation and call the SPI directly. */ if ((pd->pd_flags & CRYPTO_SYNCHRONOUS) && - EMPTY_TASKQ(taskq)) { + taskq_empty(taskq)) { KCF_PROV_IREFHOLD(pd); if (pd->pd_state == KCF_PROV_READY) { error = common_submit_request(pd, ctx, @@ -657,7 +648,7 @@ kcf_submit_request(kcf_provider_desc_t *pd, crypto_ctx_t *ctx, * case. This is unlike the asynchronous case where we * must always dispatch to the taskq. */ - if (EMPTY_TASKQ(taskq) && + if (taskq_empty(taskq) && pd->pd_state == KCF_PROV_READY) { process_req_hwp(sreq); } else { diff --git a/module/os/linux/spl/spl-taskq.c b/module/os/linux/spl/spl-taskq.c index 0aab148975..bd0052e00d 100644 --- a/module/os/linux/spl/spl-taskq.c +++ b/module/os/linux/spl/spl-taskq.c @@ -1229,6 +1229,13 @@ taskq_destroy(taskq_t *tq) } EXPORT_SYMBOL(taskq_destroy); +boolean_t +taskq_empty(taskq_t *tq) +{ + return (tq->tq_lowest_id == tq->tq_next_id); +} +EXPORT_SYMBOL(taskq_empty); + static unsigned int spl_taskq_kick = 0; /*