diff options
author | Richard Yao <[email protected]> | 2015-12-03 14:15:16 -0500 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2015-12-08 13:24:47 -0800 |
commit | a430c11f0b1ef16ca5edf3059e4082709277376c (patch) | |
tree | b16f8abb6b7c13c0fc73b9538a3181014683fb52 /include | |
parent | 1683e75edc1fdca1eba53f16ca08ce32c5e736d1 (diff) |
Make taskq_member() use ->journal_info
The ->journal_info pointer in the task_struct is reserved for use by
filesystems and because the kernel can have multiple file systems on the
same stack due to direct reclaim, each filesystem that touches
->journal_info in a callback function will save the value at the start
of its frame and restore it at the end of its frame. This allows us to
safely use ->journal_info to store a pointer to the taskq's struct in
taskq threads so that ZFS code paths can detect the presence of a taskq.
This could break if the ZFS code were to use taskq_member from the
context of direct reclaim. However, there are no such uses of it in that
manner, so this is safe.
This eliminates an O(N) list traversal under a spinlock with an O(1)
unlocked pointer comparison.
Signed-off-by: Richard Yao <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Signed-off-by: tuxoko <[email protected]>
Signed-off-by: Tim Chase <[email protected]>
Closes #500
Diffstat (limited to 'include')
-rw-r--r-- | include/sys/taskq.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/include/sys/taskq.h b/include/sys/taskq.h index a43a86da6..65f911245 100644 --- a/include/sys/taskq.h +++ b/include/sys/taskq.h @@ -124,7 +124,7 @@ extern void taskq_wait_id(taskq_t *, taskqid_t); extern void taskq_wait_outstanding(taskq_t *, taskqid_t); extern void taskq_wait(taskq_t *); extern int taskq_cancel_id(taskq_t *, taskqid_t); -extern int taskq_member(taskq_t *, void *); +#define taskq_member(taskq, thread) ((taskq) == ((thread)->journal_info)) #define taskq_create_proc(name, nthreads, pri, min, max, proc, flags) \ taskq_create(name, nthreads, pri, min, max, flags) |