]> granicus.if.org Git - spl/commitdiff
Add system_delay_taskq for long delay
authorChunwei Chen <tuxoko@gmail.com>
Thu, 8 Dec 2016 21:00:20 +0000 (13:00 -0800)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Thu, 8 Dec 2016 21:00:20 +0000 (14:00 -0700)
Add a dedicated system_delay_taskq for long delay like spa_deadman and
zpl_posix_acl_free. This will allow us to use system_taskq in the manner of
dispatch multiple tasks and call taskq_wait_outstanding.

Reviewed by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Chunwei Chen <david.chen@osnexus.com>
Closes #588

include/sys/taskq.h
module/spl/spl-taskq.c

index 1eecda4d2876027adb171edf482447ffe2e4fc2d..5adda882725cd691896d77099b5eab5b9cc2f072 100644 (file)
@@ -129,6 +129,8 @@ typedef struct taskq_thread {
 
 /* Global system-wide dynamic task queue available for all consumers */
 extern taskq_t *system_taskq;
+/* Global dynamic task queue for long delay */
+extern taskq_t *system_delay_taskq;
 
 /* List of all taskqs */
 extern struct list_head tq_list;
index b362bef548ef434c978e8a7260004499c16a33b9..83f483ea9762c78fd626a4309b65cad4f098e1bc 100644 (file)
@@ -50,6 +50,9 @@ MODULE_PARM_DESC(spl_taskq_thread_sequential,
 /* Global system-wide dynamic task queue available for all consumers */
 taskq_t *system_taskq;
 EXPORT_SYMBOL(system_taskq);
+/* Global dynamic task queue for long delay */
+taskq_t *system_delay_taskq;
+EXPORT_SYMBOL(system_delay_taskq);
 
 /* Private dedicated taskq for creating new taskq threads on demand. */
 static taskq_t *dynamic_taskq;
@@ -1238,10 +1241,18 @@ spl_taskq_init(void)
        if (system_taskq == NULL)
                return (1);
 
+       system_delay_taskq = taskq_create("spl_delay_taskq", MAX(boot_ncpus, 4),
+           maxclsyspri, boot_ncpus, INT_MAX, TASKQ_PREPOPULATE|TASKQ_DYNAMIC);
+       if (system_delay_taskq == NULL) {
+               taskq_destroy(system_taskq);
+               return (1);
+       }
+
        dynamic_taskq = taskq_create("spl_dynamic_taskq", 1,
            maxclsyspri, boot_ncpus, INT_MAX, TASKQ_PREPOPULATE);
        if (dynamic_taskq == NULL) {
                taskq_destroy(system_taskq);
+               taskq_destroy(system_delay_taskq);
                return (1);
        }
 
@@ -1261,6 +1272,9 @@ spl_taskq_fini(void)
        taskq_destroy(dynamic_taskq);
        dynamic_taskq = NULL;
 
+       taskq_destroy(system_delay_taskq);
+       system_delay_taskq = NULL;
+
        taskq_destroy(system_taskq);
        system_taskq = NULL;