From 617d5a673cd16aa91fa9668b94cc385094fae852 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Thu, 15 Jan 2009 10:44:54 -0800 Subject: Rename modules to module and update references --- module/spl/spl-taskq.c | 491 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 491 insertions(+) create mode 100644 module/spl/spl-taskq.c (limited to 'module/spl/spl-taskq.c') diff --git a/module/spl/spl-taskq.c b/module/spl/spl-taskq.c new file mode 100644 index 000000000..799b54839 --- /dev/null +++ b/module/spl/spl-taskq.c @@ -0,0 +1,491 @@ +/* + * This file is part of the SPL: Solaris Porting Layer. + * + * Copyright (c) 2008 Lawrence Livermore National Security, LLC. + * Produced at Lawrence Livermore National Laboratory + * Written by: + * Brian Behlendorf , + * Herb Wartens , + * Jim Garlick + * UCRL-CODE-235197 + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include +#include + +#ifdef DEBUG_SUBSYSTEM +#undef DEBUG_SUBSYSTEM +#endif + +#define DEBUG_SUBSYSTEM S_TASKQ + +/* Global system-wide dynamic task queue available for all consumers */ +taskq_t *system_taskq; +EXPORT_SYMBOL(system_taskq); + +typedef struct spl_task { + spinlock_t t_lock; + struct list_head t_list; + taskqid_t t_id; + task_func_t *t_func; + void *t_arg; +} spl_task_t; + +/* NOTE: Must be called with tq->tq_lock held, returns a list_t which + * is not attached to the free, work, or pending taskq lists. + */ +static spl_task_t * +task_alloc(taskq_t *tq, uint_t flags) +{ + spl_task_t *t; + int count = 0; + ENTRY; + + ASSERT(tq); + ASSERT(flags & (TQ_SLEEP | TQ_NOSLEEP)); /* One set */ + ASSERT(!((flags & TQ_SLEEP) && (flags & TQ_NOSLEEP))); /* Not both */ + ASSERT(spin_is_locked(&tq->tq_lock)); +retry: + /* Aquire spl_task_t's from free list if available */ + if (!list_empty(&tq->tq_free_list) && !(flags & TQ_NEW)) { + t = list_entry(tq->tq_free_list.next, spl_task_t, t_list); + list_del_init(&t->t_list); + RETURN(t); + } + + /* Free list is empty and memory allocs are prohibited */ + if (flags & TQ_NOALLOC) + RETURN(NULL); + + /* Hit maximum spl_task_t pool size */ + if (tq->tq_nalloc >= tq->tq_maxalloc) { + if (flags & TQ_NOSLEEP) + RETURN(NULL); + + /* Sleep periodically polling the free list for an available + * spl_task_t. If a full second passes and we have not found + * one gives up and return a NULL to the caller. */ + if (flags & TQ_SLEEP) { + spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); + schedule_timeout(HZ / 100); + spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); + if (count < 100) + GOTO(retry, count++); + + RETURN(NULL); + } + + /* Unreachable, TQ_SLEEP xor TQ_NOSLEEP */ + SBUG(); + } + + spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); + t = kmem_alloc(sizeof(spl_task_t), flags & (TQ_SLEEP | TQ_NOSLEEP)); + spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); + + if (t) { + spin_lock_init(&t->t_lock); + INIT_LIST_HEAD(&t->t_list); + t->t_id = 0; + t->t_func = NULL; + t->t_arg = NULL; + tq->tq_nalloc++; + } + + RETURN(t); +} + +/* NOTE: Must be called with tq->tq_lock held, expectes the spl_task_t + * to already be removed from the free, work, or pending taskq lists. + */ +static void +task_free(taskq_t *tq, spl_task_t *t) +{ + ENTRY; + + ASSERT(tq); + ASSERT(t); + ASSERT(spin_is_locked(&tq->tq_lock)); + ASSERT(list_empty(&t->t_list)); + + kmem_free(t, sizeof(spl_task_t)); + tq->tq_nalloc--; + + EXIT; +} + +/* NOTE: Must be called with tq->tq_lock held, either destroyes the + * spl_task_t if too many exist or moves it to the free list for later use. + */ +static void +task_done(taskq_t *tq, spl_task_t *t) +{ + ENTRY; + ASSERT(tq); + ASSERT(t); + ASSERT(spin_is_locked(&tq->tq_lock)); + + list_del_init(&t->t_list); + + if (tq->tq_nalloc <= tq->tq_minalloc) { + t->t_id = 0; + t->t_func = NULL; + t->t_arg = NULL; + list_add_tail(&t->t_list, &tq->tq_free_list); + } else { + task_free(tq, t); + } + + EXIT; +} + +/* Taskqid's are handed out in a monotonically increasing fashion per + * taskq_t. We don't handle taskqid wrapping yet, but fortuntely it isi + * a 64-bit value so this is probably never going to happen. The lowest + * pending taskqid is stored in the taskq_t to make it easy for any + * taskq_wait()'ers to know if the tasks they're waiting for have + * completed. Unfortunately, tq_task_lowest is kept up to date is + * a pretty brain dead way, something more clever should be done. + */ +static int +taskq_wait_check(taskq_t *tq, taskqid_t id) +{ + RETURN(tq->tq_lowest_id >= id); +} + +/* Expected to wait for all previously scheduled tasks to complete. We do + * not need to wait for tasked scheduled after this call to complete. In + * otherwords we do not need to drain the entire taskq. */ +void +__taskq_wait_id(taskq_t *tq, taskqid_t id) +{ + ENTRY; + ASSERT(tq); + + wait_event(tq->tq_wait_waitq, taskq_wait_check(tq, id)); + + EXIT; +} +EXPORT_SYMBOL(__taskq_wait_id); + +void +__taskq_wait(taskq_t *tq) +{ + taskqid_t id; + ENTRY; + ASSERT(tq); + + spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); + id = tq->tq_next_id; + spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); + + __taskq_wait_id(tq, id); + + EXIT; + +} +EXPORT_SYMBOL(__taskq_wait); + +int +__taskq_member(taskq_t *tq, void *t) +{ + int i; + ENTRY; + + ASSERT(tq); + ASSERT(t); + + for (i = 0; i < tq->tq_nthreads; i++) + if (tq->tq_threads[i] == (struct task_struct *)t) + RETURN(1); + + RETURN(0); +} +EXPORT_SYMBOL(__taskq_member); + +taskqid_t +__taskq_dispatch(taskq_t *tq, task_func_t func, void *arg, uint_t flags) +{ + spl_task_t *t; + taskqid_t rc = 0; + ENTRY; + + ASSERT(tq); + ASSERT(func); + if (unlikely(in_atomic() && (flags & TQ_SLEEP))) { + CERROR("May schedule while atomic: %s/0x%08x/%d\n", + current->comm, preempt_count(), current->pid); + SBUG(); + } + + spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); + + /* Taskq being destroyed and all tasks drained */ + if (!(tq->tq_flags & TQ_ACTIVE)) + GOTO(out, rc = 0); + + /* Do not queue the task unless there is idle thread for it */ + ASSERT(tq->tq_nactive <= tq->tq_nthreads); + if ((flags & TQ_NOQUEUE) && (tq->tq_nactive == tq->tq_nthreads)) + GOTO(out, rc = 0); + + if ((t = task_alloc(tq, flags)) == NULL) + GOTO(out, rc = 0); + + spin_lock(&t->t_lock); + list_add_tail(&t->t_list, &tq->tq_pend_list); + t->t_id = rc = tq->tq_next_id; + tq->tq_next_id++; + t->t_func = func; + t->t_arg = arg; + spin_unlock(&t->t_lock); + + wake_up(&tq->tq_work_waitq); +out: + spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); + RETURN(rc); +} +EXPORT_SYMBOL(__taskq_dispatch); + +/* NOTE: Must be called with tq->tq_lock held */ +static taskqid_t +taskq_lowest_id(taskq_t *tq) +{ + taskqid_t lowest_id = ~0; + spl_task_t *t; + ENTRY; + + ASSERT(tq); + ASSERT(spin_is_locked(&tq->tq_lock)); + + list_for_each_entry(t, &tq->tq_pend_list, t_list) + if (t->t_id < lowest_id) + lowest_id = t->t_id; + + list_for_each_entry(t, &tq->tq_work_list, t_list) + if (t->t_id < lowest_id) + lowest_id = t->t_id; + + RETURN(lowest_id); +} + +static int +taskq_thread(void *args) +{ + DECLARE_WAITQUEUE(wait, current); + sigset_t blocked; + taskqid_t id; + taskq_t *tq = args; + spl_task_t *t; + ENTRY; + + ASSERT(tq); + current->flags |= PF_NOFREEZE; + + sigfillset(&blocked); + sigprocmask(SIG_BLOCK, &blocked, NULL); + flush_signals(current); + + spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); + tq->tq_nthreads++; + wake_up(&tq->tq_wait_waitq); + set_current_state(TASK_INTERRUPTIBLE); + + while (!kthread_should_stop()) { + + add_wait_queue(&tq->tq_work_waitq, &wait); + if (list_empty(&tq->tq_pend_list)) { + spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); + schedule(); + spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); + } else { + __set_current_state(TASK_RUNNING); + } + + remove_wait_queue(&tq->tq_work_waitq, &wait); + if (!list_empty(&tq->tq_pend_list)) { + t = list_entry(tq->tq_pend_list.next, spl_task_t, t_list); + list_del_init(&t->t_list); + list_add_tail(&t->t_list, &tq->tq_work_list); + tq->tq_nactive++; + spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); + + /* Perform the requested task */ + t->t_func(t->t_arg); + + spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); + tq->tq_nactive--; + id = t->t_id; + task_done(tq, t); + + /* Update the lowest remaining taskqid yet to run */ + if (tq->tq_lowest_id == id) { + tq->tq_lowest_id = taskq_lowest_id(tq); + ASSERT(tq->tq_lowest_id > id); + } + + wake_up_all(&tq->tq_wait_waitq); + } + + set_current_state(TASK_INTERRUPTIBLE); + + } + + __set_current_state(TASK_RUNNING); + tq->tq_nthreads--; + spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); + + RETURN(0); +} + +taskq_t * +__taskq_create(const char *name, int nthreads, pri_t pri, + int minalloc, int maxalloc, uint_t flags) +{ + taskq_t *tq; + struct task_struct *t; + int rc = 0, i, j = 0; + ENTRY; + + ASSERT(name != NULL); + ASSERT(pri <= maxclsyspri); + ASSERT(minalloc >= 0); + ASSERT(maxalloc <= INT_MAX); + ASSERT(!(flags & (TASKQ_CPR_SAFE | TASKQ_DYNAMIC))); /* Unsupported */ + + tq = kmem_alloc(sizeof(*tq), KM_SLEEP); + if (tq == NULL) + RETURN(NULL); + + tq->tq_threads = kmem_alloc(nthreads * sizeof(t), KM_SLEEP); + if (tq->tq_threads == NULL) { + kmem_free(tq, sizeof(*tq)); + RETURN(NULL); + } + + spin_lock_init(&tq->tq_lock); + spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); + tq->tq_name = name; + tq->tq_nactive = 0; + tq->tq_nthreads = 0; + tq->tq_pri = pri; + tq->tq_minalloc = minalloc; + tq->tq_maxalloc = maxalloc; + tq->tq_nalloc = 0; + tq->tq_flags = (flags | TQ_ACTIVE); + tq->tq_next_id = 1; + tq->tq_lowest_id = 1; + INIT_LIST_HEAD(&tq->tq_free_list); + INIT_LIST_HEAD(&tq->tq_work_list); + INIT_LIST_HEAD(&tq->tq_pend_list); + init_waitqueue_head(&tq->tq_work_waitq); + init_waitqueue_head(&tq->tq_wait_waitq); + + if (flags & TASKQ_PREPOPULATE) + for (i = 0; i < minalloc; i++) + task_done(tq, task_alloc(tq, TQ_SLEEP | TQ_NEW)); + + spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); + + for (i = 0; i < nthreads; i++) { + t = kthread_create(taskq_thread, tq, "%s/%d", name, i); + if (t) { + tq->tq_threads[i] = t; + kthread_bind(t, i % num_online_cpus()); + set_user_nice(t, PRIO_TO_NICE(pri)); + wake_up_process(t); + j++; + } else { + tq->tq_threads[i] = NULL; + rc = 1; + } + } + + /* Wait for all threads to be started before potential destroy */ + wait_event(tq->tq_wait_waitq, tq->tq_nthreads == j); + + if (rc) { + __taskq_destroy(tq); + tq = NULL; + } + + RETURN(tq); +} +EXPORT_SYMBOL(__taskq_create); + +void +__taskq_destroy(taskq_t *tq) +{ + spl_task_t *t; + int i, nthreads; + ENTRY; + + ASSERT(tq); + spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); + tq->tq_flags &= ~TQ_ACTIVE; + spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); + + /* TQ_ACTIVE cleared prevents new tasks being added to pending */ + __taskq_wait(tq); + + nthreads = tq->tq_nthreads; + for (i = 0; i < nthreads; i++) + if (tq->tq_threads[i]) + kthread_stop(tq->tq_threads[i]); + + spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); + + while (!list_empty(&tq->tq_free_list)) { + t = list_entry(tq->tq_free_list.next, spl_task_t, t_list); + list_del_init(&t->t_list); + task_free(tq, t); + } + + ASSERT(tq->tq_nthreads == 0); + ASSERT(tq->tq_nalloc == 0); + ASSERT(list_empty(&tq->tq_free_list)); + ASSERT(list_empty(&tq->tq_work_list)); + ASSERT(list_empty(&tq->tq_pend_list)); + + spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); + kmem_free(tq->tq_threads, nthreads * sizeof(spl_task_t *)); + kmem_free(tq, sizeof(taskq_t)); + + EXIT; +} +EXPORT_SYMBOL(__taskq_destroy); + +int +spl_taskq_init(void) +{ + ENTRY; + + system_taskq = taskq_create("system_taskq", 64, minclsyspri, 4, 512, + TASKQ_PREPOPULATE); + if (system_taskq == NULL) + RETURN(1); + + RETURN(0); +} + +void +spl_taskq_fini(void) +{ + ENTRY; + taskq_destroy(system_taskq); + EXIT; +} -- cgit v1.2.3 From f220894e1fc86cbfaf073dc4cca519887c41e78e Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Mon, 2 Feb 2009 08:53:53 -0800 Subject: Make the number of system taskq threads based on the node of cores in the node, as is done for most linux system tasks --- module/spl/spl-taskq.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'module/spl/spl-taskq.c') diff --git a/module/spl/spl-taskq.c b/module/spl/spl-taskq.c index 799b54839..e77ef669f 100644 --- a/module/spl/spl-taskq.c +++ b/module/spl/spl-taskq.c @@ -474,8 +474,10 @@ spl_taskq_init(void) { ENTRY; - system_taskq = taskq_create("system_taskq", 64, minclsyspri, 4, 512, - TASKQ_PREPOPULATE); + /* Solaris creates a dynamic taskq of up to 64 threads, however in + * a Linux environment 1 thread per-core is usually about right */ + system_taskq = taskq_create("spl_system_taskq", num_online_cpus(), + minclsyspri, 4, 512, TASKQ_PREPOPULATE); if (system_taskq == NULL) RETURN(1); -- cgit v1.2.3 From 7257ec41856cf54d47a85f786f06e5a3c330acfc Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Sun, 15 Mar 2009 15:13:49 -0700 Subject: Fix taskq_wait() not waiting bug I'm very surprised this has not surfaced until now. But the taskq_wait() implementation work only wait successfully the first time it was called. Subsequent usage of taskq_wait() on the taskq would not wait. The issue was caused by tq->tq_lowest_id being set to MAX_INT after the first wait completed. This caused subsequent waits which check that the waiting id is less than the lowest taskq id to always succeed. The fix is to ensure that tq->tq_lowest_id is never set larger than tq->tq_next.id. Additional fixes which were added to this patch include: 1) Fix a race by placing the taskq_wait_check() in the tq->tq_lock spinlock. 2) taskq_wait() should wait for the largest outstanding id. 3) Multiple spelling corrections. 4) Added taskq wait regression test to validate correct behavior. --- include/sys/taskq.h | 1 + module/spl/spl-taskq.c | 32 ++++++++++++-------- module/splat/splat-taskq.c | 75 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 96 insertions(+), 12 deletions(-) (limited to 'module/spl/spl-taskq.c') diff --git a/include/sys/taskq.h b/include/sys/taskq.h index 0e78ea123..0b8623103 100644 --- a/include/sys/taskq.h +++ b/include/sys/taskq.h @@ -87,6 +87,7 @@ extern taskq_t *system_taskq; extern taskqid_t __taskq_dispatch(taskq_t *, task_func_t, void *, uint_t); extern taskq_t *__taskq_create(const char *, int, pri_t, int, int, uint_t); extern void __taskq_destroy(taskq_t *); +extern void __taskq_wait_id(taskq_t *, taskqid_t); extern void __taskq_wait(taskq_t *); extern int __taskq_member(taskq_t *, void *); diff --git a/module/spl/spl-taskq.c b/module/spl/spl-taskq.c index e77ef669f..5960761f4 100644 --- a/module/spl/spl-taskq.c +++ b/module/spl/spl-taskq.c @@ -60,14 +60,14 @@ task_alloc(taskq_t *tq, uint_t flags) ASSERT(!((flags & TQ_SLEEP) && (flags & TQ_NOSLEEP))); /* Not both */ ASSERT(spin_is_locked(&tq->tq_lock)); retry: - /* Aquire spl_task_t's from free list if available */ + /* Acquire spl_task_t's from free list if available */ if (!list_empty(&tq->tq_free_list) && !(flags & TQ_NEW)) { t = list_entry(tq->tq_free_list.next, spl_task_t, t_list); list_del_init(&t->t_list); RETURN(t); } - /* Free list is empty and memory allocs are prohibited */ + /* Free list is empty and memory allocations are prohibited */ if (flags & TQ_NOALLOC) RETURN(NULL); @@ -89,7 +89,7 @@ retry: RETURN(NULL); } - /* Unreachable, TQ_SLEEP xor TQ_NOSLEEP */ + /* Unreachable, TQ_SLEEP or TQ_NOSLEEP */ SBUG(); } @@ -109,7 +109,7 @@ retry: RETURN(t); } -/* NOTE: Must be called with tq->tq_lock held, expectes the spl_task_t +/* NOTE: Must be called with tq->tq_lock held, expects the spl_task_t * to already be removed from the free, work, or pending taskq lists. */ static void @@ -128,7 +128,7 @@ task_free(taskq_t *tq, spl_task_t *t) EXIT; } -/* NOTE: Must be called with tq->tq_lock held, either destroyes the +/* NOTE: Must be called with tq->tq_lock held, either destroys the * spl_task_t if too many exist or moves it to the free list for later use. */ static void @@ -154,7 +154,7 @@ task_done(taskq_t *tq, spl_task_t *t) } /* Taskqid's are handed out in a monotonically increasing fashion per - * taskq_t. We don't handle taskqid wrapping yet, but fortuntely it isi + * taskq_t. We don't handle taskqid wrapping yet, but fortunately it is * a 64-bit value so this is probably never going to happen. The lowest * pending taskqid is stored in the taskq_t to make it easy for any * taskq_wait()'ers to know if the tasks they're waiting for have @@ -164,12 +164,18 @@ task_done(taskq_t *tq, spl_task_t *t) static int taskq_wait_check(taskq_t *tq, taskqid_t id) { - RETURN(tq->tq_lowest_id >= id); + int rc; + + spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); + rc = (id < tq->tq_lowest_id); + spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); + + RETURN(rc); } /* Expected to wait for all previously scheduled tasks to complete. We do * not need to wait for tasked scheduled after this call to complete. In - * otherwords we do not need to drain the entire taskq. */ + * other words we do not need to drain the entire taskq. */ void __taskq_wait_id(taskq_t *tq, taskqid_t id) { @@ -189,8 +195,9 @@ __taskq_wait(taskq_t *tq) ENTRY; ASSERT(tq); + /* Wait for the largest outstanding taskqid */ spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); - id = tq->tq_next_id; + id = tq->tq_next_id - 1; spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); __taskq_wait_id(tq, id); @@ -265,7 +272,7 @@ EXPORT_SYMBOL(__taskq_dispatch); static taskqid_t taskq_lowest_id(taskq_t *tq) { - taskqid_t lowest_id = ~0; + taskqid_t lowest_id = tq->tq_next_id; spl_task_t *t; ENTRY; @@ -318,7 +325,7 @@ taskq_thread(void *args) remove_wait_queue(&tq->tq_work_waitq, &wait); if (!list_empty(&tq->tq_pend_list)) { - t = list_entry(tq->tq_pend_list.next, spl_task_t, t_list); + t = list_entry(tq->tq_pend_list.next,spl_task_t,t_list); list_del_init(&t->t_list); list_add_tail(&t->t_list, &tq->tq_work_list); tq->tq_nactive++; @@ -332,7 +339,8 @@ taskq_thread(void *args) id = t->t_id; task_done(tq, t); - /* Update the lowest remaining taskqid yet to run */ + /* When the current lowest outstanding taskqid is + * done calculate the new lowest outstanding id */ if (tq->tq_lowest_id == id) { tq->tq_lowest_id = taskq_lowest_id(tq); ASSERT(tq->tq_lowest_id > id); diff --git a/module/splat/splat-taskq.c b/module/splat/splat-taskq.c index 3cc09bcb9..a9398f5a5 100644 --- a/module/splat/splat-taskq.c +++ b/module/splat/splat-taskq.c @@ -42,9 +42,14 @@ #define SPLAT_TASKQ_TEST3_NAME "system" #define SPLAT_TASKQ_TEST3_DESC "System task queue, multiple tasks" +#define SPLAT_TASKQ_TEST4_ID 0x0204 +#define SPLAT_TASKQ_TEST4_NAME "wait" +#define SPLAT_TASKQ_TEST4_DESC "Multiple task waiting" + typedef struct splat_taskq_arg { int flag; int id; + atomic_t count; struct file *file; const char *name; } splat_taskq_arg_t; @@ -266,6 +271,73 @@ splat_taskq_test3(struct file *file, void *arg) return (tq_arg.flag) ? 0 : -EINVAL; } +static void +splat_taskq_test4_func(void *arg) +{ + splat_taskq_arg_t *tq_arg = (splat_taskq_arg_t *)arg; + ASSERT(tq_arg); + + atomic_inc(&tq_arg->count); +} + +static int +splat_taskq_test4(struct file *file, void *arg) +{ + taskq_t *tq; + splat_taskq_arg_t tq_arg; + int i, j, rc = 0; + + splat_vprint(file, SPLAT_TASKQ_TEST4_NAME, "Taskq '%s' creating\n", + SPLAT_TASKQ_TEST4_NAME); + if ((tq = taskq_create(SPLAT_TASKQ_TEST4_NAME, 1, maxclsyspri, + 50, INT_MAX, TASKQ_PREPOPULATE)) == NULL) { + splat_vprint(file, SPLAT_TASKQ_TEST4_NAME, + "Taskq '%s' create failed\n", + SPLAT_TASKQ_TEST4_NAME); + return -EINVAL; + } + + tq_arg.file = file; + tq_arg.name = SPLAT_TASKQ_TEST4_NAME; + + for (i = 1; i <= 1024; i *= 2) { + atomic_set(&tq_arg.count, 0); + splat_vprint(file, SPLAT_TASKQ_TEST4_NAME, + "Taskq '%s' function '%s' dispatched %d times\n", + tq_arg.name, sym2str(splat_taskq_test4_func), i); + + for (j = 0; j < i; j++) { + if ((taskq_dispatch(tq, splat_taskq_test4_func, + &tq_arg, TQ_SLEEP)) == 0) { + splat_vprint(file, SPLAT_TASKQ_TEST4_NAME, + "Taskq '%s' function '%s' dispatch " + "%d failed\n", tq_arg.name, + sym2str(splat_taskq_test13_func), j); + rc = -EINVAL; + goto out; + } + } + + splat_vprint(file, SPLAT_TASKQ_TEST4_NAME, "Taskq '%s' " + "waiting for %d dispatches\n", tq_arg.name, i); + taskq_wait(tq); + splat_vprint(file, SPLAT_TASKQ_TEST4_NAME, "Taskq '%s' " + "%d/%d dispatches finished\n", tq_arg.name, + atomic_read(&tq_arg.count), i); + if (atomic_read(&tq_arg.count) != i) { + rc = -ERANGE; + goto out; + + } + } +out: + splat_vprint(file, SPLAT_TASKQ_TEST4_NAME, "Taskq '%s' destroying\n", + tq_arg.name); + taskq_destroy(tq); + + return rc; +} + splat_subsystem_t * splat_taskq_init(void) { @@ -289,6 +361,8 @@ splat_taskq_init(void) SPLAT_TASKQ_TEST2_ID, splat_taskq_test2); SPLAT_TEST_INIT(sub, SPLAT_TASKQ_TEST3_NAME, SPLAT_TASKQ_TEST3_DESC, SPLAT_TASKQ_TEST3_ID, splat_taskq_test3); + SPLAT_TEST_INIT(sub, SPLAT_TASKQ_TEST4_NAME, SPLAT_TASKQ_TEST4_DESC, + SPLAT_TASKQ_TEST4_ID, splat_taskq_test4); return sub; } @@ -297,6 +371,7 @@ void splat_taskq_fini(splat_subsystem_t *sub) { ASSERT(sub); + SPLAT_TEST_FINI(sub, SPLAT_TASKQ_TEST4_ID); SPLAT_TEST_FINI(sub, SPLAT_TASKQ_TEST3_ID); SPLAT_TEST_FINI(sub, SPLAT_TASKQ_TEST2_ID); SPLAT_TEST_FINI(sub, SPLAT_TASKQ_TEST1_ID); -- cgit v1.2.3 From 915404bd509e5231c134042560d86e3ac86c1ab4 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Thu, 9 Jul 2009 10:07:52 -0700 Subject: Add basic support for TASKQ_THREADS_CPU_PCT taskq flag which is used to scale the number of threads based on the number of online CPUs. As CPUs are added/removed we should rescale the thread count appropriately, but currently this is only done at create. --- include/sys/taskq.h | 1 + module/spl/spl-taskq.c | 9 +++++++++ 2 files changed, 10 insertions(+) (limited to 'module/spl/spl-taskq.c') diff --git a/include/sys/taskq.h b/include/sys/taskq.h index 0b8623103..603fde680 100644 --- a/include/sys/taskq.h +++ b/include/sys/taskq.h @@ -44,6 +44,7 @@ extern "C" { #define TASKQ_PREPOPULATE 0x00000001 #define TASKQ_CPR_SAFE 0x00000002 #define TASKQ_DYNAMIC 0x00000004 +#define TASKQ_THREADS_CPU_PCT 0x00000008 typedef unsigned long taskqid_t; typedef void (task_func_t)(void *); diff --git a/module/spl/spl-taskq.c b/module/spl/spl-taskq.c index 5960761f4..7575aa3b0 100644 --- a/module/spl/spl-taskq.c +++ b/module/spl/spl-taskq.c @@ -375,6 +375,15 @@ __taskq_create(const char *name, int nthreads, pri_t pri, ASSERT(maxalloc <= INT_MAX); ASSERT(!(flags & (TASKQ_CPR_SAFE | TASKQ_DYNAMIC))); /* Unsupported */ + /* Scale the number of threads using nthreads as a percentage */ + if (flags & TASKQ_THREADS_CPU_PCT) { + ASSERT(nthreads <= 100); + ASSERT(nthreads >= 0); + nthreads = MIN(nthreads, 100); + nthreads = MAX(nthreads, 0); + nthreads = MAX((num_online_cpus() * nthreads) / 100, 1); + } + tq = kmem_alloc(sizeof(*tq), KM_SLEEP); if (tq == NULL) RETURN(NULL); -- cgit v1.2.3 From 82387586af283ac5fa6cde5d316f7ed4c587efec Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Mon, 4 Jan 2010 15:52:26 -0800 Subject: Optimize lowest outstanding taskqid calculation in taskq_lowest_id() In the initial version of taskq_lowest_id() the entire pending and work list was locked under the tq->tq_lock to determine the lowest outstanding taskqid. At the time this done because I was rushed and wanted to make sure it was right... fast was secondary. Well now fast is important too so I carefully thought through the pending and work list management and convinced myself it is safe and correct to simply check the first entry. I added a large comment to the source to explain this. But basically as long as we are careful to ensure the pending and work list stay sorted this is safe and fast. The motivation for this chance was that I was observing as much as 10% of the total CPU time go to waiting on the tq->tq_lock when the pending list was long. This resolves that problems and frees up that CPU time for something useful. --- module/spl/spl-taskq.c | 61 +++++++++++++++++++++++++++++++++----------------- 1 file changed, 41 insertions(+), 20 deletions(-) (limited to 'module/spl/spl-taskq.c') diff --git a/module/spl/spl-taskq.c b/module/spl/spl-taskq.c index 7575aa3b0..16b1382d9 100644 --- a/module/spl/spl-taskq.c +++ b/module/spl/spl-taskq.c @@ -45,7 +45,8 @@ typedef struct spl_task { void *t_arg; } spl_task_t; -/* NOTE: Must be called with tq->tq_lock held, returns a list_t which +/* + * NOTE: Must be called with tq->tq_lock held, returns a list_t which * is not attached to the free, work, or pending taskq lists. */ static spl_task_t * @@ -109,7 +110,8 @@ retry: RETURN(t); } -/* NOTE: Must be called with tq->tq_lock held, expects the spl_task_t +/* + * NOTE: Must be called with tq->tq_lock held, expects the spl_task_t * to already be removed from the free, work, or pending taskq lists. */ static void @@ -128,7 +130,8 @@ task_free(taskq_t *tq, spl_task_t *t) EXIT; } -/* NOTE: Must be called with tq->tq_lock held, either destroys the +/* + * NOTE: Must be called with tq->tq_lock held, either destroys the * spl_task_t if too many exist or moves it to the free list for later use. */ static void @@ -153,13 +156,28 @@ task_done(taskq_t *tq, spl_task_t *t) EXIT; } -/* Taskqid's are handed out in a monotonically increasing fashion per - * taskq_t. We don't handle taskqid wrapping yet, but fortunately it is - * a 64-bit value so this is probably never going to happen. The lowest - * pending taskqid is stored in the taskq_t to make it easy for any - * taskq_wait()'ers to know if the tasks they're waiting for have - * completed. Unfortunately, tq_task_lowest is kept up to date is - * a pretty brain dead way, something more clever should be done. +/* + * As tasks are submitted to the task queue they are assigned a + * monotonically increasing taskqid and added to the tail of the + * pending list. As worker threads become available the tasks are + * removed from the head of the pending list and added to the tail + * of the work list. Finally, as tasks complete they are removed + * from the work list. This means that the pending and work lists + * are always kept sorted by taskqid. Thus the lowest outstanding + * incomplete taskqid can be determined simply by checking the min + * taskqid for each head item on the pending and work list. This + * value is stored in tq->tq_lowest_id and only updated to the new + * lowest id when the previous lowest id completes. All taskqids + * lower than tq->tq_lowest_id must have completed. It is also + * possible larger taskqid's have completed because they may be + * processed in parallel by several worker threads. However, this + * is not a problem because the behavior of taskq_wait_id() is to + * block until all previously submitted taskqid's have completed. + * + * XXX: Taskqid_t wrapping is not handled. However, taskqid_t's are + * 64-bit values so even if a taskq is processing 2^24 (16,777,216) + * taskqid_ts per second it will still take 2^40 seconds, 34,865 years, + * before the wrap occurs. I can live with that for now. */ static int taskq_wait_check(taskq_t *tq, taskqid_t id) @@ -173,9 +191,6 @@ taskq_wait_check(taskq_t *tq, taskqid_t id) RETURN(rc); } -/* Expected to wait for all previously scheduled tasks to complete. We do - * not need to wait for tasked scheduled after this call to complete. In - * other words we do not need to drain the entire taskq. */ void __taskq_wait_id(taskq_t *tq, taskqid_t id) { @@ -268,7 +283,11 @@ out: } EXPORT_SYMBOL(__taskq_dispatch); -/* NOTE: Must be called with tq->tq_lock held */ +/* + * Returns the lowest incomplete taskqid_t. The taskqid_t may + * be queued on the pending list or may be on the work list + * currently being handled, but it is not 100% complete yet. + */ static taskqid_t taskq_lowest_id(taskq_t *tq) { @@ -279,13 +298,15 @@ taskq_lowest_id(taskq_t *tq) ASSERT(tq); ASSERT(spin_is_locked(&tq->tq_lock)); - list_for_each_entry(t, &tq->tq_pend_list, t_list) - if (t->t_id < lowest_id) - lowest_id = t->t_id; + if (!list_empty(&tq->tq_pend_list)) { + t = list_entry(tq->tq_pend_list.next, spl_task_t, t_list); + lowest_id = MIN(lowest_id, t->t_id); + } - list_for_each_entry(t, &tq->tq_work_list, t_list) - if (t->t_id < lowest_id) - lowest_id = t->t_id; + if (!list_empty(&tq->tq_work_list)) { + t = list_entry(tq->tq_work_list.next, spl_task_t, t_list); + lowest_id = MIN(lowest_id, t->t_id); + } RETURN(lowest_id); } -- cgit v1.2.3 From d05ec4b45f77c0f401098d88b5299ef090c73ca9 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Fri, 23 Apr 2010 14:39:47 -0700 Subject: Assume TQ_SLEEP when not explicitly specified. --- module/spl/spl-taskq.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'module/spl/spl-taskq.c') diff --git a/module/spl/spl-taskq.c b/module/spl/spl-taskq.c index 16b1382d9..64719d762 100644 --- a/module/spl/spl-taskq.c +++ b/module/spl/spl-taskq.c @@ -248,6 +248,11 @@ __taskq_dispatch(taskq_t *tq, task_func_t func, void *arg, uint_t flags) ASSERT(tq); ASSERT(func); + + /* Solaris assumes TQ_SLEEP if not passed explicitly */ + if (!(flags & (TQ_SLEEP | TQ_NOSLEEP))) + flags |= TQ_SLEEP; + if (unlikely(in_atomic() && (flags & TQ_SLEEP))) { CERROR("May schedule while atomic: %s/0x%08x/%d\n", current->comm, preempt_count(), current->pid); -- cgit v1.2.3 From 716154c5926eb391eb8178203496430ffa7ebed8 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Mon, 17 May 2010 15:18:00 -0700 Subject: Public Release Prep Updated AUTHORS, COPYING, DISCLAIMER, and INSTALL files. Added standardized headers to all source file to clearly indicate the copyright, license, and to give credit where credit is due. --- AUTHORS | 12 ++- COPYING | 39 +++++----- DISCLAIMER | 36 +++++---- INSTALL | 162 ++++++++++++++++++++++++++------------- Makefile.in | 9 +++ autogen.sh | 4 +- cmd/Makefile.in | 8 ++ cmd/spl.c | 34 ++++---- cmd/splat.c | 37 ++++----- cmd/splat.h | 32 ++++---- config/Rules.am | 8 ++ config/rpm.am | 8 ++ config/spl-build.m4 | 11 ++- config/spl-meta.m4 | 15 ++-- configure.ac | 50 ++++++------ include/fs/fs_subr.h | 24 ++++++ include/linux/bitops_compat.h | 24 ++++++ include/linux/file_compat.h | 24 ++++++ include/linux/kallsyms_compat.h | 24 ++++++ include/linux/list_compat.h | 24 ++++++ include/linux/mm_compat.h | 24 ++++++ include/linux/module_compat.h | 24 ++++++ include/linux/mutex_compat.h | 24 ++++++ include/linux/smp_compat.h | 24 ++++++ include/linux/sysctl_compat.h | 56 ++++++++++---- include/linux/time_compat.h | 24 ++++++ include/linux/uaccess_compat.h | 24 ++++++ include/linux/workqueue_compat.h | 24 ++++++ include/rpc/types.h | 24 ++++++ include/rpc/xdr.h | 23 +++--- include/sharefs/share.h | 24 ++++++ include/spl-ctl.h | 38 +++++---- include/spl-device.h | 24 ++++++ include/splat-ctl.h | 32 ++++---- include/strings.h | 24 ++++++ include/sys/acl.h | 24 ++++++ include/sys/acl_impl.h | 24 ++++++ include/sys/atomic.h | 32 ++++---- include/sys/attr.h | 24 ++++++ include/sys/bitmap.h | 24 ++++++ include/sys/bootconf.h | 24 ++++++ include/sys/buf.h | 24 ++++++ include/sys/byteorder.h | 24 ++++++ include/sys/callb.h | 32 ++++++-- include/sys/cmn_err.h | 24 ++++++ include/sys/compress.h | 24 ++++++ include/sys/condvar.h | 39 ++++------ include/sys/conf.h | 24 ++++++ include/sys/console.h | 24 ++++++ include/sys/cpuvar.h | 24 ++++++ include/sys/crc32.h | 24 ++++++ include/sys/cred.h | 32 ++++++-- include/sys/ctype.h | 24 ++++++ include/sys/ddi.h | 24 ++++++ include/sys/debug.h | 40 ++++------ include/sys/dirent.h | 24 ++++++ include/sys/disp.h | 24 ++++++ include/sys/dkio.h | 24 ++++++ include/sys/dklabel.h | 24 ++++++ include/sys/dnlc.h | 24 ++++++ include/sys/dumphdr.h | 24 ++++++ include/sys/efi_partition.h | 24 ++++++ include/sys/errno.h | 24 ++++++ include/sys/file.h | 24 ++++++ include/sys/fm/protocol.h | 24 ++++++ include/sys/fm/util.h | 24 ++++++ include/sys/fs/swapnode.h | 24 ++++++ include/sys/int_limits.h | 24 ++++++ include/sys/int_types.h | 24 ++++++ include/sys/inttypes.h | 24 ++++++ include/sys/isa_defs.h | 32 ++++++-- include/sys/kidmap.h | 24 ++++++ include/sys/kmem.h | 40 ++++------ include/sys/kobj.h | 40 ++++------ include/sys/kstat.h | 33 ++++---- include/sys/list.h | 27 ++++++- include/sys/mkdev.h | 24 ++++++ include/sys/mntent.h | 24 ++++++ include/sys/modctl.h | 24 ++++++ include/sys/mode.h | 24 ++++++ include/sys/mount.h | 24 ++++++ include/sys/mutex.h | 32 ++++---- include/sys/note.h | 24 ++++++ include/sys/open.h | 24 ++++++ include/sys/param.h | 24 ++++++ include/sys/pathname.h | 24 ++++++ include/sys/policy.h | 24 ++++++ include/sys/proc.h | 32 ++++---- include/sys/processor.h | 24 ++++++ include/sys/random.h | 47 ++++-------- include/sys/refstr.h | 24 ++++++ include/sys/resource.h | 24 ++++++ include/sys/rwlock.h | 32 ++++---- include/sys/sdt.h | 24 ++++++ include/sys/sid.h | 24 ++++++ include/sys/signal.h | 32 ++++---- include/sys/stat.h | 24 ++++++ include/sys/stropts.h | 24 ++++++ include/sys/sunddi.h | 32 ++++---- include/sys/sunldi.h | 32 ++++---- include/sys/sysevent.h | 24 ++++++ include/sys/sysevent/eventdefs.h | 24 ++++++ include/sys/sysmacros.h | 42 ++++------ include/sys/systeminfo.h | 24 ++++++ include/sys/systm.h | 24 ++++++ include/sys/t_lock.h | 24 ++++++ include/sys/taskq.h | 40 ++++------ include/sys/thread.h | 40 ++++------ include/sys/time.h | 41 ++++------ include/sys/timer.h | 40 ++++------ include/sys/types.h | 28 ++++++- include/sys/types32.h | 24 ++++++ include/sys/u8_textprep.h | 24 ++++++ include/sys/uio.h | 35 ++++++--- include/sys/unistd.h | 24 ++++++ include/sys/utsname.h | 24 ++++++ include/sys/va_list.h | 24 ++++++ include/sys/varargs.h | 24 ++++++ include/sys/vfs.h | 24 ++++++ include/sys/vfs_opreg.h | 24 ++++++ include/sys/vmsystm.h | 32 ++++---- include/sys/vnode.h | 40 ++++------ include/sys/zmod.h | 73 +++++++++++------- include/sys/zone.h | 24 ++++++ include/unistd.h | 24 ++++++ include/util/qsort.h | 24 ++++++ include/vm/anon.h | 24 ++++++ include/vm/pvn.h | 24 ++++++ include/vm/seg_kmem.h | 24 ++++++ lib/Makefile.in | 8 ++ lib/list.c | 22 +++--- lib/list.h | 12 ++- module/spl/spl-atomic.c | 34 ++++---- module/spl/spl-condvar.c | 34 ++++---- module/spl/spl-cred.c | 32 ++++---- module/spl/spl-debug.c | 41 ++++------ module/spl/spl-err.c | 34 ++++---- module/spl/spl-generic.c | 34 ++++---- module/spl/spl-kmem.c | 34 ++++---- module/spl/spl-kobj.c | 34 ++++---- module/spl/spl-kstat.c | 34 ++++---- module/spl/spl-module.c | 34 ++++---- module/spl/spl-mutex.c | 34 ++++---- module/spl/spl-proc.c | 34 ++++---- module/spl/spl-rwlock.c | 34 ++++---- module/spl/spl-taskq.c | 34 ++++---- module/spl/spl-thread.c | 34 ++++---- module/spl/spl-time.c | 34 ++++---- module/spl/spl-vnode.c | 34 ++++---- module/spl/spl-xdr.c | 27 ++++--- module/splat/splat-atomic.c | 34 ++++---- module/splat/splat-condvar.c | 34 ++++---- module/splat/splat-cred.c | 32 ++++---- module/splat/splat-ctl.c | 67 ++++++++-------- module/splat/splat-generic.c | 34 ++++---- module/splat/splat-internal.h | 32 ++++---- module/splat/splat-kmem.c | 34 ++++---- module/splat/splat-kobj.c | 34 ++++---- module/splat/splat-list.c | 34 ++++---- module/splat/splat-mutex.c | 34 ++++---- module/splat/splat-random.c | 34 ++++---- module/splat/splat-rwlock.c | 34 ++++---- module/splat/splat-taskq.c | 34 ++++---- module/splat/splat-thread.c | 34 ++++---- module/splat/splat-time.c | 34 ++++---- module/splat/splat-vnode.c | 34 ++++---- scripts/check.sh | 25 ++++++ 167 files changed, 3491 insertions(+), 1362 deletions(-) (limited to 'module/spl/spl-taskq.c') diff --git a/AUTHORS b/AUTHORS index b780cbc05..2b0fee00c 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1,4 +1,10 @@ -Brian Behlendorf , +Brian Behlendorf +- Core Implementation. + Ricardo M. Correia -Herb Wartens , -Jim Garlick +- Bug Fixes +- XDR Implementation. + +Chris Dunlap +- LSD-Tools List Implementation. +- AutoConf META File Support. diff --git a/COPYING b/COPYING index 3912109b5..d159169d1 100644 --- a/COPYING +++ b/COPYING @@ -1,12 +1,12 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. - Preamble + Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public @@ -15,7 +15,7 @@ software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to +the GNU Lesser General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not @@ -55,8 +55,8 @@ patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. - - GNU GENERAL PUBLIC LICENSE + + GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains @@ -110,7 +110,7 @@ above, provided that you also meet all of these conditions: License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) - + These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in @@ -168,7 +168,7 @@ access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. - + 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is @@ -225,7 +225,7 @@ impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. - + 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License @@ -255,7 +255,7 @@ make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. - NO WARRANTY + NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN @@ -277,9 +277,9 @@ YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it @@ -303,10 +303,9 @@ the "copyright" line and a pointer to where the full notice is found. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Also add information on how to contact you by electronic and paper mail. @@ -336,5 +335,5 @@ necessary. Here is a sample; alter the names: This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General +library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. diff --git a/DISCLAIMER b/DISCLAIMER index 86778c593..1bb04be7e 100644 --- a/DISCLAIMER +++ b/DISCLAIMER @@ -1,22 +1,24 @@ -This notice is required to be provided under our contract with the -U.S. Department of Energy (DOE). This work was produced at the -Lawrence Livermore National Laboratory under Contract with the DOE. +This work was produced at the Lawrence Livermore National Laboratory +(LLNL) under Contract No. DE-AC52-07NA27344 (Contract 44) between +the U.S. Department of Energy (DOE) and Lawrence Livermore National +Security, LLC (LLNS) for the operation of LLNL. -Neither the United States Government nor the Lawrence Livermore National -Security, LLC. nor any of their employees, makes any warranty, express -or implied, or assumes any liability or responsibility for the accuracy, -completeness, or usefulness of any information, apparatus, product, -or process disclosed, or represents that its use would not infringe -privately-owned rights. +This work was prepared as an account of work sponsored by an agency of +the United States Government. Neither the United States Government nor +Lawrence Livermore National Security, LLC nor any of their employees, +makes any warranty, express or implied, or assumes any liability or +responsibility for the accuracy, completeness, or usefulness of any +information, apparatus, product, or process disclosed, or represents +that its use would not infringe privately-owned rights. -Also, reference herein to any specific commercial products, process, -or services by trade name, trademark, manufacturer or otherwise does +Reference herein to any specific commercial products, process, or +services by trade name, trademark, manufacturer or otherwise does not necessarily constitute or imply its endorsement, recommendation, -or favoring by the United States Government or the Lawrence Livermore -National Security, LLC. The views and opinions of authors expressed -herein do not necessarily state or reflect those of the United States -Government or the Lawrence Livermore National Security, LLC., and -shall not be used for advertising or product endorsement purposes. +or favoring by the United States Government or Lawrence Livermore +National Security, LLC. The views and opinions of authors expressed +herein do not necessarily state or reflect those of the Untied States +Government or Lawrence Livermore National Security, LLC, and shall +not be used for advertising or product endorsement purposes. -The precise terms and conditions for copying, distribution and +The precise terms and conditions for copying, distribution, and modification are specified in the file "COPYING". diff --git a/INSTALL b/INSTALL index cd052060d..8b82ade08 100644 --- a/INSTALL +++ b/INSTALL @@ -1,16 +1,19 @@ Installation Instructions ************************* -Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005 Free -Software Foundation, Inc. +Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005, +2006, 2007, 2008 Free Software Foundation, Inc. -This file is free documentation; the Free Software Foundation gives + This file is free documentation; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. Basic Installation ================== -These are generic installation instructions. + Briefly, the shell commands `./configure; make; make install' should +configure, build, and install this package. The following +more-detailed instructions are generic; see the `README' file for +instructions specific to this package. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses @@ -23,9 +26,9 @@ debugging `configure'). It can also use an optional file (typically called `config.cache' and enabled with `--cache-file=config.cache' or simply `-C') that saves -the results of its tests to speed up reconfiguring. (Caching is +the results of its tests to speed up reconfiguring. Caching is disabled by default to prevent problems with accidental use of stale -cache files.) +cache files. If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail @@ -35,22 +38,17 @@ some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.ac' (or `configure.in') is used to create -`configure' by a program called `autoconf'. You only need -`configure.ac' if you want to change it or regenerate `configure' using -a newer version of `autoconf'. +`configure' by a program called `autoconf'. You need `configure.ac' if +you want to change it or regenerate `configure' using a newer version +of `autoconf'. The simplest way to compile this package is: - 0. `cd' to the directory containing the package's source code and type - `sh ./autogen.sh' to generate the configure script for your package. + 1. `cd' to the directory containing the package's source code and type + `./configure' to configure the package for your system. - 1. Type `./configure' to configure the package for your system. If you're - using `csh' on an old version of System V, you might need to type - `sh ./configure' instead to prevent `csh' from trying to execute - `configure' itself. - - Running `configure' takes awhile. While running, it prints some - messages telling which features it is checking for. + Running `configure' might take a while. While running, it prints + some messages telling which features it is checking for. 2. Type `make' to compile the package. @@ -69,51 +67,66 @@ The simplest way to compile this package is: all sorts of other programs in order to regenerate files that came with the distribution. + 6. Often, you can also type `make uninstall' to remove the installed + files again. + Compilers and Options ===================== -Some systems require unusual options for compilation or linking that the -`configure' script does not know about. Run `./configure --help' for -details on some of the pertinent environment variables. + Some systems require unusual options for compilation or linking that +the `configure' script does not know about. Run `./configure --help' +for details on some of the pertinent environment variables. You can give `configure' initial values for configuration parameters by setting variables in the command line or in the environment. Here is an example: - ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix + ./configure CC=c99 CFLAGS=-g LIBS=-lposix *Note Defining Variables::, for more details. Compiling For Multiple Architectures ==================================== -You can compile the package for more than one kind of computer at the + You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their -own directory. To do this, you must use a version of `make' that -supports the `VPATH' variable, such as GNU `make'. `cd' to the +own directory. To do this, you can use GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. - If you have to use a `make' that does not support the `VPATH' -variable, you have to compile the package for one architecture at a -time in the source code directory. After you have installed the -package for one architecture, use `make distclean' before reconfiguring -for another architecture. + With a non-GNU `make', it is safer to compile the package for one +architecture at a time in the source code directory. After you have +installed the package for one architecture, use `make distclean' before +reconfiguring for another architecture. + + On MacOS X 10.5 and later systems, you can create libraries and +executables that work on multiple system types--known as "fat" or +"universal" binaries--by specifying multiple `-arch' options to the +compiler but only a single `-arch' option to the preprocessor. Like +this: + + ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ + CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ + CPP="gcc -E" CXXCPP="g++ -E" + + This is not guaranteed to produce working output in all cases, you +may have to build one architecture at a time and combine the results +using the `lipo' tool if you have problems. Installation Names ================== -By default, `make install' will install the package's files in -`/usr/local/bin', `/usr/local/man', etc. You can specify an -installation prefix other than `/usr/local' by giving `configure' the -option `--prefix=PREFIX'. + By default, `make install' installs the package's commands under +`/usr/local/bin', include files under `/usr/local/include', etc. You +can specify an installation prefix other than `/usr/local' by giving +`configure' the option `--prefix=PREFIX'. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you -give `configure' the option `--exec-prefix=PREFIX', the package will -use PREFIX as the prefix for installing programs and libraries. -Documentation and other data files will still use the regular prefix. +pass the option `--exec-prefix=PREFIX' to `configure', the package uses +PREFIX as the prefix for installing programs and libraries. +Documentation and other data files still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=DIR' to specify different values for particular @@ -127,7 +140,7 @@ option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Optional Features ================= -Some packages pay attention to `--enable-FEATURE' options to + Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The @@ -139,14 +152,36 @@ find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. +Particular systems +================== + + On HP-UX, the default C compiler is not ANSI C compatible. If GNU +CC is not installed, it is recommended to use the following options in +order to use an ANSI C compiler: + + ./configure CC="cc -Ae" + +and if that doesn't work, install pre-built binaries of GCC for HP-UX. + + On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot +parse its `' header file. The option `-nodtk' can be used as +a workaround. If GNU CC is not installed, it is therefore recommended +to try + + ./configure CC="cc" + +and if that doesn't work, try + + ./configure CC="cc -nodtk" + Specifying the System Type ========================== -There may be some features `configure' cannot figure out automatically, -but needs to determine by the type of machine the package will run on. -Usually, assuming the package is built to be run on the _same_ -architectures, `configure' can figure that out, but if it prints a -message saying it cannot guess the machine type, give it the + There may be some features `configure' cannot figure out +automatically, but needs to determine by the type of machine the package +will run on. Usually, assuming the package is built to be run on the +_same_ architectures, `configure' can figure that out, but if it prints +a message saying it cannot guess the machine type, give it the `--build=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name which has the form: @@ -161,7 +196,7 @@ where SYSTEM can have one of these forms: need to know the machine type. If you are _building_ compiler tools for cross-compiling, you should -use the `--target=TYPE' option to select the type of system they will +use the option `--target=TYPE' to select the type of system they will produce code for. If you want to _use_ a cross compiler, that generates code for a @@ -172,9 +207,9 @@ eventually be run) with `--host=TYPE'. Sharing Defaults ================ -If you want to set default values for `configure' scripts to share, you -can create a site shell script called `config.site' that gives default -values for variables like `CC', `cache_file', and `prefix'. + If you want to set default values for `configure' scripts to share, +you can create a site shell script called `config.site' that gives +default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. @@ -183,7 +218,7 @@ A warning: not all `configure' scripts look for a site script. Defining Variables ================== -Variables not defined in a site shell script can be set in the + Variables not defined in a site shell script can be set in the environment passed to `configure'. However, some packages may run configure again during the build, and the customized values of these variables may be lost. In order to avoid this problem, you should set @@ -192,21 +227,29 @@ them in the `configure' command line, using `VAR=value'. For example: ./configure CC=/usr/local2/bin/gcc causes the specified `gcc' to be used as the C compiler (unless it is -overridden in the site shell script). Here is a another example: +overridden in the site shell script). - /bin/bash ./configure CONFIG_SHELL=/bin/bash +Unfortunately, this technique does not work for `CONFIG_SHELL' due to +an Autoconf bug. Until the bug is fixed you can use this workaround: -Here the `CONFIG_SHELL=/bin/bash' operand causes subsequent -configuration-related scripts to be executed by `/bin/bash'. + CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash `configure' Invocation ====================== -`configure' recognizes the following options to control how it operates. + `configure' recognizes the following options to control how it +operates. `--help' `-h' - Print a summary of the options to `configure', and exit. + Print a summary of all of the options to `configure', and exit. + +`--help=short' +`--help=recursive' + Print a summary of the options unique to this package's + `configure', and exit. The `short' variant lists options used + only in the top level, while the `recursive' variant lists options + also present in any nested packages. `--version' `-V' @@ -233,5 +276,16 @@ configuration-related scripts to be executed by `/bin/bash'. Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. +`--prefix=DIR' + Use DIR as the installation prefix. *Note Installation Names:: + for more details, including other options available for fine-tuning + the installation locations. + +`--no-create' +`-n' + Run the configure checks, but stop before creating any output + files. + `configure' also accepts some other, not widely useful, options. Run `configure --help' for more details. + diff --git a/Makefile.in b/Makefile.in index 72188bad4..dd591e15e 100644 --- a/Makefile.in +++ b/Makefile.in @@ -15,6 +15,14 @@ @SET_MAKE@ +############################################################################### +# Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. +# Copyright (C) 2007 The Regents of the University of California. +# Written by Brian Behlendorf . +############################################################################### +# Build targets for RPM. +############################################################################### + VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ @@ -761,6 +769,7 @@ uninstall-am: mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-recursive uninstall uninstall-am + rpm-local: mkdir -p $(rpmbuild)/TMP && \ mkdir -p $(rpmbuild)/BUILD && \ diff --git a/autogen.sh b/autogen.sh index 728000ae4..12ed476c7 100755 --- a/autogen.sh +++ b/autogen.sh @@ -1,8 +1,8 @@ #!/bin/sh -aclocal -I config && +aclocal -I config libtoolize --automake --copy -autoheader && +autoheader automake --add-missing --include-deps --copy autoconf rm -rf autom4te.cache aclocal.m4 diff --git a/cmd/Makefile.in b/cmd/Makefile.in index 7ac86e120..8caaa7d8b 100644 --- a/cmd/Makefile.in +++ b/cmd/Makefile.in @@ -15,6 +15,14 @@ @SET_MAKE@ +############################################################################### +# Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. +# Copyright (C) 2007 The Regents of the University of California. +# Written by Brian Behlendorf . +############################################################################### +# Common rules for user space components. +############################################################################### + VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ diff --git a/cmd/spl.c b/cmd/spl.c index c9eb652e4..a77ad9ca4 100644 --- a/cmd/spl.c +++ b/cmd/spl.c @@ -1,28 +1,28 @@ -/* - * This file is part of the SPL: Solaris Porting Layer. - * - * Copyright (c) 2008 Lawrence Livermore National Security, LLC. - * Produced at Lawrence Livermore National Laboratory - * Written by: - * Brian Behlendorf , - * Herb Wartens , - * Jim Garlick +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . * UCRL-CODE-235197 * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. * - * This is distributed in the hope that it will be useful, but WITHOUT + * The SPL is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ + * with the SPL. If not, see . + ***************************************************************************** + * Solaris Porting Layer (SPL) User Space Interface. +\*****************************************************************************/ #include #include diff --git a/cmd/splat.c b/cmd/splat.c index abeea15e9..c0bb7d8d4 100644 --- a/cmd/splat.c +++ b/cmd/splat.c @@ -1,30 +1,28 @@ -/* - * This file is part of the SPL: Solaris Porting Layer. - * - * Copyright (c) 2008 Lawrence Livermore National Security, LLC. - * Produced at Lawrence Livermore National Laboratory - * Written by: - * Brian Behlendorf , - * Herb Wartens , - * Jim Garlick +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . * UCRL-CODE-235197 * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. * - * This is distributed in the hope that it will be useful, but WITHOUT + * The SPL is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -/* Solaris Porting LAyer Tests (SPLAT) userspace interface */ + * with the SPL. If not, see . + ***************************************************************************** + * Solaris Porting LAyer Tests (SPLAT) User Space Interface. +\*****************************************************************************/ #include #include @@ -834,4 +832,3 @@ out: fini(); return rc; } - diff --git a/cmd/splat.h b/cmd/splat.h index 17cc166a6..dd943124e 100644 --- a/cmd/splat.h +++ b/cmd/splat.h @@ -1,28 +1,26 @@ -/* - * This file is part of the SPL: Solaris Porting Layer. - * - * Copyright (c) 2008 Lawrence Livermore National Security, LLC. - * Produced at Lawrence Livermore National Laboratory - * Written by: - * Brian Behlendorf , - * Herb Wartens , - * Jim Garlick +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . * UCRL-CODE-235197 * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. * - * This is distributed in the hope that it will be useful, but WITHOUT + * The SPL is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ + * with the SPL. If not, see . +\*****************************************************************************/ #ifndef _SPLAT_H #define _SPLAT_H diff --git a/config/Rules.am b/config/Rules.am index 5eb1a12c6..7b72770b8 100644 --- a/config/Rules.am +++ b/config/Rules.am @@ -1,3 +1,11 @@ +############################################################################### +# Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. +# Copyright (C) 2007 The Regents of the University of California. +# Written by Brian Behlendorf . +############################################################################### +# Common rules for user space components. +############################################################################### + DEFAULT_INCLUDES = -include ${top_srcdir}/spl_config.h AM_LIBTOOLFLAGS = --silent diff --git a/config/rpm.am b/config/rpm.am index b1c832674..7fb95a72d 100644 --- a/config/rpm.am +++ b/config/rpm.am @@ -1,3 +1,11 @@ +############################################################################### +# Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. +# Copyright (C) 2007 The Regents of the University of California. +# Written by Brian Behlendorf . +############################################################################### +# Build targets for RPM. +############################################################################### + rpm-local: mkdir -p $(rpmbuild)/TMP && \ mkdir -p $(rpmbuild)/BUILD && \ diff --git a/config/spl-build.m4 b/config/spl-build.m4 index 0b387418e..a0fdb3e82 100644 --- a/config/spl-build.m4 +++ b/config/spl-build.m4 @@ -1,6 +1,11 @@ -dnl # -dnl # Default SPL kernel configuration -dnl # +############################################################################### +# Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. +# Copyright (C) 2007 The Regents of the University of California. +# Written by Brian Behlendorf . +############################################################################### +# SPL_AC_CONFIG_KERNEL: Default SPL kernel configuration. +############################################################################### + AC_DEFUN([SPL_AC_CONFIG_KERNEL], [ SPL_AC_KERNEL diff --git a/config/spl-meta.m4 b/config/spl-meta.m4 index 84b41757d..b76cc8dc6 100644 --- a/config/spl-meta.m4 +++ b/config/spl-meta.m4 @@ -1,11 +1,10 @@ -dnl # -dnl # SPL_AC_META -dnl # Read metadata from the META file. -dnl # -dnl # AUTHOR: -dnl # Chris Dunlap -dnl # Brian Behlendorf -dnl # +############################################################################### +# Written by Chris Dunlap . +# Modified by Brian Behlendorf . +############################################################################### +# SPL_AC_META: Read metadata from the META file. +############################################################################### + AC_DEFUN([SPL_AC_META], [ AC_MSG_CHECKING([metadata]) diff --git a/configure.ac b/configure.ac index 0fa9ebf90..0217e9cd9 100644 --- a/configure.ac +++ b/configure.ac @@ -1,28 +1,28 @@ -/* - * This file is part of the SPL: Solaris Porting Layer. - * - * Copyright (c) 2008 Lawrence Livermore National Security, LLC. - * Produced at Lawrence Livermore National Laboratory - * Written by: - * Brian Behlendorf , - * Herb Wartens , - * Jim Garlick - * UCRL-CODE-235197 - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ +############################################################################### +# SPL AutoConf Configuration +############################################################################### +# Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. +# Copyright (C) 2007 The Regents of the University of California. +# Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). +# Written by Brian Behlendorf . +# UCRL-CODE-235197 +# +# This file is part of the SPL, Solaris Porting Layer. +# For details, see . +# +# The SPL is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; either version 2 of the License, or (at your +# option) any later version. +# +# The SPL is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with the SPL. If not, see . +############################################################################### AC_INIT AC_LANG(C) diff --git a/include/fs/fs_subr.h b/include/fs/fs_subr.h index 2a7307638..39499b532 100644 --- a/include/fs/fs_subr.h +++ b/include/fs/fs_subr.h @@ -1,3 +1,27 @@ +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . + * UCRL-CODE-235197 + * + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with the SPL. If not, see . +\*****************************************************************************/ + #ifndef _SPL_FS_FS_SUBR_H #define _SPL_FS_FS_SUBR_H diff --git a/include/linux/bitops_compat.h b/include/linux/bitops_compat.h index 8e1e25809..d466e0718 100644 --- a/include/linux/bitops_compat.h +++ b/include/linux/bitops_compat.h @@ -1,3 +1,27 @@ +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . + * UCRL-CODE-235197 + * + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with the SPL. If not, see . +\*****************************************************************************/ + #ifndef _SPL_BITOPS_COMPAT_H #define _SPL_BITOPS_COMPAT_H diff --git a/include/linux/file_compat.h b/include/linux/file_compat.h index c63be0348..d30e90356 100644 --- a/include/linux/file_compat.h +++ b/include/linux/file_compat.h @@ -1,3 +1,27 @@ +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . + * UCRL-CODE-235197 + * + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with the SPL. If not, see . +\*****************************************************************************/ + #ifndef _SPL_FILE_COMPAT_H #define _SPL_FILE_COMPAT_H diff --git a/include/linux/kallsyms_compat.h b/include/linux/kallsyms_compat.h index 6cd0a18de..34c45ea3a 100644 --- a/include/linux/kallsyms_compat.h +++ b/include/linux/kallsyms_compat.h @@ -1,3 +1,27 @@ +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . + * UCRL-CODE-235197 + * + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with the SPL. If not, see . +\*****************************************************************************/ + #ifndef _SPL_KALLSYMS_COMPAT_H #define _SPL_KALLSYMS_COMPAT_H diff --git a/include/linux/list_compat.h b/include/linux/list_compat.h index e5daa0410..26d5dfe07 100644 --- a/include/linux/list_compat.h +++ b/include/linux/list_compat.h @@ -1,3 +1,27 @@ +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . + * UCRL-CODE-235197 + * + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with the SPL. If not, see . +\*****************************************************************************/ + #ifndef _SPL_LIST_COMPAT_H #define _SPL_LIST_COMPAT_H diff --git a/include/linux/mm_compat.h b/include/linux/mm_compat.h index c99027b44..57f83dcc9 100644 --- a/include/linux/mm_compat.h +++ b/include/linux/mm_compat.h @@ -1,3 +1,27 @@ +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . + * UCRL-CODE-235197 + * + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with the SPL. If not, see . +\*****************************************************************************/ + #ifndef _SPL_MM_COMPAT_H #define _SPL_MM_COMPAT_H diff --git a/include/linux/module_compat.h b/include/linux/module_compat.h index 766cb58ea..0261f6958 100644 --- a/include/linux/module_compat.h +++ b/include/linux/module_compat.h @@ -1,3 +1,27 @@ +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . + * UCRL-CODE-235197 + * + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with the SPL. If not, see . +\*****************************************************************************/ + #ifndef _SPL_MODULE_COMPAT_H #define _SPL_MODULE_COMPAT_H diff --git a/include/linux/mutex_compat.h b/include/linux/mutex_compat.h index 49072405e..39eb68c34 100644 --- a/include/linux/mutex_compat.h +++ b/include/linux/mutex_compat.h @@ -1,3 +1,27 @@ +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . + * UCRL-CODE-235197 + * + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with the SPL. If not, see . +\*****************************************************************************/ + #ifndef _SPL_MUTEX_COMPAT_H #define _SPL_MUTEX_COMPAT_H diff --git a/include/linux/smp_compat.h b/include/linux/smp_compat.h index 4da35f4ad..31d42f909 100644 --- a/include/linux/smp_compat.h +++ b/include/linux/smp_compat.h @@ -1,3 +1,27 @@ +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . + * UCRL-CODE-235197 + * + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with the SPL. If not, see . +\*****************************************************************************/ + #ifndef _SPL_SMP_COMPAT_H #define _SPL_SMP_COMPAT_H diff --git a/include/linux/sysctl_compat.h b/include/linux/sysctl_compat.h index ecc5d1999..93210e829 100644 --- a/include/linux/sysctl_compat.h +++ b/include/linux/sysctl_compat.h @@ -1,3 +1,27 @@ +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . + * UCRL-CODE-235197 + * + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with the SPL. If not, see . +\*****************************************************************************/ + #ifndef _SPL_SYSCTL_COMPAT_H #define _SPL_SYSCTL_COMPAT_H @@ -23,34 +47,34 @@ #define SPL_PROC_HANDLER(proc_handler) \ static int \ proc_handler(struct ctl_table *table, int write, \ - void __user *buffer, size_t *lenp, loff_t *ppos) - + void __user *buffer, size_t *lenp, loff_t *ppos) + #define spl_proc_dostring(table, write, filp, buffer, lenp, ppos) \ - proc_dostring(table, write, buffer, lenp, ppos) + proc_dostring(table, write, buffer, lenp, ppos) #define spl_proc_dointvec(table, write, filp, buffer, lenp, ppos) \ - proc_dointvec(table, write, buffer, lenp, ppos) + proc_dointvec(table, write, buffer, lenp, ppos) #define spl_proc_dointvec_minmax(table, write, filp, buffer, lenp, ppos) \ - proc_dointvec_minmax(table, write, buffer, lenp, ppos) + proc_dointvec_minmax(table, write, buffer, lenp, ppos) #define spl_proc_dointvec_jiffies(table, write, filp, buffer, lenp, ppos) \ - proc_dointvec_jiffies(table, write, buffer, lenp, ppos) + proc_dointvec_jiffies(table, write, buffer, lenp, ppos) #define spl_proc_dointvec_userhz_jiffies(table,write,filp,buffer,lenp,ppos) \ - proc_dointvec_userhz_jiffies(table, write, buffer, lenp, ppos) + proc_dointvec_userhz_jiffies(table, write, buffer, lenp, ppos) #define spl_proc_dointvec_ms_jiffies(table,write,filp,buffer,lenp,ppos) \ - proc_dointvec_ms_jiffies(table, write, buffer, lenp, ppos) -#define spl_proc_doulongvec_minmax(table, write, filp, buffer, lenp, ppos) \ + proc_dointvec_ms_jiffies(table, write, buffer, lenp, ppos) +#define spl_proc_doulongvec_minmax(table, write, filp, buffer, lenp, ppos) \ proc_doulongvec_minmax(table, write, buffer, lenp, ppos) -#define spl_proc_doulongvec_ms_jiffies_minmax(table,write,filp,buffer,lenp,ppos) \ +#define spl_proc_doulongvec_ms_jiffies_minmax(table,write,filp,buffer,lenp,ppos)\ proc_doulongvec_ms_jiffies_minmax(table, write, buffer, lenp, ppos) - -#else /* HAVE_5ARGS_PROC_HANDLER */ - + +#else /* HAVE_5ARGS_PROC_HANDLER */ + #define SPL_PROC_HANDLER(proc_handler) \ static int \ proc_handler(struct ctl_table *table, int write, struct file *filp, \ - void __user *buffer, size_t *lenp, loff_t *ppos) - + void __user *buffer, size_t *lenp, loff_t *ppos) + #define spl_proc_dostring(table, write, filp, buffer, lenp, ppos) \ - proc_dostring(table, write, filp, buffer, lenp, ppos) + proc_dostring(table, write, filp, buffer, lenp, ppos) #define spl_proc_dointvec(table, write, filp, buffer, lenp, ppos) \ proc_dointvec(table, write, filp, buffer, lenp, ppos) #define spl_proc_dointvec_minmax(table, write, filp, buffer, lenp, ppos) \ diff --git a/include/linux/time_compat.h b/include/linux/time_compat.h index 1b4727dcd..fa996d346 100644 --- a/include/linux/time_compat.h +++ b/include/linux/time_compat.h @@ -1,3 +1,27 @@ +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . + * UCRL-CODE-235197 + * + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with the SPL. If not, see . +\*****************************************************************************/ + #ifndef _SPL_TIME_COMPAT_H #define _SPL_TIME_COMPAT_H diff --git a/include/linux/uaccess_compat.h b/include/linux/uaccess_compat.h index a1bfa52a5..c00669a57 100644 --- a/include/linux/uaccess_compat.h +++ b/include/linux/uaccess_compat.h @@ -1,3 +1,27 @@ +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . + * UCRL-CODE-235197 + * + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with the SPL. If not, see . +\*****************************************************************************/ + #ifndef _SPL_UACCESS_COMPAT_H #define _SPL_UACCESS_COMPAT_H diff --git a/include/linux/workqueue_compat.h b/include/linux/workqueue_compat.h index 3dab8776a..a92800ce5 100644 --- a/include/linux/workqueue_compat.h +++ b/include/linux/workqueue_compat.h @@ -1,3 +1,27 @@ +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . + * UCRL-CODE-235197 + * + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with the SPL. If not, see . +\*****************************************************************************/ + #ifndef _SPL_WORKQUEUE_COMPAT_H #define _SPL_WORKQUEUE_COMPAT_H diff --git a/include/rpc/types.h b/include/rpc/types.h index e73fd9c05..137a381dc 100644 --- a/include/rpc/types.h +++ b/include/rpc/types.h @@ -1,3 +1,27 @@ +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . + * UCRL-CODE-235197 + * + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with the SPL. If not, see . +\*****************************************************************************/ + #ifndef _SPL_RPC_TYPES_H #define _SPL_RPC_TYPES_H diff --git a/include/rpc/xdr.h b/include/rpc/xdr.h index 43919ca25..c828a38e3 100644 --- a/include/rpc/xdr.h +++ b/include/rpc/xdr.h @@ -1,22 +1,23 @@ -/* - * This file is part of the SPL: Solaris Porting Layer. - * +/*****************************************************************************\ * Copyright (c) 2008 Sun Microsystems, Inc. + * Written by Ricardo Correia * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . * - * This is distributed in the hope that it will be useful, but WITHOUT + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ + * with the SPL. If not, see . +\*****************************************************************************/ #ifndef _SPL_RPC_XDR_H #define _SPL_RPC_XDR_H diff --git a/include/sharefs/share.h b/include/sharefs/share.h index f7c649c70..b3ad6993f 100644 --- a/include/sharefs/share.h +++ b/include/sharefs/share.h @@ -1,3 +1,27 @@ +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . + * UCRL-CODE-235197 + * + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with the SPL. If not, see . +\*****************************************************************************/ + #ifndef _SPL_SHARE_H #define _SPL_SHARE_H diff --git a/include/spl-ctl.h b/include/spl-ctl.h index 9cc8ab86a..9db139073 100644 --- a/include/spl-ctl.h +++ b/include/spl-ctl.h @@ -1,36 +1,34 @@ -/* - * This file is part of the SPL: Solaris Porting Layer. - * - * Copyright (c) 2008 Lawrence Livermore National Security, LLC. - * Produced at Lawrence Livermore National Laboratory - * Written by: - * Brian Behlendorf , - * Herb Wartens , - * Jim Garlick +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . * UCRL-CODE-235197 * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. * - * This is distributed in the hope that it will be useful, but WITHOUT + * The SPL is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ + * with the SPL. If not, see . +\*****************************************************************************/ #ifndef _DEBUG_CTL_H #define _DEBUG_CTL_H -/* Contains shared definitions which both the userspace - * and kernelspace portions of splat must agree on. +/* + * Contains shared definitions which both the user space + * and kernel space portions of splat must agree on. */ - typedef struct spl_debug_header { int ph_len; int ph_flags; diff --git a/include/spl-device.h b/include/spl-device.h index d8c2d09ba..6c3789cd7 100644 --- a/include/spl-device.h +++ b/include/spl-device.h @@ -1,3 +1,27 @@ +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . + * UCRL-CODE-235197 + * + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with the SPL. If not, see . +\*****************************************************************************/ + #ifndef _SPL_DEVICE_H #define _SPL_DEVICE_H diff --git a/include/splat-ctl.h b/include/splat-ctl.h index fc68395e8..61c7e0e3c 100644 --- a/include/splat-ctl.h +++ b/include/splat-ctl.h @@ -1,28 +1,26 @@ -/* - * This file is part of the SPL: Solaris Porting Layer. - * - * Copyright (c) 2008 Lawrence Livermore National Security, LLC. - * Produced at Lawrence Livermore National Laboratory - * Written by: - * Brian Behlendorf , - * Herb Wartens , - * Jim Garlick +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . * UCRL-CODE-235197 * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . * - * This is distributed in the hope that it will be useful, but WITHOUT + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ + * with the SPL. If not, see . +\*****************************************************************************/ #ifndef _SPLAT_CTL_H #define _SPLAT_CTL_H diff --git a/include/strings.h b/include/strings.h index 697ac4db6..65ee3e7c3 100644 --- a/include/strings.h +++ b/include/strings.h @@ -1,3 +1,27 @@ +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . + * UCRL-CODE-235197 + * + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with the SPL. If not, see . +\*****************************************************************************/ + #ifndef _SPL_STRINGS_H #define _SPL_STRINGS_H diff --git a/include/sys/acl.h b/include/sys/acl.h index 61b5bdf07..7b49b0bc2 100644 --- a/include/sys/acl.h +++ b/include/sys/acl.h @@ -1,3 +1,27 @@ +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . + * UCRL-CODE-235197 + * + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with the SPL. If not, see . +\*****************************************************************************/ + #ifndef _SPL_ACL_H #define _SPL_ACL_H diff --git a/include/sys/acl_impl.h b/include/sys/acl_impl.h index 0c8698cbd..9bc45ff96 100644 --- a/include/sys/acl_impl.h +++ b/include/sys/acl_impl.h @@ -1,3 +1,27 @@ +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . + * UCRL-CODE-235197 + * + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with the SPL. If not, see . +\*****************************************************************************/ + #ifndef _SPL_ACL_IMPL_H #define _SPL_ACL_IMPL_H diff --git a/include/sys/atomic.h b/include/sys/atomic.h index f522781fc..699f4456e 100644 --- a/include/sys/atomic.h +++ b/include/sys/atomic.h @@ -1,28 +1,26 @@ -/* - * This file is part of the SPL: Solaris Porting Layer. - * - * Copyright (c) 2008 Lawrence Livermore National Security, LLC. - * Produced at Lawrence Livermore National Laboratory - * Written by: - * Brian Behlendorf , - * Herb Wartens , - * Jim Garlick +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . * UCRL-CODE-235197 * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . * - * This is distributed in the hope that it will be useful, but WITHOUT + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ + * with the SPL. If not, see . +\*****************************************************************************/ #ifndef _SPL_ATOMIC_H #define _SPL_ATOMIC_H diff --git a/include/sys/attr.h b/include/sys/attr.h index 47469ced6..42f21cfeb 100644 --- a/include/sys/attr.h +++ b/include/sys/attr.h @@ -1,3 +1,27 @@ +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . + * UCRL-CODE-235197 + * + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with the SPL. If not, see . +\*****************************************************************************/ + #ifndef _SPL_ATTR_H #define _SPL_ATTR_H diff --git a/include/sys/bitmap.h b/include/sys/bitmap.h index 1bf09e66c..85dcb2e3b 100644 --- a/include/sys/bitmap.h +++ b/include/sys/bitmap.h @@ -1,3 +1,27 @@ +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . + * UCRL-CODE-235197 + * + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with the SPL. If not, see . +\*****************************************************************************/ + #ifndef _SPL_BITMAP_H #define _SPL_BITMAP_H diff --git a/include/sys/bootconf.h b/include/sys/bootconf.h index 29c885a08..b9d40527c 100644 --- a/include/sys/bootconf.h +++ b/include/sys/bootconf.h @@ -1,3 +1,27 @@ +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . + * UCRL-CODE-235197 + * + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with the SPL. If not, see . +\*****************************************************************************/ + #ifndef _SPL_BOOTCONF_H #define _SPL_BOOTCONF_H diff --git a/include/sys/buf.h b/include/sys/buf.h index b6627301f..b1ffa479c 100644 --- a/include/sys/buf.h +++ b/include/sys/buf.h @@ -1,3 +1,27 @@ +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . + * UCRL-CODE-235197 + * + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with the SPL. If not, see . +\*****************************************************************************/ + #ifndef _SPL_BUF_H #define _SPL_BUF_H diff --git a/include/sys/byteorder.h b/include/sys/byteorder.h index 7e7d04809..30700f6b3 100644 --- a/include/sys/byteorder.h +++ b/include/sys/byteorder.h @@ -1,3 +1,27 @@ +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . + * UCRL-CODE-235197 + * + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with the SPL. If not, see . +\*****************************************************************************/ + #ifndef _SPL_BYTEORDER_H #define _SPL_BYTEORDER_H diff --git a/include/sys/callb.h b/include/sys/callb.h index b37bb278a..9db823650 100644 --- a/include/sys/callb.h +++ b/include/sys/callb.h @@ -1,10 +1,30 @@ +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . + * UCRL-CODE-235197 + * + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with the SPL. If not, see . +\*****************************************************************************/ + #ifndef _SPL_CALLB_H #define _SPL_CALLB_H -#ifdef __cplusplus -extern "C" { -#endif - #include #include @@ -31,9 +51,5 @@ typedef struct callb_cpr { mutex_exit((cp)->cc_lockp); \ } -#ifdef __cplusplus -} -#endif - #endif /* _SPL_CALLB_H */ diff --git a/include/sys/cmn_err.h b/include/sys/cmn_err.h index 62417e83e..9359c1a3b 100644 --- a/include/sys/cmn_err.h +++ b/include/sys/cmn_err.h @@ -1,3 +1,27 @@ +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . + * UCRL-CODE-235197 + * + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with the SPL. If not, see . +\*****************************************************************************/ + #ifndef _SPL_CMN_ERR_H #define _SPL_CMN_ERR_H diff --git a/include/sys/compress.h b/include/sys/compress.h index a12f6784c..8095cff9c 100644 --- a/include/sys/compress.h +++ b/include/sys/compress.h @@ -1,3 +1,27 @@ +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . + * UCRL-CODE-235197 + * + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with the SPL. If not, see . +\*****************************************************************************/ + #ifndef _SPL_COMPRESS_H #define _SPL_COMPRESS_H diff --git a/include/sys/condvar.h b/include/sys/condvar.h index bf1347b0f..d854026ac 100644 --- a/include/sys/condvar.h +++ b/include/sys/condvar.h @@ -1,42 +1,37 @@ -/* - * This file is part of the SPL: Solaris Porting Layer. - * - * Copyright (c) 2008 Lawrence Livermore National Security, LLC. - * Produced at Lawrence Livermore National Laboratory - * Written by: - * Brian Behlendorf , - * Herb Wartens , - * Jim Garlick +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . * UCRL-CODE-235197 * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. * - * This is distributed in the hope that it will be useful, but WITHOUT + * The SPL is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ + * with the SPL. If not, see . +\*****************************************************************************/ #ifndef _SPL_CONDVAR_H #define _SPL_CONDVAR_H -#ifdef __cplusplus -extern "C" { -#endif - #include #include #include #include -/* The kcondvar_t struct is protected by mutex taken externally before +/* + * The kcondvar_t struct is protected by mutex taken externally before * calling any of the wait/signal funs, and passed into the wait funs. */ #define CV_MAGIC 0x346545f4 diff --git a/include/sys/conf.h b/include/sys/conf.h index 4166b0c23..bca0ebf05 100644 --- a/include/sys/conf.h +++ b/include/sys/conf.h @@ -1,3 +1,27 @@ +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . + * UCRL-CODE-235197 + * + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with the SPL. If not, see . +\*****************************************************************************/ + #ifndef _SPL_CONF_H #define _SPL_CONF_H diff --git a/include/sys/console.h b/include/sys/console.h index eff52916c..31d419923 100644 --- a/include/sys/console.h +++ b/include/sys/console.h @@ -1,3 +1,27 @@ +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . + * UCRL-CODE-235197 + * + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with the SPL. If not, see . +\*****************************************************************************/ + #ifndef _SPL_CONSOLE_H #define _SPL_CONSOLE_H diff --git a/include/sys/cpuvar.h b/include/sys/cpuvar.h index 56ad7a41e..ca5a8b0a0 100644 --- a/include/sys/cpuvar.h +++ b/include/sys/cpuvar.h @@ -1,3 +1,27 @@ +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . + * UCRL-CODE-235197 + * + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with the SPL. If not, see . +\*****************************************************************************/ + #ifndef _SPL_CPUVAR_H #define _SPL_CPUVAR_H diff --git a/include/sys/crc32.h b/include/sys/crc32.h index b80157965..000a1dca5 100644 --- a/include/sys/crc32.h +++ b/include/sys/crc32.h @@ -1,3 +1,27 @@ +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . + * UCRL-CODE-235197 + * + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with the SPL. If not, see . +\*****************************************************************************/ + #ifndef _SPL_CRC32_H #define _SPL_CRC32_H diff --git a/include/sys/cred.h b/include/sys/cred.h index 9717b66bc..6f4cde73c 100644 --- a/include/sys/cred.h +++ b/include/sys/cred.h @@ -1,10 +1,30 @@ +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . + * UCRL-CODE-235197 + * + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with the SPL. If not, see . +\*****************************************************************************/ + #ifndef _SPL_CRED_H #define _SPL_CRED_H -#ifdef __cplusplus -extern "C" { -#endif - #include #include #include @@ -37,8 +57,4 @@ extern int crgetngroups(const cred_t *cr); extern gid_t * crgetgroups(const cred_t *cr); extern int groupmember(gid_t gid, const cred_t *cr); -#ifdef __cplusplus -} -#endif - #endif /* _SPL_CRED_H */ diff --git a/include/sys/ctype.h b/include/sys/ctype.h index 93c76a17e..7ec2bc7fa 100644 --- a/include/sys/ctype.h +++ b/include/sys/ctype.h @@ -1,3 +1,27 @@ +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . + * UCRL-CODE-235197 + * + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with the SPL. If not, see . +\*****************************************************************************/ + #ifndef _SPL_CTYPE_H #define _SPL_CTYPE_H diff --git a/include/sys/ddi.h b/include/sys/ddi.h index 186aa5ed2..903b1dd13 100644 --- a/include/sys/ddi.h +++ b/include/sys/ddi.h @@ -1,3 +1,27 @@ +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . + * UCRL-CODE-235197 + * + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with the SPL. If not, see . +\*****************************************************************************/ + #ifndef _SPL_DDI_H #define _SPL_DDI_H diff --git a/include/sys/debug.h b/include/sys/debug.h index 639b4cc28..848c885a6 100644 --- a/include/sys/debug.h +++ b/include/sys/debug.h @@ -1,36 +1,30 @@ -/* - * This file is part of the SPL: Solaris Porting Layer. - * - * Copyright (c) 2008 Lawrence Livermore National Security, LLC. - * Produced at Lawrence Livermore National Laboratory - * Written by: - * Brian Behlendorf , - * Herb Wartens , - * Jim Garlick +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . * UCRL-CODE-235197 * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. * - * This is distributed in the hope that it will be useful, but WITHOUT + * The SPL is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ + * with the SPL. If not, see . +\*****************************************************************************/ #ifndef _SPL_DEBUG_H #define _SPL_DEBUG_H -#ifdef __cplusplus -extern "C" { -#endif - #include /* THREAD_SIZE */ #include @@ -444,8 +438,4 @@ extern void spl_debug_bug(char *file, const char *func, const int line, int flag extern int spl_debug_clear_buffer(void); extern int spl_debug_mark_buffer(char *text); -#ifdef __cplusplus -} -#endif - #endif /* SPL_DEBUG_H */ diff --git a/include/sys/dirent.h b/include/sys/dirent.h index ac4c701bb..b99542e85 100644 --- a/include/sys/dirent.h +++ b/include/sys/dirent.h @@ -1,3 +1,27 @@ +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . + * UCRL-CODE-235197 + * + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with the SPL. If not, see . +\*****************************************************************************/ + #ifndef _SPL_DIRENT_H #define _SPL_DIRENT_H diff --git a/include/sys/disp.h b/include/sys/disp.h index 7ff9e3ba3..a0a1b0957 100644 --- a/include/sys/disp.h +++ b/include/sys/disp.h @@ -1,3 +1,27 @@ +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . + * UCRL-CODE-235197 + * + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with the SPL. If not, see . +\*****************************************************************************/ + #ifndef _SPL_DISP_H #define _SPL_DISP_H diff --git a/include/sys/dkio.h b/include/sys/dkio.h index efe7fa270..0659e9082 100644 --- a/include/sys/dkio.h +++ b/include/sys/dkio.h @@ -1,3 +1,27 @@ +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . + * UCRL-CODE-235197 + * + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with the SPL. If not, see . +\*****************************************************************************/ + #ifndef _SPL_DKIO_H #define _SPL_DKIO_H diff --git a/include/sys/dklabel.h b/include/sys/dklabel.h index df6bc4791..bd42622d1 100644 --- a/include/sys/dklabel.h +++ b/include/sys/dklabel.h @@ -1,3 +1,27 @@ +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . + * UCRL-CODE-235197 + * + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with the SPL. If not, see . +\*****************************************************************************/ + #ifndef _SPL_DKLABEL_H #define _SPL_DKLABEL_H diff --git a/include/sys/dnlc.h b/include/sys/dnlc.h index 38f8dd6b1..693e3d294 100644 --- a/include/sys/dnlc.h +++ b/include/sys/dnlc.h @@ -1,3 +1,27 @@ +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . + * UCRL-CODE-235197 + * + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with the SPL. If not, see . +\*****************************************************************************/ + #ifndef _SPL_DNLC_H #define _SPL_DNLC_H diff --git a/include/sys/dumphdr.h b/include/sys/dumphdr.h index fe4087317..07396e2e6 100644 --- a/include/sys/dumphdr.h +++ b/include/sys/dumphdr.h @@ -1,3 +1,27 @@ +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . + * UCRL-CODE-235197 + * + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with the SPL. If not, see . +\*****************************************************************************/ + #ifndef _SPL_DUMPHDR_H #define _SPL_DUMPHDR_H diff --git a/include/sys/efi_partition.h b/include/sys/efi_partition.h index 369062301..75df64f92 100644 --- a/include/sys/efi_partition.h +++ b/include/sys/efi_partition.h @@ -1,3 +1,27 @@ +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . + * UCRL-CODE-235197 + * + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with the SPL. If not, see . +\*****************************************************************************/ + #ifndef _SPL_EFI_PARTITION_H #define _SPL_EFI_PARTITION_H diff --git a/include/sys/errno.h b/include/sys/errno.h index f33fe8682..e6b446803 100644 --- a/include/sys/errno.h +++ b/include/sys/errno.h @@ -1,3 +1,27 @@ +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . + * UCRL-CODE-235197 + * + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with the SPL. If not, see . +\*****************************************************************************/ + #ifndef _SPL_ERRNO_H #define _SPL_ERRNO_H diff --git a/include/sys/file.h b/include/sys/file.h index f5ee2f0df..4fee255fd 100644 --- a/include/sys/file.h +++ b/include/sys/file.h @@ -1,3 +1,27 @@ +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . + * UCRL-CODE-235197 + * + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with the SPL. If not, see . +\*****************************************************************************/ + #ifndef _SPL_FILE_H #define _SPL_FILE_H diff --git a/include/sys/fm/protocol.h b/include/sys/fm/protocol.h index ffd8108ba..8c47f7c9b 100644 --- a/include/sys/fm/protocol.h +++ b/include/sys/fm/protocol.h @@ -1,3 +1,27 @@ +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . + * UCRL-CODE-235197 + * + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with the SPL. If not, see . +\*****************************************************************************/ + #ifndef _SPL_FM_PROTOCOL_H #define _SPL_FM_PROTOCOL_H diff --git a/include/sys/fm/util.h b/include/sys/fm/util.h index 6c3412f5b..40b8d47b2 100644 --- a/include/sys/fm/util.h +++ b/include/sys/fm/util.h @@ -1,3 +1,27 @@ +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . + * UCRL-CODE-235197 + * + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with the SPL. If not, see . +\*****************************************************************************/ + #ifndef _SPL_FM_UTIL_H #define _SPL_FM_UTIL_H diff --git a/include/sys/fs/swapnode.h b/include/sys/fs/swapnode.h index 12f2137a3..31be71620 100644 --- a/include/sys/fs/swapnode.h +++ b/include/sys/fs/swapnode.h @@ -1,3 +1,27 @@ +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . + * UCRL-CODE-235197 + * + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with the SPL. If not, see . +\*****************************************************************************/ + #ifndef _SPL_SWAPNODE_H #define _SPL_SWAPNODE_H diff --git a/include/sys/int_limits.h b/include/sys/int_limits.h index 13193e6f1..ed4ad9d19 100644 --- a/include/sys/int_limits.h +++ b/include/sys/int_limits.h @@ -1,3 +1,27 @@ +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . + * UCRL-CODE-235197 + * + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with the SPL. If not, see . +\*****************************************************************************/ + #ifndef _SPL_INT_LIMITS_H #define _SPL_INT_LIMITS_H diff --git a/include/sys/int_types.h b/include/sys/int_types.h index a30a8cc44..c97f47f6b 100644 --- a/include/sys/int_types.h +++ b/include/sys/int_types.h @@ -1,3 +1,27 @@ +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . + * UCRL-CODE-235197 + * + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with the SPL. If not, see . +\*****************************************************************************/ + #ifndef _SPL_INT_TYPES_H #define _SPL_INT_TYPES_H diff --git a/include/sys/inttypes.h b/include/sys/inttypes.h index ff7a65a98..6f7020134 100644 --- a/include/sys/inttypes.h +++ b/include/sys/inttypes.h @@ -1,3 +1,27 @@ +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . + * UCRL-CODE-235197 + * + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with the SPL. If not, see . +\*****************************************************************************/ + #ifndef _SPL_INTTYPES_H #define _SPL_INTTYPES_H diff --git a/include/sys/isa_defs.h b/include/sys/isa_defs.h index 081133e5a..10c0e0d3d 100644 --- a/include/sys/isa_defs.h +++ b/include/sys/isa_defs.h @@ -1,10 +1,30 @@ +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . + * UCRL-CODE-235197 + * + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with the SPL. If not, see . +\*****************************************************************************/ + #ifndef _SPL_ISA_DEFS_H #define _SPL_ISA_DEFS_H -#ifdef __cplusplus -extern "C" { -#endif - /* x86_64 arch specific defines */ #if defined(__x86_64) || defined(__x86_64__) @@ -80,8 +100,4 @@ extern "C" { #error "Neither _LITTLE_ENDIAN or _BIG_ENDIAN are defined" #endif -#ifdef __cplusplus -} -#endif - #endif /* _SPL_ISA_DEFS_H */ diff --git a/include/sys/kidmap.h b/include/sys/kidmap.h index d1c8d913f..f77656738 100644 --- a/include/sys/kidmap.h +++ b/include/sys/kidmap.h @@ -1,3 +1,27 @@ +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . + * UCRL-CODE-235197 + * + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with the SPL. If not, see . +\*****************************************************************************/ + #ifndef _SPL_KIDMAP_H #define _SPL_KIDMAP_H diff --git a/include/sys/kmem.h b/include/sys/kmem.h index f40d0813d..257f2d856 100644 --- a/include/sys/kmem.h +++ b/include/sys/kmem.h @@ -1,36 +1,30 @@ -/* - * This file is part of the SPL: Solaris Porting Layer. - * - * Copyright (c) 2008 Lawrence Livermore National Security, LLC. - * Produced at Lawrence Livermore National Laboratory - * Written by: - * Brian Behlendorf , - * Herb Wartens , - * Jim Garlick +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . * UCRL-CODE-235197 * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. * - * This is distributed in the hope that it will be useful, but WITHOUT + * The SPL is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ + * with the SPL. If not, see . +\*****************************************************************************/ #ifndef _SPL_KMEM_H #define _SPL_KMEM_H -#ifdef __cplusplus -extern "C" { -#endif - #undef DEBUG_KMEM_UNIMPLEMENTED #include @@ -411,8 +405,4 @@ void spl_kmem_fini(void); #define kmem_virt(ptr) (((ptr) >= (void *)VMALLOC_START) && \ ((ptr) < (void *)VMALLOC_END)) -#ifdef __cplusplus -} -#endif - #endif /* _SPL_KMEM_H */ diff --git a/include/sys/kobj.h b/include/sys/kobj.h index 8d79a0fbf..b682e3f9d 100644 --- a/include/sys/kobj.h +++ b/include/sys/kobj.h @@ -1,36 +1,30 @@ -/* - * This file is part of the SPL: Solaris Porting Layer. - * - * Copyright (c) 2008 Lawrence Livermore National Security, LLC. - * Produced at Lawrence Livermore National Laboratory - * Written by: - * Brian Behlendorf , - * Herb Wartens , - * Jim Garlick +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . * UCRL-CODE-235197 * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. * - * This is distributed in the hope that it will be useful, but WITHOUT + * The SPL is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ + * with the SPL. If not, see . +\*****************************************************************************/ #ifndef _SPL_KOBJ_H #define _SPL_KOBJ_H -#ifdef __cplusplus -extern "C" { -#endif - #include typedef struct _buf { @@ -45,8 +39,4 @@ extern int kobj_read_file(struct _buf *file, char *buf, ssize_t size, offset_t off); extern int kobj_get_filesize(struct _buf *file, uint64_t *size); -#ifdef __cplusplus -} -#endif - #endif /* SPL_KOBJ_H */ diff --git a/include/sys/kstat.h b/include/sys/kstat.h index 362bae286..6595f0a8b 100644 --- a/include/sys/kstat.h +++ b/include/sys/kstat.h @@ -1,28 +1,26 @@ -/* - * This file is part of the SPL: Solaris Porting Layer. - * - * Copyright (c) 2008 Lawrence Livermore National Security, LLC. - * Produced at Lawrence Livermore National Laboratory - * Written by: - * Brian Behlendorf , - * Herb Wartens , - * Jim Garlick +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . * UCRL-CODE-235197 * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. * - * This is distributed in the hope that it will be useful, but WITHOUT + * The SPL is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ + * with the SPL. If not, see . +\*****************************************************************************/ #ifndef _SPL_KSTAT_H #define _SPL_KSTAT_H @@ -163,4 +161,3 @@ extern void __kstat_delete(kstat_t *ksp); #define kstat_delete(k) __kstat_delete(k) #endif /* _SPL_KSTAT_H */ - diff --git a/include/sys/list.h b/include/sys/list.h index faf7c7a45..e30d7b7e0 100644 --- a/include/sys/list.h +++ b/include/sys/list.h @@ -1,10 +1,35 @@ +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . + * UCRL-CODE-235197 + * + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with the SPL. If not, see . +\*****************************************************************************/ + #ifndef _SPL_LIST_H #define _SPL_LIST_H #include #include -/* NOTE: We have implemented the Solaris list API in terms of the native +/* + * NOTE: I have implemented the Solaris list API in terms of the native * linux API. This has certain advantages in terms of leveraging the linux * list debugging infrastructure, but it also means that the internals of a * list differ slightly than on Solaris. This is not a problem as long as diff --git a/include/sys/mkdev.h b/include/sys/mkdev.h index f92ad08fa..89a9000d4 100644 --- a/include/sys/mkdev.h +++ b/include/sys/mkdev.h @@ -1,3 +1,27 @@ +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . + * UCRL-CODE-235197 + * + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with the SPL. If not, see . +\*****************************************************************************/ + #ifndef _SPL_MKDEV_H #define _SPL_MKDEV_H diff --git a/include/sys/mntent.h b/include/sys/mntent.h index b124e342b..5f0565f4c 100644 --- a/include/sys/mntent.h +++ b/include/sys/mntent.h @@ -1,3 +1,27 @@ +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . + * UCRL-CODE-235197 + * + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with the SPL. If not, see . +\*****************************************************************************/ + #ifndef _SPL_MNTENT_H #define _SPL_MNTENT_H diff --git a/include/sys/modctl.h b/include/sys/modctl.h index 85f936915..52f679ad5 100644 --- a/include/sys/modctl.h +++ b/include/sys/modctl.h @@ -1,3 +1,27 @@ +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . + * UCRL-CODE-235197 + * + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with the SPL. If not, see . +\*****************************************************************************/ + #ifndef _SPL_MODCTL_H #define _SPL_MODCTL_H diff --git a/include/sys/mode.h b/include/sys/mode.h index 7ca1b4889..f3d890944 100644 --- a/include/sys/mode.h +++ b/include/sys/mode.h @@ -1,3 +1,27 @@ +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . + * UCRL-CODE-235197 + * + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with the SPL. If not, see . +\*****************************************************************************/ + #ifndef _SPL_MODE_H #define _SPL_MODE_H diff --git a/include/sys/mount.h b/include/sys/mount.h index 435dd44c4..5b33a6d3a 100644 --- a/include/sys/mount.h +++ b/include/sys/mount.h @@ -1,3 +1,27 @@ +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . + * UCRL-CODE-235197 + * + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with the SPL. If not, see . +\*****************************************************************************/ + #ifndef _SPL_MOUNT_H #define _SPL_MOUNT_H diff --git a/include/sys/mutex.h b/include/sys/mutex.h index 1eedd4565..b36c7e256 100644 --- a/include/sys/mutex.h +++ b/include/sys/mutex.h @@ -1,28 +1,26 @@ -/* - * This file is part of the SPL: Solaris Porting Layer. - * - * Copyright (c) 2009 Lawrence Livermore National Security, LLC. - * Produced at Lawrence Livermore National Laboratory - * Written by: - * Brian Behlendorf , - * Herb Wartens , - * Jim Garlick +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . * UCRL-CODE-235197 * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . * - * This is distributed in the hope that it will be useful, but WITHOUT + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ + * with the SPL. If not, see . +\*****************************************************************************/ #ifndef _SPL_MUTEX_H #define _SPL_MUTEX_H diff --git a/include/sys/note.h b/include/sys/note.h index 835d1d5ad..6fcffc22e 100644 --- a/include/sys/note.h +++ b/include/sys/note.h @@ -1,3 +1,27 @@ +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . + * UCRL-CODE-235197 + * + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with the SPL. If not, see . +\*****************************************************************************/ + #ifndef _SPL_NOTE_H #define _SPL_NOTE_H diff --git a/include/sys/open.h b/include/sys/open.h index eba9fa7d7..aafedd0a1 100644 --- a/include/sys/open.h +++ b/include/sys/open.h @@ -1,3 +1,27 @@ +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . + * UCRL-CODE-235197 + * + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with the SPL. If not, see . +\*****************************************************************************/ + #ifndef _SPL_OPEN_H #define _SPL_OPEN_H diff --git a/include/sys/param.h b/include/sys/param.h index dbcdb6e9c..be3dd4bf3 100644 --- a/include/sys/param.h +++ b/include/sys/param.h @@ -1,3 +1,27 @@ +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . + * UCRL-CODE-235197 + * + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with the SPL. If not, see . +\*****************************************************************************/ + #ifndef _SPL_PARAM_H #define _SPL_PARAM_H diff --git a/include/sys/pathname.h b/include/sys/pathname.h index ffdf585b8..d22c4f297 100644 --- a/include/sys/pathname.h +++ b/include/sys/pathname.h @@ -1,3 +1,27 @@ +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . + * UCRL-CODE-235197 + * + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with the SPL. If not, see . +\*****************************************************************************/ + #ifndef _SPL_PATHNAME_H #define _SPL_PATHNAME_H diff --git a/include/sys/policy.h b/include/sys/policy.h index f6467fe18..2224c41a6 100644 --- a/include/sys/policy.h +++ b/include/sys/policy.h @@ -1,3 +1,27 @@ +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . + * UCRL-CODE-235197 + * + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with the SPL. If not, see . +\*****************************************************************************/ + #ifndef _SPL_POLICY_H #define _SPL_POLICY_H diff --git a/include/sys/proc.h b/include/sys/proc.h index 2938414b7..64b26bb3f 100644 --- a/include/sys/proc.h +++ b/include/sys/proc.h @@ -1,28 +1,26 @@ -/* - * This file is part of the SPL: Solaris Porting Layer. - * - * Copyright (c) 2008 Lawrence Livermore National Security, LLC. - * Produced at Lawrence Livermore National Laboratory - * Written by: - * Brian Behlendorf , - * Herb Wartens , - * Jim Garlick +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . * UCRL-CODE-235197 * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. * - * This is distributed in the hope that it will be useful, but WITHOUT + * The SPL is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ + * with the SPL. If not, see . +\*****************************************************************************/ #ifndef _SPL_PROC_H #define _SPL_PROC_H diff --git a/include/sys/processor.h b/include/sys/processor.h index 65285868a..65438a4da 100644 --- a/include/sys/processor.h +++ b/include/sys/processor.h @@ -1,3 +1,27 @@ +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . + * UCRL-CODE-235197 + * + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with the SPL. If not, see . +\*****************************************************************************/ + #ifndef _SPL_PROCESSOR_H #define _SPL_PROCESSOR_H diff --git a/include/sys/random.h b/include/sys/random.h index 2e206ccae..8960240b1 100644 --- a/include/sys/random.h +++ b/include/sys/random.h @@ -1,45 +1,33 @@ -/* - * This file is part of the SPL: Solaris Porting Layer. - * - * Copyright (c) 2008 Lawrence Livermore National Security, LLC. - * Produced at Lawrence Livermore National Laboratory - * Written by: - * Brian Behlendorf , - * Herb Wartens , - * Jim Garlick +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . * UCRL-CODE-235197 * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. * - * This is distributed in the hope that it will be useful, but WITHOUT + * The SPL is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ + * with the SPL. If not, see . +\*****************************************************************************/ #ifndef _SPL_RANDOM_H #define _SPL_RANDOM_H -#ifdef __cplusplus -extern "C" { -#endif - #include #include -/* FIXME: - * Should add support for blocking in the future to - * ensure that proper entopy is collected. ZFS doesn't - * use it at the moment so this is good enough for now. - * Always will succeed by returning 0. - */ static __inline__ int random_get_bytes(uint8_t *ptr, size_t len) { @@ -47,7 +35,6 @@ random_get_bytes(uint8_t *ptr, size_t len) return 0; } - /* Always will succeed by returning 0. */ static __inline__ int random_get_pseudo_bytes(uint8_t *ptr, size_t len) { @@ -55,8 +42,4 @@ random_get_pseudo_bytes(uint8_t *ptr, size_t len) return 0; } -#ifdef __cplusplus -} -#endif - #endif /* _SPL_RANDOM_H */ diff --git a/include/sys/refstr.h b/include/sys/refstr.h index 041ea23af..a8d0edbfe 100644 --- a/include/sys/refstr.h +++ b/include/sys/refstr.h @@ -1,3 +1,27 @@ +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . + * UCRL-CODE-235197 + * + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with the SPL. If not, see . +\*****************************************************************************/ + #ifndef _SPL_REFSTR_H #define _SPL_REFSTR_H diff --git a/include/sys/resource.h b/include/sys/resource.h index 6488794ff..68e3d2500 100644 --- a/include/sys/resource.h +++ b/include/sys/resource.h @@ -1,3 +1,27 @@ +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . + * UCRL-CODE-235197 + * + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with the SPL. If not, see . +\*****************************************************************************/ + #ifndef _SPL_RESOURCE_H #define _SPL_RESOURCE_H diff --git a/include/sys/rwlock.h b/include/sys/rwlock.h index 0fc8d24f7..9c4fb7e0f 100644 --- a/include/sys/rwlock.h +++ b/include/sys/rwlock.h @@ -1,28 +1,26 @@ -/* - * This file is part of the SPL: Solaris Porting Layer. - * - * Copyright (c) 2009 Lawrence Livermore National Security, LLC. - * Produced at Lawrence Livermore National Laboratory - * Written by: - * Brian Behlendorf , - * Herb Wartens , - * Jim Garlick +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . * UCRL-CODE-235197 * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . * - * This is distributed in the hope that it will be useful, but WITHOUT + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ + * with the SPL. If not, see . +\*****************************************************************************/ #ifndef _SPL_RWLOCK_H #define _SPL_RWLOCK_H diff --git a/include/sys/sdt.h b/include/sys/sdt.h index 1f94f4a1d..ed4680df9 100644 --- a/include/sys/sdt.h +++ b/include/sys/sdt.h @@ -1,3 +1,27 @@ +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . + * UCRL-CODE-235197 + * + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with the SPL. If not, see . +\*****************************************************************************/ + #ifndef _SPL_SDT_H #define _SPL_SDT_H diff --git a/include/sys/sid.h b/include/sys/sid.h index f798d24a8..9d4c7192b 100644 --- a/include/sys/sid.h +++ b/include/sys/sid.h @@ -1,3 +1,27 @@ +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . + * UCRL-CODE-235197 + * + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with the SPL. If not, see . +\*****************************************************************************/ + #ifndef _SPL_SID_H #define _SPL_SID_H diff --git a/include/sys/signal.h b/include/sys/signal.h index 4b1e82115..c7e293968 100644 --- a/include/sys/signal.h +++ b/include/sys/signal.h @@ -1,28 +1,26 @@ -/* - * This file is part of the SPL: Solaris Porting Layer. - * - * Copyright (c) 2008 Lawrence Livermore National Security, LLC. - * Produced at Lawrence Livermore National Laboratory - * Written by: - * Brian Behlendorf , - * Herb Wartens , - * Jim Garlick +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . * UCRL-CODE-235197 * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. * - * This is distributed in the hope that it will be useful, but WITHOUT + * The SPL is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ + * with the SPL. If not, see . +\*****************************************************************************/ #ifndef _SPL_SIGNAL_H #define _SPL_SIGNAL_H diff --git a/include/sys/stat.h b/include/sys/stat.h index 7f67064ba..ccc01a025 100644 --- a/include/sys/stat.h +++ b/include/sys/stat.h @@ -1,3 +1,27 @@ +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . + * UCRL-CODE-235197 + * + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with the SPL. If not, see . +\*****************************************************************************/ + #ifndef _SPL_STAT_H #define _SPL_STAT_H diff --git a/include/sys/stropts.h b/include/sys/stropts.h index b92949fee..ae20c4d70 100644 --- a/include/sys/stropts.h +++ b/include/sys/stropts.h @@ -1,3 +1,27 @@ +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . + * UCRL-CODE-235197 + * + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with the SPL. If not, see . +\*****************************************************************************/ + #ifndef _SPL_STROPTS_H #define _SPL_STROPTS_H diff --git a/include/sys/sunddi.h b/include/sys/sunddi.h index c1773f504..c48066b9c 100644 --- a/include/sys/sunddi.h +++ b/include/sys/sunddi.h @@ -1,28 +1,26 @@ -/* - * This file is part of the SPL: Solaris Porting Layer. - * - * Copyright (c) 2008 Lawrence Livermore National Security, LLC. - * Produced at Lawrence Livermore National Laboratory - * Written by: - * Brian Behlendorf , - * Herb Wartens , - * Jim Garlick +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . * UCRL-CODE-235197 * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. * - * This is distributed in the hope that it will be useful, but WITHOUT + * The SPL is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ + * with the SPL. If not, see . +\*****************************************************************************/ #ifndef _SPL_SUNDDI_H #define _SPL_SUNDDI_H diff --git a/include/sys/sunldi.h b/include/sys/sunldi.h index 97952ad2f..a1a6a12c2 100644 --- a/include/sys/sunldi.h +++ b/include/sys/sunldi.h @@ -1,28 +1,26 @@ -/* - * This file is part of the SPL: Solaris Porting Layer. - * - * Copyright (c) 2008 Lawrence Livermore National Security, LLC. - * Produced at Lawrence Livermore National Laboratory - * Written by: - * Brian Behlendorf , - * Herb Wartens , - * Jim Garlick +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . * UCRL-CODE-235197 * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. * - * This is distributed in the hope that it will be useful, but WITHOUT + * The SPL is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ + * with the SPL. If not, see . +\*****************************************************************************/ #ifndef _SPL_SUNLDI_H #define _SPL_SUNLDI_H diff --git a/include/sys/sysevent.h b/include/sys/sysevent.h index 45c960846..723220f0f 100644 --- a/include/sys/sysevent.h +++ b/include/sys/sysevent.h @@ -1,3 +1,27 @@ +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . + * UCRL-CODE-235197 + * + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with the SPL. If not, see . +\*****************************************************************************/ + #ifndef _SPL_SYSEVENT_H #define _SPL_SYSEVENT_H diff --git a/include/sys/sysevent/eventdefs.h b/include/sys/sysevent/eventdefs.h index d7b28f62b..2112e29ed 100644 --- a/include/sys/sysevent/eventdefs.h +++ b/include/sys/sysevent/eventdefs.h @@ -1,3 +1,27 @@ +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . + * UCRL-CODE-235197 + * + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with the SPL. If not, see . +\*****************************************************************************/ + #ifndef _SPL_SYSEVENT_EVENTDEFS_H #define _SPL_SYSEVENT_EVENTDEFS_H diff --git a/include/sys/sysmacros.h b/include/sys/sysmacros.h index 4ed41d4c5..f76c6dd7f 100644 --- a/include/sys/sysmacros.h +++ b/include/sys/sysmacros.h @@ -1,36 +1,30 @@ -/* - * This file is part of the SPL: Solaris Porting Layer. - * - * Copyright (c) 2008 Lawrence Livermore National Security, LLC. - * Produced at Lawrence Livermore National Laboratory - * Written by: - * Brian Behlendorf , - * Herb Wartens , - * Jim Garlick +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . * UCRL-CODE-235197 * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. * - * This is distributed in the hope that it will be useful, but WITHOUT + * The SPL is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ + * with the SPL. If not, see . +\*****************************************************************************/ #ifndef _SPL_SYSMACROS_H #define _SPL_SYSMACROS_H -#ifdef __cplusplus -extern "C" { -#endif - #include #include #include @@ -41,8 +35,6 @@ extern "C" { #define _KERNEL __KERNEL__ #endif -/* Missing defines. - */ #define FALSE 0 #define TRUE 1 @@ -214,8 +206,4 @@ extern void spl_cleanup(void); #define offsetof(s, m) ((size_t)(&(((s *)0)->m))) #endif -#ifdef __cplusplus -} -#endif - #endif /* _SPL_SYSMACROS_H */ diff --git a/include/sys/systeminfo.h b/include/sys/systeminfo.h index 0e8934554..592d71584 100644 --- a/include/sys/systeminfo.h +++ b/include/sys/systeminfo.h @@ -1,3 +1,27 @@ +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . + * UCRL-CODE-235197 + * + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with the SPL. If not, see . +\*****************************************************************************/ + #ifndef _SPL_SYSTEMINFO_H #define _SPL_SYSTEMINFO_H diff --git a/include/sys/systm.h b/include/sys/systm.h index 68bd9badf..f3e310a13 100644 --- a/include/sys/systm.h +++ b/include/sys/systm.h @@ -1,3 +1,27 @@ +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . + * UCRL-CODE-235197 + * + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with the SPL. If not, see . +\*****************************************************************************/ + #ifndef _SPL_SYSTM_H #define _SPL_SYSTM_H diff --git a/include/sys/t_lock.h b/include/sys/t_lock.h index 0e7d8ae9e..1055f7f6a 100644 --- a/include/sys/t_lock.h +++ b/include/sys/t_lock.h @@ -1,3 +1,27 @@ +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . + * UCRL-CODE-235197 + * + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with the SPL. If not, see . +\*****************************************************************************/ + #ifndef _SPL_T_LOCK_H #define _SPL_T_LOCK_H diff --git a/include/sys/taskq.h b/include/sys/taskq.h index 603fde680..d8578499b 100644 --- a/include/sys/taskq.h +++ b/include/sys/taskq.h @@ -1,36 +1,30 @@ -/* - * This file is part of the SPL: Solaris Porting Layer. - * - * Copyright (c) 2008 Lawrence Livermore National Security, LLC. - * Produced at Lawrence Livermore National Laboratory - * Written by: - * Brian Behlendorf , - * Herb Wartens , - * Jim Garlick +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . * UCRL-CODE-235197 * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. * - * This is distributed in the hope that it will be useful, but WITHOUT + * The SPL is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ + * with the SPL. If not, see . +\*****************************************************************************/ #ifndef _SPL_TASKQ_H #define _SPL_TASKQ_H -#ifdef __cplusplus -extern "C" { -#endif - #include #include #include @@ -102,8 +96,4 @@ void spl_taskq_fini(void); #define taskq_create(n, th, p, mi, ma, fl) __taskq_create(n, th, p, mi, ma, fl) #define taskq_destroy(tq) __taskq_destroy(tq) -#ifdef __cplusplus -} -#endif - #endif /* _SPL_TASKQ_H */ diff --git a/include/sys/thread.h b/include/sys/thread.h index 745f93e2b..4cad648df 100644 --- a/include/sys/thread.h +++ b/include/sys/thread.h @@ -1,36 +1,30 @@ -/* - * This file is part of the SPL: Solaris Porting Layer. - * - * Copyright (c) 2008 Lawrence Livermore National Security, LLC. - * Produced at Lawrence Livermore National Laboratory - * Written by: - * Brian Behlendorf , - * Herb Wartens , - * Jim Garlick +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . * UCRL-CODE-235197 * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . * - * This is distributed in the hope that it will be useful, but WITHOUT + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ + * with the SPL. If not, see . +\*****************************************************************************/ #ifndef _SPL_THREAD_H #define _SPL_THREAD_H -#ifdef __cplusplus -extern "C" { -#endif - #include #include #include @@ -67,9 +61,5 @@ extern kthread_t *__thread_create(caddr_t stk, size_t stksize, int state, pri_t pri); extern void __thread_exit(void); -#ifdef __cplusplus -} -#endif - #endif /* _SPL_THREAD_H */ diff --git a/include/sys/time.h b/include/sys/time.h index 5b263f82c..e4470a491 100644 --- a/include/sys/time.h +++ b/include/sys/time.h @@ -1,28 +1,26 @@ -/* - * This file is part of the SPL: Solaris Porting Layer. - * - * Copyright (c) 2008 Lawrence Livermore National Security, LLC. - * Produced at Lawrence Livermore National Laboratory - * Written by: - * Brian Behlendorf , - * Herb Wartens , - * Jim Garlick +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . * UCRL-CODE-235197 * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . * - * This is distributed in the hope that it will be useful, but WITHOUT + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ + * with the SPL. If not, see . +\*****************************************************************************/ #ifndef _SPL_TIME_H #define _SPL_TIME_H @@ -31,11 +29,6 @@ * Structure returned by gettimeofday(2) system call, * and used in other calls. */ - -#ifdef __cplusplus -extern "C" { -#endif - #include #include #include @@ -89,8 +82,4 @@ gethrestime_sec(void) return now.tv_sec; } -#ifdef __cplusplus -} -#endif - #endif /* _SPL_TIME_H */ diff --git a/include/sys/timer.h b/include/sys/timer.h index b7aff1184..3af57d8f5 100644 --- a/include/sys/timer.h +++ b/include/sys/timer.h @@ -1,36 +1,30 @@ -/* - * This file is part of the SPL: Solaris Porting Layer. - * - * Copyright (c) 2008 Lawrence Livermore National Security, LLC. - * Produced at Lawrence Livermore National Laboratory - * Written by: - * Brian Behlendorf , - * Herb Wartens , - * Jim Garlick +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . * UCRL-CODE-235197 * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. * - * This is distributed in the hope that it will be useful, but WITHOUT + * The SPL is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ + * with the SPL. If not, see . +\*****************************************************************************/ #ifndef _SPL_TIMER_H #define _SPL_TIMER_H -#ifdef __cplusplus -extern "C" { -#endif - #include #include #include @@ -40,9 +34,5 @@ extern "C" { #define delay(ticks) schedule_timeout((long)(ticks)) -#ifdef __cplusplus -} -#endif - #endif /* _SPL_TIMER_H */ diff --git a/include/sys/types.h b/include/sys/types.h index 2804974dd..498abdff4 100644 --- a/include/sys/types.h +++ b/include/sys/types.h @@ -1,10 +1,30 @@ +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . + * UCRL-CODE-235197 + * + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with the SPL. If not, see . +\*****************************************************************************/ + #ifndef _SPL_TYPES_H #define _SPL_TYPES_H -#ifdef __cplusplus -extern "C" { -#endif - #include #include diff --git a/include/sys/types32.h b/include/sys/types32.h index 290da02f3..25c4642dc 100644 --- a/include/sys/types32.h +++ b/include/sys/types32.h @@ -1,3 +1,27 @@ +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . + * UCRL-CODE-235197 + * + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with the SPL. If not, see . +\*****************************************************************************/ + #ifndef _SPL_TYPES32_H #define _SPL_TYPES32_H diff --git a/include/sys/u8_textprep.h b/include/sys/u8_textprep.h index e659548e3..456077c6f 100644 --- a/include/sys/u8_textprep.h +++ b/include/sys/u8_textprep.h @@ -1,3 +1,27 @@ +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . + * UCRL-CODE-235197 + * + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with the SPL. If not, see . +\*****************************************************************************/ + #ifndef _SPL_U8_TEXTPREP_H #define _SPL_U8_TEXTPREP_H diff --git a/include/sys/uio.h b/include/sys/uio.h index 0ef7aab63..83e9cc62a 100644 --- a/include/sys/uio.h +++ b/include/sys/uio.h @@ -1,3 +1,27 @@ +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . + * UCRL-CODE-235197 + * + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with the SPL. If not, see . +\*****************************************************************************/ + #ifndef _SPL_UIO_H #define _SPL_UIO_H @@ -32,15 +56,4 @@ typedef struct aio_req { void *aio_private; } aio_req_t; -/* XXX: Must be fully implemented when ZVOL is needed, for reference: - * http://cvs.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/uts/common/os/move.c - */ -#if 0 -static __inline__ int -uiomove(void *p, size_t n, enum uio_rw rw, struct uio *uio) -{ - return 0; -} -#endif - #endif /* SPL_UIO_H */ diff --git a/include/sys/unistd.h b/include/sys/unistd.h index c6b298a34..a2acfa705 100644 --- a/include/sys/unistd.h +++ b/include/sys/unistd.h @@ -1,3 +1,27 @@ +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . + * UCRL-CODE-235197 + * + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with the SPL. If not, see . +\*****************************************************************************/ + #ifndef _SPL_UNISTD_H #define _SPL_UNISTD_H diff --git a/include/sys/utsname.h b/include/sys/utsname.h index d4b9dc8ae..fa403ff52 100644 --- a/include/sys/utsname.h +++ b/include/sys/utsname.h @@ -1,3 +1,27 @@ +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . + * UCRL-CODE-235197 + * + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with the SPL. If not, see . +\*****************************************************************************/ + #ifndef _SPL_UTSNAME_H #define _SPL_UTSNAME_H diff --git a/include/sys/va_list.h b/include/sys/va_list.h index 6eb763ff9..644812881 100644 --- a/include/sys/va_list.h +++ b/include/sys/va_list.h @@ -1,3 +1,27 @@ +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . + * UCRL-CODE-235197 + * + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with the SPL. If not, see . +\*****************************************************************************/ + #ifndef _SPL_VA_LIST_H #define _SPL_VA_LIST_H diff --git a/include/sys/varargs.h b/include/sys/varargs.h index 056967eaa..b74570c21 100644 --- a/include/sys/varargs.h +++ b/include/sys/varargs.h @@ -1,3 +1,27 @@ +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . + * UCRL-CODE-235197 + * + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with the SPL. If not, see . +\*****************************************************************************/ + #ifndef _SPL_VARARGS_H #define _SPL_VARARGS_H diff --git a/include/sys/vfs.h b/include/sys/vfs.h index 0b968faa5..b18c90928 100644 --- a/include/sys/vfs.h +++ b/include/sys/vfs.h @@ -1,3 +1,27 @@ +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . + * UCRL-CODE-235197 + * + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with the SPL. If not, see . +\*****************************************************************************/ + #ifndef _SPL_ZFS_H #define _SPL_ZFS_H diff --git a/include/sys/vfs_opreg.h b/include/sys/vfs_opreg.h index 8f3f556cb..5dda4d36b 100644 --- a/include/sys/vfs_opreg.h +++ b/include/sys/vfs_opreg.h @@ -1,3 +1,27 @@ +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . + * UCRL-CODE-235197 + * + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with the SPL. If not, see . +\*****************************************************************************/ + #ifndef _SPL_OPREG_H #define _SPL_OPREG_H diff --git a/include/sys/vmsystm.h b/include/sys/vmsystm.h index 1c367d7cd..b8191f3ac 100644 --- a/include/sys/vmsystm.h +++ b/include/sys/vmsystm.h @@ -1,28 +1,26 @@ -/* - * This file is part of the SPL: Solaris Porting Layer. - * - * Copyright (c) 2008 Lawrence Livermore National Security, LLC. - * Produced at Lawrence Livermore National Laboratory - * Written by: - * Brian Behlendorf , - * Herb Wartens , - * Jim Garlick +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . * UCRL-CODE-235197 * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . * - * This is distributed in the hope that it will be useful, but WITHOUT + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ + * with the SPL. If not, see . +\*****************************************************************************/ #ifndef _SPL_VMSYSTM_H #define _SPL_VMSYSTM_H diff --git a/include/sys/vnode.h b/include/sys/vnode.h index 9568a1392..d3a74a738 100644 --- a/include/sys/vnode.h +++ b/include/sys/vnode.h @@ -1,36 +1,30 @@ -/* - * This file is part of the SPL: Solaris Porting Layer. - * - * Copyright (c) 2008 Lawrence Livermore National Security, LLC. - * Produced at Lawrence Livermore National Laboratory - * Written by: - * Brian Behlendorf , - * Herb Wartens , - * Jim Garlick +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . * UCRL-CODE-235197 * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. * - * This is distributed in the hope that it will be useful, but WITHOUT + * The SPL is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ + * with the SPL. If not, see . +\*****************************************************************************/ #ifndef _SPL_VNODE_H #define _SPL_VNODE_H -#ifdef __cplusplus -extern "C" { -#endif - #include #include #include @@ -245,8 +239,4 @@ vn_putpage(vnode_t *vp, offset_t off, ssize_t size, extern vnode_t *rootdir; -#ifdef __cplusplus -} -#endif - #endif /* SPL_VNODE_H */ diff --git a/include/sys/zmod.h b/include/sys/zmod.h index bc901b346..f1a63174a 100644 --- a/include/sys/zmod.h +++ b/include/sys/zmod.h @@ -1,42 +1,63 @@ -/* - * This file is part of the SPL: Solaris Porting Layer. - * - * Copyright (c) 2008 Lawrence Livermore National Security, LLC. - * Produced at Lawrence Livermore National Laboratory - * Written by: - * Brian Behlendorf , - * Herb Wartens , - * Jim Garlick +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . * UCRL-CODE-235197 * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . * - * This is distributed in the hope that it will be useful, but WITHOUT + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ + * with the SPL. If not, see . + ***************************************************************************** + * z_compress_level/z_uncompress are nearly identical copies of the + * compress2/uncompress functions provided by the official zlib package + * available at http://zlib.net/. The only changes made we to slightly + * adapt the functions called to match the linux kernel implementation + * of zlib. The full zlib license follows: + * + * zlib.h -- interface of the 'zlib' general purpose compression library + * version 1.2.5, April 19th, 2010 + * + * Copyright (C) 1995-2010 Jean-loup Gailly and Mark Adler + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + * + * Jean-loup Gailly + * Mark Adler +\*****************************************************************************/ #ifndef _SPL_ZMOD_H #define _SPL_ZMOD_H #include -/* NOTE: z_compress_level/z_uncompress are nearly identical copies of - * the compress2/uncompress functions provided by the official zlib - * package available at http://zlib.net/. The only changes made we to - * slightly adapt the functioned called to match the linux kernel - * implementation of zlib. - */ - -/* =========================================================================== +/* * Compresses the source buffer into the destination buffer. The level * parameter has the same meaning as in deflateInit. sourceLen is the byte * length of the source buffer. Upon entry, destLen is the total size of the @@ -82,7 +103,7 @@ z_compress_level(void *dest, size_t *destLen, const void *source, return err; } /* z_compress_level() */ -/* =========================================================================== +/* * Decompresses the source buffer into the destination buffer. sourceLen is * the byte length of the source buffer. Upon entry, destLen is the total * size of the destination buffer, which must be large enough to hold the diff --git a/include/sys/zone.h b/include/sys/zone.h index d3dd73794..9c2652fd2 100644 --- a/include/sys/zone.h +++ b/include/sys/zone.h @@ -1,3 +1,27 @@ +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . + * UCRL-CODE-235197 + * + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with the SPL. If not, see . +\*****************************************************************************/ + #ifndef _SPL_ZONE_H #define _SPL_ZONE_H diff --git a/include/unistd.h b/include/unistd.h index c6b298a34..a2acfa705 100644 --- a/include/unistd.h +++ b/include/unistd.h @@ -1,3 +1,27 @@ +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . + * UCRL-CODE-235197 + * + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with the SPL. If not, see . +\*****************************************************************************/ + #ifndef _SPL_UNISTD_H #define _SPL_UNISTD_H diff --git a/include/util/qsort.h b/include/util/qsort.h index f7bb26847..890674acd 100644 --- a/include/util/qsort.h +++ b/include/util/qsort.h @@ -1,3 +1,27 @@ +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . + * UCRL-CODE-235197 + * + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with the SPL. If not, see . +\*****************************************************************************/ + #ifndef _SPL_QSORT_H #define _SPL_QSORT_H diff --git a/include/vm/anon.h b/include/vm/anon.h index 0198e729e..51e8512ba 100644 --- a/include/vm/anon.h +++ b/include/vm/anon.h @@ -1,3 +1,27 @@ +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . + * UCRL-CODE-235197 + * + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with the SPL. If not, see . +\*****************************************************************************/ + #ifndef _SPL_VM_ANON_H #define _SPL_VM_ANON_H diff --git a/include/vm/pvn.h b/include/vm/pvn.h index e89ee1748..c206b1b77 100644 --- a/include/vm/pvn.h +++ b/include/vm/pvn.h @@ -1,3 +1,27 @@ +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . + * UCRL-CODE-235197 + * + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with the SPL. If not, see . +\*****************************************************************************/ + #ifndef _SPL_VM_PVN_H #define _SPL_VM_PVN_H diff --git a/include/vm/seg_kmem.h b/include/vm/seg_kmem.h index df620e73d..b21f71a52 100644 --- a/include/vm/seg_kmem.h +++ b/include/vm/seg_kmem.h @@ -1,3 +1,27 @@ +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . + * UCRL-CODE-235197 + * + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with the SPL. If not, see . +\*****************************************************************************/ + #ifndef _SPL_SEG_KMEM_H #define _SPL_SEG_KMEM_H diff --git a/lib/Makefile.in b/lib/Makefile.in index ed3f85b5a..9c5dfebdf 100644 --- a/lib/Makefile.in +++ b/lib/Makefile.in @@ -15,6 +15,14 @@ @SET_MAKE@ +############################################################################### +# Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. +# Copyright (C) 2007 The Regents of the University of California. +# Written by Brian Behlendorf . +############################################################################### +# Common rules for user space components. +############################################################################### + VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ diff --git a/lib/list.c b/lib/list.c index fbee2d97d..55367e449 100644 --- a/lib/list.c +++ b/lib/list.c @@ -1,30 +1,28 @@ /***************************************************************************** - * $Id: list.c 3709 2006-11-29 00:51:22Z dun $ - ***************************************************************************** - * Copyright (C) 2001-2002 The Regents of the University of California. + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2001-2007 The Regents of the University of California. * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). * Written by Chris Dunlap . + * UCRL-CODE-235197 * * This file is from LSD-Tools, the LLNL Software Development Toolbox. * - * LSD-Tools is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License as published by the Free - * Software Foundation; either version 2 of the License, or (at your option) - * any later version. + * LSD-Tools is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. * * LSD-Tools is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. * * You should have received a copy of the GNU General Public License along - * with LSD-Tools; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + * with LSD-Tools. If not, see . ***************************************************************************** * Refer to "list.h" for documentation on public functions. *****************************************************************************/ - #ifdef WITH_PTHREADS # include #endif /* WITH_PTHREADS */ diff --git a/lib/list.h b/lib/list.h index fe3fd006b..01adedd59 100644 --- a/lib/list.h +++ b/lib/list.h @@ -1,10 +1,10 @@ /***************************************************************************** - * $Id: list.h 2899 2002-12-11 19:00:36Z dun $ - ***************************************************************************** - * Copyright (C) 2001-2002 The Regents of the University of California. + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2001-2007 The Regents of the University of California. * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). * Written by Chris Dunlap . - * + * UCRL-CODE-235197 + * * This file is from LSD-Tools, the LLNL Software Development Toolbox. * * LSD-Tools is free software; you can redistribute it and/or modify it under @@ -18,11 +18,9 @@ * more details. * * You should have received a copy of the GNU General Public License along - * with LSD-Tools; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + * with LSD-Tools. If not, see . *****************************************************************************/ - #ifndef LSD_LIST_H #define LSD_LIST_H diff --git a/module/spl/spl-atomic.c b/module/spl/spl-atomic.c index decf9515e..f2dd67384 100644 --- a/module/spl/spl-atomic.c +++ b/module/spl/spl-atomic.c @@ -1,28 +1,28 @@ -/* - * This file is part of the SPL: Solaris Porting Layer. - * - * Copyright (c) 2008 Lawrence Livermore National Security, LLC. - * Produced at Lawrence Livermore National Laboratory - * Written by: - * Brian Behlendorf , - * Herb Wartens , - * Jim Garlick +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . * UCRL-CODE-235197 * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. * - * This is distributed in the hope that it will be useful, but WITHOUT + * The SPL is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ + * with the SPL. If not, see . + ***************************************************************************** + * Solaris Porting Layer (SPL) Atomic Implementation. +\*****************************************************************************/ #include diff --git a/module/spl/spl-condvar.c b/module/spl/spl-condvar.c index d5b9be721..269b0ab61 100644 --- a/module/spl/spl-condvar.c +++ b/module/spl/spl-condvar.c @@ -1,28 +1,28 @@ -/* - * This file is part of the SPL: Solaris Porting Layer. - * - * Copyright (c) 2008 Lawrence Livermore National Security, LLC. - * Produced at Lawrence Livermore National Laboratory - * Written by: - * Brian Behlendorf , - * Herb Wartens , - * Jim Garlick +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . * UCRL-CODE-235197 * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. * - * This is distributed in the hope that it will be useful, but WITHOUT + * The SPL is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ + * with the SPL. If not, see . + ***************************************************************************** + * Solaris Porting Layer (SPL) Credential Implementation. +\*****************************************************************************/ #include diff --git a/module/spl/spl-cred.c b/module/spl/spl-cred.c index 826a228dd..dd5d9da01 100644 --- a/module/spl/spl-cred.c +++ b/module/spl/spl-cred.c @@ -1,26 +1,28 @@ -/* - * This file is part of the SPL: Solaris Porting Layer. - * - * Copyright (c) 2009 Lawrence Livermore National Security, LLC. - * Produced at Lawrence Livermore National Laboratory - * Written by: - * Brian Behlendorf , +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . * UCRL-CODE-235197 * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . * - * This is distributed in the hope that it will be useful, but WITHOUT + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ + * with the SPL. If not, see . + ***************************************************************************** + * Solaris Porting Layer (SPL) Credential Implementation. +\*****************************************************************************/ #include diff --git a/module/spl/spl-debug.c b/module/spl/spl-debug.c index 0602a1a89..e28926c12 100644 --- a/module/spl/spl-debug.c +++ b/module/spl/spl-debug.c @@ -1,35 +1,28 @@ -/* - * This file is part of the SPL: Solaris Porting Layer. - * - * This file was originally part of Lustre, http://www.lustre.org. - * but has subsequently been adapted for use in the SPL in - * accordance with the GPL. - * - * Copyright (C) 2004 Cluster File Systems, Inc. - * Copyright (c) 2008 Lawrence Livermore National Security, LLC. - * Produced at Lawrence Livermore National Laboratory - * Written by: - * Zach Brown - * Phil Schwan - * Brian Behlendorf , - * Herb Wartens , - * Jim Garlick +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . * UCRL-CODE-235197 * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . * - * This is distributed in the hope that it will be useful, but WITHOUT + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ + * with the SPL. If not, see . + ***************************************************************************** + * Solaris Porting Layer (SPL) Debug Implementation. +\*****************************************************************************/ #include #include diff --git a/module/spl/spl-err.c b/module/spl/spl-err.c index fcf701400..1d5202827 100644 --- a/module/spl/spl-err.c +++ b/module/spl/spl-err.c @@ -1,28 +1,28 @@ -/* - * This file is part of the SPL: Solaris Porting Layer. - * - * Copyright (c) 2008 Lawrence Livermore National Security, LLC. - * Produced at Lawrence Livermore National Laboratory - * Written by: - * Brian Behlendorf , - * Herb Wartens , - * Jim Garlick +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . * UCRL-CODE-235197 * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. * - * This is distributed in the hope that it will be useful, but WITHOUT + * The SPL is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ + * with the SPL. If not, see . + ***************************************************************************** + * Solaris Porting Layer (SPL) Error Implementation. +\*****************************************************************************/ #include #include diff --git a/module/spl/spl-generic.c b/module/spl/spl-generic.c index aaf1a4c10..29b698889 100644 --- a/module/spl/spl-generic.c +++ b/module/spl/spl-generic.c @@ -1,28 +1,28 @@ -/* - * This file is part of the SPL: Solaris Porting Layer. - * - * Copyright (c) 2008 Lawrence Livermore National Security, LLC. - * Produced at Lawrence Livermore National Laboratory - * Written by: - * Brian Behlendorf , - * Herb Wartens , - * Jim Garlick +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . * UCRL-CODE-235197 * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . * - * This is distributed in the hope that it will be useful, but WITHOUT + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ + * with the SPL. If not, see . + ***************************************************************************** + * Solaris Porting Layer (SPL) Generic Implementation. +\*****************************************************************************/ #include #include diff --git a/module/spl/spl-kmem.c b/module/spl/spl-kmem.c index d62a6f61b..ca89f6fed 100644 --- a/module/spl/spl-kmem.c +++ b/module/spl/spl-kmem.c @@ -1,28 +1,28 @@ -/* - * This file is part of the SPL: Solaris Porting Layer. - * - * Copyright (c) 2008 Lawrence Livermore National Security, LLC. - * Produced at Lawrence Livermore National Laboratory - * Written by: - * Brian Behlendorf , - * Herb Wartens , - * Jim Garlick +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . * UCRL-CODE-235197 * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . * - * This is distributed in the hope that it will be useful, but WITHOUT + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ + * with the SPL. If not, see . + ***************************************************************************** + * Solaris Porting Layer (SPL) Kmem Implementation. +\*****************************************************************************/ #include diff --git a/module/spl/spl-kobj.c b/module/spl/spl-kobj.c index e78cd9244..42a264172 100644 --- a/module/spl/spl-kobj.c +++ b/module/spl/spl-kobj.c @@ -1,28 +1,28 @@ -/* - * This file is part of the SPL: Solaris Porting Layer. - * - * Copyright (c) 2008 Lawrence Livermore National Security, LLC. - * Produced at Lawrence Livermore National Laboratory - * Written by: - * Brian Behlendorf , - * Herb Wartens , - * Jim Garlick +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . * UCRL-CODE-235197 * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. * - * This is distributed in the hope that it will be useful, but WITHOUT + * The SPL is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ + * with the SPL. If not, see . + ***************************************************************************** + * Solaris Porting Layer (SPL) Kobj Implementation. +\*****************************************************************************/ #include diff --git a/module/spl/spl-kstat.c b/module/spl/spl-kstat.c index 53089c311..2b45549d6 100644 --- a/module/spl/spl-kstat.c +++ b/module/spl/spl-kstat.c @@ -1,28 +1,28 @@ -/* - * This file is part of the SPL: Solaris Porting Layer. - * - * Copyright (c) 2008 Lawrence Livermore National Security, LLC. - * Produced at Lawrence Livermore National Laboratory - * Written by: - * Brian Behlendorf , - * Herb Wartens , - * Jim Garlick +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . * UCRL-CODE-235197 * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. * - * This is distributed in the hope that it will be useful, but WITHOUT + * The SPL is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ + * with the SPL. If not, see . + ***************************************************************************** + * Solaris Porting Layer (SPL) Kstat Implementation. +\*****************************************************************************/ #include diff --git a/module/spl/spl-module.c b/module/spl/spl-module.c index f17974873..37dd4f4c1 100644 --- a/module/spl/spl-module.c +++ b/module/spl/spl-module.c @@ -1,28 +1,28 @@ -/* - * This file is part of the SPL: Solaris Porting Layer. - * - * Copyright (c) 2008 Lawrence Livermore National Security, LLC. - * Produced at Lawrence Livermore National Laboratory - * Written by: - * Brian Behlendorf , - * Herb Wartens , - * Jim Garlick +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . * UCRL-CODE-235197 * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. * - * This is distributed in the hope that it will be useful, but WITHOUT + * The SPL is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ + * with the SPL. If not, see . + ***************************************************************************** + * Solaris Porting Layer (SPL) Module Implementation. +\*****************************************************************************/ #include #include diff --git a/module/spl/spl-mutex.c b/module/spl/spl-mutex.c index 0af74571d..983245dc0 100644 --- a/module/spl/spl-mutex.c +++ b/module/spl/spl-mutex.c @@ -1,28 +1,28 @@ -/* - * This file is part of the SPL: Solaris Porting Layer. - * - * Copyright (c) 2009 Lawrence Livermore National Security, LLC. - * Produced at Lawrence Livermore National Laboratory - * Written by: - * Brian Behlendorf , - * Herb Wartens , - * Jim Garlick +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . * UCRL-CODE-235197 * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . * - * This is distributed in the hope that it will be useful, but WITHOUT + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ + * with the SPL. If not, see . + ***************************************************************************** + * Solaris Porting Layer (SPL) Mutex Implementation. +\*****************************************************************************/ #include diff --git a/module/spl/spl-proc.c b/module/spl/spl-proc.c index 6db4664da..3bc8b40cf 100644 --- a/module/spl/spl-proc.c +++ b/module/spl/spl-proc.c @@ -1,28 +1,28 @@ -/* - * This file is part of the SPL: Solaris Porting Layer. - * - * Copyright (c) 2008 Lawrence Livermore National Security, LLC. - * Produced at Lawrence Livermore National Laboratory - * Written by: - * Brian Behlendorf , - * Herb Wartens , - * Jim Garlick +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . * UCRL-CODE-235197 * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. * - * This is distributed in the hope that it will be useful, but WITHOUT + * The SPL is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ + * with the SPL. If not, see . + ***************************************************************************** + * Solaris Porting Layer (SPL) Proc Implementation. +\*****************************************************************************/ #include diff --git a/module/spl/spl-rwlock.c b/module/spl/spl-rwlock.c index 5120b2c81..c0f974f1b 100644 --- a/module/spl/spl-rwlock.c +++ b/module/spl/spl-rwlock.c @@ -1,28 +1,28 @@ -/* - * This file is part of the SPL: Solaris Porting Layer. - * - * Copyright (c) 2008 Lawrence Livermore National Security, LLC. - * Produced at Lawrence Livermore National Laboratory - * Written by: - * Brian Behlendorf , - * Herb Wartens , - * Jim Garlick +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . * UCRL-CODE-235197 * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . * - * This is distributed in the hope that it will be useful, but WITHOUT + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ + * with the SPL. If not, see . + ***************************************************************************** + * Solaris Porting Layer (SPL) Reader/Writer Lock Implementation. +\*****************************************************************************/ #include diff --git a/module/spl/spl-taskq.c b/module/spl/spl-taskq.c index 64719d762..805749a14 100644 --- a/module/spl/spl-taskq.c +++ b/module/spl/spl-taskq.c @@ -1,28 +1,28 @@ -/* - * This file is part of the SPL: Solaris Porting Layer. - * - * Copyright (c) 2008 Lawrence Livermore National Security, LLC. - * Produced at Lawrence Livermore National Laboratory - * Written by: - * Brian Behlendorf , - * Herb Wartens , - * Jim Garlick +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . * UCRL-CODE-235197 * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . * - * This is distributed in the hope that it will be useful, but WITHOUT + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ + * with the SPL. If not, see . + ***************************************************************************** + * Solaris Porting Layer (SPL) Task Queue Implementation. +\*****************************************************************************/ #include #include diff --git a/module/spl/spl-thread.c b/module/spl/spl-thread.c index 953c5ce7f..de959119e 100644 --- a/module/spl/spl-thread.c +++ b/module/spl/spl-thread.c @@ -1,28 +1,28 @@ -/* - * This file is part of the SPL: Solaris Porting Layer. - * - * Copyright (c) 2008 Lawrence Livermore National Security, LLC. - * Produced at Lawrence Livermore National Laboratory - * Written by: - * Brian Behlendorf , - * Herb Wartens , - * Jim Garlick +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . * UCRL-CODE-235197 * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . * - * This is distributed in the hope that it will be useful, but WITHOUT + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ + * with the SPL. If not, see . + ***************************************************************************** + * Solaris Porting Layer (SPL) Thread Implementation. +\*****************************************************************************/ #include #include diff --git a/module/spl/spl-time.c b/module/spl/spl-time.c index 6806dcf71..4c08b754d 100644 --- a/module/spl/spl-time.c +++ b/module/spl/spl-time.c @@ -1,28 +1,28 @@ -/* - * This file is part of the SPL: Solaris Porting Layer. - * - * Copyright (c) 2008 Lawrence Livermore National Security, LLC. - * Produced at Lawrence Livermore National Laboratory - * Written by: - * Brian Behlendorf , - * Herb Wartens , - * Jim Garlick +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . * UCRL-CODE-235197 * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. * - * This is distributed in the hope that it will be useful, but WITHOUT + * The SPL is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ + * with the SPL. If not, see . + ***************************************************************************** + * Solaris Porting Layer (SPL) Time Implementation. +\*****************************************************************************/ #include #include diff --git a/module/spl/spl-vnode.c b/module/spl/spl-vnode.c index a113ecb2f..ec312aad1 100644 --- a/module/spl/spl-vnode.c +++ b/module/spl/spl-vnode.c @@ -1,28 +1,28 @@ -/* - * This file is part of the SPL: Solaris Porting Layer. - * - * Copyright (c) 2008 Lawrence Livermore National Security, LLC. - * Produced at Lawrence Livermore National Laboratory - * Written by: - * Brian Behlendorf , - * Herb Wartens , - * Jim Garlick +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . * UCRL-CODE-235197 * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. * - * This is distributed in the hope that it will be useful, but WITHOUT + * The SPL is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ + * with the SPL. If not, see . + ***************************************************************************** + * Solaris Porting Layer (SPL) Vnode Implementation. +\*****************************************************************************/ #include #include diff --git a/module/spl/spl-xdr.c b/module/spl/spl-xdr.c index 16e42c336..174f76f19 100644 --- a/module/spl/spl-xdr.c +++ b/module/spl/spl-xdr.c @@ -1,22 +1,25 @@ -/* - * This file is part of the SPL: Solaris Porting Layer. +/*****************************************************************************\ + * Copyright (c) 2008-2010 Sun Microsystems, Inc. + * Written by Ricardo Correia * - * Copyright (c) 2008 Sun Microsystems, Inc. + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. * - * This is distributed in the hope that it will be useful, but WITHOUT + * The SPL is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ + * with the SPL. If not, see . + ***************************************************************************** + * Solaris Porting Layer (SPL) XDR Implementation. +\*****************************************************************************/ #include @@ -263,7 +266,7 @@ static bool_t xdrmem_enc_char(XDR *xdrs, char *cp) { uint32_t val; - + BUILD_BUG_ON(sizeof(char) != 1); val = *((unsigned char *) cp); diff --git a/module/splat/splat-atomic.c b/module/splat/splat-atomic.c index 3a651103e..9cdaa69df 100644 --- a/module/splat/splat-atomic.c +++ b/module/splat/splat-atomic.c @@ -1,28 +1,28 @@ -/* - * This file is part of the SPL: Solaris Porting Layer. - * - * Copyright (c) 2008 Lawrence Livermore National Security, LLC. - * Produced at Lawrence Livermore National Laboratory - * Written by: - * Brian Behlendorf , - * Herb Wartens , - * Jim Garlick +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . * UCRL-CODE-235197 * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. * - * This is distributed in the hope that it will be useful, but WITHOUT + * The SPL is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ + * with the SPL. If not, see . + ***************************************************************************** + * Solaris Porting LAyer Tests (SPLAT) Atomic Tests. +\*****************************************************************************/ #include "splat-internal.h" diff --git a/module/splat/splat-condvar.c b/module/splat/splat-condvar.c index baef871c2..ace9823c3 100644 --- a/module/splat/splat-condvar.c +++ b/module/splat/splat-condvar.c @@ -1,28 +1,28 @@ -/* - * This file is part of the SPL: Solaris Porting Layer. - * - * Copyright (c) 2008 Lawrence Livermore National Security, LLC. - * Produced at Lawrence Livermore National Laboratory - * Written by: - * Brian Behlendorf , - * Herb Wartens , - * Jim Garlick +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . * UCRL-CODE-235197 * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. * - * This is distributed in the hope that it will be useful, but WITHOUT + * The SPL is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ + * with the SPL. If not, see . + ***************************************************************************** + * Solaris Porting LAyer Tests (SPLAT) Condition Variable Tests. +\*****************************************************************************/ #include "splat-internal.h" diff --git a/module/splat/splat-cred.c b/module/splat/splat-cred.c index f808625e8..db36ece98 100644 --- a/module/splat/splat-cred.c +++ b/module/splat/splat-cred.c @@ -1,26 +1,28 @@ -/* - * This file is part of the SPL: Solaris Porting Layer. - * - * Copyright (c) 2009 Lawrence Livermore National Security, LLC. - * Produced at Lawrence Livermore National Laboratory - * Written by: - * Brian Behlendorf , +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . * UCRL-CODE-235197 * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . * - * This is distributed in the hope that it will be useful, but WITHOUT + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ + * with the SPL. If not, see . + ***************************************************************************** + * Solaris Porting LAyer Tests (SPLAT) Credential Tests. +\*****************************************************************************/ #include "splat-internal.h" diff --git a/module/splat/splat-ctl.c b/module/splat/splat-ctl.c index 36a690743..09f084710 100644 --- a/module/splat/splat-ctl.c +++ b/module/splat/splat-ctl.c @@ -1,44 +1,47 @@ -/* - * This file is part of the SPL: Solaris Porting Layer. - * - * Copyright (c) 2008 Lawrence Livermore National Security, LLC. - * Produced at Lawrence Livermore National Laboratory - * Written by: - * Brian Behlendorf , - * Herb Wartens , - * Jim Garlick +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . * UCRL-CODE-235197 * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. * - * This is distributed in the hope that it will be useful, but WITHOUT + * The SPL is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -/* - * My intent is to create a loadable 'splat' (Solaris Porting LAyer - * Tests) module which can be used as an access point to run - * in kernel Solaris ABI regression tests. This provides a - * nice mechanism to validate the shim primates are working properly. + * with the SPL. If not, see . + ***************************************************************************** + * Solaris Porting LAyer Tests (SPLAT) Test Control Interface. * - * The basic design is the splat module is that it is constructed of - * various splat_* source files each of which contains regression tests. - * For example the splat_linux_kmem.c file contains tests for validating - * kmem correctness. When the splat module is loaded splat_*_init() - * will be called for each subsystems tests, similarly splat_*_fini() is - * called when the splat module is removed. Each test can then be - * run by making an ioctl() call from a userspace control application - * to pick the subsystem and test which should be run. - */ + * The 'splat' (Solaris Porting LAyer Tests) module is designed as a + * framework which runs various in kernel regression tests to validate + * the SPL primitives honor the Solaris ABI. + * + * The splat module is constructed of various splat_* source files each + * of which contain regression tests for a particular subsystem. For + * example, the splat_kmem.c file contains all the tests for validating + * the kmem interfaces have been implemented correctly. When the splat + * module is loaded splat_*_init() will be called for each subsystems + * tests. It is the responsibility of splat_*_init() to register all + * the tests for this subsystem using the SPLAT_TEST_INIT() macro. + * Similarly splat_*_fini() is called when the splat module is removed + * and is responsible for unregistering its tests via the SPLAT_TEST_FINI + * macro. Once a test is registered it can then be run with an ioctl() + * call which specifies the subsystem and test to be run. The provided + * splat command line tool can be used to display all available + * subsystems and tests. It can also be used to run the full suite + * of regression tests or particular tests. +\*****************************************************************************/ #include "splat-internal.h" diff --git a/module/splat/splat-generic.c b/module/splat/splat-generic.c index d963e50f3..8ad6913c0 100644 --- a/module/splat/splat-generic.c +++ b/module/splat/splat-generic.c @@ -1,28 +1,28 @@ -/* - * This file is part of the SPL: Solaris Porting Layer. - * - * Copyright (c) 2008 Lawrence Livermore National Security, LLC. - * Produced at Lawrence Livermore National Laboratory - * Written by: - * Brian Behlendorf , - * Herb Wartens , - * Jim Garlick +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . * UCRL-CODE-235197 * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. * - * This is distributed in the hope that it will be useful, but WITHOUT + * The SPL is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ + * with the SPL. If not, see . + ***************************************************************************** + * Solaris Porting LAyer Tests (SPLAT) Generic Tests. +\*****************************************************************************/ #include "splat-internal.h" diff --git a/module/splat/splat-internal.h b/module/splat/splat-internal.h index fea78e043..ba1224fc1 100644 --- a/module/splat/splat-internal.h +++ b/module/splat/splat-internal.h @@ -1,28 +1,26 @@ -/* - * This file is part of the SPL: Solaris Porting Layer. - * - * Copyright (c) 2008 Lawrence Livermore National Security, LLC. - * Produced at Lawrence Livermore National Laboratory - * Written by: - * Brian Behlendorf , - * Herb Wartens , - * Jim Garlick +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . * UCRL-CODE-235197 * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. * - * This is distributed in the hope that it will be useful, but WITHOUT + * The SPL is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ + * with the SPL. If not, see . +\*****************************************************************************/ #ifndef _SPLAT_INTERNAL_H #define _SPLAT_INTERNAL_H diff --git a/module/splat/splat-kmem.c b/module/splat/splat-kmem.c index c743dd163..28b657c15 100644 --- a/module/splat/splat-kmem.c +++ b/module/splat/splat-kmem.c @@ -1,28 +1,28 @@ -/* - * This file is part of the SPL: Solaris Porting Layer. - * - * Copyright (c) 2008 Lawrence Livermore National Security, LLC. - * Produced at Lawrence Livermore National Laboratory - * Written by: - * Brian Behlendorf , - * Herb Wartens , - * Jim Garlick +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . * UCRL-CODE-235197 * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . * - * This is distributed in the hope that it will be useful, but WITHOUT + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ + * with the SPL. If not, see . + ***************************************************************************** + * Solaris Porting LAyer Tests (SPLAT) Kmem Tests. +\*****************************************************************************/ #include "splat-internal.h" diff --git a/module/splat/splat-kobj.c b/module/splat/splat-kobj.c index cd73a98f3..f0720dbf5 100644 --- a/module/splat/splat-kobj.c +++ b/module/splat/splat-kobj.c @@ -1,28 +1,28 @@ -/* - * This file is part of the SPL: Solaris Porting Layer. - * - * Copyright (c) 2008 Lawrence Livermore National Security, LLC. - * Produced at Lawrence Livermore National Laboratory - * Written by: - * Brian Behlendorf , - * Herb Wartens , - * Jim Garlick +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . * UCRL-CODE-235197 * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. * - * This is distributed in the hope that it will be useful, but WITHOUT + * The SPL is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ + * with the SPL. If not, see . + ***************************************************************************** + * Solaris Porting LAyer Tests (SPLAT) Kobj Tests. +\*****************************************************************************/ #include "splat-internal.h" diff --git a/module/splat/splat-list.c b/module/splat/splat-list.c index e68d4be33..d517e7d22 100644 --- a/module/splat/splat-list.c +++ b/module/splat/splat-list.c @@ -1,28 +1,28 @@ -/* - * This file is part of the SPL: Solaris Porting Layer. - * - * Copyright (c) 2008 Lawrence Livermore National Security, LLC. - * Produced at Lawrence Livermore National Laboratory - * Written by: - * Brian Behlendorf , - * Herb Wartens , - * Jim Garlick +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . * UCRL-CODE-235197 * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. * - * This is distributed in the hope that it will be useful, but WITHOUT + * The SPL is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ + * with the SPL. If not, see . + ***************************************************************************** + * Solaris Porting LAyer Tests (SPLAT) List Tests. +\*****************************************************************************/ #include "splat-internal.h" diff --git a/module/splat/splat-mutex.c b/module/splat/splat-mutex.c index 72fa32c81..96ed27297 100644 --- a/module/splat/splat-mutex.c +++ b/module/splat/splat-mutex.c @@ -1,28 +1,28 @@ -/* - * This file is part of the SPL: Solaris Porting Layer. - * - * Copyright (c) 2008 Lawrence Livermore National Security, LLC. - * Produced at Lawrence Livermore National Laboratory - * Written by: - * Brian Behlendorf , - * Herb Wartens , - * Jim Garlick +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . * UCRL-CODE-235197 * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. * - * This is distributed in the hope that it will be useful, but WITHOUT + * The SPL is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ + * with the SPL. If not, see . + ***************************************************************************** + * Solaris Porting LAyer Tests (SPLAT) Mutex Tests. +\*****************************************************************************/ #include "splat-internal.h" diff --git a/module/splat/splat-random.c b/module/splat/splat-random.c index ed8f694c3..3ee580df7 100644 --- a/module/splat/splat-random.c +++ b/module/splat/splat-random.c @@ -1,28 +1,28 @@ -/* - * This file is part of the SPL: Solaris Porting Layer. - * - * Copyright (c) 2008 Lawrence Livermore National Security, LLC. - * Produced at Lawrence Livermore National Laboratory - * Written by: - * Brian Behlendorf , - * Herb Wartens , - * Jim Garlick +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . * UCRL-CODE-235197 * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. * - * This is distributed in the hope that it will be useful, but WITHOUT + * The SPL is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ + * with the SPL. If not, see . + ***************************************************************************** + * Solaris Porting LAyer Tests (SPLAT) Random Number Generator Tests. +\*****************************************************************************/ #include "splat-internal.h" diff --git a/module/splat/splat-rwlock.c b/module/splat/splat-rwlock.c index 13140260c..6b2ecbe82 100644 --- a/module/splat/splat-rwlock.c +++ b/module/splat/splat-rwlock.c @@ -1,28 +1,28 @@ -/* - * This file is part of the SPL: Solaris Porting Layer. - * - * Copyright (c) 2008 Lawrence Livermore National Security, LLC. - * Produced at Lawrence Livermore National Laboratory - * Written by: - * Brian Behlendorf , - * Herb Wartens , - * Jim Garlick +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . * UCRL-CODE-235197 * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. * - * This is distributed in the hope that it will be useful, but WITHOUT + * The SPL is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ + * with the SPL. If not, see . + ***************************************************************************** + * Solaris Porting LAyer Tests (SPLAT) Read/Writer Lock Tests. +\*****************************************************************************/ #include "splat-internal.h" diff --git a/module/splat/splat-taskq.c b/module/splat/splat-taskq.c index 9214ecf8d..ea79dfa85 100644 --- a/module/splat/splat-taskq.c +++ b/module/splat/splat-taskq.c @@ -1,28 +1,28 @@ -/* - * This file is part of the SPL: Solaris Porting Layer. - * - * Copyright (c) 2008 Lawrence Livermore National Security, LLC. - * Produced at Lawrence Livermore National Laboratory - * Written by: - * Brian Behlendorf , - * Herb Wartens , - * Jim Garlick +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . * UCRL-CODE-235197 * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . * - * This is distributed in the hope that it will be useful, but WITHOUT + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ + * with the SPL. If not, see . + ***************************************************************************** + * Solaris Porting LAyer Tests (SPLAT) Task Queue Tests. +\*****************************************************************************/ #include "splat-internal.h" diff --git a/module/splat/splat-thread.c b/module/splat/splat-thread.c index b88cecb83..d21ded795 100644 --- a/module/splat/splat-thread.c +++ b/module/splat/splat-thread.c @@ -1,28 +1,28 @@ -/* - * This file is part of the SPL: Solaris Porting Layer. - * - * Copyright (c) 2008 Lawrence Livermore National Security, LLC. - * Produced at Lawrence Livermore National Laboratory - * Written by: - * Brian Behlendorf , - * Herb Wartens , - * Jim Garlick +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . * UCRL-CODE-235197 * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. * - * This is distributed in the hope that it will be useful, but WITHOUT + * The SPL is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ + * with the SPL. If not, see . + ***************************************************************************** + * Solaris Porting LAyer Tests (SPLAT) Thread Tests. +\*****************************************************************************/ #include "splat-internal.h" diff --git a/module/splat/splat-time.c b/module/splat/splat-time.c index d9b62be8f..3b06b9ef2 100644 --- a/module/splat/splat-time.c +++ b/module/splat/splat-time.c @@ -1,28 +1,28 @@ -/* - * This file is part of the SPL: Solaris Porting Layer. - * - * Copyright (c) 2008 Lawrence Livermore National Security, LLC. - * Produced at Lawrence Livermore National Laboratory - * Written by: - * Brian Behlendorf , - * Herb Wartens , - * Jim Garlick +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . * UCRL-CODE-235197 * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. * - * This is distributed in the hope that it will be useful, but WITHOUT + * The SPL is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ + * with the SPL. If not, see . + ***************************************************************************** + * Solaris Porting LAyer Tests (SPLAT) Time Tests. +\*****************************************************************************/ #include "splat-internal.h" diff --git a/module/splat/splat-vnode.c b/module/splat/splat-vnode.c index 91a719b5f..1955841e2 100644 --- a/module/splat/splat-vnode.c +++ b/module/splat/splat-vnode.c @@ -1,28 +1,28 @@ -/* - * This file is part of the SPL: Solaris Porting Layer. - * - * Copyright (c) 2008 Lawrence Livermore National Security, LLC. - * Produced at Lawrence Livermore National Laboratory - * Written by: - * Brian Behlendorf , - * Herb Wartens , - * Jim Garlick +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . * UCRL-CODE-235197 * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. * - * This is distributed in the hope that it will be useful, but WITHOUT + * The SPL is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. * * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ + * with the SPL. If not, see . + ***************************************************************************** + * Solaris Porting LAyer Tests (SPLAT) Vnode Tests. +\*****************************************************************************/ #include "splat-internal.h" #include diff --git a/scripts/check.sh b/scripts/check.sh index 37f77853a..712605547 100755 --- a/scripts/check.sh +++ b/scripts/check.sh @@ -1,4 +1,29 @@ #!/bin/bash +############################################################################### +# Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. +# Copyright (C) 2007 The Regents of the University of California. +# Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). +# Written by Brian Behlendorf . +# UCRL-CODE-235197 +# +# This file is part of the SPL, Solaris Porting Layer. +# For details, see . +# +# The SPL is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; either version 2 of the License, or (at your +# option) any later version. +# +# The SPL is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with the SPL. If not, see . +############################################################################### +# This script runs the full set of regression tests. +############################################################################### prog=check.sh spl_module=../module/spl/spl.ko -- cgit v1.2.3 From eb12b3782c94113d2d40d2da22265dc4111a672b Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Fri, 11 Jun 2010 14:53:23 -0700 Subject: Support TQ_FRONT flag used by taskq_dispatch() Allow taskq_dispatch() to insert work items at the head of the queue instead of just the tail by passing the TQ_FRONT flag. --- include/sys/taskq.h | 2 ++ module/spl/spl-taskq.c | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'module/spl/spl-taskq.c') diff --git a/include/sys/taskq.h b/include/sys/taskq.h index baa96eaa0..4e51d98dd 100644 --- a/include/sys/taskq.h +++ b/include/sys/taskq.h @@ -39,6 +39,7 @@ #define TASKQ_CPR_SAFE 0x00000002 #define TASKQ_DYNAMIC 0x00000004 #define TASKQ_THREADS_CPU_PCT 0x00000008 +#define TASKQ_DC_BATCH 0x00000010 typedef unsigned long taskqid_t; typedef void (task_func_t)(void *); @@ -53,6 +54,7 @@ typedef void (task_func_t)(void *); #define TQ_NOQUEUE 0x01000000 #define TQ_NOALLOC 0x02000000 #define TQ_NEW 0x04000000 +#define TQ_FRONT 0x08000000 #define TQ_ACTIVE 0x80000000 typedef struct taskq { diff --git a/module/spl/spl-taskq.c b/module/spl/spl-taskq.c index 805749a14..fba38021f 100644 --- a/module/spl/spl-taskq.c +++ b/module/spl/spl-taskq.c @@ -274,7 +274,13 @@ __taskq_dispatch(taskq_t *tq, task_func_t func, void *arg, uint_t flags) GOTO(out, rc = 0); spin_lock(&t->t_lock); - list_add_tail(&t->t_list, &tq->tq_pend_list); + + /* Queue to the head instead of the tail */ + if (flags & TQ_FRONT) + list_add(&t->t_list, &tq->tq_pend_list); + else + list_add_tail(&t->t_list, &tq->tq_pend_list); + t->t_id = rc = tq->tq_next_id; tq->tq_next_id++; t->t_func = func; -- cgit v1.2.3 From 438683c0a9c9a045106f27aca85dc1855d926497 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Mon, 21 Jun 2010 10:19:44 -0700 Subject: Revert "Support TQ_FRONT flag used by taskq_dispatch()" This reverts commit eb12b3782c94113d2d40d2da22265dc4111a672b. --- include/sys/taskq.h | 2 -- module/spl/spl-taskq.c | 8 +------- 2 files changed, 1 insertion(+), 9 deletions(-) (limited to 'module/spl/spl-taskq.c') diff --git a/include/sys/taskq.h b/include/sys/taskq.h index 4e51d98dd..baa96eaa0 100644 --- a/include/sys/taskq.h +++ b/include/sys/taskq.h @@ -39,7 +39,6 @@ #define TASKQ_CPR_SAFE 0x00000002 #define TASKQ_DYNAMIC 0x00000004 #define TASKQ_THREADS_CPU_PCT 0x00000008 -#define TASKQ_DC_BATCH 0x00000010 typedef unsigned long taskqid_t; typedef void (task_func_t)(void *); @@ -54,7 +53,6 @@ typedef void (task_func_t)(void *); #define TQ_NOQUEUE 0x01000000 #define TQ_NOALLOC 0x02000000 #define TQ_NEW 0x04000000 -#define TQ_FRONT 0x08000000 #define TQ_ACTIVE 0x80000000 typedef struct taskq { diff --git a/module/spl/spl-taskq.c b/module/spl/spl-taskq.c index fba38021f..805749a14 100644 --- a/module/spl/spl-taskq.c +++ b/module/spl/spl-taskq.c @@ -274,13 +274,7 @@ __taskq_dispatch(taskq_t *tq, task_func_t func, void *arg, uint_t flags) GOTO(out, rc = 0); spin_lock(&t->t_lock); - - /* Queue to the head instead of the tail */ - if (flags & TQ_FRONT) - list_add(&t->t_list, &tq->tq_pend_list); - else - list_add_tail(&t->t_list, &tq->tq_pend_list); - + list_add_tail(&t->t_list, &tq->tq_pend_list); t->t_id = rc = tq->tq_next_id; tq->tq_next_id++; t->t_func = func; -- cgit v1.2.3 From f0d8bb26b492dca0da1faff50b097b1665143bf4 Mon Sep 17 00:00:00 2001 From: Ned Bass Date: Thu, 1 Jul 2010 10:07:51 -0700 Subject: Implementation of the TQ_FRONT flag. Adds a task queue to receive tasks dispatched with TQ_FRONT. Worker threads pull tasks from this high priority queue before the default pending queue. Executing tasks out of FIFO order potentially breaks taskq_lowest_id() if we do not preserve the ordering of the work list by taskqid. Therefore, instead of always appending to the work list, we search for the appropriate place to insert a task. The common case is to append to the list, so we make this operation efficient by searching the work list in reverse order. Signed-off-by: Brian Behlendorf --- include/sys/taskq.h | 1 + module/spl/spl-taskq.c | 95 +++++++++++++++++++++++++++++++++++++++----------- 2 files changed, 75 insertions(+), 21 deletions(-) (limited to 'module/spl/spl-taskq.c') diff --git a/include/sys/taskq.h b/include/sys/taskq.h index 4e51d98dd..c83409d49 100644 --- a/include/sys/taskq.h +++ b/include/sys/taskq.h @@ -74,6 +74,7 @@ typedef struct taskq { struct list_head tq_free_list; /* free task_t's */ struct list_head tq_work_list; /* work task_t's */ struct list_head tq_pend_list; /* pending task_t's */ + struct list_head tq_prio_list; /* priority pending task_t's */ wait_queue_head_t tq_work_waitq; /* new work waitq */ wait_queue_head_t tq_wait_waitq; /* wait waitq */ } taskq_t; diff --git a/module/spl/spl-taskq.c b/module/spl/spl-taskq.c index 805749a14..9aca699c7 100644 --- a/module/spl/spl-taskq.c +++ b/module/spl/spl-taskq.c @@ -158,21 +158,22 @@ task_done(taskq_t *tq, spl_task_t *t) /* * As tasks are submitted to the task queue they are assigned a - * monotonically increasing taskqid and added to the tail of the - * pending list. As worker threads become available the tasks are - * removed from the head of the pending list and added to the tail - * of the work list. Finally, as tasks complete they are removed - * from the work list. This means that the pending and work lists - * are always kept sorted by taskqid. Thus the lowest outstanding + * monotonically increasing taskqid and added to the tail of the pending + * list. As worker threads become available the tasks are removed from + * the head of the pending or priority list, giving preference to the + * priority list. The tasks are then added to the work list, preserving + * the ordering by taskqid. Finally, as tasks complete they are removed + * from the work list. This means that the pending and work lists are + * always kept sorted by taskqid. Thus the lowest outstanding * incomplete taskqid can be determined simply by checking the min - * taskqid for each head item on the pending and work list. This - * value is stored in tq->tq_lowest_id and only updated to the new - * lowest id when the previous lowest id completes. All taskqids - * lower than tq->tq_lowest_id must have completed. It is also - * possible larger taskqid's have completed because they may be - * processed in parallel by several worker threads. However, this - * is not a problem because the behavior of taskq_wait_id() is to - * block until all previously submitted taskqid's have completed. + * taskqid for each head item on the pending, priority, and work list. + * This value is stored in tq->tq_lowest_id and only updated to the new + * lowest id when the previous lowest id completes. All taskqids lower + * than tq->tq_lowest_id must have completed. It is also possible + * larger taskqid's have completed because they may be processed in + * parallel by several worker threads. However, this is not a problem + * because the behavior of taskq_wait_id() is to block until all + * previously submitted taskqid's have completed. * * XXX: Taskqid_t wrapping is not handled. However, taskqid_t's are * 64-bit values so even if a taskq is processing 2^24 (16,777,216) @@ -274,7 +275,13 @@ __taskq_dispatch(taskq_t *tq, task_func_t func, void *arg, uint_t flags) GOTO(out, rc = 0); spin_lock(&t->t_lock); - list_add_tail(&t->t_list, &tq->tq_pend_list); + + /* Queue to the priority list instead of the pending list */ + if (flags & TQ_FRONT) + list_add_tail(&t->t_list, &tq->tq_prio_list); + else + list_add_tail(&t->t_list, &tq->tq_pend_list); + t->t_id = rc = tq->tq_next_id; tq->tq_next_id++; t->t_func = func; @@ -290,8 +297,9 @@ EXPORT_SYMBOL(__taskq_dispatch); /* * Returns the lowest incomplete taskqid_t. The taskqid_t may - * be queued on the pending list or may be on the work list - * currently being handled, but it is not 100% complete yet. + * be queued on the pending list, on the priority list, or on + * the work list currently being handled, but it is not 100% + * complete yet. */ static taskqid_t taskq_lowest_id(taskq_t *tq) @@ -308,6 +316,11 @@ taskq_lowest_id(taskq_t *tq) lowest_id = MIN(lowest_id, t->t_id); } + if (!list_empty(&tq->tq_prio_list)) { + t = list_entry(tq->tq_prio_list.next, spl_task_t, t_list); + lowest_id = MIN(lowest_id, t->t_id); + } + if (!list_empty(&tq->tq_work_list)) { t = list_entry(tq->tq_work_list.next, spl_task_t, t_list); lowest_id = MIN(lowest_id, t->t_id); @@ -316,6 +329,34 @@ taskq_lowest_id(taskq_t *tq) RETURN(lowest_id); } +/* + * Insert a task into a list keeping the list sorted by increasing + * taskqid. + */ +static void +taskq_insert_in_order(taskq_t *tq, spl_task_t *t) +{ + spl_task_t *w; + struct list_head *l; + + ENTRY; + ASSERT(tq); + ASSERT(t); + ASSERT(spin_is_locked(&tq->tq_lock)); + + list_for_each_prev(l, &tq->tq_work_list) { + w = list_entry(l, spl_task_t, t_list); + if (w->t_id < t->t_id) { + list_add(&t->t_list, l); + break; + } + } + if (l == &tq->tq_work_list) + list_add(&t->t_list, &tq->tq_work_list); + + EXIT; +} + static int taskq_thread(void *args) { @@ -324,6 +365,7 @@ taskq_thread(void *args) taskqid_t id; taskq_t *tq = args; spl_task_t *t; + struct list_head *pend_list; ENTRY; ASSERT(tq); @@ -341,7 +383,8 @@ taskq_thread(void *args) while (!kthread_should_stop()) { add_wait_queue(&tq->tq_work_waitq, &wait); - if (list_empty(&tq->tq_pend_list)) { + if (list_empty(&tq->tq_pend_list) && + list_empty(&tq->tq_prio_list)) { spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); schedule(); spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); @@ -350,10 +393,18 @@ taskq_thread(void *args) } remove_wait_queue(&tq->tq_work_waitq, &wait); - if (!list_empty(&tq->tq_pend_list)) { - t = list_entry(tq->tq_pend_list.next,spl_task_t,t_list); + + if (!list_empty(&tq->tq_prio_list)) + pend_list = &tq->tq_prio_list; + else if (!list_empty(&tq->tq_pend_list)) + pend_list = &tq->tq_pend_list; + else + pend_list = NULL; + + if (pend_list) { + t = list_entry(pend_list->next, spl_task_t, t_list); list_del_init(&t->t_list); - list_add_tail(&t->t_list, &tq->tq_work_list); + taskq_insert_in_order(tq, t); tq->tq_nactive++; spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); @@ -435,6 +486,7 @@ __taskq_create(const char *name, int nthreads, pri_t pri, INIT_LIST_HEAD(&tq->tq_free_list); INIT_LIST_HEAD(&tq->tq_work_list); INIT_LIST_HEAD(&tq->tq_pend_list); + INIT_LIST_HEAD(&tq->tq_prio_list); init_waitqueue_head(&tq->tq_work_waitq); init_waitqueue_head(&tq->tq_wait_waitq); @@ -503,6 +555,7 @@ __taskq_destroy(taskq_t *tq) ASSERT(list_empty(&tq->tq_free_list)); ASSERT(list_empty(&tq->tq_work_list)); ASSERT(list_empty(&tq->tq_pend_list)); + ASSERT(list_empty(&tq->tq_prio_list)); spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); kmem_free(tq->tq_threads, nthreads * sizeof(spl_task_t *)); -- cgit v1.2.3 From 55abb0929e4fbe326a9737650a167a1a988ad86b Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Mon, 19 Jul 2010 14:16:05 -0700 Subject: Split header To avoid symbol conflicts with dependent packages the debug header must be split in to several parts. The header now only contains the Solaris macro's such as ASSERT and VERIFY. The spl-debug.h header contain the spl specific debugging infrastructure and should be included by any package which needs to use the spl logging. Finally the spl-trace.h header contains internal data structures only used for the log facility and should not be included by anythign by spl-debug.c. This way dependent packages can include the standard Solaris headers without picking up any SPL debug macros. However, if the dependant package want to integrate with the SPL debugging subsystem they can then explicitly include spl-debug.h. Along with this change I have dropped the CHECK_STACK macros because the upstream Linux kernel now has much better stack depth checking built in and we don't need this complexity. Additionally SBUG has been replaced with PANIC and provided as part of the Solaris macro set. While the Solaris version is really panic() that conflicts with the Linux kernel so we'll just have to make due to PANIC. It should rarely be called directly, the prefered usage would be an ASSERT or VERIFY. There's lots of change here but this cleanup was overdue. --- include/linux/file_compat.h | 1 + include/spl-debug.h | 181 +++++++++++++++++ include/spl-trace.h | 132 ++++++++++++ include/sys/debug.h | 462 ++++++++---------------------------------- include/sys/kmem.h | 1 - include/sys/rwlock.h | 4 +- include/sys/signal.h | 2 + include/sys/sunddi.h | 2 - include/sys/thread.h | 2 +- module/spl/spl-condvar.c | 1 + module/spl/spl-debug.c | 70 +++---- module/spl/spl-err.c | 3 +- module/spl/spl-generic.c | 5 +- module/spl/spl-kmem.c | 1 + module/spl/spl-kobj.c | 1 + module/spl/spl-kstat.c | 13 +- module/spl/spl-module.c | 2 +- module/spl/spl-proc.c | 10 +- module/spl/spl-taskq.c | 13 +- module/spl/spl-thread.c | 1 + module/spl/spl-vnode.c | 3 +- module/spl/spl-xdr.c | 3 +- module/splat/splat-atomic.c | 2 +- module/splat/splat-internal.h | 1 + scripts/check.sh | 2 +- 25 files changed, 460 insertions(+), 458 deletions(-) create mode 100644 include/spl-debug.h create mode 100644 include/spl-trace.h (limited to 'module/spl/spl-taskq.c') diff --git a/include/linux/file_compat.h b/include/linux/file_compat.h index b03373ebd..77d5a27c3 100644 --- a/include/linux/file_compat.h +++ b/include/linux/file_compat.h @@ -25,6 +25,7 @@ #ifndef _SPL_FILE_COMPAT_H #define _SPL_FILE_COMPAT_H +#include #ifdef HAVE_FDTABLE_HEADER #include #endif diff --git a/include/spl-debug.h b/include/spl-debug.h new file mode 100644 index 000000000..b5ca64f87 --- /dev/null +++ b/include/spl-debug.h @@ -0,0 +1,181 @@ +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . + * UCRL-CODE-235197 + * + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with the SPL. If not, see . +\*****************************************************************************/ + +/* + * Available debug functions. These function should be used by any + * package which needs to integrate with the SPL log infrastructure. + * + * CDEBUG() - Log debug message with specified mask. + * CDEBUG_LIMIT() - Log just 1 debug message with specified mask. + * CWARN() - Log a warning message. + * CERROR() - Log an error message. + * CEMERG() - Log an emergency error message. + * CONSOLE() - Log a generic message to the console. + * + * ENTRY - Log entry point to a function. + * EXIT - Log exit point from a function. + * RETURN(x) - Log return from a function. + * GOTO(x, y) - Log goto within a function. + */ + +#ifndef _SPL_DEBUG_INTERNAL_H +#define _SPL_DEBUG_INTERNAL_H + +#include + +#define S_UNDEFINED 0x00000001 +#define S_ATOMIC 0x00000002 +#define S_KOBJ 0x00000004 +#define S_VNODE 0x00000008 +#define S_TIME 0x00000010 +#define S_RWLOCK 0x00000020 +#define S_THREAD 0x00000040 +#define S_CONDVAR 0x00000080 +#define S_MUTEX 0x00000100 +#define S_RNG 0x00000200 +#define S_TASKQ 0x00000400 +#define S_KMEM 0x00000800 +#define S_DEBUG 0x00001000 +#define S_GENERIC 0x00002000 +#define S_PROC 0x00004000 +#define S_MODULE 0x00008000 +#define S_CRED 0x00010000 + +#define D_TRACE 0x00000001 +#define D_INFO 0x00000002 +#define D_WARNING 0x00000004 +#define D_ERROR 0x00000008 +#define D_EMERG 0x00000010 +#define D_CONSOLE 0x00000020 +#define D_IOCTL 0x00000040 +#define D_DPRINTF 0x00000080 +#define D_OTHER 0x00000100 + +#define D_CANTMASK (D_ERROR | D_EMERG | D_WARNING | D_CONSOLE) +#define DEBUG_SUBSYSTEM S_UNDEFINED + +#ifdef NDEBUG /* Debugging Disabled */ + +#define CDEBUG(mask, fmt, a...) ((void)0) +#define CDEBUG_LIMIT(x, y, fmt, a...) ((void)0) +#define CWARN(fmt, a...) ((void)0) +#define CERROR(fmt, a...) ((void)0) +#define CEMERG(fmt, a...) ((void)0) +#define CONSOLE(mask, fmt, a...) ((void)0) + +#define ENTRY ((void)0) +#define EXIT ((void)0) +#define RETURN(x) return (x) +#define GOTO(x, y) { ((void)(y)); goto x; } + +#else /* Debugging Enabled */ + +#define __CDEBUG(cdls, subsys, mask, format, a...) \ +do { \ + if (((mask) & D_CANTMASK) != 0 || \ + ((spl_debug_mask & (mask)) != 0 && \ + (spl_debug_subsys & (subsys)) != 0)) \ + spl_debug_msg(cdls, subsys, mask, __FILE__, \ + __FUNCTION__, __LINE__, format, ## a); \ +} while (0) + +#define CDEBUG(mask, format, a...) \ + __CDEBUG(NULL, DEBUG_SUBSYSTEM, mask, format, ## a) + +#define __CDEBUG_LIMIT(subsys, mask, format, a...) \ +do { \ + static spl_debug_limit_state_t cdls; \ + \ + __CDEBUG(&cdls, subsys, mask, format, ## a); \ +} while (0) + +#define CDEBUG_LIMIT(mask, format, a...) \ + __CDEBUG_LIMIT(DEBUG_SUBSYSTEM, mask, format, ## a) + +#define CWARN(fmt, a...) CDEBUG_LIMIT(D_WARNING, fmt, ## a) +#define CERROR(fmt, a...) CDEBUG_LIMIT(D_ERROR, fmt, ## a) +#define CEMERG(fmt, a...) CDEBUG_LIMIT(D_EMERG, fmt, ## a) +#define CONSOLE(mask, fmt, a...) CDEBUG(D_CONSOLE | (mask), fmt, ## a) + +#define ENTRY CDEBUG(D_TRACE, "Process entered\n") +#define EXIT CDEBUG(D_TRACE, "Process leaving\n") + +#define RETURN(rc) \ +do { \ + typeof(rc) RETURN__ret = (rc); \ + CDEBUG(D_TRACE, "Process leaving (rc=%lu : %ld : %lx)\n", \ + (long)RETURN__ret, (long)RETURN__ret, (long)RETURN__ret); \ + return RETURN__ret; \ +} while (0) + +#define GOTO(label, rc) \ +do { \ + long GOTO__ret = (long)(rc); \ + CDEBUG(D_TRACE,"Process leaving via %s (rc=%lu : %ld : %lx)\n", \ + #label, (unsigned long)GOTO__ret, (signed long)GOTO__ret, \ + (signed long)GOTO__ret); \ + goto label; \ +} while (0) + +#endif /* NDEBUG */ + +typedef struct { + unsigned long cdls_next; + int cdls_count; + long cdls_delay; +} spl_debug_limit_state_t; + +/* Global debug variables */ +extern unsigned long spl_debug_subsys; +extern unsigned long spl_debug_mask; +extern unsigned long spl_debug_printk; +extern int spl_debug_mb; +extern unsigned int spl_debug_binary; +extern unsigned int spl_debug_catastrophe; +extern unsigned int spl_debug_panic_on_bug; +extern char spl_debug_file_path[PATH_MAX]; +extern unsigned int spl_console_ratelimit; +extern long spl_console_max_delay; +extern long spl_console_min_delay; +extern unsigned int spl_console_backoff; +extern unsigned int spl_debug_stack; + +/* Exported debug functions */ +extern int spl_debug_mask2str(char *str, int size, unsigned long mask, int ss); +extern int spl_debug_str2mask(unsigned long *mask, const char *str, int ss); +extern unsigned long spl_debug_set_mask(unsigned long mask); +extern unsigned long spl_debug_get_mask(void); +extern unsigned long spl_debug_set_subsys(unsigned long mask); +extern unsigned long spl_debug_get_subsys(void); +extern int spl_debug_set_mb(int mb); +extern int spl_debug_get_mb(void); +extern int spl_debug_dumplog(int flags); +extern void spl_debug_dumpstack(struct task_struct *tsk); +extern int spl_debug_clear_buffer(void); +extern int spl_debug_mark_buffer(char *text); + +int debug_init(void); +void debug_fini(void); + +#endif /* SPL_DEBUG_INTERNAL_H */ diff --git a/include/spl-trace.h b/include/spl-trace.h new file mode 100644 index 000000000..709b1326e --- /dev/null +++ b/include/spl-trace.h @@ -0,0 +1,132 @@ +/*****************************************************************************\ + * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. + * Copyright (C) 2007 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . + * UCRL-CODE-235197 + * + * This file is part of the SPL, Solaris Porting Layer. + * For details, see . + * + * The SPL is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * The SPL is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with the SPL. If not, see . +\*****************************************************************************/ + +#ifndef _SPL_TRACE_H +#define _SPL_TRACE_H + +#define TCD_MAX_PAGES (5 << (20 - PAGE_SHIFT)) +#define TCD_STOCK_PAGES (TCD_MAX_PAGES) +#define TRACE_CONSOLE_BUFFER_SIZE 1024 + +#define SPL_DEFAULT_MAX_DELAY (600 * HZ) +#define SPL_DEFAULT_MIN_DELAY ((HZ + 1) / 2) +#define SPL_DEFAULT_BACKOFF 2 + +#define DL_NOTHREAD 0x0001 /* Do not create a new thread */ +#define DL_SINGLE_CPU 0x0002 /* Collect pages from this CPU*/ + +typedef struct dumplog_priv { + wait_queue_head_t dp_waitq; + pid_t dp_pid; + int dp_flags; + atomic_t dp_done; +} dumplog_priv_t; + +/* Three trace data types */ +typedef enum { + TCD_TYPE_PROC, + TCD_TYPE_SOFTIRQ, + TCD_TYPE_IRQ, + TCD_TYPE_MAX +} tcd_type_t; + +union trace_data_union { + struct trace_cpu_data { + /* pages with trace records not yet processed by tracefiled */ + struct list_head tcd_pages; + /* number of pages on ->tcd_pages */ + unsigned long tcd_cur_pages; + /* Max number of pages allowed on ->tcd_pages */ + unsigned long tcd_max_pages; + + /* + * preallocated pages to write trace records into. Pages from + * ->tcd_stock_pages are moved to ->tcd_pages by spl_debug_msg(). + * + * This list is necessary, because on some platforms it's + * impossible to perform efficient atomic page allocation in a + * non-blockable context. + * + * Such platforms fill ->tcd_stock_pages "on occasion", when + * tracing code is entered in blockable context. + * + * trace_get_tage_try() tries to get a page from + * ->tcd_stock_pages first and resorts to atomic page + * allocation only if this queue is empty. ->tcd_stock_pages + * is replenished when tracing code is entered in blocking + * context (darwin-tracefile.c:trace_get_tcd()). We try to + * maintain TCD_STOCK_PAGES (40 by default) pages in this + * queue. Atomic allocation is only required if more than + * TCD_STOCK_PAGES pagesful are consumed by trace records all + * emitted in non-blocking contexts. Which is quite unlikely. + */ + struct list_head tcd_stock_pages; + /* number of pages on ->tcd_stock_pages */ + unsigned long tcd_cur_stock_pages; + + unsigned short tcd_shutting_down; + unsigned short tcd_cpu; + unsigned short tcd_type; + /* The factors to share debug memory. */ + unsigned short tcd_pages_factor; + + /* + * This spinlock is needed to workaround the problem of + * set_cpus_allowed() being GPL-only. Since we cannot + * schedule a thread on a specific CPU when dumping the + * pages, we must use the spinlock for mutual exclusion. + */ + spinlock_t tcd_lock; + unsigned long tcd_lock_flags; + } tcd; + char __pad[L1_CACHE_ALIGN(sizeof(struct trace_cpu_data))]; +}; + +extern union trace_data_union (*trace_data[TCD_TYPE_MAX])[NR_CPUS]; + +#define tcd_for_each(tcd, i, j) \ + for (i = 0; i < TCD_TYPE_MAX && trace_data[i]; i++) \ + for (j = 0, ((tcd) = &(*trace_data[i])[j].tcd); \ + j < num_possible_cpus(); j++, (tcd) = &(*trace_data[i])[j].tcd) + +#define tcd_for_each_type_lock(tcd, i, cpu) \ + for (i = 0; i < TCD_TYPE_MAX && trace_data[i] && \ + (tcd = &(*trace_data[i])[cpu].tcd) && \ + trace_lock_tcd(tcd); trace_unlock_tcd(tcd), i++) + +struct trace_page { + struct page *page; /* page itself */ + struct list_head linkage; /* Used by trace_data_union */ + unsigned int used; /* number of bytes used within this page */ + unsigned short cpu; /* cpu that owns this page */ + unsigned short type; /* type(context) of this page */ +}; + +struct page_collection { + struct list_head pc_pages; + spinlock_t pc_lock; + int pc_want_daemon_pages; +}; + +#endif /* SPL_TRACE_H */ diff --git a/include/sys/debug.h b/include/sys/debug.h index 848c885a6..0da7e31bb 100644 --- a/include/sys/debug.h +++ b/include/sys/debug.h @@ -22,420 +22,118 @@ * with the SPL. If not, see . \*****************************************************************************/ +/* + * Available Solaris debug functions. All of the ASSERT() macros will be + * compiled out when NDEBUG is defined, this is the default behavior for + * the SPL. To enable assertions use the --enable-debug with configure. + * The VERIFY() functions are never compiled out and cannot be disabled. + * + * PANIC() - Panic the node and print message. + * ASSERT() - Assert X is true, if not panic. + * ASSERTF() - Assert X is true, if not panic and print message. + * ASSERTV() - Wraps a variable declaration which is only used by ASSERT(). + * ASSERT3S() - Assert signed X OP Y is true, if not panic. + * ASSERT3U() - Assert unsigned X OP Y is true, if not panic. + * ASSERT3P() - Assert pointer X OP Y is true, if not panic. + * VERIFY() - Verify X is true, if not panic. + * VERIFY3S() - Verify signed X OP Y is true, if not panic. + * VERIFY3U() - Verify unsigned X OP Y is true, if not panic. + * VERIFY3P() - Verify pointer X OP Y is true, if not panic. + */ + #ifndef _SPL_DEBUG_H #define _SPL_DEBUG_H -#include /* THREAD_SIZE */ -#include - -extern unsigned long spl_debug_mask; -extern unsigned long spl_debug_subsys; - -#define S_UNDEFINED 0x00000001 -#define S_ATOMIC 0x00000002 -#define S_KOBJ 0x00000004 -#define S_VNODE 0x00000008 -#define S_TIME 0x00000010 -#define S_RWLOCK 0x00000020 -#define S_THREAD 0x00000040 -#define S_CONDVAR 0x00000080 -#define S_MUTEX 0x00000100 -#define S_RNG 0x00000200 -#define S_TASKQ 0x00000400 -#define S_KMEM 0x00000800 -#define S_DEBUG 0x00001000 -#define S_GENERIC 0x00002000 -#define S_PROC 0x00004000 -#define S_MODULE 0x00008000 -#define S_CRED 0x00010000 - -#define D_TRACE 0x00000001 -#define D_INFO 0x00000002 -#define D_WARNING 0x00000004 -#define D_ERROR 0x00000008 -#define D_EMERG 0x00000010 -#define D_CONSOLE 0x00000020 -#define D_IOCTL 0x00000040 -#define D_DPRINTF 0x00000080 -#define D_OTHER 0x00000100 - -#define D_CANTMASK (D_ERROR | D_EMERG | D_WARNING | D_CONSOLE) -#define DEBUG_SUBSYSTEM S_UNDEFINED - -int debug_init(void); -void debug_fini(void); -int spl_debug_mask2str(char *str, int size, unsigned long mask, int is_subsys); -int spl_debug_str2mask(unsigned long *mask, const char *str, int is_subsys); - -extern unsigned long spl_debug_subsys; -extern unsigned long spl_debug_mask; -extern unsigned long spl_debug_printk; -extern int spl_debug_mb; -extern unsigned int spl_debug_binary; -extern unsigned int spl_debug_catastrophe; -extern unsigned int spl_debug_panic_on_bug; -extern char spl_debug_file_path[PATH_MAX]; -extern unsigned int spl_console_ratelimit; -extern long spl_console_max_delay; -extern long spl_console_min_delay; -extern unsigned int spl_console_backoff; -extern unsigned int spl_debug_stack; - -#define TCD_MAX_PAGES (5 << (20 - PAGE_SHIFT)) -#define TCD_STOCK_PAGES (TCD_MAX_PAGES) -#define TRACE_CONSOLE_BUFFER_SIZE 1024 - -#define SPL_DEFAULT_MAX_DELAY (600 * HZ) -#define SPL_DEFAULT_MIN_DELAY ((HZ + 1) / 2) -#define SPL_DEFAULT_BACKOFF 2 - -#define DL_NOTHREAD 0x0001 /* Do not create a new thread */ -#define DL_SINGLE_CPU 0x0002 /* Collect pages from this CPU */ - -typedef struct dumplog_priv { - wait_queue_head_t dp_waitq; - pid_t dp_pid; - int dp_flags; - atomic_t dp_done; -} dumplog_priv_t; - -typedef struct { - unsigned long cdls_next; - int cdls_count; - long cdls_delay; -} spl_debug_limit_state_t; - -/* Three trace data types */ -typedef enum { - TCD_TYPE_PROC, - TCD_TYPE_SOFTIRQ, - TCD_TYPE_IRQ, - TCD_TYPE_MAX -} tcd_type_t; - -union trace_data_union { - struct trace_cpu_data { - /* pages with trace records not yet processed by tracefiled */ - struct list_head tcd_pages; - /* number of pages on ->tcd_pages */ - unsigned long tcd_cur_pages; - /* Max number of pages allowed on ->tcd_pages */ - unsigned long tcd_max_pages; - - /* - * preallocated pages to write trace records into. Pages from - * ->tcd_stock_pages are moved to ->tcd_pages by spl_debug_msg(). - * - * This list is necessary, because on some platforms it's - * impossible to perform efficient atomic page allocation in a - * non-blockable context. - * - * Such platforms fill ->tcd_stock_pages "on occasion", when - * tracing code is entered in blockable context. - * - * trace_get_tage_try() tries to get a page from - * ->tcd_stock_pages first and resorts to atomic page - * allocation only if this queue is empty. ->tcd_stock_pages - * is replenished when tracing code is entered in blocking - * context (darwin-tracefile.c:trace_get_tcd()). We try to - * maintain TCD_STOCK_PAGES (40 by default) pages in this - * queue. Atomic allocation is only required if more than - * TCD_STOCK_PAGES pagesful are consumed by trace records all - * emitted in non-blocking contexts. Which is quite unlikely. - */ - struct list_head tcd_stock_pages; - /* number of pages on ->tcd_stock_pages */ - unsigned long tcd_cur_stock_pages; - - unsigned short tcd_shutting_down; - unsigned short tcd_cpu; - unsigned short tcd_type; - /* The factors to share debug memory. */ - unsigned short tcd_pages_factor; - - /* - * This spinlock is needed to workaround the problem of - * set_cpus_allowed() being GPL-only. Since we cannot - * schedule a thread on a specific CPU when dumping the - * pages, we must use the spinlock for mutual exclusion. - */ - spinlock_t tcd_lock; - unsigned long tcd_lock_flags; - } tcd; - char __pad[L1_CACHE_ALIGN(sizeof(struct trace_cpu_data))]; -}; - -extern union trace_data_union (*trace_data[TCD_TYPE_MAX])[NR_CPUS]; - -#define tcd_for_each(tcd, i, j) \ - for (i = 0; i < TCD_TYPE_MAX && trace_data[i]; i++) \ - for (j = 0, ((tcd) = &(*trace_data[i])[j].tcd); \ - j < num_possible_cpus(); j++, (tcd) = &(*trace_data[i])[j].tcd) - -#define tcd_for_each_type_lock(tcd, i, cpu) \ - for (i = 0; i < TCD_TYPE_MAX && trace_data[i] && \ - (tcd = &(*trace_data[i])[cpu].tcd) && \ - trace_lock_tcd(tcd); trace_unlock_tcd(tcd), i++) - -struct trace_page { - struct page * page; /* page itself */ - struct list_head linkage; /* Used by lists in trace_data_union */ - unsigned int used; /* number of bytes used within this page */ - unsigned short cpu; /* cpu that owns this page */ - unsigned short type; /* type(context) of this page */ -}; - -struct page_collection { - struct list_head pc_pages; - spinlock_t pc_lock; - int pc_want_daemon_pages; -}; - -#define SBUG() spl_debug_bug(__FILE__, __FUNCTION__, __LINE__, 0); - -#ifdef NDEBUG +#ifdef NDEBUG /* Debugging Disabled */ -#define CDEBUG_STACK() (0) -#define CDEBUG_LIMIT(x, y, z, a...) ((void)0) -#define __CDEBUG_LIMIT(x, y, z, a...) ((void)0) -#define CDEBUG(mask, format, a...) ((void)0) -#define CWARN(fmt, a...) ((void)0) -#define CERROR(fmt, a...) ((void)0) -#define CEMERG(fmt, a...) ((void)0) -#define CONSOLE(mask, fmt, a...) ((void)0) - -#define ENTRY ((void)0) -#define EXIT ((void)0) -#define RETURN(x) return (x) -#define GOTO(x, y) { ((void)(y)); goto x; } +#define PANIC(fmt, a...) \ +do { \ + printk(KERN_EMERG fmt, ## a); \ + spl_debug_bug(__FILE__, __FUNCTION__, __LINE__, 0); \ +} while (0) #define __ASSERT(x) ((void)0) -#define __ASSERT_TAGE_INVARIANT(x) ((void)0) #define ASSERT(x) ((void)0) #define ASSERTF(x, y, z...) ((void)0) #define ASSERTV(x) -#define VERIFY(cond) \ -do { \ - if (unlikely(!(cond))) { \ - printk(KERN_ERR "VERIFY(" #cond ") failed\n"); \ - SBUG(); \ - } \ +#define VERIFY(cond) \ +do { \ + if (unlikely(!(cond))) \ + PANIC("VERIFY(" #cond ") failed\n"); \ } while (0) -#define VERIFY3_IMPL(LEFT, OP, RIGHT, TYPE, FMT, CAST) \ -do { \ - if (!((TYPE)(LEFT) OP (TYPE)(RIGHT))) { \ - printk(KERN_ERR \ - "VERIFY3(" #LEFT " " #OP " " #RIGHT ") " \ - "failed (" FMT " " #OP " " FMT ")\n", \ - CAST (LEFT), CAST (RIGHT)); \ - SBUG(); \ - } \ +#define VERIFY3_IMPL(LEFT, OP, RIGHT, TYPE, FMT, CAST) \ +do { \ + if (!((TYPE)(LEFT) OP (TYPE)(RIGHT))) \ + PANIC("VERIFY3(" #LEFT " " #OP " " #RIGHT ") " \ + "failed (" FMT " " #OP " " FMT ")\n", \ + CAST (LEFT), CAST (RIGHT)); \ } while (0) -#define VERIFY3S(x,y,z) VERIFY3_IMPL(x, y, z, int64_t, "%lld", (long long)) -#define VERIFY3U(x,y,z) VERIFY3_IMPL(x, y, z, uint64_t, "%llu", \ - (unsigned long long)) -#define VERIFY3P(x,y,z) VERIFY3_IMPL(x, y, z, uintptr_t, "%p", (void *)) +#define VERIFY3S(x,y,z) VERIFY3_IMPL(x, y, z, int64_t, "%lld", (long long)) +#define VERIFY3U(x,y,z) VERIFY3_IMPL(x, y, z, uint64_t, "%llu", \ + (unsigned long long)) +#define VERIFY3P(x,y,z) VERIFY3_IMPL(x, y, z, uintptr_t, "%p", (void *)) -#define ASSERT3S(x,y,z) ((void)0) -#define ASSERT3U(x,y,z) ((void)0) -#define ASSERT3P(x,y,z) ((void)0) +#define ASSERT3S(x,y,z) ((void)0) +#define ASSERT3U(x,y,z) ((void)0) +#define ASSERT3P(x,y,z) ((void)0) -#else /* NDEBUG */ +#else /* Debugging Enabled */ -#ifdef __ia64__ -#define CDEBUG_STACK() (THREAD_SIZE - \ - ((unsigned long)__builtin_dwarf_cfa() & \ - (THREAD_SIZE - 1))) -#else -#define CDEBUG_STACK() (THREAD_SIZE - \ - ((unsigned long)__builtin_frame_address(0) & \ - (THREAD_SIZE - 1))) -# endif /* __ia64__ */ - -/* DL_SINGLE_CPU flag is passed to spl_debug_bug() because we are about - * to over run our stack and likely damage at least one other unknown - * thread stack. We must finish generating the needed debug info within - * this thread context because once we yeild the CPU its very likely - * the system will crash. - */ -#define __CHECK_STACK(file, func, line) \ -do { \ - if (unlikely(CDEBUG_STACK() > spl_debug_stack)) { \ - spl_debug_stack = CDEBUG_STACK(); \ - \ - if (unlikely(CDEBUG_STACK() > (4 * THREAD_SIZE) / 5)) { \ - spl_debug_msg(NULL, D_TRACE, D_WARNING, \ - file, func, line, "Error " \ - "exceeded maximum safe stack " \ - "size (%lu/%lu)\n", \ - CDEBUG_STACK(), THREAD_SIZE); \ - spl_debug_bug(file, func, line, DL_SINGLE_CPU); \ - } \ - } \ +#define PANIC(fmt, a...) \ +do { \ + spl_debug_msg(NULL, 0, 0, \ + __FILE__, __FUNCTION__, __LINE__, fmt, ## a); \ + spl_debug_bug(__FILE__, __FUNCTION__, __LINE__, 0); \ } while (0) -/* NOTE: The run time stack overflow checking is being disabled by default - * because it is not safe for use with 2.6.29 and latter kernels. These - * kernels do now have their own stack overflow checking so this support - * has become redundant anyway. It can be re-enabled for older kernels or - * arches without stack overflow checking by redefining CHECK_STACK(). - * - * #define CHECK_STACK() __CHECK_STACK(__FILE__, __func__, __LINE__) - */ -#define CHECK_STACK() ((void)0) - /* ASSERTION that is safe to use within the debug system */ -#define __ASSERT(cond) \ -do { \ - if (unlikely(!(cond))) { \ - printk(KERN_ERR "ASSERTION(" #cond ") failed\n"); \ - BUG(); \ - } \ +#define __ASSERT(cond) \ +do { \ + if (unlikely(!(cond))) { \ + printk(KERN_EMERG "ASSERTION(" #cond ") failed\n"); \ + BUG(); \ + } \ } while (0) -#define __ASSERT_TAGE_INVARIANT(tage) \ -do { \ - __ASSERT(tage != NULL); \ - __ASSERT(tage->page != NULL); \ - __ASSERT(tage->used <= PAGE_SIZE); \ - __ASSERT(page_count(tage->page) > 0); \ -} while(0) - /* ASSERTION that will debug log used outside the debug sysytem */ -#define ASSERT(cond) \ -do { \ - CHECK_STACK(); \ - \ - if (unlikely(!(cond))) { \ - spl_debug_msg(NULL, DEBUG_SUBSYSTEM, D_EMERG, \ - __FILE__, __FUNCTION__, __LINE__, \ - "ASSERTION(" #cond ") failed\n"); \ - SBUG(); \ - } \ -} while (0) - -#define ASSERTF(cond, fmt, a...) \ -do { \ - CHECK_STACK(); \ - \ - if (unlikely(!(cond))) { \ - spl_debug_msg(NULL, DEBUG_SUBSYSTEM, D_EMERG, \ - __FILE__, __FUNCTION__, __LINE__, \ - "ASSERTION(" #cond ") failed: " fmt, \ - ## a); \ - SBUG(); \ - } \ -} while (0) - -#define VERIFY3_IMPL(LEFT, OP, RIGHT, TYPE, FMT, CAST) \ -do { \ - CHECK_STACK(); \ - \ - if (!((TYPE)(LEFT) OP (TYPE)(RIGHT))) { \ - spl_debug_msg(NULL, DEBUG_SUBSYSTEM, D_EMERG, \ - __FILE__, __FUNCTION__, __LINE__, \ - "VERIFY3(" #LEFT " " #OP " " #RIGHT ") " \ - "failed (" FMT " " #OP " " FMT ")\n", \ - CAST (LEFT), CAST (RIGHT)); \ - SBUG(); \ - } \ -} while (0) - -#define VERIFY3S(x,y,z) VERIFY3_IMPL(x, y, z, int64_t, "%lld", (long long)) -#define VERIFY3U(x,y,z) VERIFY3_IMPL(x, y, z, uint64_t, "%llu", \ - (unsigned long long)) -#define VERIFY3P(x,y,z) VERIFY3_IMPL(x, y, z, uintptr_t, "%p", (void *)) - -#define ASSERT3S(x,y,z) VERIFY3S(x, y, z) -#define ASSERT3U(x,y,z) VERIFY3U(x, y, z) -#define ASSERT3P(x,y,z) VERIFY3P(x, y, z) - -#define ASSERTV(x) x -#define VERIFY(x) ASSERT(x) - -#define __CDEBUG(cdls, subsys, mask, format, a...) \ -do { \ - CHECK_STACK(); \ - \ - if (((mask) & D_CANTMASK) != 0 || \ - ((spl_debug_mask & (mask)) != 0 && \ - (spl_debug_subsys & (subsys)) != 0)) \ - spl_debug_msg(cdls, subsys, mask, \ - __FILE__, __FUNCTION__, __LINE__, \ - format, ## a); \ +#define ASSERT(cond) \ +do { \ + if (unlikely(!(cond))) \ + PANIC("ASSERTION(" #cond ") failed\n"); \ } while (0) -#define CDEBUG(mask, format, a...) \ - __CDEBUG(NULL, DEBUG_SUBSYSTEM, mask, format, ## a) - -#define __CDEBUG_LIMIT(subsys, mask, format, a...) \ -do { \ - static spl_debug_limit_state_t cdls; \ - \ - __CDEBUG(&cdls, subsys, mask, format, ## a); \ +#define ASSERTF(cond, fmt, a...) \ +do { \ + if (unlikely(!(cond))) \ + PANIC("ASSERTION(" #cond ") failed: " fmt, ## a); \ } while (0) -#define CDEBUG_LIMIT(mask, format, a...) \ - __CDEBUG_LIMIT(DEBUG_SUBSYSTEM, mask, format, ## a) - -#define CWARN(fmt, a...) CDEBUG_LIMIT(D_WARNING, fmt, ## a) -#define CERROR(fmt, a...) CDEBUG_LIMIT(D_ERROR, fmt, ## a) -#define CEMERG(fmt, a...) CDEBUG_LIMIT(D_EMERG, fmt, ## a) -#define CONSOLE(mask, fmt, a...) CDEBUG(D_CONSOLE | (mask), fmt, ## a) - -#define GOTO(label, rc) \ -do { \ - long GOTO__ret = (long)(rc); \ - CDEBUG(D_TRACE,"Process leaving via %s (rc=%lu : %ld : %lx)\n", \ - #label, (unsigned long)GOTO__ret, (signed long)GOTO__ret,\ - (signed long)GOTO__ret); \ - goto label; \ +#define VERIFY3_IMPL(LEFT, OP, RIGHT, TYPE, FMT, CAST) \ +do { \ + if (!((TYPE)(LEFT) OP (TYPE)(RIGHT))) \ + PANIC("VERIFY3(" #LEFT " " #OP " " #RIGHT ") " \ + "failed (" FMT " " #OP " " FMT ")\n", \ + CAST (LEFT), CAST (RIGHT)); \ } while (0) -#define RETURN(rc) \ -do { \ - typeof(rc) RETURN__ret = (rc); \ - CDEBUG(D_TRACE, "Process leaving (rc=%lu : %ld : %lx)\n", \ - (long)RETURN__ret, (long)RETURN__ret, (long)RETURN__ret);\ - return RETURN__ret; \ -} while (0) +#define VERIFY3S(x,y,z) VERIFY3_IMPL(x, y, z, int64_t, "%lld", (long long)) +#define VERIFY3U(x,y,z) VERIFY3_IMPL(x, y, z, uint64_t, "%llu", \ + (unsigned long long)) +#define VERIFY3P(x,y,z) VERIFY3_IMPL(x, y, z, uintptr_t, "%p", (void *)) -#define __ENTRY(subsys) \ -do { \ - __CDEBUG(NULL, subsys, D_TRACE, "Process entered\n"); \ -} while (0) +#define ASSERT3S(x,y,z) VERIFY3S(x, y, z) +#define ASSERT3U(x,y,z) VERIFY3U(x, y, z) +#define ASSERT3P(x,y,z) VERIFY3P(x, y, z) -#define __EXIT(subsys) \ -do { \ - __CDEBUG(NULL, subsys, D_TRACE, "Process leaving\n"); \ -} while(0) +#define ASSERTV(x) x +#define VERIFY(x) ASSERT(x) -#define ENTRY __ENTRY(DEBUG_SUBSYSTEM) -#define EXIT __EXIT(DEBUG_SUBSYSTEM) #endif /* NDEBUG */ -#define spl_debug_msg(cdls, subsys, mask, file, fn, line, format, a...) \ - spl_debug_vmsg(cdls, subsys, mask, file, fn, \ - line, NULL, NULL, format, ##a) - -extern int spl_debug_vmsg(spl_debug_limit_state_t *cdls, int subsys, int mask, - const char *file, const char *fn, const int line, - const char *format1, va_list args, const char *format2, ...); - -extern unsigned long spl_debug_set_mask(unsigned long mask); -extern unsigned long spl_debug_get_mask(void); -extern unsigned long spl_debug_set_subsys(unsigned long mask); -extern unsigned long spl_debug_get_subsys(void); -extern int spl_debug_set_mb(int mb); -extern int spl_debug_get_mb(void); - -extern int spl_debug_dumplog(int flags); -extern void spl_debug_dumpstack(struct task_struct *tsk); -extern void spl_debug_bug(char *file, const char *func, const int line, int flags); - -extern int spl_debug_clear_buffer(void); -extern int spl_debug_mark_buffer(char *text); +extern void spl_debug_bug(char *file, const char *fn, const int line, int fl); +extern int spl_debug_msg(void *arg, int subsys, int mask, const char *file, + const char *fn, const int line, const char *format, ...); #endif /* SPL_DEBUG_H */ diff --git a/include/sys/kmem.h b/include/sys/kmem.h index a5758bd61..17b3a2276 100644 --- a/include/sys/kmem.h +++ b/include/sys/kmem.h @@ -35,7 +35,6 @@ #include #include #include -#include #include #include diff --git a/include/sys/rwlock.h b/include/sys/rwlock.h index e2be77c54..eb763ec78 100644 --- a/include/sys/rwlock.h +++ b/include/sys/rwlock.h @@ -156,7 +156,7 @@ RW_LOCK_HELD(krwlock_t *rwp) spl_rw_set_owner(rwp); \ break; \ default: \ - SBUG(); \ + VERIFY(0); \ } \ _rc_; \ }) @@ -172,7 +172,7 @@ RW_LOCK_HELD(krwlock_t *rwp) spl_rw_set_owner(rwp); \ break; \ default: \ - SBUG(); \ + VERIFY(0); \ } \ }) diff --git a/include/sys/signal.h b/include/sys/signal.h index c7e293968..254bf0641 100644 --- a/include/sys/signal.h +++ b/include/sys/signal.h @@ -25,6 +25,8 @@ #ifndef _SPL_SIGNAL_H #define _SPL_SIGNAL_H +#include + #define FORREAL 0 /* Usual side-effects */ #define JUSTLOOKING 1 /* Don't stop the process */ diff --git a/include/sys/sunddi.h b/include/sys/sunddi.h index c48066b9c..65df2a053 100644 --- a/include/sys/sunddi.h +++ b/include/sys/sunddi.h @@ -268,7 +268,6 @@ ddi_create_minor_node(dev_info_t *di, char *name, int spec_type, rc = PTR_ERR(di->di_class); di->di_class = NULL; ddi_remove_minor_node(di, name); - CERROR("Error creating %s class, %d\n", name, rc); return DDI_FAILURE; } @@ -285,7 +284,6 @@ ddi_create_minor_node(dev_info_t *di, char *name, int spec_type, if (name) { rc = __mod_mknod(di->di_name, "c", di->di_major, di->di_minor); if (rc) { - CERROR("Error mknod %s, %d\n", di->di_name, rc); ddi_remove_minor_node(di, name); } } diff --git a/include/sys/thread.h b/include/sys/thread.h index e29715d83..06db6d4c9 100644 --- a/include/sys/thread.h +++ b/include/sys/thread.h @@ -48,7 +48,7 @@ typedef void (*thread_func_t)(void *); __thread_create(stk, stksize, (thread_func_t)func, \ #func, arg, len, pp, state, pri) #define thread_exit() __thread_exit() -#define thread_join(t) SBUG() +#define thread_join(t) VERIFY(0) #define curthread get_current() extern kthread_t *__thread_create(caddr_t stk, size_t stksize, diff --git a/module/spl/spl-condvar.c b/module/spl/spl-condvar.c index 269b0ab61..002dcdb45 100644 --- a/module/spl/spl-condvar.c +++ b/module/spl/spl-condvar.c @@ -25,6 +25,7 @@ \*****************************************************************************/ #include +#include #ifdef DEBUG_SUBSYSTEM #undef DEBUG_SUBSYSTEM diff --git a/module/spl/spl-debug.c b/module/spl/spl-debug.c index 75778752b..5284eb339 100644 --- a/module/spl/spl-debug.c +++ b/module/spl/spl-debug.c @@ -37,7 +37,8 @@ #include #include #include -#include +#include +#include #include #ifdef DEBUG_SUBSYSTEM @@ -48,17 +49,17 @@ unsigned long spl_debug_subsys = ~0; EXPORT_SYMBOL(spl_debug_subsys); -module_param(spl_debug_subsys, long, 0644); +module_param(spl_debug_subsys, ulong, 0644); MODULE_PARM_DESC(spl_debug_subsys, "Subsystem debugging level mask."); unsigned long spl_debug_mask = (D_EMERG | D_ERROR | D_WARNING | D_CONSOLE); EXPORT_SYMBOL(spl_debug_mask); -module_param(spl_debug_mask, long, 0644); +module_param(spl_debug_mask, ulong, 0644); MODULE_PARM_DESC(spl_debug_mask, "Debugging level mask."); unsigned long spl_debug_printk = D_CANTMASK; EXPORT_SYMBOL(spl_debug_printk); -module_param(spl_debug_printk, long, 0644); +module_param(spl_debug_printk, ulong, 0644); MODULE_PARM_DESC(spl_debug_printk, "Console printk level mask."); int spl_debug_mb = -1; @@ -74,7 +75,7 @@ EXPORT_SYMBOL(spl_debug_catastrophe); unsigned int spl_debug_panic_on_bug = 0; EXPORT_SYMBOL(spl_debug_panic_on_bug); -module_param(spl_debug_panic_on_bug, int, 0644); +module_param(spl_debug_panic_on_bug, uint, 0644); MODULE_PARM_DESC(spl_debug_panic_on_bug, "Panic on BUG"); static char spl_debug_file_name[PATH_MAX]; @@ -633,10 +634,10 @@ trace_get_tage(struct trace_cpu_data *tcd, unsigned long len) } int -spl_debug_vmsg(spl_debug_limit_state_t *cdls, int subsys, int mask, - const char *file, const char *fn, const int line, - const char *format1, va_list args, const char *format2, ...) +spl_debug_msg(void *arg, int subsys, int mask, const char *file, + const char *fn, const int line, const char *format, ...) { + spl_debug_limit_state_t *cdls = arg; struct trace_cpu_data *tcd = NULL; struct spl_debug_header header = { 0, }; struct trace_page *tage; @@ -650,10 +651,16 @@ spl_debug_vmsg(spl_debug_limit_state_t *cdls, int subsys, int mask, int i; int remain; + if (subsys == 0) + subsys = DEBUG_SUBSYSTEM; + + if (mask == 0) + mask = D_EMERG; + if (strchr(file, '/')) file = strrchr(file, '/') + 1; - trace_set_debug_header(&header, subsys, mask, line, CDEBUG_STACK()); + trace_set_debug_header(&header, subsys, mask, line, 0); tcd = trace_get_tcd(); if (tcd == NULL) @@ -698,19 +705,14 @@ spl_debug_vmsg(spl_debug_limit_state_t *cdls, int subsys, int mask, } needed = 0; - if (format1) { - va_copy(ap, args); - needed = vsnprintf(string_buf, max_nob, format1, ap); - va_end(ap); - } - - if (format2) { + if (format) { remain = max_nob - needed; if (remain < 0) remain = 0; - va_start(ap, format2); - needed += vsnprintf(string_buf+needed, remain, format2, ap); + va_start(ap, format); + needed += vsnprintf(string_buf+needed, remain, + format, ap); va_end(ap); } @@ -784,16 +786,12 @@ console: string_buf = trace_get_console_buffer(); needed = 0; - if (format1 != NULL) { - va_copy(ap, args); - needed = vsnprintf(string_buf, TRACE_CONSOLE_BUFFER_SIZE, format1, ap); - va_end(ap); - } - if (format2 != NULL) { + if (format != NULL) { remain = TRACE_CONSOLE_BUFFER_SIZE - needed; if (remain > 0) { - va_start(ap, format2); - needed += vsnprintf(string_buf+needed, remain, format2, ap); + va_start(ap, format); + needed += vsnprintf(string_buf+needed, remain, + format, ap); va_end(ap); } } @@ -819,7 +817,7 @@ console: return 0; } -EXPORT_SYMBOL(spl_debug_vmsg); +EXPORT_SYMBOL(spl_debug_msg); /* Do the collect_pages job on a single CPU: assumes that all other * CPUs have been stopped during a panic. If this isn't true for @@ -881,9 +879,6 @@ put_pages_back_on_all_cpus(struct page_collection *pc) list_for_each_entry_safe(tage, tmp, &pc->pc_pages, linkage) { - - __ASSERT_TAGE_INVARIANT(tage); - if (tage->cpu != cpu || tage->type != i) continue; @@ -935,8 +930,6 @@ spl_debug_dump_all_pages(dumplog_priv_t *dp, char *filename) set_fs(get_ds()); list_for_each_entry_safe(tage, tmp, &pc.pc_pages, linkage) { - __ASSERT_TAGE_INVARIANT(tage); - rc = spl_filp_write(filp, page_address(tage->page), tage->used, spl_filp_poff(filp)); if (rc != (int)tage->used) { @@ -979,7 +972,6 @@ spl_debug_flush_pages(void) collect_pages(&dp, &pc); list_for_each_entry_safe(tage, tmp, &pc.pc_pages, linkage) { - __ASSERT_TAGE_INVARIANT(tage); list_del(&tage->linkage); tage_free(tage); } @@ -1077,12 +1069,10 @@ EXPORT_SYMBOL(spl_debug_dumpstack); void spl_debug_bug(char *file, const char *func, const int line, int flags) { spl_debug_catastrophe = 1; - spl_debug_msg(NULL, 0, D_EMERG, file, func, line, "SBUG\n"); + spl_debug_msg(NULL, 0, D_EMERG, file, func, line, "SPL PANIC\n"); - if (in_interrupt()) { - panic("SBUG in interrupt.\n"); - /* not reached */ - } + if (in_interrupt()) + panic("SPL PANIC in interrupt.\n"); if (in_atomic() || irqs_disabled()) flags |= DL_NOTHREAD; @@ -1095,7 +1085,7 @@ void spl_debug_bug(char *file, const char *func, const int line, int flags) spl_debug_dumplog(flags); if (spl_debug_panic_on_bug) - panic("SBUG"); + panic("SPL PANIC"); set_task_state(current, TASK_UNINTERRUPTIBLE); while (1) @@ -1208,8 +1198,6 @@ trace_cleanup_on_all_cpus(void) list_for_each_entry_safe(tage, tmp, &tcd->tcd_pages, linkage) { - __ASSERT_TAGE_INVARIANT(tage); - list_del(&tage->linkage); tage_free(tage); } diff --git a/module/spl/spl-err.c b/module/spl/spl-err.c index 1d5202827..1b059f0c8 100644 --- a/module/spl/spl-err.c +++ b/module/spl/spl-err.c @@ -26,6 +26,7 @@ #include #include +#include #ifdef DEBUG_SUBSYSTEM #undef DEBUG_SUBSYSTEM @@ -44,7 +45,7 @@ vpanic(const char *fmt, va_list ap) char msg[MAXMSGLEN]; vsnprintf(msg, MAXMSGLEN - 1, fmt, ap); - panic("%s", msg); + PANIC("%s", msg); } /* vpanic() */ EXPORT_SYMBOL(vpanic); diff --git a/module/spl/spl-generic.c b/module/spl/spl-generic.c index 6a3f49ae0..b875f7d7f 100644 --- a/module/spl/spl-generic.c +++ b/module/spl/spl-generic.c @@ -39,6 +39,7 @@ #include #include #include +#include #ifdef DEBUG_SUBSYSTEM #undef DEBUG_SUBSYSTEM @@ -339,12 +340,12 @@ EXPORT_SYMBOL(ddi_copyout); * never be putting away the last reference on a task structure so this will * not be called. However, we still need to define it so the module does not * have undefined symbol at load time. That all said if this impossible - * thing does somehow happen SBUG() immediately so we know about it. + * thing does somehow happen PANIC immediately so we know about it. */ void __put_task_struct(struct task_struct *t) { - SBUG(); + PANIC("Unexpectly put last reference on task %d\n", (int)t->pid); } EXPORT_SYMBOL(__put_task_struct); #endif /* HAVE_PUT_TASK_STRUCT */ diff --git a/module/spl/spl-kmem.c b/module/spl/spl-kmem.c index a348021d8..e0b7e12e2 100644 --- a/module/spl/spl-kmem.c +++ b/module/spl/spl-kmem.c @@ -25,6 +25,7 @@ \*****************************************************************************/ #include +#include #ifdef DEBUG_SUBSYSTEM # undef DEBUG_SUBSYSTEM diff --git a/module/spl/spl-kobj.c b/module/spl/spl-kobj.c index 42a264172..d58a9892b 100644 --- a/module/spl/spl-kobj.c +++ b/module/spl/spl-kobj.c @@ -25,6 +25,7 @@ \*****************************************************************************/ #include +#include #ifdef DEBUG_SUBSYSTEM #undef DEBUG_SUBSYSTEM diff --git a/module/spl/spl-kstat.c b/module/spl/spl-kstat.c index 433f3e5b0..238f37ae3 100644 --- a/module/spl/spl-kstat.c +++ b/module/spl/spl-kstat.c @@ -24,8 +24,9 @@ * Solaris Porting Layer (SPL) Kstat Implementation. \*****************************************************************************/ -#include #include +#include +#include static spinlock_t kstat_lock; static struct list_head kstat_list; @@ -72,7 +73,7 @@ kstat_seq_show_headers(struct seq_file *f) "min", "max", "start", "stop"); break; default: - SBUG(); /* Unreachable */ + PANIC("Undefined kstat type %d\n", ksp->ks_type); } } @@ -135,7 +136,7 @@ kstat_seq_show_named(struct seq_file *f, kstat_named_t *knp) seq_printf(f, "%s", KSTAT_NAMED_STR_PTR(knp)); break; default: - SBUG(); /* Unreachable */ + PANIC("Undefined kstat data type %d\n", knp->data_type); } seq_printf(f, "\n"); @@ -210,7 +211,7 @@ kstat_seq_show(struct seq_file *f, void *p) rc = kstat_seq_show_timer(f, (kstat_timer_t *)p); break; default: - SBUG(); /* Unreachable */ + PANIC("Undefined kstat type %d\n", ksp->ks_type); } return rc; @@ -239,7 +240,7 @@ kstat_seq_data_addr(kstat_t *ksp, loff_t n) rc = ksp->ks_data + n * sizeof(kstat_timer_t); break; default: - SBUG(); /* Unreachable */ + PANIC("Undefined kstat type %d\n", ksp->ks_type); } RETURN(rc); @@ -377,7 +378,7 @@ __kstat_create(const char *ks_module, int ks_instance, const char *ks_name, ksp->ks_data_size = ks_ndata * sizeof(kstat_timer_t); break; default: - SBUG(); /* Unreachable */ + PANIC("Undefined kstat type %d\n", ksp->ks_type); } if (ksp->ks_flags & KSTAT_FLAG_VIRTUAL) { diff --git a/module/spl/spl-module.c b/module/spl/spl-module.c index 37dd4f4c1..787a4480e 100644 --- a/module/spl/spl-module.c +++ b/module/spl/spl-module.c @@ -24,8 +24,8 @@ * Solaris Porting Layer (SPL) Module Implementation. \*****************************************************************************/ -#include #include +#include #ifdef DEBUG_SUBSYSTEM #undef DEBUG_SUBSYSTEM diff --git a/module/spl/spl-proc.c b/module/spl/spl-proc.c index 5a71f795c..bc6dac5b8 100644 --- a/module/spl/spl-proc.c +++ b/module/spl/spl-proc.c @@ -29,6 +29,7 @@ #include #include #include +#include #ifdef DEBUG_SUBSYSTEM #undef DEBUG_SUBSYSTEM @@ -297,13 +298,10 @@ SPL_PROC_HANDLER(proc_force_bug) { ENTRY; - if (write) { - CERROR("Crashing due to forced SBUG\n"); - SBUG(); - /* Unreachable */ - } else { + if (write) + PANIC("Crashing due to forced panic\n"); + else *lenp = 0; - } RETURN(0); } diff --git a/module/spl/spl-taskq.c b/module/spl/spl-taskq.c index 9aca699c7..d9c83279c 100644 --- a/module/spl/spl-taskq.c +++ b/module/spl/spl-taskq.c @@ -26,6 +26,7 @@ #include #include +#include #ifdef DEBUG_SUBSYSTEM #undef DEBUG_SUBSYSTEM @@ -90,8 +91,8 @@ retry: RETURN(NULL); } - /* Unreachable, TQ_SLEEP or TQ_NOSLEEP */ - SBUG(); + /* Unreachable, Neither TQ_SLEEP or TQ_NOSLEEP set */ + PANIC("Neither TQ_SLEEP or TQ_NOSLEEP set"); } spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); @@ -254,11 +255,9 @@ __taskq_dispatch(taskq_t *tq, task_func_t func, void *arg, uint_t flags) if (!(flags & (TQ_SLEEP | TQ_NOSLEEP))) flags |= TQ_SLEEP; - if (unlikely(in_atomic() && (flags & TQ_SLEEP))) { - CERROR("May schedule while atomic: %s/0x%08x/%d\n", - current->comm, preempt_count(), current->pid); - SBUG(); - } + if (unlikely(in_atomic() && (flags & TQ_SLEEP))) + PANIC("May schedule while atomic: %s/0x%08x/%d\n", + current->comm, preempt_count(), current->pid); spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); diff --git a/module/spl/spl-thread.c b/module/spl/spl-thread.c index bce912c4d..e28b1261a 100644 --- a/module/spl/spl-thread.c +++ b/module/spl/spl-thread.c @@ -26,6 +26,7 @@ #include #include +#include #ifdef DEBUG_SUBSYSTEM #undef DEBUG_SUBSYSTEM diff --git a/module/spl/spl-vnode.c b/module/spl/spl-vnode.c index c67fc4c7f..840bb6718 100644 --- a/module/spl/spl-vnode.c +++ b/module/spl/spl-vnode.c @@ -24,9 +24,8 @@ * Solaris Porting Layer (SPL) Vnode Implementation. \*****************************************************************************/ -#include #include - +#include #ifdef DEBUG_SUBSYSTEM #undef DEBUG_SUBSYSTEM diff --git a/module/spl/spl-xdr.c b/module/spl/spl-xdr.c index 174f76f19..375b74e53 100644 --- a/module/spl/spl-xdr.c +++ b/module/spl/spl-xdr.c @@ -22,13 +22,12 @@ \*****************************************************************************/ #include - #include #include #include - #include #include +#include /* * SPL's XDR mem implementation. diff --git a/module/splat/splat-atomic.c b/module/splat/splat-atomic.c index fd86a9fa8..6162d6abf 100644 --- a/module/splat/splat-atomic.c +++ b/module/splat/splat-atomic.c @@ -109,7 +109,7 @@ splat_atomic_work(void *priv) atomic_sub_64_nv(&ap->ap_atomic, 5); break; default: - SBUG(); + PANIC("Undefined op %d\n", op); } } diff --git a/module/splat/splat-internal.h b/module/splat/splat-internal.h index ba1224fc1..c42e08d6f 100644 --- a/module/splat/splat-internal.h +++ b/module/splat/splat-internal.h @@ -66,6 +66,7 @@ #include #include "spl-device.h" +#include "spl-debug.h" #include "splat-ctl.h" #define SPLAT_SUBSYSTEM_INIT(type) \ diff --git a/scripts/check.sh b/scripts/check.sh index 712605547..b44b31333 100755 --- a/scripts/check.sh +++ b/scripts/check.sh @@ -62,7 +62,7 @@ if [ ! -f ${spl_module} ] || [ ! -f ${splat_module} ]; then die "Source tree must be built, run 'make'" fi -spl_module_params="spl_debug_mask=-1 spl_debug_subsys=-1" +spl_module_params="spl_debug_mask=0xffffffff spl_debug_subsys=0xffffffff" echo "Loading ${spl_module}" /sbin/insmod ${spl_module} ${spl_module_params} || die "Failed to load ${spl_module}" -- cgit v1.2.3 From b17edc10a9c66543bef54b08e4655832aefe8939 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Tue, 20 Jul 2010 11:55:37 -0700 Subject: Prefix all SPL debug macros with 'S' To avoid conflicts with symbols defined by dependent packages all debugging symbols have been prefixed with a 'S' for SPL. Any dependent package needing to integrate with the SPL debug should include the spl-debug.h header and use the 'S' prefixed macros. They must also build with DEBUG defined. --- include/spl-debug.h | 145 ++++++++++++++++++---------------- module/spl/spl-condvar.c | 32 ++++---- module/spl/spl-debug.c | 108 ++++++++++++++----------- module/spl/spl-err.c | 10 +-- module/spl/spl-generic.c | 36 ++++----- module/spl/spl-kmem.c | 200 +++++++++++++++++++++++------------------------ module/spl/spl-kobj.c | 28 +++---- module/spl/spl-kstat.c | 40 ++++++---- module/spl/spl-module.c | 48 ++++++------ module/spl/spl-proc.c | 116 +++++++++++++-------------- module/spl/spl-taskq.c | 88 ++++++++++----------- module/spl/spl-thread.c | 22 +++--- module/spl/spl-vnode.c | 140 ++++++++++++++++----------------- module/spl/spl-xdr.c | 12 ++- 14 files changed, 533 insertions(+), 492 deletions(-) (limited to 'module/spl/spl-taskq.c') diff --git a/include/spl-debug.h b/include/spl-debug.h index b5ca64f87..cf0d58cad 100644 --- a/include/spl-debug.h +++ b/include/spl-debug.h @@ -26,17 +26,17 @@ * Available debug functions. These function should be used by any * package which needs to integrate with the SPL log infrastructure. * - * CDEBUG() - Log debug message with specified mask. - * CDEBUG_LIMIT() - Log just 1 debug message with specified mask. - * CWARN() - Log a warning message. - * CERROR() - Log an error message. - * CEMERG() - Log an emergency error message. - * CONSOLE() - Log a generic message to the console. + * SDEBUG() - Log debug message with specified mask. + * SDEBUG_LIMIT() - Log just 1 debug message with specified mask. + * SWARN() - Log a warning message. + * SERROR() - Log an error message. + * SEMERG() - Log an emergency error message. + * SCONSOLE() - Log a generic message to the console. * - * ENTRY - Log entry point to a function. - * EXIT - Log exit point from a function. - * RETURN(x) - Log return from a function. - * GOTO(x, y) - Log goto within a function. + * SENTRY - Log entry point to a function. + * SEXIT - Log exit point from a function. + * SRETURN(x) - Log return from a function. + * SGOTO(x, y) - Log goto within a function. */ #ifndef _SPL_DEBUG_INTERNAL_H @@ -44,95 +44,104 @@ #include -#define S_UNDEFINED 0x00000001 -#define S_ATOMIC 0x00000002 -#define S_KOBJ 0x00000004 -#define S_VNODE 0x00000008 -#define S_TIME 0x00000010 -#define S_RWLOCK 0x00000020 -#define S_THREAD 0x00000040 -#define S_CONDVAR 0x00000080 -#define S_MUTEX 0x00000100 -#define S_RNG 0x00000200 -#define S_TASKQ 0x00000400 -#define S_KMEM 0x00000800 -#define S_DEBUG 0x00001000 -#define S_GENERIC 0x00002000 -#define S_PROC 0x00004000 -#define S_MODULE 0x00008000 -#define S_CRED 0x00010000 - -#define D_TRACE 0x00000001 -#define D_INFO 0x00000002 -#define D_WARNING 0x00000004 -#define D_ERROR 0x00000008 -#define D_EMERG 0x00000010 -#define D_CONSOLE 0x00000020 -#define D_IOCTL 0x00000040 -#define D_DPRINTF 0x00000080 -#define D_OTHER 0x00000100 - -#define D_CANTMASK (D_ERROR | D_EMERG | D_WARNING | D_CONSOLE) -#define DEBUG_SUBSYSTEM S_UNDEFINED +#define SS_UNDEFINED 0x00000001 +#define SS_ATOMIC 0x00000002 +#define SS_KOBJ 0x00000004 +#define SS_VNODE 0x00000008 +#define SS_TIME 0x00000010 +#define SS_RWLOCK 0x00000020 +#define SS_THREAD 0x00000040 +#define SS_CONDVAR 0x00000080 +#define SS_MUTEX 0x00000100 +#define SS_RNG 0x00000200 +#define SS_TASKQ 0x00000400 +#define SS_KMEM 0x00000800 +#define SS_DEBUG 0x00001000 +#define SS_GENERIC 0x00002000 +#define SS_PROC 0x00004000 +#define SS_MODULE 0x00008000 +#define SS_CRED 0x00010000 +#define SS_KSTAT 0x00020000 +#define SS_XDR 0x00040000 +#define SS_USER1 0x01000000 +#define SS_USER2 0x02000000 +#define SS_USER3 0x04000000 +#define SS_USER4 0x08000000 +#define SS_USER5 0x10000000 +#define SS_USER6 0x20000000 +#define SS_USER7 0x40000000 +#define SS_USER8 0x80000000 +#define SS_DEBUG_SUBSYS SS_UNDEFINED + +#define SD_TRACE 0x00000001 +#define SD_INFO 0x00000002 +#define SD_WARNING 0x00000004 +#define SD_ERROR 0x00000008 +#define SD_EMERG 0x00000010 +#define SD_CONSOLE 0x00000020 +#define SD_IOCTL 0x00000040 +#define SD_DPRINTF 0x00000080 +#define SD_OTHER 0x00000100 +#define SD_CANTMASK (SD_ERROR | SD_EMERG | SD_WARNING | SD_CONSOLE) #ifdef NDEBUG /* Debugging Disabled */ -#define CDEBUG(mask, fmt, a...) ((void)0) -#define CDEBUG_LIMIT(x, y, fmt, a...) ((void)0) -#define CWARN(fmt, a...) ((void)0) -#define CERROR(fmt, a...) ((void)0) -#define CEMERG(fmt, a...) ((void)0) -#define CONSOLE(mask, fmt, a...) ((void)0) +#define SDEBUG(mask, fmt, a...) ((void)0) +#define SDEBUG_LIMIT(x, y, fmt, a...) ((void)0) +#define SWARN(fmt, a...) ((void)0) +#define SERROR(fmt, a...) ((void)0) +#define SEMERG(fmt, a...) ((void)0) +#define SCONSOLE(mask, fmt, a...) ((void)0) -#define ENTRY ((void)0) -#define EXIT ((void)0) -#define RETURN(x) return (x) -#define GOTO(x, y) { ((void)(y)); goto x; } +#define SENTRY ((void)0) +#define SEXIT ((void)0) +#define SRETURN(x) return (x) +#define SGOTO(x, y) { ((void)(y)); goto x; } #else /* Debugging Enabled */ -#define __CDEBUG(cdls, subsys, mask, format, a...) \ +#define __SDEBUG(cdls, subsys, mask, format, a...) \ do { \ - if (((mask) & D_CANTMASK) != 0 || \ + if (((mask) & SD_CANTMASK) != 0 || \ ((spl_debug_mask & (mask)) != 0 && \ (spl_debug_subsys & (subsys)) != 0)) \ spl_debug_msg(cdls, subsys, mask, __FILE__, \ __FUNCTION__, __LINE__, format, ## a); \ } while (0) -#define CDEBUG(mask, format, a...) \ - __CDEBUG(NULL, DEBUG_SUBSYSTEM, mask, format, ## a) +#define SDEBUG(mask, format, a...) \ + __SDEBUG(NULL, SS_DEBUG_SUBSYS, mask, format, ## a) -#define __CDEBUG_LIMIT(subsys, mask, format, a...) \ +#define __SDEBUG_LIMIT(subsys, mask, format, a...) \ do { \ static spl_debug_limit_state_t cdls; \ \ - __CDEBUG(&cdls, subsys, mask, format, ## a); \ + __SDEBUG(&cdls, subsys, mask, format, ## a); \ } while (0) -#define CDEBUG_LIMIT(mask, format, a...) \ - __CDEBUG_LIMIT(DEBUG_SUBSYSTEM, mask, format, ## a) +#define SDEBUG_LIMIT(mask, format, a...) \ + __SDEBUG_LIMIT(SS_DEBUG_SUBSYS, mask, format, ## a) -#define CWARN(fmt, a...) CDEBUG_LIMIT(D_WARNING, fmt, ## a) -#define CERROR(fmt, a...) CDEBUG_LIMIT(D_ERROR, fmt, ## a) -#define CEMERG(fmt, a...) CDEBUG_LIMIT(D_EMERG, fmt, ## a) -#define CONSOLE(mask, fmt, a...) CDEBUG(D_CONSOLE | (mask), fmt, ## a) +#define SWARN(fmt, a...) SDEBUG_LIMIT(SD_WARNING, fmt, ## a) +#define SERROR(fmt, a...) SDEBUG_LIMIT(SD_ERROR, fmt, ## a) +#define SEMERG(fmt, a...) SDEBUG_LIMIT(SD_EMERG, fmt, ## a) +#define SCONSOLE(mask, fmt, a...) SDEBUG(SD_CONSOLE | (mask), fmt, ## a) -#define ENTRY CDEBUG(D_TRACE, "Process entered\n") -#define EXIT CDEBUG(D_TRACE, "Process leaving\n") +#define SENTRY SDEBUG(SD_TRACE, "Process entered\n") +#define SEXIT SDEBUG(SD_TRACE, "Process leaving\n") -#define RETURN(rc) \ +#define SRETURN(rc) \ do { \ typeof(rc) RETURN__ret = (rc); \ - CDEBUG(D_TRACE, "Process leaving (rc=%lu : %ld : %lx)\n", \ + SDEBUG(SD_TRACE, "Process leaving (rc=%lu : %ld : %lx)\n", \ (long)RETURN__ret, (long)RETURN__ret, (long)RETURN__ret); \ return RETURN__ret; \ } while (0) -#define GOTO(label, rc) \ +#define SGOTO(label, rc) \ do { \ long GOTO__ret = (long)(rc); \ - CDEBUG(D_TRACE,"Process leaving via %s (rc=%lu : %ld : %lx)\n", \ + SDEBUG(SD_TRACE,"Process leaving via %s (rc=%lu : %ld : %lx)\n",\ #label, (unsigned long)GOTO__ret, (signed long)GOTO__ret, \ (signed long)GOTO__ret); \ goto label; \ diff --git a/module/spl/spl-condvar.c b/module/spl/spl-condvar.c index 002dcdb45..6b4512472 100644 --- a/module/spl/spl-condvar.c +++ b/module/spl/spl-condvar.c @@ -27,18 +27,18 @@ #include #include -#ifdef DEBUG_SUBSYSTEM -#undef DEBUG_SUBSYSTEM +#ifdef SS_DEBUG_SUBSYS +#undef SS_DEBUG_SUBSYS #endif -#define DEBUG_SUBSYSTEM S_CONDVAR +#define SS_DEBUG_SUBSYS SS_CONDVAR void __cv_init(kcondvar_t *cvp, char *name, kcv_type_t type, void *arg) { int flags = KM_SLEEP; - ENTRY; + SENTRY; ASSERT(cvp); ASSERT(name); ASSERT(type == CV_DEFAULT); @@ -62,14 +62,14 @@ __cv_init(kcondvar_t *cvp, char *name, kcv_type_t type, void *arg) if (cvp->cv_name) strcpy(cvp->cv_name, name); - EXIT; + SEXIT; } EXPORT_SYMBOL(__cv_init); void __cv_destroy(kcondvar_t *cvp) { - ENTRY; + SENTRY; ASSERT(cvp); ASSERT(cvp->cv_magic == CV_MAGIC); spin_lock(&cvp->cv_lock); @@ -81,7 +81,7 @@ __cv_destroy(kcondvar_t *cvp) spin_unlock(&cvp->cv_lock); memset(cvp, CV_POISON, sizeof(*cvp)); - EXIT; + SEXIT; } EXPORT_SYMBOL(__cv_destroy); @@ -89,7 +89,7 @@ static void cv_wait_common(kcondvar_t *cvp, kmutex_t *mp, int state) { DEFINE_WAIT(wait); - ENTRY; + SENTRY; ASSERT(cvp); ASSERT(mp); @@ -116,7 +116,7 @@ cv_wait_common(kcondvar_t *cvp, kmutex_t *mp, int state) atomic_dec(&cvp->cv_waiters); finish_wait(&cvp->cv_event, &wait); - EXIT; + SEXIT; } void @@ -141,7 +141,7 @@ __cv_timedwait(kcondvar_t *cvp, kmutex_t *mp, clock_t expire_time) { DEFINE_WAIT(wait); clock_t time_left; - ENTRY; + SENTRY; ASSERT(cvp); ASSERT(mp); @@ -159,7 +159,7 @@ __cv_timedwait(kcondvar_t *cvp, kmutex_t *mp, clock_t expire_time) /* XXX - Does not handle jiffie wrap properly */ time_left = expire_time - jiffies; if (time_left <= 0) - RETURN(-1); + SRETURN(-1); prepare_to_wait_exclusive(&cvp->cv_event, &wait, TASK_UNINTERRUPTIBLE); @@ -175,14 +175,14 @@ __cv_timedwait(kcondvar_t *cvp, kmutex_t *mp, clock_t expire_time) atomic_dec(&cvp->cv_waiters); finish_wait(&cvp->cv_event, &wait); - RETURN(time_left > 0 ? time_left : -1); + SRETURN(time_left > 0 ? time_left : -1); } EXPORT_SYMBOL(__cv_timedwait); void __cv_signal(kcondvar_t *cvp) { - ENTRY; + SENTRY; ASSERT(cvp); ASSERT(cvp->cv_magic == CV_MAGIC); @@ -193,7 +193,7 @@ __cv_signal(kcondvar_t *cvp) if (atomic_read(&cvp->cv_waiters) > 0) wake_up(&cvp->cv_event); - EXIT; + SEXIT; } EXPORT_SYMBOL(__cv_signal); @@ -202,13 +202,13 @@ __cv_broadcast(kcondvar_t *cvp) { ASSERT(cvp); ASSERT(cvp->cv_magic == CV_MAGIC); - ENTRY; + SENTRY; /* Wake_up_all() will wake up all waiters even those which * have the WQ_FLAG_EXCLUSIVE flag set. */ if (atomic_read(&cvp->cv_waiters) > 0) wake_up_all(&cvp->cv_event); - EXIT; + SEXIT; } EXPORT_SYMBOL(__cv_broadcast); diff --git a/module/spl/spl-debug.c b/module/spl/spl-debug.c index 5284eb339..f6ec86ac4 100644 --- a/module/spl/spl-debug.c +++ b/module/spl/spl-debug.c @@ -41,23 +41,23 @@ #include #include -#ifdef DEBUG_SUBSYSTEM -#undef DEBUG_SUBSYSTEM +#ifdef SS_DEBUG_SUBSYS +#undef SS_DEBUG_SUBSYS #endif -#define DEBUG_SUBSYSTEM S_DEBUG +#define SS_DEBUG_SUBSYS SS_DEBUG unsigned long spl_debug_subsys = ~0; EXPORT_SYMBOL(spl_debug_subsys); module_param(spl_debug_subsys, ulong, 0644); MODULE_PARM_DESC(spl_debug_subsys, "Subsystem debugging level mask."); -unsigned long spl_debug_mask = (D_EMERG | D_ERROR | D_WARNING | D_CONSOLE); +unsigned long spl_debug_mask = SD_CANTMASK; EXPORT_SYMBOL(spl_debug_mask); module_param(spl_debug_mask, ulong, 0644); MODULE_PARM_DESC(spl_debug_mask, "Debugging level mask."); -unsigned long spl_debug_printk = D_CANTMASK; +unsigned long spl_debug_printk = SD_CANTMASK; EXPORT_SYMBOL(spl_debug_printk); module_param(spl_debug_printk, ulong, 0644); MODULE_PARM_DESC(spl_debug_printk, "Console printk level mask."); @@ -120,40 +120,60 @@ spl_debug_subsys2str(int subsys) switch (subsys) { default: return NULL; - case S_UNDEFINED: + case SS_UNDEFINED: return "undefined"; - case S_ATOMIC: + case SS_ATOMIC: return "atomic"; - case S_KOBJ: + case SS_KOBJ: return "kobj"; - case S_VNODE: + case SS_VNODE: return "vnode"; - case S_TIME: + case SS_TIME: return "time"; - case S_RWLOCK: + case SS_RWLOCK: return "rwlock"; - case S_THREAD: + case SS_THREAD: return "thread"; - case S_CONDVAR: + case SS_CONDVAR: return "condvar"; - case S_MUTEX: + case SS_MUTEX: return "mutex"; - case S_RNG: + case SS_RNG: return "rng"; - case S_TASKQ: + case SS_TASKQ: return "taskq"; - case S_KMEM: + case SS_KMEM: return "kmem"; - case S_DEBUG: + case SS_DEBUG: return "debug"; - case S_GENERIC: + case SS_GENERIC: return "generic"; - case S_PROC: + case SS_PROC: return "proc"; - case S_MODULE: + case SS_MODULE: return "module"; - case S_CRED: + case SS_CRED: return "cred"; + case SS_KSTAT: + return "kstat"; + case SS_XDR: + return "xdr"; + case SS_USER1: + return "user1"; + case SS_USER2: + return "user2"; + case SS_USER3: + return "user3"; + case SS_USER4: + return "user4"; + case SS_USER5: + return "user5"; + case SS_USER6: + return "user6"; + case SS_USER7: + return "user7"; + case SS_USER8: + return "user8"; } } @@ -163,23 +183,23 @@ spl_debug_dbg2str(int debug) switch (debug) { default: return NULL; - case D_TRACE: + case SD_TRACE: return "trace"; - case D_INFO: + case SD_INFO: return "info"; - case D_WARNING: + case SD_WARNING: return "warning"; - case D_ERROR: + case SD_ERROR: return "error"; - case D_EMERG: + case SD_EMERG: return "emerg"; - case D_CONSOLE: + case SD_CONSOLE: return "console"; - case D_IOCTL: + case SD_IOCTL: return "ioctl"; - case D_DPRINTF: + case SD_DPRINTF: return "dprintf"; - case D_OTHER: + case SD_OTHER: return "other"; } } @@ -493,21 +513,21 @@ trace_print_to_console(struct spl_debug_header *hdr, int mask, const char *buf, { char *prefix = "SPL", *ptype = NULL; - if ((mask & D_EMERG) != 0) { + if ((mask & SD_EMERG) != 0) { prefix = "SPLError"; ptype = KERN_EMERG; - } else if ((mask & D_ERROR) != 0) { + } else if ((mask & SD_ERROR) != 0) { prefix = "SPLError"; ptype = KERN_ERR; - } else if ((mask & D_WARNING) != 0) { + } else if ((mask & SD_WARNING) != 0) { prefix = "SPL"; ptype = KERN_WARNING; - } else if ((mask & (D_CONSOLE | spl_debug_printk)) != 0) { + } else if ((mask & (SD_CONSOLE | spl_debug_printk)) != 0) { prefix = "SPL"; ptype = KERN_INFO; } - if ((mask & D_CONSOLE) != 0) { + if ((mask & SD_CONSOLE) != 0) { printk("%s%s: %.*s", ptype, prefix, len, buf); } else { printk("%s%s: %d:%d:(%s:%d:%s()) %.*s", ptype, prefix, @@ -652,10 +672,10 @@ spl_debug_msg(void *arg, int subsys, int mask, const char *file, int remain; if (subsys == 0) - subsys = DEBUG_SUBSYSTEM; + subsys = SS_DEBUG_SUBSYS; if (mask == 0) - mask = D_EMERG; + mask = SD_EMERG; if (strchr(file, '/')) file = strrchr(file, '/') + 1; @@ -685,7 +705,7 @@ spl_debug_msg(void *arg, int subsys, int mask, const char *file, tage = trace_get_tage(tcd, needed + known_size + 1); if (tage == NULL) { if (needed + known_size > PAGE_SIZE) - mask |= D_ERROR; + mask |= SD_ERROR; trace_put_tcd(tcd); tcd = NULL; @@ -698,7 +718,7 @@ spl_debug_msg(void *arg, int subsys, int mask, const char *file, max_nob = PAGE_SIZE - tage->used - known_size; if (max_nob <= 0) { printk(KERN_EMERG "negative max_nob: %i\n", max_nob); - mask |= D_ERROR; + mask |= SD_ERROR; trace_put_tcd(tcd); tcd = NULL; goto console; @@ -1069,7 +1089,7 @@ EXPORT_SYMBOL(spl_debug_dumpstack); void spl_debug_bug(char *file, const char *func, const int line, int flags) { spl_debug_catastrophe = 1; - spl_debug_msg(NULL, 0, D_EMERG, file, func, line, "SPL PANIC\n"); + spl_debug_msg(NULL, 0, SD_EMERG, file, func, line, "SPL PANIC\n"); if (in_interrupt()) panic("SPL PANIC in interrupt.\n"); @@ -1104,9 +1124,9 @@ EXPORT_SYMBOL(spl_debug_clear_buffer); int spl_debug_mark_buffer(char *text) { - CDEBUG(D_WARNING, "*************************************\n"); - CDEBUG(D_WARNING, "DEBUG MARKER: %s\n", text); - CDEBUG(D_WARNING, "*************************************\n"); + SDEBUG(SD_WARNING, "*************************************\n"); + SDEBUG(SD_WARNING, "DEBUG MARKER: %s\n", text); + SDEBUG(SD_WARNING, "*************************************\n"); return 0; } diff --git a/module/spl/spl-err.c b/module/spl/spl-err.c index 1b059f0c8..200028f3b 100644 --- a/module/spl/spl-err.c +++ b/module/spl/spl-err.c @@ -28,11 +28,11 @@ #include #include -#ifdef DEBUG_SUBSYSTEM -#undef DEBUG_SUBSYSTEM +#ifdef SS_DEBUG_SUBSYS +#undef SS_DEBUG_SUBSYS #endif -#define DEBUG_SUBSYSTEM S_GENERIC +#define SS_DEBUG_SUBSYS SS_GENERIC #ifndef NDEBUG static char ce_prefix[CE_IGNORE][10] = { "", "NOTICE: ", "WARNING: ", "" }; @@ -61,10 +61,10 @@ vcmn_err(int ce, const char *fmt, va_list ap) vsnprintf(msg, MAXMSGLEN - 1, fmt, ap); if (fmt[0] == '!') - CDEBUG(D_INFO, "%s%s%s", + SDEBUG(SD_INFO, "%s%s%s", ce_prefix[ce], msg, ce_suffix[ce]); else - CERROR("%s%s%s", ce_prefix[ce], msg, ce_suffix[ce]); + SERROR("%s%s%s", ce_prefix[ce], msg, ce_suffix[ce]); } } /* vcmn_err() */ EXPORT_SYMBOL(vcmn_err); diff --git a/module/spl/spl-generic.c b/module/spl/spl-generic.c index b875f7d7f..a7083b6d2 100644 --- a/module/spl/spl-generic.c +++ b/module/spl/spl-generic.c @@ -41,11 +41,11 @@ #include #include -#ifdef DEBUG_SUBSYSTEM -#undef DEBUG_SUBSYSTEM +#ifdef SS_DEBUG_SUBSYS +#undef SS_DEBUG_SUBSYS #endif -#define DEBUG_SUBSYSTEM S_GENERIC +#define SS_DEBUG_SUBSYS SS_GENERIC char spl_version[16] = "SPL v" SPL_META_VERSION; EXPORT_SYMBOL(spl_version); @@ -67,10 +67,10 @@ int highbit(unsigned long i) { register int h = 1; - ENTRY; + SENTRY; if (i == 0) - RETURN(0); + SRETURN(0); #if BITS_PER_LONG == 64 if (i & 0xffffffff00000000ul) { h += 32; i >>= 32; @@ -91,7 +91,7 @@ highbit(unsigned long i) if (i & 0x2) { h += 1; } - RETURN(h); + SRETURN(h); } EXPORT_SYMBOL(highbit); @@ -447,39 +447,39 @@ __init spl_init(void) return rc; if ((rc = spl_kmem_init())) - GOTO(out1, rc); + SGOTO(out1, rc); if ((rc = spl_mutex_init())) - GOTO(out2, rc); + SGOTO(out2, rc); if ((rc = spl_rw_init())) - GOTO(out3, rc); + SGOTO(out3, rc); if ((rc = spl_taskq_init())) - GOTO(out4, rc); + SGOTO(out4, rc); if ((rc = vn_init())) - GOTO(out5, rc); + SGOTO(out5, rc); if ((rc = proc_init())) - GOTO(out6, rc); + SGOTO(out6, rc); if ((rc = kstat_init())) - GOTO(out7, rc); + SGOTO(out7, rc); if ((rc = set_hostid())) - GOTO(out8, rc = -EADDRNOTAVAIL); + SGOTO(out8, rc = -EADDRNOTAVAIL); #ifndef HAVE_KALLSYMS_LOOKUP_NAME if ((rc = set_kallsyms_lookup_name())) - GOTO(out8, rc = -EADDRNOTAVAIL); + SGOTO(out8, rc = -EADDRNOTAVAIL); #endif /* HAVE_KALLSYMS_LOOKUP_NAME */ if ((rc = spl_kmem_init_kallsyms_lookup())) - GOTO(out8, rc); + SGOTO(out8, rc); printk("SPL: Loaded Solaris Porting Layer v%s\n", SPL_META_VERSION); - RETURN(rc); + SRETURN(rc); out8: kstat_fini(); out7: @@ -505,7 +505,7 @@ out1: static void spl_fini(void) { - ENTRY; + SENTRY; printk("SPL: Unloaded Solaris Porting Layer v%s\n", SPL_META_VERSION); kstat_fini(); diff --git a/module/spl/spl-kmem.c b/module/spl/spl-kmem.c index e0b7e12e2..100c60230 100644 --- a/module/spl/spl-kmem.c +++ b/module/spl/spl-kmem.c @@ -27,11 +27,11 @@ #include #include -#ifdef DEBUG_SUBSYSTEM -# undef DEBUG_SUBSYSTEM +#ifdef SS_DEBUG_SUBSYS +#undef SS_DEBUG_SUBSYS #endif -#define DEBUG_SUBSYSTEM S_KMEM +#define SS_DEBUG_SUBSYS SS_KMEM /* * The minimum amount of memory measured in pages to be free at all @@ -416,7 +416,7 @@ kmem_del_init(spinlock_t *lock, struct hlist_head *table, int bits, struct hlist_node *node; struct kmem_debug *p; unsigned long flags; - ENTRY; + SENTRY; spin_lock_irqsave(lock, flags); @@ -432,7 +432,7 @@ kmem_del_init(spinlock_t *lock, struct hlist_head *table, int bits, spin_unlock_irqrestore(lock, flags); - RETURN(NULL); + SRETURN(NULL); } void * @@ -442,13 +442,13 @@ kmem_alloc_track(size_t size, int flags, const char *func, int line, void *ptr = NULL; kmem_debug_t *dptr; unsigned long irq_flags; - ENTRY; + SENTRY; dptr = (kmem_debug_t *) kmalloc_nofail(sizeof(kmem_debug_t), flags & ~__GFP_ZERO); if (dptr == NULL) { - CDEBUG_LIMIT(D_CONSOLE | D_WARNING, "debug " + SDEBUG_LIMIT(SD_CONSOLE | SD_WARNING, "debug " "kmem_alloc(%ld, 0x%x) at %s:%d failed (%lld/%llu)\n", sizeof(kmem_debug_t), flags, func, line, kmem_alloc_used_read(), kmem_alloc_max); @@ -456,7 +456,7 @@ kmem_alloc_track(size_t size, int flags, const char *func, int line, /* Marked unlikely because we should never be doing this, * we tolerate to up 2 pages but a single page is best. */ if (unlikely((size > PAGE_SIZE*2) && !(flags & KM_NODEBUG))) { - CDEBUG_LIMIT(D_CONSOLE | D_WARNING, "large " + SDEBUG_LIMIT(SD_CONSOLE | SD_WARNING, "large " "kmem_alloc(%llu, 0x%x) at %s:%d (%lld/%llu)\n", (unsigned long long) size, flags, func, line, kmem_alloc_used_read(), kmem_alloc_max); @@ -469,7 +469,7 @@ kmem_alloc_track(size_t size, int flags, const char *func, int line, dptr->kd_func = kstrdup(func, flags & ~__GFP_ZERO); if (unlikely(dptr->kd_func == NULL)) { kfree(dptr); - CDEBUG_LIMIT(D_CONSOLE | D_WARNING, + SDEBUG_LIMIT(SD_CONSOLE | SD_WARNING, "debug kstrdup() at %s:%d failed (%lld/%llu)\n", func, line, kmem_alloc_used_read(), kmem_alloc_max); goto out; @@ -488,7 +488,7 @@ kmem_alloc_track(size_t size, int flags, const char *func, int line, if (unlikely(ptr == NULL)) { kfree(dptr->kd_func); kfree(dptr); - CDEBUG_LIMIT(D_CONSOLE | D_WARNING, "kmem_alloc" + SDEBUG_LIMIT(SD_CONSOLE | SD_WARNING, "kmem_alloc" "(%llu, 0x%x) at %s:%d failed (%lld/%llu)\n", (unsigned long long) size, flags, func, line, kmem_alloc_used_read(), kmem_alloc_max); @@ -512,13 +512,13 @@ kmem_alloc_track(size_t size, int flags, const char *func, int line, list_add_tail(&dptr->kd_list, &kmem_list); spin_unlock_irqrestore(&kmem_lock, irq_flags); - CDEBUG_LIMIT(D_INFO, + SDEBUG_LIMIT(SD_INFO, "kmem_alloc(%llu, 0x%x) at %s:%d = %p (%lld/%llu)\n", (unsigned long long) size, flags, func, line, ptr, kmem_alloc_used_read(), kmem_alloc_max); } out: - RETURN(ptr); + SRETURN(ptr); } EXPORT_SYMBOL(kmem_alloc_track); @@ -526,7 +526,7 @@ void kmem_free_track(void *ptr, size_t size) { kmem_debug_t *dptr; - ENTRY; + SENTRY; ASSERTF(ptr || size > 0, "ptr: %p, size: %llu", ptr, (unsigned long long) size); @@ -541,7 +541,7 @@ kmem_free_track(void *ptr, size_t size) (unsigned long long) size, dptr->kd_func, dptr->kd_line); kmem_alloc_used_sub(size); - CDEBUG_LIMIT(D_INFO, "kmem_free(%p, %llu) (%lld/%llu)\n", ptr, + SDEBUG_LIMIT(SD_INFO, "kmem_free(%p, %llu) (%lld/%llu)\n", ptr, (unsigned long long) size, kmem_alloc_used_read(), kmem_alloc_max); @@ -553,7 +553,7 @@ kmem_free_track(void *ptr, size_t size) memset(ptr, 0x5a, size); kfree(ptr); - EXIT; + SEXIT; } EXPORT_SYMBOL(kmem_free_track); @@ -563,14 +563,14 @@ vmem_alloc_track(size_t size, int flags, const char *func, int line) void *ptr = NULL; kmem_debug_t *dptr; unsigned long irq_flags; - ENTRY; + SENTRY; ASSERT(flags & KM_SLEEP); dptr = (kmem_debug_t *) kmalloc_nofail(sizeof(kmem_debug_t), flags & ~__GFP_ZERO); if (dptr == NULL) { - CDEBUG_LIMIT(D_CONSOLE | D_WARNING, "debug " + SDEBUG_LIMIT(SD_CONSOLE | SD_WARNING, "debug " "vmem_alloc(%ld, 0x%x) at %s:%d failed (%lld/%llu)\n", sizeof(kmem_debug_t), flags, func, line, vmem_alloc_used_read(), vmem_alloc_max); @@ -581,7 +581,7 @@ vmem_alloc_track(size_t size, int flags, const char *func, int line) dptr->kd_func = kstrdup(func, flags & ~__GFP_ZERO); if (unlikely(dptr->kd_func == NULL)) { kfree(dptr); - CDEBUG_LIMIT(D_CONSOLE | D_WARNING, + SDEBUG_LIMIT(SD_CONSOLE | SD_WARNING, "debug kstrdup() at %s:%d failed (%lld/%llu)\n", func, line, vmem_alloc_used_read(), vmem_alloc_max); goto out; @@ -593,7 +593,7 @@ vmem_alloc_track(size_t size, int flags, const char *func, int line) if (unlikely(ptr == NULL)) { kfree(dptr->kd_func); kfree(dptr); - CDEBUG_LIMIT(D_CONSOLE | D_WARNING, "vmem_alloc" + SDEBUG_LIMIT(SD_CONSOLE | SD_WARNING, "vmem_alloc" "(%llu, 0x%x) at %s:%d failed (%lld/%llu)\n", (unsigned long long) size, flags, func, line, vmem_alloc_used_read(), vmem_alloc_max); @@ -620,13 +620,13 @@ vmem_alloc_track(size_t size, int flags, const char *func, int line) list_add_tail(&dptr->kd_list, &vmem_list); spin_unlock_irqrestore(&vmem_lock, irq_flags); - CDEBUG_LIMIT(D_INFO, + SDEBUG_LIMIT(SD_INFO, "vmem_alloc(%llu, 0x%x) at %s:%d = %p (%lld/%llu)\n", (unsigned long long) size, flags, func, line, ptr, vmem_alloc_used_read(), vmem_alloc_max); } out: - RETURN(ptr); + SRETURN(ptr); } EXPORT_SYMBOL(vmem_alloc_track); @@ -634,7 +634,7 @@ void vmem_free_track(void *ptr, size_t size) { kmem_debug_t *dptr; - ENTRY; + SENTRY; ASSERTF(ptr || size > 0, "ptr: %p, size: %llu", ptr, (unsigned long long) size); @@ -648,7 +648,7 @@ vmem_free_track(void *ptr, size_t size) (unsigned long long) size, dptr->kd_func, dptr->kd_line); vmem_alloc_used_sub(size); - CDEBUG_LIMIT(D_INFO, "vmem_free(%p, %llu) (%lld/%llu)\n", ptr, + SDEBUG_LIMIT(SD_INFO, "vmem_free(%p, %llu) (%lld/%llu)\n", ptr, (unsigned long long) size, vmem_alloc_used_read(), vmem_alloc_max); @@ -660,7 +660,7 @@ vmem_free_track(void *ptr, size_t size) memset(ptr, 0x5a, size); vfree(ptr); - EXIT; + SEXIT; } EXPORT_SYMBOL(vmem_free_track); @@ -671,12 +671,12 @@ kmem_alloc_debug(size_t size, int flags, const char *func, int line, int node_alloc, int node) { void *ptr; - ENTRY; + SENTRY; /* Marked unlikely because we should never be doing this, * we tolerate to up 2 pages but a single page is best. */ if (unlikely((size > PAGE_SIZE * 2) && !(flags & KM_NODEBUG))) { - CDEBUG(D_CONSOLE | D_WARNING, + SDEBUG(SD_CONSOLE | SD_WARNING, "Large kmem_alloc(%llu, 0x%x) at %s:%d (%lld/%llu)\n", (unsigned long long) size, flags, func, line, kmem_alloc_used_read(), kmem_alloc_max); @@ -694,7 +694,7 @@ kmem_alloc_debug(size_t size, int flags, const char *func, int line, } if (ptr == NULL) { - CDEBUG_LIMIT(D_CONSOLE | D_WARNING, + SDEBUG_LIMIT(SD_CONSOLE | SD_WARNING, "kmem_alloc(%llu, 0x%x) at %s:%d failed (%lld/%llu)\n", (unsigned long long) size, flags, func, line, kmem_alloc_used_read(), kmem_alloc_max); @@ -703,32 +703,32 @@ kmem_alloc_debug(size_t size, int flags, const char *func, int line, if (unlikely(kmem_alloc_used_read() > kmem_alloc_max)) kmem_alloc_max = kmem_alloc_used_read(); - CDEBUG_LIMIT(D_INFO, + SDEBUG_LIMIT(SD_INFO, "kmem_alloc(%llu, 0x%x) at %s:%d = %p (%lld/%llu)\n", (unsigned long long) size, flags, func, line, ptr, kmem_alloc_used_read(), kmem_alloc_max); } - RETURN(ptr); + SRETURN(ptr); } EXPORT_SYMBOL(kmem_alloc_debug); void kmem_free_debug(void *ptr, size_t size) { - ENTRY; + SENTRY; ASSERTF(ptr || size > 0, "ptr: %p, size: %llu", ptr, (unsigned long long) size); kmem_alloc_used_sub(size); - CDEBUG_LIMIT(D_INFO, "kmem_free(%p, %llu) (%lld/%llu)\n", ptr, + SDEBUG_LIMIT(SD_INFO, "kmem_free(%p, %llu) (%lld/%llu)\n", ptr, (unsigned long long) size, kmem_alloc_used_read(), kmem_alloc_max); memset(ptr, 0x5a, size); kfree(ptr); - EXIT; + SEXIT; } EXPORT_SYMBOL(kmem_free_debug); @@ -736,14 +736,14 @@ void * vmem_alloc_debug(size_t size, int flags, const char *func, int line) { void *ptr; - ENTRY; + SENTRY; ASSERT(flags & KM_SLEEP); ptr = __vmalloc(size, (flags | __GFP_HIGHMEM) & ~__GFP_ZERO, PAGE_KERNEL); if (ptr == NULL) { - CDEBUG_LIMIT(D_CONSOLE | D_WARNING, + SDEBUG_LIMIT(SD_CONSOLE | SD_WARNING, "vmem_alloc(%llu, 0x%x) at %s:%d failed (%lld/%llu)\n", (unsigned long long) size, flags, func, line, vmem_alloc_used_read(), vmem_alloc_max); @@ -755,32 +755,32 @@ vmem_alloc_debug(size_t size, int flags, const char *func, int line) if (unlikely(vmem_alloc_used_read() > vmem_alloc_max)) vmem_alloc_max = vmem_alloc_used_read(); - CDEBUG_LIMIT(D_INFO, "vmem_alloc(%llu, 0x%x) = %p " + SDEBUG_LIMIT(SD_INFO, "vmem_alloc(%llu, 0x%x) = %p " "(%lld/%llu)\n", (unsigned long long) size, flags, ptr, vmem_alloc_used_read(), vmem_alloc_max); } - RETURN(ptr); + SRETURN(ptr); } EXPORT_SYMBOL(vmem_alloc_debug); void vmem_free_debug(void *ptr, size_t size) { - ENTRY; + SENTRY; ASSERTF(ptr || size > 0, "ptr: %p, size: %llu", ptr, (unsigned long long) size); vmem_alloc_used_sub(size); - CDEBUG_LIMIT(D_INFO, "vmem_free(%p, %llu) (%lld/%llu)\n", ptr, + SDEBUG_LIMIT(SD_INFO, "vmem_free(%p, %llu) (%lld/%llu)\n", ptr, (unsigned long long) size, vmem_alloc_used_read(), vmem_alloc_max); memset(ptr, 0x5a, size); vfree(ptr); - EXIT; + SEXIT; } EXPORT_SYMBOL(vmem_free_debug); @@ -901,7 +901,7 @@ spl_slab_alloc(spl_kmem_cache_t *skc, int flags) base = kv_alloc(skc, skc->skc_slab_size, flags); if (base == NULL) - RETURN(NULL); + SRETURN(NULL); sks = (spl_kmem_slab_t *)base; sks->sks_magic = SKS_MAGIC; @@ -920,7 +920,7 @@ spl_slab_alloc(spl_kmem_cache_t *skc, int flags) if (skc->skc_flags & KMC_OFFSLAB) { obj = kv_alloc(skc, offslab_size, flags); if (!obj) - GOTO(out, rc = -ENOMEM); + SGOTO(out, rc = -ENOMEM); } else { obj = base + spl_sks_size(skc) + (i * obj_size); } @@ -948,7 +948,7 @@ out: sks = NULL; } - RETURN(sks); + SRETURN(sks); } /* @@ -961,7 +961,7 @@ spl_slab_free(spl_kmem_slab_t *sks, struct list_head *sks_list, struct list_head *sko_list) { spl_kmem_cache_t *skc; - ENTRY; + SENTRY; ASSERT(sks->sks_magic == SKS_MAGIC); ASSERT(sks->sks_ref == 0); @@ -982,7 +982,7 @@ spl_slab_free(spl_kmem_slab_t *sks, list_add(&sks->sks_list, sks_list); list_splice_init(&sks->sks_free_list, sko_list); - EXIT; + SEXIT; } /* @@ -1002,7 +1002,7 @@ spl_slab_reclaim(spl_kmem_cache_t *skc, int count, int flag) LIST_HEAD(sko_list); uint32_t size = 0; int i = 0; - ENTRY; + SENTRY; /* * Move empty slabs and objects which have not been touched in @@ -1057,7 +1057,7 @@ spl_slab_reclaim(spl_kmem_cache_t *skc, int count, int flag) cond_resched(); } - EXIT; + SEXIT; } /* @@ -1136,7 +1136,7 @@ spl_slab_size(spl_kmem_cache_t *skc, uint32_t *objs, uint32_t *size) for (*size = PAGE_SIZE; *size <= max_size; *size *= 2) { *objs = (*size - sks_size) / obj_size; if (*objs >= SPL_KMEM_CACHE_OBJ_PER_SLAB) - RETURN(0); + SRETURN(0); } /* @@ -1147,10 +1147,10 @@ spl_slab_size(spl_kmem_cache_t *skc, uint32_t *objs, uint32_t *size) *size = max_size; *objs = (*size - sks_size) / obj_size; if (*objs >= SPL_KMEM_CACHE_OBJ_PER_SLAB_MIN) - RETURN(0); + SRETURN(0); } - RETURN(-ENOSPC); + SRETURN(-ENOSPC); } /* @@ -1163,7 +1163,7 @@ spl_magazine_size(spl_kmem_cache_t *skc) { uint32_t obj_size = spl_obj_size(skc); int size; - ENTRY; + SENTRY; /* Per-magazine sizes below assume a 4Kib page size */ if (obj_size > (PAGE_SIZE * 256)) @@ -1177,7 +1177,7 @@ spl_magazine_size(spl_kmem_cache_t *skc) else size = 256; - RETURN(size); + SRETURN(size); } /* @@ -1189,7 +1189,7 @@ spl_magazine_alloc(spl_kmem_cache_t *skc, int node) spl_kmem_magazine_t *skm; int size = sizeof(spl_kmem_magazine_t) + sizeof(void *) * skc->skc_mag_size; - ENTRY; + SENTRY; skm = kmem_alloc_node(size, KM_SLEEP, node); if (skm) { @@ -1202,7 +1202,7 @@ spl_magazine_alloc(spl_kmem_cache_t *skc, int node) skm->skm_age = jiffies; } - RETURN(skm); + SRETURN(skm); } /* @@ -1214,12 +1214,12 @@ spl_magazine_free(spl_kmem_magazine_t *skm) int size = sizeof(spl_kmem_magazine_t) + sizeof(void *) * skm->skm_size; - ENTRY; + SENTRY; ASSERT(skm->skm_magic == SKM_MAGIC); ASSERT(skm->skm_avail == 0); kmem_free(skm, size); - EXIT; + SEXIT; } /* @@ -1229,7 +1229,7 @@ static int spl_magazine_create(spl_kmem_cache_t *skc) { int i; - ENTRY; + SENTRY; skc->skc_mag_size = spl_magazine_size(skc); skc->skc_mag_refill = (skc->skc_mag_size + 1) / 2; @@ -1240,7 +1240,7 @@ spl_magazine_create(spl_kmem_cache_t *skc) for (i--; i >= 0; i--) spl_magazine_free(skc->skc_mag[i]); - RETURN(-ENOMEM); + SRETURN(-ENOMEM); } } @@ -1249,7 +1249,7 @@ spl_magazine_create(spl_kmem_cache_t *skc) schedule_delayed_work_on(i, &skc->skc_mag[i]->skm_work, skc->skc_delay / 3 * HZ); - RETURN(0); + SRETURN(0); } /* @@ -1260,7 +1260,7 @@ spl_magazine_destroy(spl_kmem_cache_t *skc) { spl_kmem_magazine_t *skm; int i; - ENTRY; + SENTRY; for_each_online_cpu(i) { skm = skc->skc_mag[i]; @@ -1268,7 +1268,7 @@ spl_magazine_destroy(spl_kmem_cache_t *skc) spl_magazine_free(skm); } - EXIT; + SEXIT; } /* @@ -1300,7 +1300,7 @@ spl_kmem_cache_create(char *name, size_t size, size_t align, { spl_kmem_cache_t *skc; int rc, kmem_flags = KM_SLEEP; - ENTRY; + SENTRY; ASSERTF(!(flags & KMC_NOMAGAZINE), "Bad KMC_NOMAGAZINE (%x)\n", flags); ASSERTF(!(flags & KMC_NOHASH), "Bad KMC_NOHASH (%x)\n", flags); @@ -1321,14 +1321,14 @@ spl_kmem_cache_create(char *name, size_t size, size_t align, skc = (spl_kmem_cache_t *)kmem_zalloc(sizeof(*skc), kmem_flags | KM_NODEBUG); if (skc == NULL) - RETURN(NULL); + SRETURN(NULL); skc->skc_magic = SKC_MAGIC; skc->skc_name_size = strlen(name) + 1; skc->skc_name = (char *)kmem_alloc(skc->skc_name_size, kmem_flags); if (skc->skc_name == NULL) { kmem_free(skc, sizeof(*skc)); - RETURN(NULL); + SRETURN(NULL); } strncpy(skc->skc_name, name, skc->skc_name_size); @@ -1375,11 +1375,11 @@ spl_kmem_cache_create(char *name, size_t size, size_t align, rc = spl_slab_size(skc, &skc->skc_slab_objs, &skc->skc_slab_size); if (rc) - GOTO(out, rc); + SGOTO(out, rc); rc = spl_magazine_create(skc); if (rc) - GOTO(out, rc); + SGOTO(out, rc); spl_init_delayed_work(&skc->skc_work, spl_cache_age, skc); schedule_delayed_work(&skc->skc_work, skc->skc_delay / 3 * HZ); @@ -1388,11 +1388,11 @@ spl_kmem_cache_create(char *name, size_t size, size_t align, list_add_tail(&skc->skc_list, &spl_kmem_cache_list); up_write(&spl_kmem_cache_sem); - RETURN(skc); + SRETURN(skc); out: kmem_free(skc->skc_name, skc->skc_name_size); kmem_free(skc, sizeof(*skc)); - RETURN(NULL); + SRETURN(NULL); } EXPORT_SYMBOL(spl_kmem_cache_create); @@ -1404,7 +1404,7 @@ spl_kmem_cache_destroy(spl_kmem_cache_t *skc) { DECLARE_WAIT_QUEUE_HEAD(wq); int i; - ENTRY; + SENTRY; ASSERT(skc->skc_magic == SKC_MAGIC); @@ -1442,7 +1442,7 @@ spl_kmem_cache_destroy(spl_kmem_cache_t *skc) kmem_free(skc, sizeof(*skc)); - EXIT; + SEXIT; } EXPORT_SYMBOL(spl_kmem_cache_destroy); @@ -1495,7 +1495,7 @@ static spl_kmem_slab_t * spl_cache_grow(spl_kmem_cache_t *skc, int flags) { spl_kmem_slab_t *sks; - ENTRY; + SENTRY; ASSERT(skc->skc_magic == SKC_MAGIC); local_irq_enable(); @@ -1508,13 +1508,13 @@ spl_cache_grow(spl_kmem_cache_t *skc, int flags) */ if (test_bit(KMC_BIT_REAPING, &skc->skc_flags)) { schedule(); - GOTO(out, sks= NULL); + SGOTO(out, sks= NULL); } /* Allocate a new slab for the cache */ sks = spl_slab_alloc(skc, flags | __GFP_NORETRY | KM_NODEBUG); if (sks == NULL) - GOTO(out, sks = NULL); + SGOTO(out, sks = NULL); /* Link the new empty slab in to the end of skc_partial_list. */ spin_lock(&skc->skc_lock); @@ -1525,7 +1525,7 @@ spl_cache_grow(spl_kmem_cache_t *skc, int flags) out: local_irq_disable(); - RETURN(sks); + SRETURN(sks); } /* @@ -1539,7 +1539,7 @@ spl_cache_refill(spl_kmem_cache_t *skc, spl_kmem_magazine_t *skm, int flags) { spl_kmem_slab_t *sks; int rc = 0, refill; - ENTRY; + SENTRY; ASSERT(skc->skc_magic == SKC_MAGIC); ASSERT(skm->skm_magic == SKM_MAGIC); @@ -1554,11 +1554,11 @@ spl_cache_refill(spl_kmem_cache_t *skc, spl_kmem_magazine_t *skm, int flags) sks = spl_cache_grow(skc, flags); if (!sks) - GOTO(out, rc); + SGOTO(out, rc); /* Rescheduled to different CPU skm is not local */ if (skm != skc->skc_mag[smp_processor_id()]) - GOTO(out, rc); + SGOTO(out, rc); /* Potentially rescheduled to the same CPU but * allocations may have occured from this CPU while @@ -1594,7 +1594,7 @@ spl_cache_refill(spl_kmem_cache_t *skc, spl_kmem_magazine_t *skm, int flags) spin_unlock(&skc->skc_lock); out: /* Returns the number of entries added to cache */ - RETURN(rc); + SRETURN(rc); } /* @@ -1605,7 +1605,7 @@ spl_cache_shrink(spl_kmem_cache_t *skc, void *obj) { spl_kmem_slab_t *sks = NULL; spl_kmem_obj_t *sko = NULL; - ENTRY; + SENTRY; ASSERT(skc->skc_magic == SKC_MAGIC); ASSERT(spin_is_locked(&skc->skc_lock)); @@ -1637,7 +1637,7 @@ spl_cache_shrink(spl_kmem_cache_t *skc, void *obj) skc->skc_slab_alloc--; } - EXIT; + SEXIT; } /* @@ -1651,7 +1651,7 @@ static int spl_cache_flush(spl_kmem_cache_t *skc, spl_kmem_magazine_t *skm, int flush) { int i, count = MIN(flush, skm->skm_avail); - ENTRY; + SENTRY; ASSERT(skc->skc_magic == SKC_MAGIC); ASSERT(skm->skm_magic == SKM_MAGIC); @@ -1673,7 +1673,7 @@ spl_cache_flush(spl_kmem_cache_t *skc, spl_kmem_magazine_t *skm, int flush) spin_unlock(&skc->skc_lock); - RETURN(count); + SRETURN(count); } /* @@ -1686,7 +1686,7 @@ spl_kmem_cache_alloc(spl_kmem_cache_t *skc, int flags) spl_kmem_magazine_t *skm; unsigned long irq_flags; void *obj = NULL; - ENTRY; + SENTRY; ASSERT(skc->skc_magic == SKC_MAGIC); ASSERT(!test_bit(KMC_BIT_DESTROY, &skc->skc_flags)); @@ -1712,7 +1712,7 @@ restart: /* Per-CPU cache empty, directly allocate from * the slab and refill the per-CPU cache. */ (void)spl_cache_refill(skc, skm, flags); - GOTO(restart, obj = NULL); + SGOTO(restart, obj = NULL); } local_irq_restore(irq_flags); @@ -1723,7 +1723,7 @@ restart: prefetchw(obj); atomic_dec(&skc->skc_ref); - RETURN(obj); + SRETURN(obj); } EXPORT_SYMBOL(spl_kmem_cache_alloc); @@ -1738,7 +1738,7 @@ spl_kmem_cache_free(spl_kmem_cache_t *skc, void *obj) { spl_kmem_magazine_t *skm; unsigned long flags; - ENTRY; + SENTRY; ASSERT(skc->skc_magic == SKC_MAGIC); ASSERT(!test_bit(KMC_BIT_DESTROY, &skc->skc_flags)); @@ -1762,7 +1762,7 @@ spl_kmem_cache_free(spl_kmem_cache_t *skc, void *obj) local_irq_restore(flags); atomic_dec(&skc->skc_ref); - EXIT; + SEXIT; } EXPORT_SYMBOL(spl_kmem_cache_free); @@ -1814,14 +1814,14 @@ spl_kmem_cache_generic_shrinker(int nr_to_scan, unsigned int gfp_mask) void spl_kmem_cache_reap_now(spl_kmem_cache_t *skc) { - ENTRY; + SENTRY; ASSERT(skc->skc_magic == SKC_MAGIC); ASSERT(!test_bit(KMC_BIT_DESTROY, &skc->skc_flags)); /* Prevent concurrent cache reaping when contended */ if (test_and_set_bit(KMC_BIT_REAPING, &skc->skc_flags)) { - EXIT; + SEXIT; return; } @@ -1834,7 +1834,7 @@ spl_kmem_cache_reap_now(spl_kmem_cache_t *skc) clear_bit(KMC_BIT_REAPING, &skc->skc_flags); atomic_dec(&skc->skc_ref); - EXIT; + SEXIT; } EXPORT_SYMBOL(spl_kmem_cache_reap_now); @@ -1894,7 +1894,7 @@ static int spl_kmem_init_tracking(struct list_head *list, spinlock_t *lock, int size) { int i; - ENTRY; + SENTRY; spin_lock_init(lock); INIT_LIST_HEAD(list); @@ -1902,7 +1902,7 @@ spl_kmem_init_tracking(struct list_head *list, spinlock_t *lock, int size) for (i = 0; i < size; i++) INIT_HLIST_HEAD(&kmem_table[i]); - RETURN(0); + SRETURN(0); } static void @@ -1911,7 +1911,7 @@ spl_kmem_fini_tracking(struct list_head *list, spinlock_t *lock) unsigned long flags; kmem_debug_t *kd; char str[17]; - ENTRY; + SENTRY; spin_lock_irqsave(lock, flags); if (!list_empty(list)) @@ -1924,7 +1924,7 @@ spl_kmem_fini_tracking(struct list_head *list, spinlock_t *lock) kd->kd_func, kd->kd_line); spin_unlock_irqrestore(lock, flags); - EXIT; + SEXIT; } #else /* DEBUG_KMEM && DEBUG_KMEM_TRACKING */ #define spl_kmem_init_tracking(list, lock, size) @@ -2031,7 +2031,7 @@ int spl_kmem_init(void) { int rc = 0; - ENTRY; + SENTRY; init_rwsem(&spl_kmem_cache_sem); INIT_LIST_HEAD(&spl_kmem_cache_list); @@ -2040,7 +2040,7 @@ spl_kmem_init(void) spl_kmem_cache_shrinker = set_shrinker(KMC_DEFAULT_SEEKS, spl_kmem_cache_generic_shrinker); if (spl_kmem_cache_shrinker == NULL) - RETURN(rc = -ENOMEM); + SRETURN(rc = -ENOMEM); #else register_shrinker(&spl_kmem_cache_shrinker); #endif @@ -2052,7 +2052,7 @@ spl_kmem_init(void) spl_kmem_init_tracking(&kmem_list, &kmem_lock, KMEM_TABLE_SIZE); spl_kmem_init_tracking(&vmem_list, &vmem_lock, VMEM_TABLE_SIZE); #endif - RETURN(rc); + SRETURN(rc); } void @@ -2064,20 +2064,20 @@ spl_kmem_fini(void) * at that address to aid in debugging. Performance is not * a serious concern here since it is module unload time. */ if (kmem_alloc_used_read() != 0) - CDEBUG_LIMIT(D_CONSOLE | D_WARNING, + SDEBUG_LIMIT(SD_CONSOLE | SD_WARNING, "kmem leaked %ld/%ld bytes\n", kmem_alloc_used_read(), kmem_alloc_max); if (vmem_alloc_used_read() != 0) - CDEBUG_LIMIT(D_CONSOLE | D_WARNING, + SDEBUG_LIMIT(SD_CONSOLE | SD_WARNING, "vmem leaked %ld/%ld bytes\n", vmem_alloc_used_read(), vmem_alloc_max); spl_kmem_fini_tracking(&kmem_list, &kmem_lock); spl_kmem_fini_tracking(&vmem_list, &vmem_lock); #endif /* DEBUG_KMEM */ - ENTRY; + SENTRY; #ifdef HAVE_SET_SHRINKER remove_shrinker(spl_kmem_cache_shrinker); @@ -2085,5 +2085,5 @@ spl_kmem_fini(void) unregister_shrinker(&spl_kmem_cache_shrinker); #endif - EXIT; + SEXIT; } diff --git a/module/spl/spl-kobj.c b/module/spl/spl-kobj.c index d58a9892b..226a12971 100644 --- a/module/spl/spl-kobj.c +++ b/module/spl/spl-kobj.c @@ -27,11 +27,11 @@ #include #include -#ifdef DEBUG_SUBSYSTEM -#undef DEBUG_SUBSYSTEM +#ifdef SS_DEBUG_SUBSYS +#undef SS_DEBUG_SUBSYS #endif -#define DEBUG_SUBSYSTEM S_KOBJ +#define SS_DEBUG_SUBSYS SS_KOBJ struct _buf * kobj_open_file(const char *name) @@ -39,39 +39,39 @@ kobj_open_file(const char *name) struct _buf *file; vnode_t *vp; int rc; - ENTRY; + SENTRY; file = kmalloc(sizeof(_buf_t), GFP_KERNEL); if (file == NULL) - RETURN((_buf_t *)-1UL); + SRETURN((_buf_t *)-1UL); if ((rc = vn_open(name, UIO_SYSSPACE, FREAD, 0644, &vp, 0, 0))) { kfree(file); - RETURN((_buf_t *)-1UL); + SRETURN((_buf_t *)-1UL); } file->vp = vp; - RETURN(file); + SRETURN(file); } /* kobj_open_file() */ EXPORT_SYMBOL(kobj_open_file); void kobj_close_file(struct _buf *file) { - ENTRY; + SENTRY; VOP_CLOSE(file->vp, 0, 0, 0, 0, 0); VN_RELE(file->vp); kfree(file); - EXIT; + SEXIT; } /* kobj_close_file() */ EXPORT_SYMBOL(kobj_close_file); int kobj_read_file(struct _buf *file, char *buf, ssize_t size, offset_t off) { - ENTRY; - RETURN(vn_rdwr(UIO_READ, file->vp, buf, size, off, + SENTRY; + SRETURN(vn_rdwr(UIO_READ, file->vp, buf, size, off, UIO_SYSSPACE, 0, RLIM64_INFINITY, 0, NULL)); } /* kobj_read_file() */ EXPORT_SYMBOL(kobj_read_file); @@ -81,14 +81,14 @@ kobj_get_filesize(struct _buf *file, uint64_t *size) { vattr_t vap; int rc; - ENTRY; + SENTRY; rc = VOP_GETATTR(file->vp, &vap, 0, 0, NULL); if (rc) - RETURN(rc); + SRETURN(rc); *size = vap.va_size; - RETURN(rc); + SRETURN(rc); } /* kobj_get_filesize() */ EXPORT_SYMBOL(kobj_get_filesize); diff --git a/module/spl/spl-kstat.c b/module/spl/spl-kstat.c index 238f37ae3..5be1c21fc 100644 --- a/module/spl/spl-kstat.c +++ b/module/spl/spl-kstat.c @@ -28,6 +28,12 @@ #include #include +#ifdef SS_DEBUG_SUBSYS +#undef SS_DEBUG_SUBSYS +#endif + +#define SS_DEBUG_SUBSYS SS_KSTAT + static spinlock_t kstat_lock; static struct list_head kstat_list; static kid_t kstat_id; @@ -221,7 +227,7 @@ static void * kstat_seq_data_addr(kstat_t *ksp, loff_t n) { void *rc = NULL; - ENTRY; + SENTRY; switch (ksp->ks_type) { case KSTAT_TYPE_RAW: @@ -243,7 +249,7 @@ kstat_seq_data_addr(kstat_t *ksp, loff_t n) PANIC("Undefined kstat type %d\n", ksp->ks_type); } - RETURN(rc); + SRETURN(rc); } static void * @@ -252,7 +258,7 @@ kstat_seq_start(struct seq_file *f, loff_t *pos) loff_t n = *pos; kstat_t *ksp = (kstat_t *)f->private; ASSERT(ksp->ks_magic == KS_MAGIC); - ENTRY; + SENTRY; spin_lock(&ksp->ks_lock); ksp->ks_snaptime = gethrtime(); @@ -261,9 +267,9 @@ kstat_seq_start(struct seq_file *f, loff_t *pos) kstat_seq_show_headers(f); if (n >= ksp->ks_ndata) - RETURN(NULL); + SRETURN(NULL); - RETURN(kstat_seq_data_addr(ksp, n)); + SRETURN(kstat_seq_data_addr(ksp, n)); } static void * @@ -271,13 +277,13 @@ kstat_seq_next(struct seq_file *f, void *p, loff_t *pos) { kstat_t *ksp = (kstat_t *)f->private; ASSERT(ksp->ks_magic == KS_MAGIC); - ENTRY; + SENTRY; ++*pos; if (*pos >= ksp->ks_ndata) - RETURN(NULL); + SRETURN(NULL); - RETURN(kstat_seq_data_addr(ksp, *pos)); + SRETURN(kstat_seq_data_addr(ksp, *pos)); } static void @@ -401,7 +407,7 @@ __kstat_install(kstat_t *ksp) struct proc_dir_entry *de_module, *de_name; kstat_t *tmp; int rc = 0; - ENTRY; + SENTRY; spin_lock(&kstat_lock); @@ -409,7 +415,7 @@ __kstat_install(kstat_t *ksp) list_for_each_entry(tmp, &kstat_list, ks_list) { if (tmp == ksp) { spin_unlock(&kstat_lock); - GOTO(out, rc = -EEXIST); + SGOTO(out, rc = -EEXIST); } } @@ -420,12 +426,12 @@ __kstat_install(kstat_t *ksp) if (de_module == NULL) { de_module = proc_mkdir(ksp->ks_module, proc_spl_kstat); if (de_module == NULL) - GOTO(out, rc = -EUNATCH); + SGOTO(out, rc = -EUNATCH); } de_name = create_proc_entry(ksp->ks_name, 0444, de_module); if (de_name == NULL) - GOTO(out, rc = -EUNATCH); + SGOTO(out, rc = -EUNATCH); spin_lock(&ksp->ks_lock); ksp->ks_proc = de_name; @@ -439,7 +445,7 @@ out: spin_unlock(&kstat_lock); } - EXIT; + SEXIT; } EXPORT_SYMBOL(__kstat_install); @@ -473,18 +479,18 @@ EXPORT_SYMBOL(__kstat_delete); int kstat_init(void) { - ENTRY; + SENTRY; spin_lock_init(&kstat_lock); INIT_LIST_HEAD(&kstat_list); kstat_id = 0; - RETURN(0); + SRETURN(0); } void kstat_fini(void) { - ENTRY; + SENTRY; ASSERT(list_empty(&kstat_list)); - EXIT; + SEXIT; } diff --git a/module/spl/spl-module.c b/module/spl/spl-module.c index 787a4480e..ee6bd696a 100644 --- a/module/spl/spl-module.c +++ b/module/spl/spl-module.c @@ -27,11 +27,11 @@ #include #include -#ifdef DEBUG_SUBSYSTEM -#undef DEBUG_SUBSYSTEM +#ifdef SS_DEBUG_SUBSYS +#undef SS_DEBUG_SUBSYS #endif -#define DEBUG_SUBSYSTEM S_MODULE +#define SS_DEBUG_SUBSYS SS_MODULE static spinlock_t dev_info_lock = SPIN_LOCK_UNLOCKED; static LIST_HEAD(dev_info_list); @@ -98,7 +98,7 @@ __ddi_create_minor_node(dev_info_t *di, char *name, int spec_type, struct cb_ops *cb_ops; struct file_operations *fops; int rc; - ENTRY; + SENTRY; ASSERT(spec_type == S_IFCHR); ASSERT(minor_num < di->di_minors); @@ -106,12 +106,12 @@ __ddi_create_minor_node(dev_info_t *di, char *name, int spec_type, fops = kzalloc(sizeof(struct file_operations), GFP_KERNEL); if (fops == NULL) - RETURN(DDI_FAILURE); + SRETURN(DDI_FAILURE); cdev = cdev_alloc(); if (cdev == NULL) { kfree(fops); - RETURN(DDI_FAILURE); + SRETURN(DDI_FAILURE); } cdev->ops = fops; @@ -169,11 +169,11 @@ __ddi_create_minor_node(dev_info_t *di, char *name, int spec_type, rc = cdev_add(cdev, di->di_dev, 1); if (rc) { - CERROR("Error adding cdev, %d\n", rc); + SERROR("Error adding cdev, %d\n", rc); kfree(fops); cdev_del(cdev); mutex_exit(&di->di_lock); - RETURN(DDI_FAILURE); + SRETURN(DDI_FAILURE); } spin_lock(&dev_info_lock); @@ -182,7 +182,7 @@ __ddi_create_minor_node(dev_info_t *di, char *name, int spec_type, mutex_exit(&di->di_lock); - RETURN(DDI_SUCCESS); + SRETURN(DDI_SUCCESS); } EXPORT_SYMBOL(__ddi_create_minor_node); @@ -202,18 +202,18 @@ __ddi_remove_minor_node_locked(dev_info_t *di, char *name) void __ddi_remove_minor_node(dev_info_t *di, char *name) { - ENTRY; + SENTRY; mutex_enter(&di->di_lock); __ddi_remove_minor_node_locked(di, name); mutex_exit(&di->di_lock); - EXIT; + SEXIT; } EXPORT_SYMBOL(__ddi_remove_minor_node); int ddi_quiesce_not_needed(dev_info_t *dip) { - RETURN(DDI_SUCCESS); + SRETURN(DDI_SUCCESS); } EXPORT_SYMBOL(ddi_quiesce_not_needed); @@ -280,12 +280,12 @@ __mod_install(struct modlinkage *modlp) struct modldrv *drv = modlp->ml_modldrv; struct dev_info *di; int rc; - ENTRY; + SENTRY; di = dev_info_alloc(modlp->ml_major, modlp->ml_minors, drv->drv_dev_ops); if (di == NULL) - RETURN(ENOMEM); + SRETURN(ENOMEM); /* XXX: Really we need to be calling devo_probe if it's available * and then calling devo_attach for each device discovered. However @@ -294,12 +294,12 @@ __mod_install(struct modlinkage *modlp) rc = drv->drv_dev_ops->devo_attach(di, DDI_ATTACH); if (rc != DDI_SUCCESS) { dev_info_free(di); - RETURN(rc); + SRETURN(rc); } drv->drv_dev_info = di; - RETURN(DDI_SUCCESS); + SRETURN(DDI_SUCCESS); } EXPORT_SYMBOL(__mod_install); @@ -333,16 +333,16 @@ __mod_remove(struct modlinkage *modlp) struct modldrv *drv = modlp->ml_modldrv; struct dev_info *di = drv->drv_dev_info; int rc; - ENTRY; + SENTRY; rc = drv->drv_dev_ops->devo_detach(di, DDI_DETACH); if (rc != DDI_SUCCESS) - RETURN(rc); + SRETURN(rc); dev_info_free(di); drv->drv_dev_info = NULL; - RETURN(DDI_SUCCESS); + SRETURN(DDI_SUCCESS); } EXPORT_SYMBOL(__mod_remove); @@ -350,28 +350,28 @@ int ldi_ident_from_mod(struct modlinkage *modlp, ldi_ident_t *lip) { ldi_ident_t li; - ENTRY; + SENTRY; ASSERT(modlp); ASSERT(lip); li = kmalloc(sizeof(struct ldi_ident), GFP_KERNEL); if (li == NULL) - RETURN(ENOMEM); + SRETURN(ENOMEM); li->li_dev = MKDEV(modlp->ml_major, 0); *lip = li; - RETURN(0); + SRETURN(0); } EXPORT_SYMBOL(ldi_ident_from_mod); void ldi_ident_release(ldi_ident_t lip) { - ENTRY; + SENTRY; ASSERT(lip); kfree(lip); - EXIT; + SEXIT; } EXPORT_SYMBOL(ldi_ident_release); diff --git a/module/spl/spl-proc.c b/module/spl/spl-proc.c index bc6dac5b8..789d8e129 100644 --- a/module/spl/spl-proc.c +++ b/module/spl/spl-proc.c @@ -31,11 +31,11 @@ #include #include -#ifdef DEBUG_SUBSYSTEM -#undef DEBUG_SUBSYSTEM +#ifdef SS_DEBUG_SUBSYS +#undef SS_DEBUG_SUBSYS #endif -#define DEBUG_SUBSYSTEM S_PROC +#define SS_DEBUG_SUBSYS SS_PROC #ifdef DEBUG_KMEM static unsigned long table_min = 0; @@ -217,21 +217,21 @@ SPL_PROC_HANDLER(proc_dobitmasks) int is_printk = (mask == &spl_debug_printk) ? 1 : 0; int size = 512, rc; char *str; - ENTRY; + SENTRY; str = kmem_alloc(size, KM_SLEEP); if (str == NULL) - RETURN(-ENOMEM); + SRETURN(-ENOMEM); if (write) { rc = proc_copyin_string(str, size, buffer, *lenp); if (rc < 0) - RETURN(rc); + SRETURN(rc); rc = spl_debug_str2mask(mask, str, is_subsys); /* Always print BUG/ASSERT to console, so keep this mask */ if (is_printk) - *mask |= D_EMERG; + *mask |= SD_EMERG; *ppos += *lenp; } else { @@ -248,19 +248,19 @@ SPL_PROC_HANDLER(proc_dobitmasks) } kmem_free(str, size); - RETURN(rc); + SRETURN(rc); } SPL_PROC_HANDLER(proc_debug_mb) { char str[32]; int rc, len; - ENTRY; + SENTRY; if (write) { rc = proc_copyin_string(str, sizeof(str), buffer, *lenp); if (rc < 0) - RETURN(rc); + SRETURN(rc); rc = spl_debug_set_mb(simple_strtoul(str, NULL, 0)); *ppos += *lenp; @@ -277,12 +277,12 @@ SPL_PROC_HANDLER(proc_debug_mb) } } - RETURN(rc); + SRETURN(rc); } SPL_PROC_HANDLER(proc_dump_kernel) { - ENTRY; + SENTRY; if (write) { spl_debug_dumplog(0); @@ -291,19 +291,19 @@ SPL_PROC_HANDLER(proc_dump_kernel) *lenp = 0; } - RETURN(0); + SRETURN(0); } SPL_PROC_HANDLER(proc_force_bug) { - ENTRY; + SENTRY; if (write) PANIC("Crashing due to forced panic\n"); else *lenp = 0; - RETURN(0); + SRETURN(0); } SPL_PROC_HANDLER(proc_console_max_delay_cs) @@ -311,7 +311,7 @@ SPL_PROC_HANDLER(proc_console_max_delay_cs) int rc, max_delay_cs; struct ctl_table dummy = *table; long d; - ENTRY; + SENTRY; dummy.data = &max_delay_cs; dummy.proc_handler = &proc_dointvec; @@ -320,14 +320,14 @@ SPL_PROC_HANDLER(proc_console_max_delay_cs) max_delay_cs = 0; rc = spl_proc_dointvec(&dummy,write,filp,buffer,lenp,ppos); if (rc < 0) - RETURN(rc); + SRETURN(rc); if (max_delay_cs <= 0) - RETURN(-EINVAL); + SRETURN(-EINVAL); d = (max_delay_cs * HZ) / 100; if (d == 0 || d < spl_console_min_delay) - RETURN(-EINVAL); + SRETURN(-EINVAL); spl_console_max_delay = d; } else { @@ -335,7 +335,7 @@ SPL_PROC_HANDLER(proc_console_max_delay_cs) rc = spl_proc_dointvec(&dummy,write,filp,buffer,lenp,ppos); } - RETURN(rc); + SRETURN(rc); } SPL_PROC_HANDLER(proc_console_min_delay_cs) @@ -343,7 +343,7 @@ SPL_PROC_HANDLER(proc_console_min_delay_cs) int rc, min_delay_cs; struct ctl_table dummy = *table; long d; - ENTRY; + SENTRY; dummy.data = &min_delay_cs; dummy.proc_handler = &proc_dointvec; @@ -352,14 +352,14 @@ SPL_PROC_HANDLER(proc_console_min_delay_cs) min_delay_cs = 0; rc = spl_proc_dointvec(&dummy,write,filp,buffer,lenp,ppos); if (rc < 0) - RETURN(rc); + SRETURN(rc); if (min_delay_cs <= 0) - RETURN(-EINVAL); + SRETURN(-EINVAL); d = (min_delay_cs * HZ) / 100; if (d == 0 || d > spl_console_max_delay) - RETURN(-EINVAL); + SRETURN(-EINVAL); spl_console_min_delay = d; } else { @@ -367,14 +367,14 @@ SPL_PROC_HANDLER(proc_console_min_delay_cs) rc = spl_proc_dointvec(&dummy,write,filp,buffer,lenp,ppos); } - RETURN(rc); + SRETURN(rc); } SPL_PROC_HANDLER(proc_console_backoff) { int rc, backoff; struct ctl_table dummy = *table; - ENTRY; + SENTRY; dummy.data = &backoff; dummy.proc_handler = &proc_dointvec; @@ -383,10 +383,10 @@ SPL_PROC_HANDLER(proc_console_backoff) backoff = 0; rc = spl_proc_dointvec(&dummy,write,filp,buffer,lenp,ppos); if (rc < 0) - RETURN(rc); + SRETURN(rc); if (backoff <= 0) - RETURN(-EINVAL); + SRETURN(-EINVAL); spl_console_backoff = backoff; } else { @@ -394,7 +394,7 @@ SPL_PROC_HANDLER(proc_console_backoff) rc = spl_proc_dointvec(&dummy,write,filp,buffer,lenp,ppos); } - RETURN(rc); + SRETURN(rc); } #ifdef DEBUG_KMEM @@ -403,7 +403,7 @@ SPL_PROC_HANDLER(proc_domemused) int rc = 0; unsigned long min = 0, max = ~0, val; struct ctl_table dummy = *table; - ENTRY; + SENTRY; dummy.data = &val; dummy.proc_handler = &proc_dointvec; @@ -422,7 +422,7 @@ SPL_PROC_HANDLER(proc_domemused) buffer, lenp, ppos); } - RETURN(rc); + SRETURN(rc); } #endif /* DEBUG_KMEM */ @@ -431,7 +431,7 @@ SPL_PROC_HANDLER(proc_dohostid) int len, rc = 0; int32_t val; char *end, str[32]; - ENTRY; + SENTRY; if (write) { /* We can't use spl_proc_doulongvec_minmax() in the write @@ -439,11 +439,11 @@ SPL_PROC_HANDLER(proc_dohostid) * leading 0x which confuses the helper function. */ rc = proc_copyin_string(str, sizeof(str), buffer, *lenp); if (rc < 0) - RETURN(rc); + SRETURN(rc); val = simple_strtol(str, &end, 16); if (str == end) - RETURN(-EINVAL); + SRETURN(-EINVAL); spl_hostid = (long) val; (void) snprintf(hw_serial, HW_HOSTID_LEN, "%u", @@ -463,7 +463,7 @@ SPL_PROC_HANDLER(proc_dohostid) } } - RETURN(rc); + SRETURN(rc); } #ifndef HAVE_KALLSYMS_LOOKUP_NAME @@ -471,24 +471,24 @@ SPL_PROC_HANDLER(proc_dokallsyms_lookup_name) { int len, rc = 0; char *end, str[32]; - ENTRY; + SENTRY; if (write) { /* This may only be set once at module load time */ if (spl_kallsyms_lookup_name_fn != SYMBOL_POISON) - RETURN(-EEXIST); + SRETURN(-EEXIST); /* We can't use spl_proc_doulongvec_minmax() in the write * case hear because the address while a hex value has no * leading 0x which confuses the helper function. */ rc = proc_copyin_string(str, sizeof(str), buffer, *lenp); if (rc < 0) - RETURN(rc); + SRETURN(rc); spl_kallsyms_lookup_name_fn = (kallsyms_lookup_name_t)simple_strtoul(str, &end, 16); if (str == end) - RETURN(-EINVAL); + SRETURN(-EINVAL); *ppos += *lenp; } else { @@ -505,7 +505,7 @@ SPL_PROC_HANDLER(proc_dokallsyms_lookup_name) } } - RETURN(rc); + SRETURN(rc); } #endif /* HAVE_KALLSYMS_LOOKUP_NAME */ @@ -513,7 +513,7 @@ SPL_PROC_HANDLER(proc_doavailrmem) { int len, rc = 0; char str[32]; - ENTRY; + SENTRY; if (write) { *ppos += *lenp; @@ -531,14 +531,14 @@ SPL_PROC_HANDLER(proc_doavailrmem) } } - RETURN(rc); + SRETURN(rc); } SPL_PROC_HANDLER(proc_dofreemem) { int len, rc = 0; char str[32]; - ENTRY; + SENTRY; if (write) { *ppos += *lenp; @@ -555,7 +555,7 @@ SPL_PROC_HANDLER(proc_dofreemem) } } - RETURN(rc); + SRETURN(rc); } #ifdef DEBUG_KMEM @@ -605,7 +605,7 @@ slab_seq_start(struct seq_file *f, loff_t *pos) { struct list_head *p; loff_t n = *pos; - ENTRY; + SENTRY; down_read(&spl_kmem_cache_sem); if (!n) @@ -615,20 +615,20 @@ slab_seq_start(struct seq_file *f, loff_t *pos) while (n--) { p = p->next; if (p == &spl_kmem_cache_list) - RETURN(NULL); + SRETURN(NULL); } - RETURN(list_entry(p, spl_kmem_cache_t, skc_list)); + SRETURN(list_entry(p, spl_kmem_cache_t, skc_list)); } static void * slab_seq_next(struct seq_file *f, void *p, loff_t *pos) { spl_kmem_cache_t *skc = p; - ENTRY; + SENTRY; ++*pos; - RETURN((skc->skc_list.next == &spl_kmem_cache_list) ? + SRETURN((skc->skc_list.next == &spl_kmem_cache_list) ? NULL : list_entry(skc->skc_list.next,spl_kmem_cache_t,skc_list)); } @@ -1025,33 +1025,33 @@ int proc_init(void) { int rc = 0; - ENTRY; + SENTRY; #ifdef CONFIG_SYSCTL spl_header = spl_register_sysctl_table(spl_root, 0); if (spl_header == NULL) - RETURN(-EUNATCH); + SRETURN(-EUNATCH); #endif /* CONFIG_SYSCTL */ proc_spl = proc_mkdir("spl", NULL); if (proc_spl == NULL) - GOTO(out, rc = -EUNATCH); + SGOTO(out, rc = -EUNATCH); #ifdef DEBUG_KMEM proc_spl_kmem = proc_mkdir("kmem", proc_spl); if (proc_spl_kmem == NULL) - GOTO(out, rc = -EUNATCH); + SGOTO(out, rc = -EUNATCH); proc_spl_kmem_slab = create_proc_entry("slab", 0444, proc_spl_kmem); if (proc_spl_kmem_slab == NULL) - GOTO(out, rc = -EUNATCH); + SGOTO(out, rc = -EUNATCH); proc_spl_kmem_slab->proc_fops = &proc_slab_operations; #endif /* DEBUG_KMEM */ proc_spl_kstat = proc_mkdir("kstat", proc_spl); if (proc_spl_kstat == NULL) - GOTO(out, rc = -EUNATCH); + SGOTO(out, rc = -EUNATCH); out: if (rc) { remove_proc_entry("kstat", proc_spl); @@ -1065,13 +1065,13 @@ out: #endif /* CONFIG_SYSCTL */ } - RETURN(rc); + SRETURN(rc); } void proc_fini(void) { - ENTRY; + SENTRY; remove_proc_entry("kstat", proc_spl); #ifdef DEBUG_KMEM @@ -1085,5 +1085,5 @@ proc_fini(void) spl_unregister_sysctl_table(spl_header); #endif /* CONFIG_SYSCTL */ - EXIT; + SEXIT; } diff --git a/module/spl/spl-taskq.c b/module/spl/spl-taskq.c index d9c83279c..201cb5949 100644 --- a/module/spl/spl-taskq.c +++ b/module/spl/spl-taskq.c @@ -28,11 +28,11 @@ #include #include -#ifdef DEBUG_SUBSYSTEM -#undef DEBUG_SUBSYSTEM +#ifdef SS_DEBUG_SUBSYS +#undef SS_DEBUG_SUBSYS #endif -#define DEBUG_SUBSYSTEM S_TASKQ +#define SS_DEBUG_SUBSYS SS_TASKQ /* Global system-wide dynamic task queue available for all consumers */ taskq_t *system_taskq; @@ -55,7 +55,7 @@ task_alloc(taskq_t *tq, uint_t flags) { spl_task_t *t; int count = 0; - ENTRY; + SENTRY; ASSERT(tq); ASSERT(flags & (TQ_SLEEP | TQ_NOSLEEP)); /* One set */ @@ -66,17 +66,17 @@ retry: if (!list_empty(&tq->tq_free_list) && !(flags & TQ_NEW)) { t = list_entry(tq->tq_free_list.next, spl_task_t, t_list); list_del_init(&t->t_list); - RETURN(t); + SRETURN(t); } /* Free list is empty and memory allocations are prohibited */ if (flags & TQ_NOALLOC) - RETURN(NULL); + SRETURN(NULL); /* Hit maximum spl_task_t pool size */ if (tq->tq_nalloc >= tq->tq_maxalloc) { if (flags & TQ_NOSLEEP) - RETURN(NULL); + SRETURN(NULL); /* Sleep periodically polling the free list for an available * spl_task_t. If a full second passes and we have not found @@ -86,9 +86,9 @@ retry: schedule_timeout(HZ / 100); spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); if (count < 100) - GOTO(retry, count++); + SGOTO(retry, count++); - RETURN(NULL); + SRETURN(NULL); } /* Unreachable, Neither TQ_SLEEP or TQ_NOSLEEP set */ @@ -108,7 +108,7 @@ retry: tq->tq_nalloc++; } - RETURN(t); + SRETURN(t); } /* @@ -118,7 +118,7 @@ retry: static void task_free(taskq_t *tq, spl_task_t *t) { - ENTRY; + SENTRY; ASSERT(tq); ASSERT(t); @@ -128,7 +128,7 @@ task_free(taskq_t *tq, spl_task_t *t) kmem_free(t, sizeof(spl_task_t)); tq->tq_nalloc--; - EXIT; + SEXIT; } /* @@ -138,7 +138,7 @@ task_free(taskq_t *tq, spl_task_t *t) static void task_done(taskq_t *tq, spl_task_t *t) { - ENTRY; + SENTRY; ASSERT(tq); ASSERT(t); ASSERT(spin_is_locked(&tq->tq_lock)); @@ -154,7 +154,7 @@ task_done(taskq_t *tq, spl_task_t *t) task_free(tq, t); } - EXIT; + SEXIT; } /* @@ -190,18 +190,18 @@ taskq_wait_check(taskq_t *tq, taskqid_t id) rc = (id < tq->tq_lowest_id); spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); - RETURN(rc); + SRETURN(rc); } void __taskq_wait_id(taskq_t *tq, taskqid_t id) { - ENTRY; + SENTRY; ASSERT(tq); wait_event(tq->tq_wait_waitq, taskq_wait_check(tq, id)); - EXIT; + SEXIT; } EXPORT_SYMBOL(__taskq_wait_id); @@ -209,7 +209,7 @@ void __taskq_wait(taskq_t *tq) { taskqid_t id; - ENTRY; + SENTRY; ASSERT(tq); /* Wait for the largest outstanding taskqid */ @@ -219,7 +219,7 @@ __taskq_wait(taskq_t *tq) __taskq_wait_id(tq, id); - EXIT; + SEXIT; } EXPORT_SYMBOL(__taskq_wait); @@ -228,16 +228,16 @@ int __taskq_member(taskq_t *tq, void *t) { int i; - ENTRY; + SENTRY; ASSERT(tq); ASSERT(t); for (i = 0; i < tq->tq_nthreads; i++) if (tq->tq_threads[i] == (struct task_struct *)t) - RETURN(1); + SRETURN(1); - RETURN(0); + SRETURN(0); } EXPORT_SYMBOL(__taskq_member); @@ -246,7 +246,7 @@ __taskq_dispatch(taskq_t *tq, task_func_t func, void *arg, uint_t flags) { spl_task_t *t; taskqid_t rc = 0; - ENTRY; + SENTRY; ASSERT(tq); ASSERT(func); @@ -263,15 +263,15 @@ __taskq_dispatch(taskq_t *tq, task_func_t func, void *arg, uint_t flags) /* Taskq being destroyed and all tasks drained */ if (!(tq->tq_flags & TQ_ACTIVE)) - GOTO(out, rc = 0); + SGOTO(out, rc = 0); /* Do not queue the task unless there is idle thread for it */ ASSERT(tq->tq_nactive <= tq->tq_nthreads); if ((flags & TQ_NOQUEUE) && (tq->tq_nactive == tq->tq_nthreads)) - GOTO(out, rc = 0); + SGOTO(out, rc = 0); if ((t = task_alloc(tq, flags)) == NULL) - GOTO(out, rc = 0); + SGOTO(out, rc = 0); spin_lock(&t->t_lock); @@ -290,7 +290,7 @@ __taskq_dispatch(taskq_t *tq, task_func_t func, void *arg, uint_t flags) wake_up(&tq->tq_work_waitq); out: spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); - RETURN(rc); + SRETURN(rc); } EXPORT_SYMBOL(__taskq_dispatch); @@ -305,7 +305,7 @@ taskq_lowest_id(taskq_t *tq) { taskqid_t lowest_id = tq->tq_next_id; spl_task_t *t; - ENTRY; + SENTRY; ASSERT(tq); ASSERT(spin_is_locked(&tq->tq_lock)); @@ -325,7 +325,7 @@ taskq_lowest_id(taskq_t *tq) lowest_id = MIN(lowest_id, t->t_id); } - RETURN(lowest_id); + SRETURN(lowest_id); } /* @@ -338,7 +338,7 @@ taskq_insert_in_order(taskq_t *tq, spl_task_t *t) spl_task_t *w; struct list_head *l; - ENTRY; + SENTRY; ASSERT(tq); ASSERT(t); ASSERT(spin_is_locked(&tq->tq_lock)); @@ -353,7 +353,7 @@ taskq_insert_in_order(taskq_t *tq, spl_task_t *t) if (l == &tq->tq_work_list) list_add(&t->t_list, &tq->tq_work_list); - EXIT; + SEXIT; } static int @@ -365,7 +365,7 @@ taskq_thread(void *args) taskq_t *tq = args; spl_task_t *t; struct list_head *pend_list; - ENTRY; + SENTRY; ASSERT(tq); current->flags |= PF_NOFREEZE; @@ -433,7 +433,7 @@ taskq_thread(void *args) tq->tq_nthreads--; spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); - RETURN(0); + SRETURN(0); } taskq_t * @@ -443,7 +443,7 @@ __taskq_create(const char *name, int nthreads, pri_t pri, taskq_t *tq; struct task_struct *t; int rc = 0, i, j = 0; - ENTRY; + SENTRY; ASSERT(name != NULL); ASSERT(pri <= maxclsyspri); @@ -462,12 +462,12 @@ __taskq_create(const char *name, int nthreads, pri_t pri, tq = kmem_alloc(sizeof(*tq), KM_SLEEP); if (tq == NULL) - RETURN(NULL); + SRETURN(NULL); tq->tq_threads = kmem_alloc(nthreads * sizeof(t), KM_SLEEP); if (tq->tq_threads == NULL) { kmem_free(tq, sizeof(*tq)); - RETURN(NULL); + SRETURN(NULL); } spin_lock_init(&tq->tq_lock); @@ -517,7 +517,7 @@ __taskq_create(const char *name, int nthreads, pri_t pri, tq = NULL; } - RETURN(tq); + SRETURN(tq); } EXPORT_SYMBOL(__taskq_create); @@ -526,7 +526,7 @@ __taskq_destroy(taskq_t *tq) { spl_task_t *t; int i, nthreads; - ENTRY; + SENTRY; ASSERT(tq); spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); @@ -560,29 +560,29 @@ __taskq_destroy(taskq_t *tq) kmem_free(tq->tq_threads, nthreads * sizeof(spl_task_t *)); kmem_free(tq, sizeof(taskq_t)); - EXIT; + SEXIT; } EXPORT_SYMBOL(__taskq_destroy); int spl_taskq_init(void) { - ENTRY; + SENTRY; /* Solaris creates a dynamic taskq of up to 64 threads, however in * a Linux environment 1 thread per-core is usually about right */ system_taskq = taskq_create("spl_system_taskq", num_online_cpus(), minclsyspri, 4, 512, TASKQ_PREPOPULATE); if (system_taskq == NULL) - RETURN(1); + SRETURN(1); - RETURN(0); + SRETURN(0); } void spl_taskq_fini(void) { - ENTRY; + SENTRY; taskq_destroy(system_taskq); - EXIT; + SEXIT; } diff --git a/module/spl/spl-thread.c b/module/spl/spl-thread.c index e28b1261a..5de12ac33 100644 --- a/module/spl/spl-thread.c +++ b/module/spl/spl-thread.c @@ -28,11 +28,11 @@ #include #include -#ifdef DEBUG_SUBSYSTEM -#undef DEBUG_SUBSYSTEM +#ifdef SS_DEBUG_SUBSYS +#undef SS_DEBUG_SUBSYS #endif -#define DEBUG_SUBSYSTEM S_THREAD +#define SS_DEBUG_SUBSYS SS_THREAD /* * Thread interfaces @@ -72,8 +72,8 @@ thread_generic_wrapper(void *arg) void __thread_exit(void) { - ENTRY; - EXIT; + SENTRY; + SEXIT; complete_and_exit(NULL, 0); /* Unreachable */ } @@ -90,7 +90,7 @@ __thread_create(caddr_t stk, size_t stksize, thread_func_t func, thread_priv_t *tp; struct task_struct *tsk; char *p; - ENTRY; + SENTRY; /* Option pp is simply ignored */ /* Variable stack size unsupported */ @@ -98,7 +98,7 @@ __thread_create(caddr_t stk, size_t stksize, thread_func_t func, tp = kmem_alloc(sizeof(thread_priv_t), KM_SLEEP); if (tp == NULL) - RETURN(NULL); + SRETURN(NULL); tp->tp_magic = TP_MAGIC; tp->tp_name_size = strlen(name) + 1; @@ -106,7 +106,7 @@ __thread_create(caddr_t stk, size_t stksize, thread_func_t func, tp->tp_name = kmem_alloc(tp->tp_name_size, KM_SLEEP); if (tp->tp_name == NULL) { kmem_free(tp, sizeof(thread_priv_t)); - RETURN(NULL); + SRETURN(NULL); } strncpy(tp->tp_name, name, tp->tp_name_size); @@ -127,11 +127,11 @@ __thread_create(caddr_t stk, size_t stksize, thread_func_t func, tsk = kthread_create(thread_generic_wrapper, (void *)tp, "%s", tp->tp_name); if (IS_ERR(tsk)) { - CERROR("Failed to create thread: %ld\n", PTR_ERR(tsk)); - RETURN(NULL); + SERROR("Failed to create thread: %ld\n", PTR_ERR(tsk)); + SRETURN(NULL); } wake_up_process(tsk); - RETURN((kthread_t *)tsk); + SRETURN((kthread_t *)tsk); } EXPORT_SYMBOL(__thread_create); diff --git a/module/spl/spl-vnode.c b/module/spl/spl-vnode.c index 840bb6718..9bfead8cf 100644 --- a/module/spl/spl-vnode.c +++ b/module/spl/spl-vnode.c @@ -27,11 +27,11 @@ #include #include -#ifdef DEBUG_SUBSYSTEM -#undef DEBUG_SUBSYSTEM +#ifdef SS_DEBUG_SUBSYS +#undef SS_DEBUG_SUBSYS #endif -#define DEBUG_SUBSYSTEM S_VNODE +#define SS_DEBUG_SUBSYS SS_VNODE vnode_t *rootdir = (vnode_t *)0xabcd1234; EXPORT_SYMBOL(rootdir); @@ -76,7 +76,7 @@ vnode_t * vn_alloc(int flag) { vnode_t *vp; - ENTRY; + SENTRY; vp = kmem_cache_alloc(vn_cache, flag); if (vp != NULL) { @@ -84,16 +84,16 @@ vn_alloc(int flag) vp->v_type = 0; } - RETURN(vp); + SRETURN(vp); } /* vn_alloc() */ EXPORT_SYMBOL(vn_alloc); void vn_free(vnode_t *vp) { - ENTRY; + SENTRY; kmem_cache_free(vn_cache, vp); - EXIT; + SEXIT; } /* vn_free() */ EXPORT_SYMBOL(vn_free); @@ -105,7 +105,7 @@ vn_open(const char *path, uio_seg_t seg, int flags, int mode, struct kstat stat; int rc, saved_umask = 0; vnode_t *vp; - ENTRY; + SENTRY; ASSERT(flags & (FWRITE | FREAD)); ASSERT(seg == UIO_SYSSPACE); @@ -131,18 +131,18 @@ vn_open(const char *path, uio_seg_t seg, int flags, int mode, (void)xchg(¤t->fs->umask, saved_umask); if (IS_ERR(fp)) - RETURN(-PTR_ERR(fp)); + SRETURN(-PTR_ERR(fp)); rc = vfs_getattr(fp->f_vfsmnt, fp->f_dentry, &stat); if (rc) { filp_close(fp, 0); - RETURN(-rc); + SRETURN(-rc); } vp = vn_alloc(KM_SLEEP); if (!vp) { filp_close(fp, 0); - RETURN(ENOMEM); + SRETURN(ENOMEM); } mutex_enter(&vp->v_lock); @@ -151,7 +151,7 @@ vn_open(const char *path, uio_seg_t seg, int flags, int mode, *vpp = vp; mutex_exit(&vp->v_lock); - RETURN(0); + SRETURN(0); } /* vn_open() */ EXPORT_SYMBOL(vn_open); @@ -161,20 +161,20 @@ vn_openat(const char *path, uio_seg_t seg, int flags, int mode, { char *realpath; int len, rc; - ENTRY; + SENTRY; ASSERT(vp == rootdir); len = strlen(path) + 2; realpath = kmalloc(len, GFP_KERNEL); if (!realpath) - RETURN(ENOMEM); + SRETURN(ENOMEM); (void)snprintf(realpath, len, "/%s", path); rc = vn_open(realpath, seg, flags, mode, vpp, x1, x2); kfree(realpath); - RETURN(rc); + SRETURN(rc); } /* vn_openat() */ EXPORT_SYMBOL(vn_openat); @@ -186,7 +186,7 @@ vn_rdwr(uio_rw_t uio, vnode_t *vp, void *addr, ssize_t len, offset_t off, mm_segment_t saved_fs; struct file *fp; int rc; - ENTRY; + SENTRY; ASSERT(uio == UIO_WRITE || uio == UIO_READ); ASSERT(vp); @@ -215,16 +215,16 @@ vn_rdwr(uio_rw_t uio, vnode_t *vp, void *addr, ssize_t len, offset_t off, set_fs(saved_fs); if (rc < 0) - RETURN(-rc); + SRETURN(-rc); if (residp) { *residp = len - rc; } else { if (rc != len) - RETURN(EIO); + SRETURN(EIO); } - RETURN(0); + SRETURN(0); } /* vn_rdwr() */ EXPORT_SYMBOL(vn_rdwr); @@ -232,7 +232,7 @@ int vn_close(vnode_t *vp, int flags, int x1, int x2, void *x3, void *x4) { int rc; - ENTRY; + SENTRY; ASSERT(vp); ASSERT(vp->v_file); @@ -240,7 +240,7 @@ vn_close(vnode_t *vp, int flags, int x1, int x2, void *x3, void *x4) rc = filp_close(vp->v_file, 0); vn_free(vp); - RETURN(-rc); + SRETURN(-rc); } /* vn_close() */ EXPORT_SYMBOL(vn_close); @@ -275,18 +275,18 @@ vn_remove(const char *path, uio_seg_t seg, int flags) struct nameidata nd; struct inode *inode = NULL; int rc = 0; - ENTRY; + SENTRY; ASSERT(seg == UIO_SYSSPACE); ASSERT(flags == RMFILE); rc = path_lookup(path, LOOKUP_PARENT, &nd); if (rc) - GOTO(exit, rc); + SGOTO(exit, rc); rc = -EISDIR; if (nd.last_type != LAST_NORM) - GOTO(exit1, rc); + SGOTO(exit1, rc); #ifdef HAVE_INODE_I_MUTEX mutex_lock_nested(&nd.nd_dentry->d_inode->i_mutex, I_MUTEX_PARENT); @@ -298,7 +298,7 @@ vn_remove(const char *path, uio_seg_t seg, int flags) if (!IS_ERR(dentry)) { /* Why not before? Because we want correct rc value */ if (nd.last.name[nd.last.len]) - GOTO(slashes, rc); + SGOTO(slashes, rc); inode = dentry->d_inode; if (inode) @@ -321,12 +321,12 @@ exit2: exit1: vn_path_release(&nd); exit: - RETURN(-rc); + SRETURN(-rc); slashes: rc = !dentry->d_inode ? -ENOENT : S_ISDIR(dentry->d_inode->i_mode) ? -EISDIR : -ENOTDIR; - GOTO(exit2, rc); + SGOTO(exit2, rc); } /* vn_remove() */ EXPORT_SYMBOL(vn_remove); @@ -339,28 +339,28 @@ vn_rename(const char *oldname, const char *newname, int x1) struct dentry *trap; struct nameidata oldnd, newnd; int rc = 0; - ENTRY; + SENTRY; rc = path_lookup(oldname, LOOKUP_PARENT, &oldnd); if (rc) - GOTO(exit, rc); + SGOTO(exit, rc); rc = path_lookup(newname, LOOKUP_PARENT, &newnd); if (rc) - GOTO(exit1, rc); + SGOTO(exit1, rc); rc = -EXDEV; if (oldnd.nd_mnt != newnd.nd_mnt) - GOTO(exit2, rc); + SGOTO(exit2, rc); old_dir = oldnd.nd_dentry; rc = -EBUSY; if (oldnd.last_type != LAST_NORM) - GOTO(exit2, rc); + SGOTO(exit2, rc); new_dir = newnd.nd_dentry; if (newnd.last_type != LAST_NORM) - GOTO(exit2, rc); + SGOTO(exit2, rc); trap = lock_rename(new_dir, old_dir); @@ -368,36 +368,36 @@ vn_rename(const char *oldname, const char *newname, int x1) rc = PTR_ERR(old_dentry); if (IS_ERR(old_dentry)) - GOTO(exit3, rc); + SGOTO(exit3, rc); /* source must exist */ rc = -ENOENT; if (!old_dentry->d_inode) - GOTO(exit4, rc); + SGOTO(exit4, rc); /* unless the source is a directory trailing slashes give -ENOTDIR */ if (!S_ISDIR(old_dentry->d_inode->i_mode)) { rc = -ENOTDIR; if (oldnd.last.name[oldnd.last.len]) - GOTO(exit4, rc); + SGOTO(exit4, rc); if (newnd.last.name[newnd.last.len]) - GOTO(exit4, rc); + SGOTO(exit4, rc); } /* source should not be ancestor of target */ rc = -EINVAL; if (old_dentry == trap) - GOTO(exit4, rc); + SGOTO(exit4, rc); new_dentry = vn_lookup_hash(&newnd); rc = PTR_ERR(new_dentry); if (IS_ERR(new_dentry)) - GOTO(exit4, rc); + SGOTO(exit4, rc); /* target should not be an ancestor of source */ rc = -ENOTEMPTY; if (new_dentry == trap) - GOTO(exit5, rc); + SGOTO(exit5, rc); #ifdef HAVE_4ARGS_VFS_RENAME rc = vfs_rename(old_dir->d_inode, old_dentry, @@ -417,7 +417,7 @@ exit2: exit1: vn_path_release(&oldnd); exit: - RETURN(-rc); + SRETURN(-rc); } EXPORT_SYMBOL(vn_rename); @@ -427,7 +427,7 @@ vn_getattr(vnode_t *vp, vattr_t *vap, int flags, void *x3, void *x4) struct file *fp; struct kstat stat; int rc; - ENTRY; + SENTRY; ASSERT(vp); ASSERT(vp->v_file); @@ -437,7 +437,7 @@ vn_getattr(vnode_t *vp, vattr_t *vap, int flags, void *x3, void *x4) rc = vfs_getattr(fp->f_vfsmnt, fp->f_dentry, &stat); if (rc) - RETURN(-rc); + SRETURN(-rc); vap->va_type = vn_get_sol_type(stat.mode); vap->va_mode = stat.mode; @@ -457,14 +457,14 @@ vn_getattr(vnode_t *vp, vattr_t *vap, int flags, void *x3, void *x4) vap->va_rdev = stat.rdev; vap->va_blocks = stat.blocks; - RETURN(0); + SRETURN(0); } EXPORT_SYMBOL(vn_getattr); int vn_fsync(vnode_t *vp, int flags, void *x3, void *x4) { int datasync = 0; - ENTRY; + SENTRY; ASSERT(vp); ASSERT(vp->v_file); @@ -472,7 +472,7 @@ int vn_fsync(vnode_t *vp, int flags, void *x3, void *x4) if (flags & FDSYNC) datasync = 1; - RETURN(-spl_filp_fsync(vp->v_file, datasync)); + SRETURN(-spl_filp_fsync(vp->v_file, datasync)); } /* vn_fsync() */ EXPORT_SYMBOL(vn_fsync); @@ -502,7 +502,7 @@ vn_getf(int fd) file_t *fp; vnode_t *vp; int rc = 0; - ENTRY; + SENTRY; /* Already open just take an extra reference */ spin_lock(&vn_file_lock); @@ -511,7 +511,7 @@ vn_getf(int fd) if (fp) { atomic_inc(&fp->f_ref); spin_unlock(&vn_file_lock); - RETURN(fp); + SRETURN(fp); } spin_unlock(&vn_file_lock); @@ -519,7 +519,7 @@ vn_getf(int fd) /* File was not yet opened create the object and setup */ fp = kmem_cache_alloc(vn_file_cache, KM_SLEEP); if (fp == NULL) - GOTO(out, rc); + SGOTO(out, rc); mutex_enter(&fp->f_lock); @@ -529,14 +529,14 @@ vn_getf(int fd) lfp = fget(fd); if (lfp == NULL) - GOTO(out_mutex, rc); + SGOTO(out_mutex, rc); vp = vn_alloc(KM_SLEEP); if (vp == NULL) - GOTO(out_fget, rc); + SGOTO(out_fget, rc); if (vfs_getattr(lfp->f_vfsmnt, lfp->f_dentry, &stat)) - GOTO(out_vnode, rc); + SGOTO(out_vnode, rc); mutex_enter(&vp->v_lock); vp->v_type = vn_get_sol_type(stat.mode); @@ -552,7 +552,7 @@ vn_getf(int fd) spin_unlock(&vn_file_lock); mutex_exit(&fp->f_lock); - RETURN(fp); + SRETURN(fp); out_vnode: vn_free(vp); @@ -562,7 +562,7 @@ out_mutex: mutex_exit(&fp->f_lock); kmem_cache_free(vn_file_cache, fp); out: - RETURN(NULL); + SRETURN(NULL); } /* getf() */ EXPORT_SYMBOL(getf); @@ -582,7 +582,7 @@ void vn_releasef(int fd) { file_t *fp; - ENTRY; + SENTRY; spin_lock(&vn_file_lock); fp = file_find(fd); @@ -590,7 +590,7 @@ vn_releasef(int fd) atomic_dec(&fp->f_ref); if (atomic_read(&fp->f_ref) > 0) { spin_unlock(&vn_file_lock); - EXIT; + SEXIT; return; } @@ -599,7 +599,7 @@ vn_releasef(int fd) } spin_unlock(&vn_file_lock); - EXIT; + SEXIT; return; } /* releasef() */ EXPORT_SYMBOL(releasef); @@ -654,7 +654,7 @@ vn_set_pwd(const char *filename) #endif /* HAVE_2ARGS_SET_FS_PWD */ mm_segment_t saved_fs; int rc; - ENTRY; + SENTRY; /* * user_path_dir() and __user_walk() both expect 'filename' to be @@ -668,11 +668,11 @@ vn_set_pwd(const char *filename) # ifdef HAVE_USER_PATH_DIR rc = user_path_dir(filename, &path); if (rc) - GOTO(out, rc); + SGOTO(out, rc); rc = inode_permission(path.dentry->d_inode, MAY_EXEC | MAY_ACCESS); if (rc) - GOTO(dput_and_out, rc); + SGOTO(dput_and_out, rc); set_fs_pwd(current->fs, &path); @@ -682,11 +682,11 @@ dput_and_out: rc = __user_walk(filename, LOOKUP_FOLLOW|LOOKUP_DIRECTORY|LOOKUP_CHDIR, &nd); if (rc) - GOTO(out, rc); + SGOTO(out, rc); rc = vfs_permission(&nd, MAY_EXEC); if (rc) - GOTO(dput_and_out, rc); + SGOTO(dput_and_out, rc); set_fs_pwd(current->fs, &nd.path); @@ -697,11 +697,11 @@ dput_and_out: rc = __user_walk(filename, LOOKUP_FOLLOW|LOOKUP_DIRECTORY|LOOKUP_CHDIR, &nd); if (rc) - GOTO(out, rc); + SGOTO(out, rc); rc = vfs_permission(&nd, MAY_EXEC); if (rc) - GOTO(dput_and_out, rc); + SGOTO(dput_and_out, rc); set_fs_pwd(current->fs, nd.nd_mnt, nd.nd_dentry); @@ -711,7 +711,7 @@ dput_and_out: out: set_fs(saved_fs); - RETURN(-rc); + SRETURN(-rc); } /* vn_set_pwd() */ EXPORT_SYMBOL(vn_set_pwd); @@ -756,7 +756,7 @@ vn_file_cache_destructor(void *buf, void *cdrarg) int vn_init(void) { - ENTRY; + SENTRY; vn_cache = kmem_cache_create("spl_vn_cache", sizeof(struct vnode), 64, vn_cache_constructor, @@ -768,7 +768,7 @@ vn_init(void) vn_file_cache_constructor, vn_file_cache_destructor, NULL, NULL, NULL, 0); - RETURN(0); + SRETURN(0); } /* vn_init() */ void @@ -776,7 +776,7 @@ vn_fini(void) { file_t *fp, *next_fp; int leaked = 0; - ENTRY; + SENTRY; spin_lock(&vn_file_lock); @@ -791,10 +791,10 @@ vn_fini(void) spin_unlock(&vn_file_lock); if (leaked > 0) - CWARN("Warning %d files leaked\n", leaked); + SWARN("Warning %d files leaked\n", leaked); kmem_cache_destroy(vn_cache); - EXIT; + SEXIT; return; } /* vn_fini() */ diff --git a/module/spl/spl-xdr.c b/module/spl/spl-xdr.c index 375b74e53..eba470a4b 100644 --- a/module/spl/spl-xdr.c +++ b/module/spl/spl-xdr.c @@ -29,6 +29,12 @@ #include #include +#ifdef SS_DEBUG_SUBSYS +#undef SS_DEBUG_SUBSYS +#endif + +#define SS_DEBUG_SUBSYS SS_XDR + /* * SPL's XDR mem implementation. * @@ -144,7 +150,7 @@ xdrmem_create(XDR *xdrs, const caddr_t addr, const uint_t size, xdrs->x_ops = &xdrmem_decode_ops; break; default: - CWARN("Invalid op value: %d\n", op); + SWARN("Invalid op value: %d\n", op); xdrs->x_ops = NULL; /* Let the caller know we failed */ return; } @@ -154,7 +160,7 @@ xdrmem_create(XDR *xdrs, const caddr_t addr, const uint_t size, xdrs->x_addr_end = addr + size; if (xdrs->x_addr_end < xdrs->x_addr) { - CWARN("Overflow while creating xdrmem: %p, %u\n", addr, size); + SWARN("Overflow while creating xdrmem: %p, %u\n", addr, size); xdrs->x_ops = NULL; } } @@ -166,7 +172,7 @@ xdrmem_control(XDR *xdrs, int req, void *info) struct xdr_bytesrec *rec = (struct xdr_bytesrec *) info; if (req != XDR_GET_BYTES_AVAIL) { - CWARN("Called with unknown request: %d\n", req); + SWARN("Called with unknown request: %d\n", req); return FALSE; } -- cgit v1.2.3 From 26f7245c7cfa77f25aedf1a500db689343644ead Mon Sep 17 00:00:00 2001 From: "Ricardo M. Correia" Date: Mon, 2 Aug 2010 09:24:01 +0000 Subject: Fix taskq code to not drop tasks when TQ_SLEEP is used. When TQ_SLEEP is used, taskq_dispatch() should always succeed even if the number of pending tasks is above tq->tq_maxalloc. This semantic is similar to KM_SLEEP in kmem allocations, which also always succeed. However, we cannot block forever otherwise there is a risk of deadlock. Therefore, we still allow the number of pending tasks to go above tq->tq_maxalloc with TQ_SLEEP, but we may sleep up to 1 second per task dispatch, thereby throttling the task dispatch rate. One of the existing splat tests was also augmented to test for this scenario. The test would fail with the previous implementation but now it succeeds. Signed-off-by: Brian Behlendorf --- module/spl/spl-taskq.c | 47 +++++++++++++++++++++++----------------------- module/splat/splat-taskq.c | 29 +++++++++++++++++++++++----- 2 files changed, 48 insertions(+), 28 deletions(-) (limited to 'module/spl/spl-taskq.c') diff --git a/module/spl/spl-taskq.c b/module/spl/spl-taskq.c index 201cb5949..5a17f1ccf 100644 --- a/module/spl/spl-taskq.c +++ b/module/spl/spl-taskq.c @@ -78,35 +78,36 @@ retry: if (flags & TQ_NOSLEEP) SRETURN(NULL); - /* Sleep periodically polling the free list for an available - * spl_task_t. If a full second passes and we have not found - * one gives up and return a NULL to the caller. */ - if (flags & TQ_SLEEP) { - spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); - schedule_timeout(HZ / 100); - spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); - if (count < 100) - SGOTO(retry, count++); - - SRETURN(NULL); - } - - /* Unreachable, Neither TQ_SLEEP or TQ_NOSLEEP set */ - PANIC("Neither TQ_SLEEP or TQ_NOSLEEP set"); + /* + * Sleep periodically polling the free list for an available + * spl_task_t. Dispatching with TQ_SLEEP should always succeed + * but we cannot block forever waiting for an spl_taskq_t to + * show up in the free list, otherwise a deadlock can happen. + * + * Therefore, we need to allocate a new task even if the number + * of allocated tasks is above tq->tq_maxalloc, but we still + * end up delaying the task allocation by one second, thereby + * throttling the task dispatch rate. + */ + spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); + schedule_timeout(HZ / 100); + spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); + if (count < 100) + SGOTO(retry, count++); } - spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); + spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); t = kmem_alloc(sizeof(spl_task_t), flags & (TQ_SLEEP | TQ_NOSLEEP)); spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); - if (t) { - spin_lock_init(&t->t_lock); + if (t) { + spin_lock_init(&t->t_lock); INIT_LIST_HEAD(&t->t_list); - t->t_id = 0; - t->t_func = NULL; - t->t_arg = NULL; - tq->tq_nalloc++; - } + t->t_id = 0; + t->t_func = NULL; + t->t_arg = NULL; + tq->tq_nalloc++; + } SRETURN(t); } diff --git a/module/splat/splat-taskq.c b/module/splat/splat-taskq.c index d4540f37a..a7c537236 100644 --- a/module/splat/splat-taskq.c +++ b/module/splat/splat-taskq.c @@ -296,6 +296,10 @@ splat_taskq_test3(struct file *file, void *arg) * Then use taskq_wait() to block until all the tasks complete, then * cross check that all the tasks ran by checking tg_arg->count which * is incremented in the task function. Finally cleanup the taskq. + * + * First we try with a large 'maxalloc' value, then we try with a small one. + * We should not drop tasks when TQ_SLEEP is used in taskq_dispatch(), even + * if the number of pending tasks is above maxalloc. */ static void splat_taskq_test4_func(void *arg) @@ -307,16 +311,18 @@ splat_taskq_test4_func(void *arg) } static int -splat_taskq_test4(struct file *file, void *arg) +splat_taskq_test4_common(struct file *file, void *arg, int minalloc, + int maxalloc, int nr_tasks) { taskq_t *tq; splat_taskq_arg_t tq_arg; int i, j, rc = 0; - splat_vprint(file, SPLAT_TASKQ_TEST4_NAME, "Taskq '%s' creating\n", - SPLAT_TASKQ_TEST4_NAME); + splat_vprint(file, SPLAT_TASKQ_TEST4_NAME, "Taskq '%s' creating " + "(%d/%d/%d)\n", SPLAT_TASKQ_TEST4_NAME, minalloc, maxalloc, + nr_tasks); if ((tq = taskq_create(SPLAT_TASKQ_TEST4_NAME, 1, maxclsyspri, - 50, INT_MAX, TASKQ_PREPOPULATE)) == NULL) { + minalloc, maxalloc, TASKQ_PREPOPULATE)) == NULL) { splat_vprint(file, SPLAT_TASKQ_TEST4_NAME, "Taskq '%s' create failed\n", SPLAT_TASKQ_TEST4_NAME); @@ -326,7 +332,7 @@ splat_taskq_test4(struct file *file, void *arg) tq_arg.file = file; tq_arg.name = SPLAT_TASKQ_TEST4_NAME; - for (i = 1; i <= 1024; i *= 2) { + for (i = 1; i <= nr_tasks; i *= 2) { atomic_set(&tq_arg.count, 0); splat_vprint(file, SPLAT_TASKQ_TEST4_NAME, "Taskq '%s' function '%s' dispatched %d times\n", @@ -364,6 +370,19 @@ out: return rc; } +static int splat_taskq_test4(struct file *file, void *arg) +{ + int rc; + + rc = splat_taskq_test4_common(file, arg, 50, INT_MAX, 1024); + if (rc) + return rc; + + rc = splat_taskq_test4_common(file, arg, 1, 1, 32); + + return rc; +} + /* * Create a taskq and dispatch a specific sequence of tasks carefully * crafted to validate the order in which tasks are processed. When -- cgit v1.2.3 From 372c2572336468cbf60272aa7e735b7ca0c3807c Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Fri, 6 May 2011 15:21:58 -0700 Subject: Add TASKQ_NORECLAIM flag It has become necessary to be able to optionally disable direct memory reclaim for certain taskqs. To support this the TASKQ_NORECLAIM flags has been added which sets the PF_MEMALLOC bit for all threads in the taskq. --- include/sys/taskq.h | 1 + module/spl/spl-taskq.c | 4 ++++ 2 files changed, 5 insertions(+) (limited to 'module/spl/spl-taskq.c') diff --git a/include/sys/taskq.h b/include/sys/taskq.h index c83409d49..57f8b1cb5 100644 --- a/include/sys/taskq.h +++ b/include/sys/taskq.h @@ -40,6 +40,7 @@ #define TASKQ_DYNAMIC 0x00000004 #define TASKQ_THREADS_CPU_PCT 0x00000008 #define TASKQ_DC_BATCH 0x00000010 +#define TASKQ_NORECLAIM 0x00000020 typedef unsigned long taskqid_t; typedef void (task_func_t)(void *); diff --git a/module/spl/spl-taskq.c b/module/spl/spl-taskq.c index 5a17f1ccf..f9ee57035 100644 --- a/module/spl/spl-taskq.c +++ b/module/spl/spl-taskq.c @@ -371,6 +371,10 @@ taskq_thread(void *args) ASSERT(tq); current->flags |= PF_NOFREEZE; + /* Disable the direct memory reclaim path */ + if (tq->tq_flags & TASKQ_NORECLAIM) + current->flags |= PF_MEMALLOC; + sigfillset(&blocked); sigprocmask(SIG_BLOCK, &blocked, NULL); flush_signals(current); -- cgit v1.2.3 From 046a70c93b2951bd4c705fb09592d2555a8858f0 Mon Sep 17 00:00:00 2001 From: Prakash Surya Date: Fri, 11 Nov 2011 15:06:35 -0800 Subject: Replace struct spl_task with struct taskq_ent The spl_task structure was renamed to taskq_ent, and all of its fields were renamed to have a prefix of 'tqent' rather than 't'. This was to align with the naming convention which the ZFS code assumes. Previously these fields were private so the name never mattered. Signed-off-by: Prakash Surya Signed-off-by: Brian Behlendorf Issue #65 --- module/spl/spl-taskq.c | 125 ++++++++++++++++++++++++------------------------- 1 file changed, 62 insertions(+), 63 deletions(-) (limited to 'module/spl/spl-taskq.c') diff --git a/module/spl/spl-taskq.c b/module/spl/spl-taskq.c index f9ee57035..50d32e021 100644 --- a/module/spl/spl-taskq.c +++ b/module/spl/spl-taskq.c @@ -38,22 +38,22 @@ taskq_t *system_taskq; EXPORT_SYMBOL(system_taskq); -typedef struct spl_task { - spinlock_t t_lock; - struct list_head t_list; - taskqid_t t_id; - task_func_t *t_func; - void *t_arg; -} spl_task_t; +typedef struct taskq_ent { + spinlock_t tqent_lock; + struct list_head tqent_list; + taskqid_t tqent_id; + task_func_t *tqent_func; + void *tqent_arg; +} taskq_ent_t; /* * NOTE: Must be called with tq->tq_lock held, returns a list_t which * is not attached to the free, work, or pending taskq lists. */ -static spl_task_t * +static taskq_ent_t * task_alloc(taskq_t *tq, uint_t flags) { - spl_task_t *t; + taskq_ent_t *t; int count = 0; SENTRY; @@ -62,10 +62,10 @@ task_alloc(taskq_t *tq, uint_t flags) ASSERT(!((flags & TQ_SLEEP) && (flags & TQ_NOSLEEP))); /* Not both */ ASSERT(spin_is_locked(&tq->tq_lock)); retry: - /* Acquire spl_task_t's from free list if available */ + /* Acquire taskq_ent_t's from free list if available */ if (!list_empty(&tq->tq_free_list) && !(flags & TQ_NEW)) { - t = list_entry(tq->tq_free_list.next, spl_task_t, t_list); - list_del_init(&t->t_list); + t = list_entry(tq->tq_free_list.next, taskq_ent_t, tqent_list); + list_del_init(&t->tqent_list); SRETURN(t); } @@ -73,15 +73,15 @@ retry: if (flags & TQ_NOALLOC) SRETURN(NULL); - /* Hit maximum spl_task_t pool size */ + /* Hit maximum taskq_ent_t pool size */ if (tq->tq_nalloc >= tq->tq_maxalloc) { if (flags & TQ_NOSLEEP) SRETURN(NULL); /* * Sleep periodically polling the free list for an available - * spl_task_t. Dispatching with TQ_SLEEP should always succeed - * but we cannot block forever waiting for an spl_taskq_t to + * taskq_ent_t. Dispatching with TQ_SLEEP should always succeed + * but we cannot block forever waiting for an taskq_entq_t to * show up in the free list, otherwise a deadlock can happen. * * Therefore, we need to allocate a new task even if the number @@ -97,15 +97,15 @@ retry: } spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); - t = kmem_alloc(sizeof(spl_task_t), flags & (TQ_SLEEP | TQ_NOSLEEP)); + t = kmem_alloc(sizeof(taskq_ent_t), flags & (TQ_SLEEP | TQ_NOSLEEP)); spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); if (t) { - spin_lock_init(&t->t_lock); - INIT_LIST_HEAD(&t->t_list); - t->t_id = 0; - t->t_func = NULL; - t->t_arg = NULL; + spin_lock_init(&t->tqent_lock); + INIT_LIST_HEAD(&t->tqent_list); + t->tqent_id = 0; + t->tqent_func = NULL; + t->tqent_arg = NULL; tq->tq_nalloc++; } @@ -113,20 +113,20 @@ retry: } /* - * NOTE: Must be called with tq->tq_lock held, expects the spl_task_t + * NOTE: Must be called with tq->tq_lock held, expects the taskq_ent_t * to already be removed from the free, work, or pending taskq lists. */ static void -task_free(taskq_t *tq, spl_task_t *t) +task_free(taskq_t *tq, taskq_ent_t *t) { SENTRY; ASSERT(tq); ASSERT(t); ASSERT(spin_is_locked(&tq->tq_lock)); - ASSERT(list_empty(&t->t_list)); + ASSERT(list_empty(&t->tqent_list)); - kmem_free(t, sizeof(spl_task_t)); + kmem_free(t, sizeof(taskq_ent_t)); tq->tq_nalloc--; SEXIT; @@ -134,23 +134,23 @@ task_free(taskq_t *tq, spl_task_t *t) /* * NOTE: Must be called with tq->tq_lock held, either destroys the - * spl_task_t if too many exist or moves it to the free list for later use. + * taskq_ent_t if too many exist or moves it to the free list for later use. */ static void -task_done(taskq_t *tq, spl_task_t *t) +task_done(taskq_t *tq, taskq_ent_t *t) { SENTRY; ASSERT(tq); ASSERT(t); ASSERT(spin_is_locked(&tq->tq_lock)); - list_del_init(&t->t_list); + list_del_init(&t->tqent_list); if (tq->tq_nalloc <= tq->tq_minalloc) { - t->t_id = 0; - t->t_func = NULL; - t->t_arg = NULL; - list_add_tail(&t->t_list, &tq->tq_free_list); + t->tqent_id = 0; + t->tqent_func = NULL; + t->tqent_arg = NULL; + list_add_tail(&t->tqent_list, &tq->tq_free_list); } else { task_free(tq, t); } @@ -245,7 +245,7 @@ EXPORT_SYMBOL(__taskq_member); taskqid_t __taskq_dispatch(taskq_t *tq, task_func_t func, void *arg, uint_t flags) { - spl_task_t *t; + taskq_ent_t *t; taskqid_t rc = 0; SENTRY; @@ -274,19 +274,19 @@ __taskq_dispatch(taskq_t *tq, task_func_t func, void *arg, uint_t flags) if ((t = task_alloc(tq, flags)) == NULL) SGOTO(out, rc = 0); - spin_lock(&t->t_lock); + spin_lock(&t->tqent_lock); /* Queue to the priority list instead of the pending list */ if (flags & TQ_FRONT) - list_add_tail(&t->t_list, &tq->tq_prio_list); + list_add_tail(&t->tqent_list, &tq->tq_prio_list); else - list_add_tail(&t->t_list, &tq->tq_pend_list); + list_add_tail(&t->tqent_list, &tq->tq_pend_list); - t->t_id = rc = tq->tq_next_id; + t->tqent_id = rc = tq->tq_next_id; tq->tq_next_id++; - t->t_func = func; - t->t_arg = arg; - spin_unlock(&t->t_lock); + t->tqent_func = func; + t->tqent_arg = arg; + spin_unlock(&t->tqent_lock); wake_up(&tq->tq_work_waitq); out: @@ -294,7 +294,6 @@ out: SRETURN(rc); } EXPORT_SYMBOL(__taskq_dispatch); - /* * Returns the lowest incomplete taskqid_t. The taskqid_t may * be queued on the pending list, on the priority list, or on @@ -305,25 +304,25 @@ static taskqid_t taskq_lowest_id(taskq_t *tq) { taskqid_t lowest_id = tq->tq_next_id; - spl_task_t *t; + taskq_ent_t *t; SENTRY; ASSERT(tq); ASSERT(spin_is_locked(&tq->tq_lock)); if (!list_empty(&tq->tq_pend_list)) { - t = list_entry(tq->tq_pend_list.next, spl_task_t, t_list); - lowest_id = MIN(lowest_id, t->t_id); + t = list_entry(tq->tq_pend_list.next, taskq_ent_t, tqent_list); + lowest_id = MIN(lowest_id, t->tqent_id); } if (!list_empty(&tq->tq_prio_list)) { - t = list_entry(tq->tq_prio_list.next, spl_task_t, t_list); - lowest_id = MIN(lowest_id, t->t_id); + t = list_entry(tq->tq_prio_list.next, taskq_ent_t, tqent_list); + lowest_id = MIN(lowest_id, t->tqent_id); } if (!list_empty(&tq->tq_work_list)) { - t = list_entry(tq->tq_work_list.next, spl_task_t, t_list); - lowest_id = MIN(lowest_id, t->t_id); + t = list_entry(tq->tq_work_list.next, taskq_ent_t, tqent_list); + lowest_id = MIN(lowest_id, t->tqent_id); } SRETURN(lowest_id); @@ -334,9 +333,9 @@ taskq_lowest_id(taskq_t *tq) * taskqid. */ static void -taskq_insert_in_order(taskq_t *tq, spl_task_t *t) +taskq_insert_in_order(taskq_t *tq, taskq_ent_t *t) { - spl_task_t *w; + taskq_ent_t *w; struct list_head *l; SENTRY; @@ -345,14 +344,14 @@ taskq_insert_in_order(taskq_t *tq, spl_task_t *t) ASSERT(spin_is_locked(&tq->tq_lock)); list_for_each_prev(l, &tq->tq_work_list) { - w = list_entry(l, spl_task_t, t_list); - if (w->t_id < t->t_id) { - list_add(&t->t_list, l); + w = list_entry(l, taskq_ent_t, tqent_list); + if (w->tqent_id < t->tqent_id) { + list_add(&t->tqent_list, l); break; } } if (l == &tq->tq_work_list) - list_add(&t->t_list, &tq->tq_work_list); + list_add(&t->tqent_list, &tq->tq_work_list); SEXIT; } @@ -364,7 +363,7 @@ taskq_thread(void *args) sigset_t blocked; taskqid_t id; taskq_t *tq = args; - spl_task_t *t; + taskq_ent_t *t; struct list_head *pend_list; SENTRY; @@ -406,18 +405,18 @@ taskq_thread(void *args) pend_list = NULL; if (pend_list) { - t = list_entry(pend_list->next, spl_task_t, t_list); - list_del_init(&t->t_list); + t = list_entry(pend_list->next, taskq_ent_t, tqent_list); + list_del_init(&t->tqent_list); taskq_insert_in_order(tq, t); tq->tq_nactive++; spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); /* Perform the requested task */ - t->t_func(t->t_arg); + t->tqent_func(t->tqent_arg); spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); tq->tq_nactive--; - id = t->t_id; + id = t->tqent_id; task_done(tq, t); /* When the current lowest outstanding taskqid is @@ -529,7 +528,7 @@ EXPORT_SYMBOL(__taskq_create); void __taskq_destroy(taskq_t *tq) { - spl_task_t *t; + taskq_ent_t *t; int i, nthreads; SENTRY; @@ -549,8 +548,8 @@ __taskq_destroy(taskq_t *tq) spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); while (!list_empty(&tq->tq_free_list)) { - t = list_entry(tq->tq_free_list.next, spl_task_t, t_list); - list_del_init(&t->t_list); + t = list_entry(tq->tq_free_list.next, taskq_ent_t, tqent_list); + list_del_init(&t->tqent_list); task_free(tq, t); } @@ -562,7 +561,7 @@ __taskq_destroy(taskq_t *tq) ASSERT(list_empty(&tq->tq_prio_list)); spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); - kmem_free(tq->tq_threads, nthreads * sizeof(spl_task_t *)); + kmem_free(tq->tq_threads, nthreads * sizeof(taskq_ent_t *)); kmem_free(tq, sizeof(taskq_t)); SEXIT; -- cgit v1.2.3 From 2c02b71b1411176905228666abf7a50a2e5f85dc Mon Sep 17 00:00:00 2001 From: Prakash Surya Date: Mon, 5 Dec 2011 17:32:48 -0800 Subject: Replace tq_work_list and tq_threads in taskq_t To lay the ground work for introducing the taskq_dispatch_prealloc() interface, the tq_work_list and tq_threads fields had to be replaced with new alternatives in the taskq_t structure. The tq_threads field was replaced with tq_thread_list. Rather than storing the pointers to the taskq's kernel threads in an array, they are now stored as a list. In addition to laying the ground work for the taskq_dispatch_prealloc() interface, this change could also enable taskq threads to be dynamically created and destroyed as threads can now be added and removed to this list relatively easily. The tq_work_list field was replaced with tq_active_list. Instead of keeping a list of taskq_ent_t's which are currently being serviced, a list of taskq_threads currently servicing a taskq_ent_t is kept. This frees up the taskq_ent_t's tqent_list field when it is being serviced (i.e. now when a taskq_ent_t is being serviced, it's tqent_list field will be empty). Signed-off-by: Prakash Surya Signed-off-by: Brian Behlendorf Issue #65 --- include/sys/taskq.h | 20 +++++++- module/spl/spl-taskq.c | 132 ++++++++++++++++++++++++++++--------------------- 2 files changed, 95 insertions(+), 57 deletions(-) (limited to 'module/spl/spl-taskq.c') diff --git a/include/sys/taskq.h b/include/sys/taskq.h index 57f8b1cb5..4ea29cb3b 100644 --- a/include/sys/taskq.h +++ b/include/sys/taskq.h @@ -45,6 +45,14 @@ typedef unsigned long taskqid_t; typedef void (task_func_t)(void *); +typedef struct taskq_ent { + spinlock_t tqent_lock; + struct list_head tqent_list; + taskqid_t tqent_id; + task_func_t *tqent_func; + void *tqent_arg; +} taskq_ent_t; + /* * Flags for taskq_dispatch. TQ_SLEEP/TQ_NOSLEEP should be same as * KM_SLEEP/KM_NOSLEEP. TQ_NOQUEUE/TQ_NOALLOC are set particularly @@ -61,8 +69,9 @@ typedef void (task_func_t)(void *); typedef struct taskq { spinlock_t tq_lock; /* protects taskq_t */ unsigned long tq_lock_flags; /* interrupt state */ - struct task_struct **tq_threads; /* thread pointers */ const char *tq_name; /* taskq name */ + struct list_head tq_thread_list;/* list of all threads */ + struct list_head tq_active_list;/* list of active threads */ int tq_nactive; /* # of active threads */ int tq_nthreads; /* # of total threads */ int tq_pri; /* priority */ @@ -73,13 +82,20 @@ typedef struct taskq { taskqid_t tq_next_id; /* next pend/work id */ taskqid_t tq_lowest_id; /* lowest pend/work id */ struct list_head tq_free_list; /* free task_t's */ - struct list_head tq_work_list; /* work task_t's */ struct list_head tq_pend_list; /* pending task_t's */ struct list_head tq_prio_list; /* priority pending task_t's */ wait_queue_head_t tq_work_waitq; /* new work waitq */ wait_queue_head_t tq_wait_waitq; /* wait waitq */ } taskq_t; +typedef struct taskq_thread { + struct list_head tqt_thread_list; + struct list_head tqt_active_list; + struct task_struct *tqt_thread; + taskq_t *tqt_tq; + taskq_ent_t *tqt_ent; +} taskq_thread_t; + /* Global system-wide dynamic task queue available for all consumers */ extern taskq_t *system_taskq; diff --git a/module/spl/spl-taskq.c b/module/spl/spl-taskq.c index 50d32e021..5c22544b8 100644 --- a/module/spl/spl-taskq.c +++ b/module/spl/spl-taskq.c @@ -38,14 +38,6 @@ taskq_t *system_taskq; EXPORT_SYMBOL(system_taskq); -typedef struct taskq_ent { - spinlock_t tqent_lock; - struct list_head tqent_list; - taskqid_t tqent_id; - task_func_t *tqent_func; - void *tqent_arg; -} taskq_ent_t; - /* * NOTE: Must be called with tq->tq_lock held, returns a list_t which * is not attached to the free, work, or pending taskq lists. @@ -228,15 +220,18 @@ EXPORT_SYMBOL(__taskq_wait); int __taskq_member(taskq_t *tq, void *t) { - int i; + struct list_head *l; + taskq_thread_t *tqt; SENTRY; ASSERT(tq); ASSERT(t); - for (i = 0; i < tq->tq_nthreads; i++) - if (tq->tq_threads[i] == (struct task_struct *)t) - SRETURN(1); + list_for_each(l, &tq->tq_thread_list) { + tqt = list_entry(l, taskq_thread_t, tqt_thread_list); + if (tqt->tqt_thread == (struct task_struct *)t) + SRETURN(1); + } SRETURN(0); } @@ -305,6 +300,7 @@ taskq_lowest_id(taskq_t *tq) { taskqid_t lowest_id = tq->tq_next_id; taskq_ent_t *t; + taskq_thread_t *tqt; SENTRY; ASSERT(tq); @@ -320,9 +316,11 @@ taskq_lowest_id(taskq_t *tq) lowest_id = MIN(lowest_id, t->tqent_id); } - if (!list_empty(&tq->tq_work_list)) { - t = list_entry(tq->tq_work_list.next, taskq_ent_t, tqent_list); - lowest_id = MIN(lowest_id, t->tqent_id); + if (!list_empty(&tq->tq_active_list)) { + tqt = list_entry(tq->tq_active_list.next, taskq_thread_t, + tqt_active_list); + ASSERT(tqt->tqt_ent != NULL); + lowest_id = MIN(lowest_id, tqt->tqt_ent->tqent_id); } SRETURN(lowest_id); @@ -333,25 +331,25 @@ taskq_lowest_id(taskq_t *tq) * taskqid. */ static void -taskq_insert_in_order(taskq_t *tq, taskq_ent_t *t) +taskq_insert_in_order(taskq_t *tq, taskq_thread_t *tqt) { - taskq_ent_t *w; + taskq_thread_t *w; struct list_head *l; SENTRY; ASSERT(tq); - ASSERT(t); + ASSERT(tqt); ASSERT(spin_is_locked(&tq->tq_lock)); - list_for_each_prev(l, &tq->tq_work_list) { - w = list_entry(l, taskq_ent_t, tqent_list); - if (w->tqent_id < t->tqent_id) { - list_add(&t->tqent_list, l); + list_for_each_prev(l, &tq->tq_active_list) { + w = list_entry(l, taskq_thread_t, tqt_active_list); + if (w->tqt_ent->tqent_id < tqt->tqt_ent->tqent_id) { + list_add(&tqt->tqt_active_list, l); break; } } - if (l == &tq->tq_work_list) - list_add(&t->tqent_list, &tq->tq_work_list); + if (l == &tq->tq_active_list) + list_add(&tqt->tqt_active_list, &tq->tq_active_list); SEXIT; } @@ -362,12 +360,14 @@ taskq_thread(void *args) DECLARE_WAITQUEUE(wait, current); sigset_t blocked; taskqid_t id; - taskq_t *tq = args; + taskq_thread_t *tqt = args; + taskq_t *tq; taskq_ent_t *t; struct list_head *pend_list; SENTRY; - ASSERT(tq); + ASSERT(tqt); + tq = tqt->tqt_tq; current->flags |= PF_NOFREEZE; /* Disable the direct memory reclaim path */ @@ -407,7 +407,8 @@ taskq_thread(void *args) if (pend_list) { t = list_entry(pend_list->next, taskq_ent_t, tqent_list); list_del_init(&t->tqent_list); - taskq_insert_in_order(tq, t); + tqt->tqt_ent = t; + taskq_insert_in_order(tq, tqt); tq->tq_nactive++; spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); @@ -416,6 +417,8 @@ taskq_thread(void *args) spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); tq->tq_nactive--; + list_del_init(&tqt->tqt_active_list); + tqt->tqt_ent = NULL; id = t->tqent_id; task_done(tq, t); @@ -435,6 +438,9 @@ taskq_thread(void *args) __set_current_state(TASK_RUNNING); tq->tq_nthreads--; + list_del_init(&tqt->tqt_thread_list); + kmem_free(tqt, sizeof(taskq_thread_t)); + spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); SRETURN(0); @@ -445,7 +451,7 @@ __taskq_create(const char *name, int nthreads, pri_t pri, int minalloc, int maxalloc, uint_t flags) { taskq_t *tq; - struct task_struct *t; + taskq_thread_t *tqt; int rc = 0, i, j = 0; SENTRY; @@ -468,14 +474,10 @@ __taskq_create(const char *name, int nthreads, pri_t pri, if (tq == NULL) SRETURN(NULL); - tq->tq_threads = kmem_alloc(nthreads * sizeof(t), KM_SLEEP); - if (tq->tq_threads == NULL) { - kmem_free(tq, sizeof(*tq)); - SRETURN(NULL); - } - spin_lock_init(&tq->tq_lock); spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); + INIT_LIST_HEAD(&tq->tq_thread_list); + INIT_LIST_HEAD(&tq->tq_active_list); tq->tq_name = name; tq->tq_nactive = 0; tq->tq_nthreads = 0; @@ -487,7 +489,6 @@ __taskq_create(const char *name, int nthreads, pri_t pri, tq->tq_next_id = 1; tq->tq_lowest_id = 1; INIT_LIST_HEAD(&tq->tq_free_list); - INIT_LIST_HEAD(&tq->tq_work_list); INIT_LIST_HEAD(&tq->tq_pend_list); INIT_LIST_HEAD(&tq->tq_prio_list); init_waitqueue_head(&tq->tq_work_waitq); @@ -499,19 +500,26 @@ __taskq_create(const char *name, int nthreads, pri_t pri, spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); - for (i = 0; i < nthreads; i++) { - t = kthread_create(taskq_thread, tq, "%s/%d", name, i); - if (t) { - tq->tq_threads[i] = t; - kthread_bind(t, i % num_online_cpus()); - set_user_nice(t, PRIO_TO_NICE(pri)); - wake_up_process(t); + for (i = 0; i < nthreads; i++) { + tqt = kmem_alloc(sizeof(*tqt), KM_SLEEP); + INIT_LIST_HEAD(&tqt->tqt_thread_list); + INIT_LIST_HEAD(&tqt->tqt_active_list); + tqt->tqt_tq = tq; + tqt->tqt_ent = NULL; + + tqt->tqt_thread = kthread_create(taskq_thread, tqt, + "%s/%d", name, i); + if (tqt->tqt_thread) { + list_add(&tqt->tqt_thread_list, &tq->tq_thread_list); + kthread_bind(tqt->tqt_thread, i % num_online_cpus()); + set_user_nice(tqt->tqt_thread, PRIO_TO_NICE(pri)); + wake_up_process(tqt->tqt_thread); j++; - } else { - tq->tq_threads[i] = NULL; - rc = 1; - } - } + } else { + kmem_free(tqt, sizeof(taskq_thread_t)); + rc = 1; + } + } /* Wait for all threads to be started before potential destroy */ wait_event(tq->tq_wait_waitq, tq->tq_nthreads == j); @@ -528,8 +536,9 @@ EXPORT_SYMBOL(__taskq_create); void __taskq_destroy(taskq_t *tq) { + struct task_struct *thread; + taskq_thread_t *tqt; taskq_ent_t *t; - int i, nthreads; SENTRY; ASSERT(tq); @@ -540,13 +549,25 @@ __taskq_destroy(taskq_t *tq) /* TQ_ACTIVE cleared prevents new tasks being added to pending */ __taskq_wait(tq); - nthreads = tq->tq_nthreads; - for (i = 0; i < nthreads; i++) - if (tq->tq_threads[i]) - kthread_stop(tq->tq_threads[i]); - spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); + /* + * Signal each thread to exit and block until it does. Each thread + * is responsible for removing itself from the list and freeing its + * taskq_thread_t. This allows for idle threads to opt to remove + * themselves from the taskq. They can be recreated as needed. + */ + while (!list_empty(&tq->tq_thread_list)) { + tqt = list_entry(tq->tq_thread_list.next, + taskq_thread_t, tqt_thread_list); + thread = tqt->tqt_thread; + spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); + + kthread_stop(thread); + + spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); + } + while (!list_empty(&tq->tq_free_list)) { t = list_entry(tq->tq_free_list.next, taskq_ent_t, tqent_list); list_del_init(&t->tqent_list); @@ -555,13 +576,14 @@ __taskq_destroy(taskq_t *tq) ASSERT(tq->tq_nthreads == 0); ASSERT(tq->tq_nalloc == 0); + ASSERT(list_empty(&tq->tq_thread_list)); + ASSERT(list_empty(&tq->tq_active_list)); ASSERT(list_empty(&tq->tq_free_list)); - ASSERT(list_empty(&tq->tq_work_list)); ASSERT(list_empty(&tq->tq_pend_list)); ASSERT(list_empty(&tq->tq_prio_list)); spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); - kmem_free(tq->tq_threads, nthreads * sizeof(taskq_ent_t *)); + kmem_free(tq, sizeof(taskq_t)); SEXIT; -- cgit v1.2.3 From 44217f7aad12225c09e5fefbbce97ac6bf2f2d16 Mon Sep 17 00:00:00 2001 From: Prakash Surya Date: Tue, 6 Dec 2011 10:04:51 -0800 Subject: Implement taskq_dispatch_prealloc() interface This patch implements the taskq_dispatch_prealloc() interface which was introduced by the following illumos-gate commit. It allows for a preallocated taskq_ent_t to be used when dispatching items to a taskq. This eliminates a memory allocation which helps minimize lock contention in the taskq when dispatching functions. commit 5aeb94743e3be0c51e86f73096334611ae3a058e Author: Garrett D'Amore Date: Wed Jul 27 07:13:44 2011 -0700 734 taskq_dispatch_prealloc() desired 943 zio_interrupt ends up calling taskq_dispatch with TQ_SLEEP Signed-off-by: Prakash Surya Signed-off-by: Brian Behlendorf Issue #65 --- include/sys/taskq.h | 9 +++++ module/spl/spl-taskq.c | 92 ++++++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 95 insertions(+), 6 deletions(-) (limited to 'module/spl/spl-taskq.c') diff --git a/include/sys/taskq.h b/include/sys/taskq.h index 4ea29cb3b..54d869afe 100644 --- a/include/sys/taskq.h +++ b/include/sys/taskq.h @@ -51,8 +51,11 @@ typedef struct taskq_ent { taskqid_t tqent_id; task_func_t *tqent_func; void *tqent_arg; + uintptr_t tqent_flags; } taskq_ent_t; +#define TQENT_FLAG_PREALLOC 0x1 + /* * Flags for taskq_dispatch. TQ_SLEEP/TQ_NOSLEEP should be same as * KM_SLEEP/KM_NOSLEEP. TQ_NOQUEUE/TQ_NOALLOC are set particularly @@ -100,6 +103,9 @@ typedef struct taskq_thread { extern taskq_t *system_taskq; extern taskqid_t __taskq_dispatch(taskq_t *, task_func_t, void *, uint_t); +extern void __taskq_dispatch_ent(taskq_t *, task_func_t, void *, uint_t, taskq_ent_t *); +extern int __taskq_empty_ent(taskq_ent_t *); +extern void __taskq_init_ent(taskq_ent_t *); extern taskq_t *__taskq_create(const char *, int, pri_t, int, int, uint_t); extern void __taskq_destroy(taskq_t *); extern void __taskq_wait_id(taskq_t *, taskqid_t); @@ -113,6 +119,9 @@ void spl_taskq_fini(void); #define taskq_wait_id(tq, id) __taskq_wait_id(tq, id) #define taskq_wait(tq) __taskq_wait(tq) #define taskq_dispatch(tq, f, p, fl) __taskq_dispatch(tq, f, p, fl) +#define taskq_dispatch_ent(tq, f, p, fl, t) __taskq_dispatch_ent(tq, f, p, fl, t) +#define taskq_empty_ent(t) __taskq_empty_ent(t) +#define taskq_init_ent(t) __taskq_init_ent(t) #define taskq_create(n, th, p, mi, ma, fl) __taskq_create(n, th, p, mi, ma, fl) #define taskq_create_proc(n, th, p, mi, ma, pr, fl) \ __taskq_create(n, th, p, mi, ma, fl) diff --git a/module/spl/spl-taskq.c b/module/spl/spl-taskq.c index 5c22544b8..b2b0e6ca8 100644 --- a/module/spl/spl-taskq.c +++ b/module/spl/spl-taskq.c @@ -57,6 +57,9 @@ retry: /* Acquire taskq_ent_t's from free list if available */ if (!list_empty(&tq->tq_free_list) && !(flags & TQ_NEW)) { t = list_entry(tq->tq_free_list.next, taskq_ent_t, tqent_list); + + ASSERT(!(t->tqent_flags & TQENT_FLAG_PREALLOC)); + list_del_init(&t->tqent_list); SRETURN(t); } @@ -93,11 +96,7 @@ retry: spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); if (t) { - spin_lock_init(&t->tqent_lock); - INIT_LIST_HEAD(&t->tqent_list); - t->tqent_id = 0; - t->tqent_func = NULL; - t->tqent_arg = NULL; + taskq_init_ent(t); tq->tq_nalloc++; } @@ -136,12 +135,18 @@ task_done(taskq_t *tq, taskq_ent_t *t) ASSERT(t); ASSERT(spin_is_locked(&tq->tq_lock)); + /* For prealloc'd tasks, we don't free anything. */ + if ((!(tq->tq_flags & TASKQ_DYNAMIC)) && + (t->tqent_flags & TQENT_FLAG_PREALLOC)) + return; + list_del_init(&t->tqent_list); if (tq->tq_nalloc <= tq->tq_minalloc) { t->tqent_id = 0; t->tqent_func = NULL; t->tqent_arg = NULL; + t->tqent_flags = 0; list_add_tail(&t->tqent_list, &tq->tq_free_list); } else { task_free(tq, t); @@ -281,6 +286,9 @@ __taskq_dispatch(taskq_t *tq, task_func_t func, void *arg, uint_t flags) tq->tq_next_id++; t->tqent_func = func; t->tqent_arg = arg; + + ASSERT(!(t->tqent_flags & TQENT_FLAG_PREALLOC)); + spin_unlock(&t->tqent_lock); wake_up(&tq->tq_work_waitq); @@ -289,6 +297,72 @@ out: SRETURN(rc); } EXPORT_SYMBOL(__taskq_dispatch); + +void +__taskq_dispatch_ent(taskq_t *tq, task_func_t func, void *arg, uint_t flags, + taskq_ent_t *t) +{ + SENTRY; + + ASSERT(tq); + ASSERT(func); + ASSERT(!(tq->tq_flags & TASKQ_DYNAMIC)); + + spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); + + /* Taskq being destroyed and all tasks drained */ + if (!(tq->tq_flags & TQ_ACTIVE)) { + t->tqent_id = 0; + goto out; + } + + spin_lock(&t->tqent_lock); + + /* + * Mark it as a prealloc'd task. This is important + * to ensure that we don't free it later. + */ + t->tqent_flags |= TQENT_FLAG_PREALLOC; + + /* Queue to the priority list instead of the pending list */ + if (flags & TQ_FRONT) + list_add_tail(&t->tqent_list, &tq->tq_prio_list); + else + list_add_tail(&t->tqent_list, &tq->tq_pend_list); + + t->tqent_id = tq->tq_next_id; + tq->tq_next_id++; + t->tqent_func = func; + t->tqent_arg = arg; + + spin_unlock(&t->tqent_lock); + + wake_up(&tq->tq_work_waitq); +out: + spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); + SEXIT; +} +EXPORT_SYMBOL(__taskq_dispatch_ent); + +int +__taskq_empty_ent(taskq_ent_t *t) +{ + return list_empty(&t->tqent_list); +} +EXPORT_SYMBOL(__taskq_empty_ent); + +void +__taskq_init_ent(taskq_ent_t *t) +{ + spin_lock_init(&t->tqent_lock); + INIT_LIST_HEAD(&t->tqent_list); + t->tqent_id = 0; + t->tqent_func = NULL; + t->tqent_arg = NULL; + t->tqent_flags = 0; +} +EXPORT_SYMBOL(__taskq_init_ent); + /* * Returns the lowest incomplete taskqid_t. The taskqid_t may * be queued on the pending list, on the priority list, or on @@ -407,6 +481,10 @@ taskq_thread(void *args) if (pend_list) { t = list_entry(pend_list->next, taskq_ent_t, tqent_list); list_del_init(&t->tqent_list); + /* In order to support recursively dispatching a + * preallocated taskq_ent_t, tqent_id must be + * stored prior to executing tqent_func. */ + id = t->tqent_id; tqt->tqt_ent = t; taskq_insert_in_order(tq, tqt); tq->tq_nactive++; @@ -419,7 +497,6 @@ taskq_thread(void *args) tq->tq_nactive--; list_del_init(&tqt->tqt_active_list); tqt->tqt_ent = NULL; - id = t->tqent_id; task_done(tq, t); /* When the current lowest outstanding taskqid is @@ -570,6 +647,9 @@ __taskq_destroy(taskq_t *tq) while (!list_empty(&tq->tq_free_list)) { t = list_entry(tq->tq_free_list.next, taskq_ent_t, tqent_list); + + ASSERT(!(t->tqent_flags & TQENT_FLAG_PREALLOC)); + list_del_init(&t->tqent_list); task_free(tq, t); } -- cgit v1.2.3 From e7e5f78e7bf6dc86337483f4d9f01becc017d185 Mon Sep 17 00:00:00 2001 From: Prakash Surya Date: Fri, 16 Dec 2011 09:44:31 -0800 Subject: Swap taskq_ent_t with taskqid_t in taskq_thread_t The taskq_t's active thread list is sorted based on its tqt_ent->tqent_id field. The list is kept sorted solely by inserting new taskq_thread_t's in their correct sorted location; no other means is used. This means that once inserted, if a taskq_thread_t's tqt_ent->tqent_id field changes, the list runs the risk of no longer being sorted. Prior to the introduction of the taskq_dispatch_prealloc() interface, this was not a problem as a taskq_ent_t actively being serviced under the old interface should always have a static tqent_id field. Thus, once the taskq_thread_t is added to the taskq_t's active thread list, the taskq_thread_t's tqt_ent->tqent_id field would remain constant. Now, this is no longer the case. Currently, if using the taskq_dispatch_prealloc() interface, any given taskq_ent_t actively being serviced _may_ have its tqent_id value incremented. This happens when the preallocated taskq_ent_t structure is recursively dispatched. Thus, a taskq_thread_t could potentially have its tqt_ent->tqent_id field silently modified from under its feet. If this were to happen to a taskq_thread_t on a taskq_t's active thread list, this would compromise the integrity of the order of the list (as the list _may_ no longer be sorted). To get around this, the taskq_thread_t's taskq_ent_t pointer was replaced with its own static copy of the tqent_id. So, as a taskq_ent_t is pulled off of the taskq_t's pending list, a static copy of its tqent_id is made and this copy is used to sort the active thread list. Using a static copy is key in ensuring the integrity of the order of the active thread list. Even if the underlying taskq_ent_t is recursively dispatched (as has its tqent_id modified), this static copy stored inside the taskq_thread_t will remain constant. Signed-off-by: Prakash Surya Signed-off-by: Brian Behlendorf Issue #71 --- include/sys/taskq.h | 2 +- module/spl/spl-taskq.c | 18 ++++++++---------- 2 files changed, 9 insertions(+), 11 deletions(-) (limited to 'module/spl/spl-taskq.c') diff --git a/include/sys/taskq.h b/include/sys/taskq.h index 54d869afe..0a7143375 100644 --- a/include/sys/taskq.h +++ b/include/sys/taskq.h @@ -96,7 +96,7 @@ typedef struct taskq_thread { struct list_head tqt_active_list; struct task_struct *tqt_thread; taskq_t *tqt_tq; - taskq_ent_t *tqt_ent; + taskqid_t tqt_id; } taskq_thread_t; /* Global system-wide dynamic task queue available for all consumers */ diff --git a/module/spl/spl-taskq.c b/module/spl/spl-taskq.c index b2b0e6ca8..ccb713c20 100644 --- a/module/spl/spl-taskq.c +++ b/module/spl/spl-taskq.c @@ -393,8 +393,8 @@ taskq_lowest_id(taskq_t *tq) if (!list_empty(&tq->tq_active_list)) { tqt = list_entry(tq->tq_active_list.next, taskq_thread_t, tqt_active_list); - ASSERT(tqt->tqt_ent != NULL); - lowest_id = MIN(lowest_id, tqt->tqt_ent->tqent_id); + ASSERT(tqt->tqt_id != 0); + lowest_id = MIN(lowest_id, tqt->tqt_id); } SRETURN(lowest_id); @@ -417,7 +417,7 @@ taskq_insert_in_order(taskq_t *tq, taskq_thread_t *tqt) list_for_each_prev(l, &tq->tq_active_list) { w = list_entry(l, taskq_thread_t, tqt_active_list); - if (w->tqt_ent->tqent_id < tqt->tqt_ent->tqent_id) { + if (w->tqt_id < tqt->tqt_id) { list_add(&tqt->tqt_active_list, l); break; } @@ -433,7 +433,6 @@ taskq_thread(void *args) { DECLARE_WAITQUEUE(wait, current); sigset_t blocked; - taskqid_t id; taskq_thread_t *tqt = args; taskq_t *tq; taskq_ent_t *t; @@ -484,8 +483,7 @@ taskq_thread(void *args) /* In order to support recursively dispatching a * preallocated taskq_ent_t, tqent_id must be * stored prior to executing tqent_func. */ - id = t->tqent_id; - tqt->tqt_ent = t; + tqt->tqt_id = t->tqent_id; taskq_insert_in_order(tq, tqt); tq->tq_nactive++; spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); @@ -496,16 +494,16 @@ taskq_thread(void *args) spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); tq->tq_nactive--; list_del_init(&tqt->tqt_active_list); - tqt->tqt_ent = NULL; task_done(tq, t); /* When the current lowest outstanding taskqid is * done calculate the new lowest outstanding id */ - if (tq->tq_lowest_id == id) { + if (tq->tq_lowest_id == tqt->tqt_id) { tq->tq_lowest_id = taskq_lowest_id(tq); - ASSERT(tq->tq_lowest_id > id); + ASSERT3S(tq->tq_lowest_id, >, tqt->tqt_id); } + tqt->tqt_id = 0; wake_up_all(&tq->tq_wait_waitq); } @@ -582,7 +580,7 @@ __taskq_create(const char *name, int nthreads, pri_t pri, INIT_LIST_HEAD(&tqt->tqt_thread_list); INIT_LIST_HEAD(&tqt->tqt_active_list); tqt->tqt_tq = tq; - tqt->tqt_ent = NULL; + tqt->tqt_id = 0; tqt->tqt_thread = kthread_create(taskq_thread, tqt, "%s/%d", name, i); -- cgit v1.2.3 From 8f2503e0af490ea253d6db1a15b4901437171cc1 Mon Sep 17 00:00:00 2001 From: Prakash Surya Date: Fri, 16 Dec 2011 14:57:31 -0800 Subject: Store copy of tqent_flags prior to servicing task A preallocated taskq_ent_t's tqent_flags must be checked prior to servicing the taskq_ent_t. Once a preallocated taskq entry is serviced, the ownership of the entry is handed back to the caller of taskq_dispatch, thus the entry's contents can potentially be mangled. In particular, this is a problem in the case where a preallocated taskq entry is serviced, and the caller clears it's tqent_flags field. Thus, when the function returns and task_done is called, it looks as though the entry is **not** a preallocated task (when in fact it **is** a preallocated task). In this situation, task_done will place the preallocated taskq_ent_t structure onto the taskq_t's free list. This is a **huge** mistake. If the taskq_ent_t is then freed by the caller of taskq_dispatch, the taskq_t's free list will hold a pointer to garbage data. Even worse, if nothing has over written the freed memory before the pointer is dereferenced, it may still look as though it points to a valid list_head belonging to a taskq_ent_t structure. Thus, the task entry's flags are now copied prior to servicing the task. This copy is then checked to see if it is a preallocated task, and determine if the entry needs to be passed down to the task_done function. Signed-off-by: Prakash Surya Signed-off-by: Brian Behlendorf Closes #71 --- include/sys/taskq.h | 1 + module/spl/spl-taskq.c | 22 ++++++++++++++++------ 2 files changed, 17 insertions(+), 6 deletions(-) (limited to 'module/spl/spl-taskq.c') diff --git a/include/sys/taskq.h b/include/sys/taskq.h index 0a7143375..fec4de8ca 100644 --- a/include/sys/taskq.h +++ b/include/sys/taskq.h @@ -97,6 +97,7 @@ typedef struct taskq_thread { struct task_struct *tqt_thread; taskq_t *tqt_tq; taskqid_t tqt_id; + uintptr_t tqt_flags; } taskq_thread_t; /* Global system-wide dynamic task queue available for all consumers */ diff --git a/module/spl/spl-taskq.c b/module/spl/spl-taskq.c index ccb713c20..ece99aad6 100644 --- a/module/spl/spl-taskq.c +++ b/module/spl/spl-taskq.c @@ -135,11 +135,6 @@ task_done(taskq_t *tq, taskq_ent_t *t) ASSERT(t); ASSERT(spin_is_locked(&tq->tq_lock)); - /* For prealloc'd tasks, we don't free anything. */ - if ((!(tq->tq_flags & TASKQ_DYNAMIC)) && - (t->tqent_flags & TQENT_FLAG_PREALLOC)) - return; - list_del_init(&t->tqent_list); if (tq->tq_nalloc <= tq->tq_minalloc) { @@ -147,6 +142,7 @@ task_done(taskq_t *tq, taskq_ent_t *t) t->tqent_func = NULL; t->tqent_arg = NULL; t->tqent_flags = 0; + list_add_tail(&t->tqent_list, &tq->tq_free_list); } else { task_free(tq, t); @@ -480,10 +476,19 @@ taskq_thread(void *args) if (pend_list) { t = list_entry(pend_list->next, taskq_ent_t, tqent_list); list_del_init(&t->tqent_list); + /* In order to support recursively dispatching a * preallocated taskq_ent_t, tqent_id must be * stored prior to executing tqent_func. */ tqt->tqt_id = t->tqent_id; + + /* We must store a copy of the flags prior to + * servicing the task (servicing a prealloc'd task + * returns the ownership of the tqent back to + * the caller of taskq_dispatch). Thus, + * tqent_flags _may_ change within the call. */ + tqt->tqt_flags = t->tqent_flags; + taskq_insert_in_order(tq, tqt); tq->tq_nactive++; spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); @@ -494,7 +499,11 @@ taskq_thread(void *args) spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); tq->tq_nactive--; list_del_init(&tqt->tqt_active_list); - task_done(tq, t); + + /* For prealloc'd tasks, we don't free anything. */ + if ((tq->tq_flags & TASKQ_DYNAMIC) || + !(tqt->tqt_flags & TQENT_FLAG_PREALLOC)) + task_done(tq, t); /* When the current lowest outstanding taskqid is * done calculate the new lowest outstanding id */ @@ -504,6 +513,7 @@ taskq_thread(void *args) } tqt->tqt_id = 0; + tqt->tqt_flags = 0; wake_up_all(&tq->tq_wait_waitq); } -- cgit v1.2.3 From ec2b41049f7f576aaa772b326d083e5971212d33 Mon Sep 17 00:00:00 2001 From: Ned Bass Date: Tue, 17 Jan 2012 15:34:55 -0800 Subject: Taskq locking optimizations Testing has shown that tq->tq_lock can be highly contended when a large number of small work items are dispatched. The lock hold time is reduced by the following changes: 1) Use exclusive threads in the work_waitq When a single work item is dispatched we only need to wake a single thread to service it. The current implementation uses non-exclusive threads so all threads are woken when the dispatcher calls wake_up(). If a large number of threads are in the queue this overhead can become non-negligible. 2) Conditionally add/remove threads from work waitq outside of tq_lock Taskq threads need only add themselves to the work wait queue if there are no pending work items. Furthermore, the add and remove function calls can be made outside of the taskq lock since the wait queues are protected from concurrent access by their own spinlocks. 3) Call wake_up() outside of tq->tq_lock Again, the wait queues are protected by their own spinlock, so the dispatcher functions can drop tq->tq_lock before calling wake_up(). A new splat test taskq:contention was added in a prior commit to measure the impact of these changes. The following table summarizes the results using data from the kernel lock profiler. tq_lock time %diff Wall clock (s) %diff original: 39117614.10 0 41.72 0 exclusive threads: 31871483.61 18.5 34.2 18.0 unlocked add/rm waitq: 13794303.90 64.7 16.17 61.2 unlocked wake_up(): 1589172.08 95.9 16.61 60.2 Each row reflects the average result over 5 test runs. /proc/lock_stats was zeroed out before and collected after each run. Column 1 is the cumulative hold time in microseconds for tq->tq_lock. The tests are cumulative; each row reflects the code changes of the previous rows. %diff is calculated with respect to "original" as 100*(orig-new)/orig. Although calling wake_up() outside of the taskq lock dramatically reduced the taskq lock hold time, the test actually took slightly more wall clock time. This is because the point of contention shifts from the taskq lock to the wait queue lock. But the change still seems worthwhile since it removes our taskq implementation as a bottleneck, assuming the small increase in wall clock time to be statistical noise. Signed-off-by: Brian Behlendorf Closes #32 --- module/spl/spl-taskq.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'module/spl/spl-taskq.c') diff --git a/module/spl/spl-taskq.c b/module/spl/spl-taskq.c index ece99aad6..b0677666d 100644 --- a/module/spl/spl-taskq.c +++ b/module/spl/spl-taskq.c @@ -286,10 +286,11 @@ __taskq_dispatch(taskq_t *tq, task_func_t func, void *arg, uint_t flags) ASSERT(!(t->tqent_flags & TQENT_FLAG_PREALLOC)); spin_unlock(&t->tqent_lock); - - wake_up(&tq->tq_work_waitq); out: spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); + if (rc > 0) + wake_up(&tq->tq_work_waitq); + SRETURN(rc); } EXPORT_SYMBOL(__taskq_dispatch); @@ -309,6 +310,7 @@ __taskq_dispatch_ent(taskq_t *tq, task_func_t func, void *arg, uint_t flags, /* Taskq being destroyed and all tasks drained */ if (!(tq->tq_flags & TQ_ACTIVE)) { t->tqent_id = 0; + spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); goto out; } @@ -332,10 +334,10 @@ __taskq_dispatch_ent(taskq_t *tq, task_func_t func, void *arg, uint_t flags, t->tqent_arg = arg; spin_unlock(&t->tqent_lock); + spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); wake_up(&tq->tq_work_waitq); out: - spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); SEXIT; } EXPORT_SYMBOL(__taskq_dispatch_ent); @@ -454,17 +456,17 @@ taskq_thread(void *args) while (!kthread_should_stop()) { - add_wait_queue(&tq->tq_work_waitq, &wait); if (list_empty(&tq->tq_pend_list) && list_empty(&tq->tq_prio_list)) { spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); + add_wait_queue_exclusive(&tq->tq_work_waitq, &wait); schedule(); + remove_wait_queue(&tq->tq_work_waitq, &wait); spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); } else { __set_current_state(TASK_RUNNING); } - remove_wait_queue(&tq->tq_work_waitq, &wait); if (!list_empty(&tq->tq_prio_list)) pend_list = &tq->tq_prio_list; -- cgit v1.2.3 From 0bb43ca2823ab55a74565f6e17e2c36749cff3b9 Mon Sep 17 00:00:00 2001 From: Ned Bass Date: Thu, 19 Jan 2012 11:36:27 -0800 Subject: Revert "Taskq locking optimizations" This reverts commit ec2b41049f7f576aaa772b326d083e5971212d33. A race condition was introduced by which a wake_up() call can be lost after the taskq thread determines there is no pending work items, leading to deadlock: 1. taksq thread enables interrupts 2. dispatcher thread runs, queues work item, call wake_up() 3. taskq thread runs, adds self to waitq, sleeps This could easily happen if an interrupt for an IO completion was outstanding at the point where the taskq thread reenables interrupts, just before the call to add_wait_queue_exclusive(). The handler would run immediately within the race window. Signed-off-by: Brian Behlendorf Issue #32 --- module/spl/spl-taskq.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'module/spl/spl-taskq.c') diff --git a/module/spl/spl-taskq.c b/module/spl/spl-taskq.c index b0677666d..ece99aad6 100644 --- a/module/spl/spl-taskq.c +++ b/module/spl/spl-taskq.c @@ -286,11 +286,10 @@ __taskq_dispatch(taskq_t *tq, task_func_t func, void *arg, uint_t flags) ASSERT(!(t->tqent_flags & TQENT_FLAG_PREALLOC)); spin_unlock(&t->tqent_lock); + + wake_up(&tq->tq_work_waitq); out: spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); - if (rc > 0) - wake_up(&tq->tq_work_waitq); - SRETURN(rc); } EXPORT_SYMBOL(__taskq_dispatch); @@ -310,7 +309,6 @@ __taskq_dispatch_ent(taskq_t *tq, task_func_t func, void *arg, uint_t flags, /* Taskq being destroyed and all tasks drained */ if (!(tq->tq_flags & TQ_ACTIVE)) { t->tqent_id = 0; - spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); goto out; } @@ -334,10 +332,10 @@ __taskq_dispatch_ent(taskq_t *tq, task_func_t func, void *arg, uint_t flags, t->tqent_arg = arg; spin_unlock(&t->tqent_lock); - spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); wake_up(&tq->tq_work_waitq); out: + spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); SEXIT; } EXPORT_SYMBOL(__taskq_dispatch_ent); @@ -456,17 +454,17 @@ taskq_thread(void *args) while (!kthread_should_stop()) { + add_wait_queue(&tq->tq_work_waitq, &wait); if (list_empty(&tq->tq_pend_list) && list_empty(&tq->tq_prio_list)) { spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); - add_wait_queue_exclusive(&tq->tq_work_waitq, &wait); schedule(); - remove_wait_queue(&tq->tq_work_waitq, &wait); spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); } else { __set_current_state(TASK_RUNNING); } + remove_wait_queue(&tq->tq_work_waitq, &wait); if (!list_empty(&tq->tq_prio_list)) pend_list = &tq->tq_prio_list; -- cgit v1.2.3 From 3c6ed5410beb7a4f9e0c042229eb63c4c11a5fc9 Mon Sep 17 00:00:00 2001 From: Ned Bass Date: Thu, 19 Jan 2012 10:33:19 -0800 Subject: Taskq locking optimizations Testing has shown that tq->tq_lock can be highly contended when a large number of small work items are dispatched. The lock hold time is reduced by the following changes: 1) Use exclusive threads in the work_waitq When a single work item is dispatched we only need to wake a single thread to service it. The current implementation uses non-exclusive threads so all threads are woken when the dispatcher calls wake_up(). If a large number of threads are in the queue this overhead can become non-negligible. 2) Conditionally add/remove threads from work waitq Taskq threads need only add themselves to the work wait queue if there are no pending work items. Signed-off-by: Brian Behlendorf Issue #32 --- module/spl/spl-taskq.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/spl/spl-taskq.c') diff --git a/module/spl/spl-taskq.c b/module/spl/spl-taskq.c index ece99aad6..0b3b3a131 100644 --- a/module/spl/spl-taskq.c +++ b/module/spl/spl-taskq.c @@ -454,17 +454,17 @@ taskq_thread(void *args) while (!kthread_should_stop()) { - add_wait_queue(&tq->tq_work_waitq, &wait); if (list_empty(&tq->tq_pend_list) && list_empty(&tq->tq_prio_list)) { + add_wait_queue_exclusive(&tq->tq_work_waitq, &wait); spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); schedule(); spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); + remove_wait_queue(&tq->tq_work_waitq, &wait); } else { __set_current_state(TASK_RUNNING); } - remove_wait_queue(&tq->tq_work_waitq, &wait); if (!list_empty(&tq->tq_prio_list)) pend_list = &tq->tq_prio_list; -- cgit v1.2.3 From 05b8f50c3318cc904059a6f36d83730790d7d9fe Mon Sep 17 00:00:00 2001 From: Prakash Surya Date: Thu, 15 Dec 2011 13:48:37 -0800 Subject: Update a comment to reflect new taskq internals As of the removal of the taskq work list made in commit: commit 2c02b71b1411176905228666abf7a50a2e5f85dc Author: Prakash Surya Date: Mon Dec 5 17:32:48 2011 -0800 Replace tq_work_list and tq_threads in taskq_t To lay the ground work for introducing the taskq_dispatch_prealloc() interface, the tq_work_list and tq_threads fields had to be replaced with new alternatives in the taskq_t structure. the comment above taskq_wait_check has been incorrect. This change is an attempt at bringing that description more in line with the current implementation. Essentially, references to the old task work list had to be updated to reference the new taskq thread active list. Signed-off-by: Prakash Surya Signed-off-by: Brian Behlendorf Issue #65 --- module/spl/spl-taskq.c | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) (limited to 'module/spl/spl-taskq.c') diff --git a/module/spl/spl-taskq.c b/module/spl/spl-taskq.c index 0b3b3a131..67a834572 100644 --- a/module/spl/spl-taskq.c +++ b/module/spl/spl-taskq.c @@ -156,19 +156,22 @@ task_done(taskq_t *tq, taskq_ent_t *t) * monotonically increasing taskqid and added to the tail of the pending * list. As worker threads become available the tasks are removed from * the head of the pending or priority list, giving preference to the - * priority list. The tasks are then added to the work list, preserving - * the ordering by taskqid. Finally, as tasks complete they are removed - * from the work list. This means that the pending and work lists are - * always kept sorted by taskqid. Thus the lowest outstanding - * incomplete taskqid can be determined simply by checking the min - * taskqid for each head item on the pending, priority, and work list. - * This value is stored in tq->tq_lowest_id and only updated to the new - * lowest id when the previous lowest id completes. All taskqids lower - * than tq->tq_lowest_id must have completed. It is also possible - * larger taskqid's have completed because they may be processed in - * parallel by several worker threads. However, this is not a problem - * because the behavior of taskq_wait_id() is to block until all - * previously submitted taskqid's have completed. + * priority list. The tasks are then removed from their respective + * list, and the taskq_thread servicing the task is added to the active + * list, preserving the order using the serviced task's taskqid. + * Finally, as tasks complete the taskq_thread servicing the task is + * removed from the active list. This means that the pending task and + * active taskq_thread lists are always kept sorted by taskqid. Thus the + * lowest outstanding incomplete taskqid can be determined simply by + * checking the min taskqid for each head item on the pending, priority, + * and active taskq_thread list. This value is stored in + * tq->tq_lowest_id and only updated to the new lowest id when the + * previous lowest id completes. All taskqids lower than + * tq->tq_lowest_id must have completed. It is also possible larger + * taskqid's have completed because they may be processed in parallel by + * several worker threads. However, this is not a problem because the + * behavior of taskq_wait_id() is to block until all previously + * submitted taskqid's have completed. * * XXX: Taskqid_t wrapping is not handled. However, taskqid_t's are * 64-bit values so even if a taskq is processing 2^24 (16,777,216) -- cgit v1.2.3 From d47e664ad4b7468c43a97aa6d299d8756571155d Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Sat, 18 Aug 2012 10:56:17 -0700 Subject: Revert "Add TASKQ_NORECLAIM flag" This reverts commit 372c2572336468cbf60272aa7e735b7ca0c3807c. The use of the PF_MEMALLOC flag was always a hack to work around memory reclaim deadlocks. Those issues are believed to be resolved so this workaround can be safely reverted. Signed-off-by: Brian Behlendorf --- include/sys/taskq.h | 1 - module/spl/spl-taskq.c | 4 ---- 2 files changed, 5 deletions(-) (limited to 'module/spl/spl-taskq.c') diff --git a/include/sys/taskq.h b/include/sys/taskq.h index fec4de8ca..a5d9492f2 100644 --- a/include/sys/taskq.h +++ b/include/sys/taskq.h @@ -40,7 +40,6 @@ #define TASKQ_DYNAMIC 0x00000004 #define TASKQ_THREADS_CPU_PCT 0x00000008 #define TASKQ_DC_BATCH 0x00000010 -#define TASKQ_NORECLAIM 0x00000020 typedef unsigned long taskqid_t; typedef void (task_func_t)(void *); diff --git a/module/spl/spl-taskq.c b/module/spl/spl-taskq.c index 67a834572..e4092b842 100644 --- a/module/spl/spl-taskq.c +++ b/module/spl/spl-taskq.c @@ -442,10 +442,6 @@ taskq_thread(void *args) tq = tqt->tqt_tq; current->flags |= PF_NOFREEZE; - /* Disable the direct memory reclaim path */ - if (tq->tq_flags & TASKQ_NORECLAIM) - current->flags |= PF_MEMALLOC; - sigfillset(&blocked); sigprocmask(SIG_BLOCK, &blocked, NULL); flush_signals(current); -- cgit v1.2.3 From cd5ca4b2f86a606aa6ed68341a3672fdde1c9856 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Thu, 23 Aug 2012 15:36:28 -0700 Subject: Switch KM_SLEEP to KM_PUSHPAGE Under certain circumstances the following functions may be called in a context where KM_SLEEP is unsafe and can result in a deadlocked system. To avoid this problem the unconditional KM_SLEEPs are converted to KM_PUSHPAGEs. This will prevent them from attempting to initiate any I/O during direct reclaim. Signed-off-by: Brian Behlendorf --- include/sys/taskq.h | 1 + module/spl/spl-taskq.c | 8 +++----- module/spl/spl-thread.c | 4 ++-- 3 files changed, 6 insertions(+), 7 deletions(-) (limited to 'module/spl/spl-taskq.c') diff --git a/include/sys/taskq.h b/include/sys/taskq.h index a5d9492f2..a73f7703f 100644 --- a/include/sys/taskq.h +++ b/include/sys/taskq.h @@ -62,6 +62,7 @@ typedef struct taskq_ent { */ #define TQ_SLEEP KM_SLEEP #define TQ_NOSLEEP KM_NOSLEEP +#define TQ_PUSHPAGE KM_PUSHPAGE #define TQ_NOQUEUE 0x01000000 #define TQ_NOALLOC 0x02000000 #define TQ_NEW 0x04000000 diff --git a/module/spl/spl-taskq.c b/module/spl/spl-taskq.c index e4092b842..b58eb8e94 100644 --- a/module/spl/spl-taskq.c +++ b/module/spl/spl-taskq.c @@ -50,8 +50,6 @@ task_alloc(taskq_t *tq, uint_t flags) SENTRY; ASSERT(tq); - ASSERT(flags & (TQ_SLEEP | TQ_NOSLEEP)); /* One set */ - ASSERT(!((flags & TQ_SLEEP) && (flags & TQ_NOSLEEP))); /* Not both */ ASSERT(spin_is_locked(&tq->tq_lock)); retry: /* Acquire taskq_ent_t's from free list if available */ @@ -554,7 +552,7 @@ __taskq_create(const char *name, int nthreads, pri_t pri, nthreads = MAX((num_online_cpus() * nthreads) / 100, 1); } - tq = kmem_alloc(sizeof(*tq), KM_SLEEP); + tq = kmem_alloc(sizeof(*tq), KM_PUSHPAGE); if (tq == NULL) SRETURN(NULL); @@ -580,12 +578,12 @@ __taskq_create(const char *name, int nthreads, pri_t pri, if (flags & TASKQ_PREPOPULATE) for (i = 0; i < minalloc; i++) - task_done(tq, task_alloc(tq, TQ_SLEEP | TQ_NEW)); + task_done(tq, task_alloc(tq, TQ_PUSHPAGE | TQ_NEW)); spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); for (i = 0; i < nthreads; i++) { - tqt = kmem_alloc(sizeof(*tqt), KM_SLEEP); + tqt = kmem_alloc(sizeof(*tqt), KM_PUSHPAGE); INIT_LIST_HEAD(&tqt->tqt_thread_list); INIT_LIST_HEAD(&tqt->tqt_active_list); tqt->tqt_tq = tq; diff --git a/module/spl/spl-thread.c b/module/spl/spl-thread.c index 9f6e22379..71e5f331d 100644 --- a/module/spl/spl-thread.c +++ b/module/spl/spl-thread.c @@ -98,14 +98,14 @@ __thread_create(caddr_t stk, size_t stksize, thread_func_t func, /* Variable stack size unsupported */ ASSERT(stk == NULL); - tp = kmem_alloc(sizeof(thread_priv_t), KM_SLEEP); + tp = kmem_alloc(sizeof(thread_priv_t), KM_PUSHPAGE); if (tp == NULL) SRETURN(NULL); tp->tp_magic = TP_MAGIC; tp->tp_name_size = strlen(name) + 1; - tp->tp_name = kmem_alloc(tp->tp_name_size, KM_SLEEP); + tp->tp_name = kmem_alloc(tp->tp_name_size, KM_PUSHPAGE); if (tp->tp_name == NULL) { kmem_free(tp, sizeof(thread_priv_t)); SRETURN(NULL); -- cgit v1.2.3 From 330fe010e42fcdbc70832583f95248b9227ac2c4 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Wed, 12 Sep 2012 10:06:13 -0700 Subject: Revert "Switch KM_SLEEP to KM_PUSHPAGE" This reverts commit cd5ca4b2f86a606aa6ed68341a3672fdde1c9856 due to conflicts in the higher TQ_ bits which caused incorrect behavior. Signed-off-by: Brian Behlendorf --- include/sys/taskq.h | 1 - module/spl/spl-taskq.c | 8 +++++--- module/spl/spl-thread.c | 4 ++-- 3 files changed, 7 insertions(+), 6 deletions(-) (limited to 'module/spl/spl-taskq.c') diff --git a/include/sys/taskq.h b/include/sys/taskq.h index a73f7703f..a5d9492f2 100644 --- a/include/sys/taskq.h +++ b/include/sys/taskq.h @@ -62,7 +62,6 @@ typedef struct taskq_ent { */ #define TQ_SLEEP KM_SLEEP #define TQ_NOSLEEP KM_NOSLEEP -#define TQ_PUSHPAGE KM_PUSHPAGE #define TQ_NOQUEUE 0x01000000 #define TQ_NOALLOC 0x02000000 #define TQ_NEW 0x04000000 diff --git a/module/spl/spl-taskq.c b/module/spl/spl-taskq.c index b58eb8e94..e4092b842 100644 --- a/module/spl/spl-taskq.c +++ b/module/spl/spl-taskq.c @@ -50,6 +50,8 @@ task_alloc(taskq_t *tq, uint_t flags) SENTRY; ASSERT(tq); + ASSERT(flags & (TQ_SLEEP | TQ_NOSLEEP)); /* One set */ + ASSERT(!((flags & TQ_SLEEP) && (flags & TQ_NOSLEEP))); /* Not both */ ASSERT(spin_is_locked(&tq->tq_lock)); retry: /* Acquire taskq_ent_t's from free list if available */ @@ -552,7 +554,7 @@ __taskq_create(const char *name, int nthreads, pri_t pri, nthreads = MAX((num_online_cpus() * nthreads) / 100, 1); } - tq = kmem_alloc(sizeof(*tq), KM_PUSHPAGE); + tq = kmem_alloc(sizeof(*tq), KM_SLEEP); if (tq == NULL) SRETURN(NULL); @@ -578,12 +580,12 @@ __taskq_create(const char *name, int nthreads, pri_t pri, if (flags & TASKQ_PREPOPULATE) for (i = 0; i < minalloc; i++) - task_done(tq, task_alloc(tq, TQ_PUSHPAGE | TQ_NEW)); + task_done(tq, task_alloc(tq, TQ_SLEEP | TQ_NEW)); spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); for (i = 0; i < nthreads; i++) { - tqt = kmem_alloc(sizeof(*tqt), KM_PUSHPAGE); + tqt = kmem_alloc(sizeof(*tqt), KM_SLEEP); INIT_LIST_HEAD(&tqt->tqt_thread_list); INIT_LIST_HEAD(&tqt->tqt_active_list); tqt->tqt_tq = tq; diff --git a/module/spl/spl-thread.c b/module/spl/spl-thread.c index 71e5f331d..9f6e22379 100644 --- a/module/spl/spl-thread.c +++ b/module/spl/spl-thread.c @@ -98,14 +98,14 @@ __thread_create(caddr_t stk, size_t stksize, thread_func_t func, /* Variable stack size unsupported */ ASSERT(stk == NULL); - tp = kmem_alloc(sizeof(thread_priv_t), KM_PUSHPAGE); + tp = kmem_alloc(sizeof(thread_priv_t), KM_SLEEP); if (tp == NULL) SRETURN(NULL); tp->tp_magic = TP_MAGIC; tp->tp_name_size = strlen(name) + 1; - tp->tp_name = kmem_alloc(tp->tp_name_size, KM_PUSHPAGE); + tp->tp_name = kmem_alloc(tp->tp_name_size, KM_SLEEP); if (tp->tp_name == NULL) { kmem_free(tp, sizeof(thread_priv_t)); SRETURN(NULL); -- cgit v1.2.3 From 9b51f218410ccdeb69a85d99bd5f09051ec2def1 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Wed, 12 Sep 2012 11:31:39 -0700 Subject: Remove TQ_SLEEP -> KM_SLEEP mapping When the taskq code was originally written it seemed like a good idea to simply map TQ_SLEEP to KM_SLEEP. Unfortunately, this assumed that the TQ_* flags would never confict with any of the Linux GFP_* flags. When adding the TQ_PUSHPAGE support in commit cd5ca4b this invariant was accidentally broken. Therefore to support TQ_PUSHPAGE, which is needed for Linux, and prevent any further confusion I have removed this direct mapping. The TQ_SLEEP, TQ_NOSLEEP, and TQ_PUSHPAGE are no longer defined in terms of their KM_* counterparts. Instead a simple mapping function is introduce to convert TQ_* -> KM_* where needed. Signed-off-by: Brian Behlendorf Issue #171 --- include/sys/taskq.h | 5 +++-- module/spl/spl-taskq.c | 30 ++++++++++++++++-------------- 2 files changed, 19 insertions(+), 16 deletions(-) (limited to 'module/spl/spl-taskq.c') diff --git a/include/sys/taskq.h b/include/sys/taskq.h index a5d9492f2..6b09bdf1b 100644 --- a/include/sys/taskq.h +++ b/include/sys/taskq.h @@ -60,8 +60,9 @@ typedef struct taskq_ent { * KM_SLEEP/KM_NOSLEEP. TQ_NOQUEUE/TQ_NOALLOC are set particularly * large so as not to conflict with already used GFP_* defines. */ -#define TQ_SLEEP KM_SLEEP -#define TQ_NOSLEEP KM_NOSLEEP +#define TQ_SLEEP 0x00000000 +#define TQ_NOSLEEP 0x00000001 +#define TQ_PUSHPAGE 0x00000002 #define TQ_NOQUEUE 0x01000000 #define TQ_NOALLOC 0x02000000 #define TQ_NEW 0x04000000 diff --git a/module/spl/spl-taskq.c b/module/spl/spl-taskq.c index e4092b842..7ea20461b 100644 --- a/module/spl/spl-taskq.c +++ b/module/spl/spl-taskq.c @@ -38,6 +38,18 @@ taskq_t *system_taskq; EXPORT_SYMBOL(system_taskq); +static int +task_km_flags(uint_t flags) +{ + if (flags & TQ_NOSLEEP) + return KM_NOSLEEP; + + if (flags & TQ_PUSHPAGE) + return KM_PUSHPAGE; + + return KM_SLEEP; +} + /* * NOTE: Must be called with tq->tq_lock held, returns a list_t which * is not attached to the free, work, or pending taskq lists. @@ -50,8 +62,6 @@ task_alloc(taskq_t *tq, uint_t flags) SENTRY; ASSERT(tq); - ASSERT(flags & (TQ_SLEEP | TQ_NOSLEEP)); /* One set */ - ASSERT(!((flags & TQ_SLEEP) && (flags & TQ_NOSLEEP))); /* Not both */ ASSERT(spin_is_locked(&tq->tq_lock)); retry: /* Acquire taskq_ent_t's from free list if available */ @@ -92,7 +102,7 @@ retry: } spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); - t = kmem_alloc(sizeof(taskq_ent_t), flags & (TQ_SLEEP | TQ_NOSLEEP)); + t = kmem_alloc(sizeof(taskq_ent_t), task_km_flags(flags)); spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); if (t) { @@ -251,14 +261,6 @@ __taskq_dispatch(taskq_t *tq, task_func_t func, void *arg, uint_t flags) ASSERT(tq); ASSERT(func); - /* Solaris assumes TQ_SLEEP if not passed explicitly */ - if (!(flags & (TQ_SLEEP | TQ_NOSLEEP))) - flags |= TQ_SLEEP; - - if (unlikely(in_atomic() && (flags & TQ_SLEEP))) - PANIC("May schedule while atomic: %s/0x%08x/%d\n", - current->comm, preempt_count(), current->pid); - spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); /* Taskq being destroyed and all tasks drained */ @@ -554,7 +556,7 @@ __taskq_create(const char *name, int nthreads, pri_t pri, nthreads = MAX((num_online_cpus() * nthreads) / 100, 1); } - tq = kmem_alloc(sizeof(*tq), KM_SLEEP); + tq = kmem_alloc(sizeof(*tq), KM_PUSHPAGE); if (tq == NULL) SRETURN(NULL); @@ -580,12 +582,12 @@ __taskq_create(const char *name, int nthreads, pri_t pri, if (flags & TASKQ_PREPOPULATE) for (i = 0; i < minalloc; i++) - task_done(tq, task_alloc(tq, TQ_SLEEP | TQ_NEW)); + task_done(tq, task_alloc(tq, TQ_PUSHPAGE | TQ_NEW)); spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); for (i = 0; i < nthreads; i++) { - tqt = kmem_alloc(sizeof(*tqt), KM_SLEEP); + tqt = kmem_alloc(sizeof(*tqt), KM_PUSHPAGE); INIT_LIST_HEAD(&tqt->tqt_thread_list); INIT_LIST_HEAD(&tqt->tqt_active_list); tqt->tqt_tq = tq; -- cgit v1.2.3 From 472a34caff3bc8b0f65e7cdb4b5960b0e2d616c2 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Thu, 6 Dec 2012 12:57:42 -0800 Subject: taskq style, convert spaces to soft tabs Update the taskq implementation to conform with the style used throughout the rest of the code. There are no functional changes in this commit. Signed-off-by: Brian Behlendorf --- include/sys/taskq.h | 120 ++++++++++--------- module/spl/spl-taskq.c | 315 ++++++++++++++++++++++++------------------------- 2 files changed, 218 insertions(+), 217 deletions(-) (limited to 'module/spl/spl-taskq.c') diff --git a/include/sys/taskq.h b/include/sys/taskq.h index 6b09bdf1b..8260cf935 100644 --- a/include/sys/taskq.h +++ b/include/sys/taskq.h @@ -33,71 +33,71 @@ #include #include -#define TASKQ_NAMELEN 31 +#define TASKQ_NAMELEN 31 -#define TASKQ_PREPOPULATE 0x00000001 -#define TASKQ_CPR_SAFE 0x00000002 -#define TASKQ_DYNAMIC 0x00000004 -#define TASKQ_THREADS_CPU_PCT 0x00000008 -#define TASKQ_DC_BATCH 0x00000010 +#define TASKQ_PREPOPULATE 0x00000001 +#define TASKQ_CPR_SAFE 0x00000002 +#define TASKQ_DYNAMIC 0x00000004 +#define TASKQ_THREADS_CPU_PCT 0x00000008 +#define TASKQ_DC_BATCH 0x00000010 typedef unsigned long taskqid_t; typedef void (task_func_t)(void *); typedef struct taskq_ent { - spinlock_t tqent_lock; - struct list_head tqent_list; - taskqid_t tqent_id; - task_func_t *tqent_func; - void *tqent_arg; - uintptr_t tqent_flags; + spinlock_t tqent_lock; + struct list_head tqent_list; + taskqid_t tqent_id; + task_func_t *tqent_func; + void *tqent_arg; + uintptr_t tqent_flags; } taskq_ent_t; -#define TQENT_FLAG_PREALLOC 0x1 +#define TQENT_FLAG_PREALLOC 0x1 /* * Flags for taskq_dispatch. TQ_SLEEP/TQ_NOSLEEP should be same as * KM_SLEEP/KM_NOSLEEP. TQ_NOQUEUE/TQ_NOALLOC are set particularly * large so as not to conflict with already used GFP_* defines. */ -#define TQ_SLEEP 0x00000000 -#define TQ_NOSLEEP 0x00000001 -#define TQ_PUSHPAGE 0x00000002 -#define TQ_NOQUEUE 0x01000000 -#define TQ_NOALLOC 0x02000000 -#define TQ_NEW 0x04000000 -#define TQ_FRONT 0x08000000 -#define TQ_ACTIVE 0x80000000 +#define TQ_SLEEP 0x00000000 +#define TQ_NOSLEEP 0x00000001 +#define TQ_PUSHPAGE 0x00000002 +#define TQ_NOQUEUE 0x01000000 +#define TQ_NOALLOC 0x02000000 +#define TQ_NEW 0x04000000 +#define TQ_FRONT 0x08000000 +#define TQ_ACTIVE 0x80000000 typedef struct taskq { - spinlock_t tq_lock; /* protects taskq_t */ - unsigned long tq_lock_flags; /* interrupt state */ - const char *tq_name; /* taskq name */ - struct list_head tq_thread_list;/* list of all threads */ - struct list_head tq_active_list;/* list of active threads */ - int tq_nactive; /* # of active threads */ - int tq_nthreads; /* # of total threads */ - int tq_pri; /* priority */ - int tq_minalloc; /* min task_t pool size */ - int tq_maxalloc; /* max task_t pool size */ - int tq_nalloc; /* cur task_t pool size */ - uint_t tq_flags; /* flags */ - taskqid_t tq_next_id; /* next pend/work id */ - taskqid_t tq_lowest_id; /* lowest pend/work id */ - struct list_head tq_free_list; /* free task_t's */ - struct list_head tq_pend_list; /* pending task_t's */ - struct list_head tq_prio_list; /* priority pending task_t's */ - wait_queue_head_t tq_work_waitq; /* new work waitq */ - wait_queue_head_t tq_wait_waitq; /* wait waitq */ + spinlock_t tq_lock; /* protects taskq_t */ + unsigned long tq_lock_flags; /* interrupt state */ + const char *tq_name; /* taskq name */ + struct list_head tq_thread_list;/* list of all threads */ + struct list_head tq_active_list;/* list of active threads */ + int tq_nactive; /* # of active threads */ + int tq_nthreads; /* # of total threads */ + int tq_pri; /* priority */ + int tq_minalloc; /* min task_t pool size */ + int tq_maxalloc; /* max task_t pool size */ + int tq_nalloc; /* cur task_t pool size */ + uint_t tq_flags; /* flags */ + taskqid_t tq_next_id; /* next pend/work id */ + taskqid_t tq_lowest_id; /* lowest pend/work id */ + struct list_head tq_free_list; /* free task_t's */ + struct list_head tq_pend_list; /* pending task_t's */ + struct list_head tq_prio_list; /* priority pending task_t's */ + wait_queue_head_t tq_work_waitq; /* new work waitq */ + wait_queue_head_t tq_wait_waitq; /* wait waitq */ } taskq_t; typedef struct taskq_thread { - struct list_head tqt_thread_list; - struct list_head tqt_active_list; - struct task_struct *tqt_thread; - taskq_t *tqt_tq; - taskqid_t tqt_id; - uintptr_t tqt_flags; + struct list_head tqt_thread_list; + struct list_head tqt_active_list; + struct task_struct *tqt_thread; + taskq_t *tqt_tq; + taskqid_t tqt_id; + uintptr_t tqt_flags; } taskq_thread_t; /* Global system-wide dynamic task queue available for all consumers */ @@ -116,18 +116,20 @@ extern int __taskq_member(taskq_t *, void *); int spl_taskq_init(void); void spl_taskq_fini(void); -#define taskq_member(tq, t) __taskq_member(tq, t) -#define taskq_wait_id(tq, id) __taskq_wait_id(tq, id) -#define taskq_wait(tq) __taskq_wait(tq) -#define taskq_dispatch(tq, f, p, fl) __taskq_dispatch(tq, f, p, fl) -#define taskq_dispatch_ent(tq, f, p, fl, t) __taskq_dispatch_ent(tq, f, p, fl, t) -#define taskq_empty_ent(t) __taskq_empty_ent(t) -#define taskq_init_ent(t) __taskq_init_ent(t) -#define taskq_create(n, th, p, mi, ma, fl) __taskq_create(n, th, p, mi, ma, fl) -#define taskq_create_proc(n, th, p, mi, ma, pr, fl) \ - __taskq_create(n, th, p, mi, ma, fl) -#define taskq_create_sysdc(n, th, mi, ma, pr, dc, fl) \ - __taskq_create(n, th, maxclsyspri, mi, ma, fl) -#define taskq_destroy(tq) __taskq_destroy(tq) +#define taskq_member(tq, t) __taskq_member(tq, t) +#define taskq_wait_id(tq, id) __taskq_wait_id(tq, id) +#define taskq_wait(tq) __taskq_wait(tq) +#define taskq_dispatch(tq, f, p, fl) __taskq_dispatch(tq, f, p, fl) +#define taskq_dispatch_ent(tq, f, p, fl, t) \ + __taskq_dispatch_ent(tq, f, p, fl, t) +#define taskq_empty_ent(t) __taskq_empty_ent(t) +#define taskq_init_ent(t) __taskq_init_ent(t) +#define taskq_create(n, th, p, mi, ma, fl) \ + __taskq_create(n, th, p, mi, ma, fl) +#define taskq_create_proc(n, th, p, mi, ma, pr, fl) \ + __taskq_create(n, th, p, mi, ma, fl) +#define taskq_create_sysdc(n, th, mi, ma, pr, dc, fl) \ + __taskq_create(n, th, maxclsyspri, mi, ma, fl) +#define taskq_destroy(tq) __taskq_destroy(tq) #endif /* _SPL_TASKQ_H */ diff --git a/module/spl/spl-taskq.c b/module/spl/spl-taskq.c index 7ea20461b..99bd361ad 100644 --- a/module/spl/spl-taskq.c +++ b/module/spl/spl-taskq.c @@ -57,60 +57,60 @@ task_km_flags(uint_t flags) static taskq_ent_t * task_alloc(taskq_t *tq, uint_t flags) { - taskq_ent_t *t; - int count = 0; - SENTRY; + taskq_ent_t *t; + int count = 0; + SENTRY; - ASSERT(tq); - ASSERT(spin_is_locked(&tq->tq_lock)); + ASSERT(tq); + ASSERT(spin_is_locked(&tq->tq_lock)); retry: - /* Acquire taskq_ent_t's from free list if available */ - if (!list_empty(&tq->tq_free_list) && !(flags & TQ_NEW)) { - t = list_entry(tq->tq_free_list.next, taskq_ent_t, tqent_list); - - ASSERT(!(t->tqent_flags & TQENT_FLAG_PREALLOC)); - - list_del_init(&t->tqent_list); - SRETURN(t); - } - - /* Free list is empty and memory allocations are prohibited */ - if (flags & TQ_NOALLOC) - SRETURN(NULL); - - /* Hit maximum taskq_ent_t pool size */ - if (tq->tq_nalloc >= tq->tq_maxalloc) { - if (flags & TQ_NOSLEEP) - SRETURN(NULL); - - /* - * Sleep periodically polling the free list for an available - * taskq_ent_t. Dispatching with TQ_SLEEP should always succeed - * but we cannot block forever waiting for an taskq_entq_t to - * show up in the free list, otherwise a deadlock can happen. - * - * Therefore, we need to allocate a new task even if the number - * of allocated tasks is above tq->tq_maxalloc, but we still - * end up delaying the task allocation by one second, thereby - * throttling the task dispatch rate. - */ - spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); - schedule_timeout(HZ / 100); - spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); - if (count < 100) - SGOTO(retry, count++); - } - - spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); - t = kmem_alloc(sizeof(taskq_ent_t), task_km_flags(flags)); - spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); - - if (t) { - taskq_init_ent(t); - tq->tq_nalloc++; - } - - SRETURN(t); + /* Acquire taskq_ent_t's from free list if available */ + if (!list_empty(&tq->tq_free_list) && !(flags & TQ_NEW)) { + t = list_entry(tq->tq_free_list.next, taskq_ent_t, tqent_list); + + ASSERT(!(t->tqent_flags & TQENT_FLAG_PREALLOC)); + + list_del_init(&t->tqent_list); + SRETURN(t); + } + + /* Free list is empty and memory allocations are prohibited */ + if (flags & TQ_NOALLOC) + SRETURN(NULL); + + /* Hit maximum taskq_ent_t pool size */ + if (tq->tq_nalloc >= tq->tq_maxalloc) { + if (flags & TQ_NOSLEEP) + SRETURN(NULL); + + /* + * Sleep periodically polling the free list for an available + * taskq_ent_t. Dispatching with TQ_SLEEP should always succeed + * but we cannot block forever waiting for an taskq_ent_t to + * show up in the free list, otherwise a deadlock can happen. + * + * Therefore, we need to allocate a new task even if the number + * of allocated tasks is above tq->tq_maxalloc, but we still + * end up delaying the task allocation by one second, thereby + * throttling the task dispatch rate. + */ + spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); + schedule_timeout(HZ / 100); + spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); + if (count < 100) + SGOTO(retry, count++); + } + + spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); + t = kmem_alloc(sizeof(taskq_ent_t), task_km_flags(flags)); + spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); + + if (t) { + taskq_init_ent(t); + tq->tq_nalloc++; + } + + SRETURN(t); } /* @@ -120,15 +120,15 @@ retry: static void task_free(taskq_t *tq, taskq_ent_t *t) { - SENTRY; + SENTRY; - ASSERT(tq); - ASSERT(t); + ASSERT(tq); + ASSERT(t); ASSERT(spin_is_locked(&tq->tq_lock)); ASSERT(list_empty(&t->tqent_list)); - kmem_free(t, sizeof(taskq_ent_t)); - tq->tq_nalloc--; + kmem_free(t, sizeof(taskq_ent_t)); + tq->tq_nalloc--; SEXIT; } @@ -147,18 +147,18 @@ task_done(taskq_t *tq, taskq_ent_t *t) list_del_init(&t->tqent_list); - if (tq->tq_nalloc <= tq->tq_minalloc) { + if (tq->tq_nalloc <= tq->tq_minalloc) { t->tqent_id = 0; t->tqent_func = NULL; t->tqent_arg = NULL; t->tqent_flags = 0; - list_add_tail(&t->tqent_list, &tq->tq_free_list); + list_add_tail(&t->tqent_list, &tq->tq_free_list); } else { task_free(tq, t); } - SEXIT; + SEXIT; } /* @@ -236,10 +236,10 @@ __taskq_member(taskq_t *tq, void *t) { struct list_head *l; taskq_thread_t *tqt; - SENTRY; + SENTRY; ASSERT(tq); - ASSERT(t); + ASSERT(t); list_for_each(l, &tq->tq_thread_list) { tqt = list_entry(l, taskq_thread_t, tqt_thread_list); @@ -247,21 +247,21 @@ __taskq_member(taskq_t *tq, void *t) SRETURN(1); } - SRETURN(0); + SRETURN(0); } EXPORT_SYMBOL(__taskq_member); taskqid_t __taskq_dispatch(taskq_t *tq, task_func_t func, void *arg, uint_t flags) { - taskq_ent_t *t; + taskq_ent_t *t; taskqid_t rc = 0; - SENTRY; + SENTRY; - ASSERT(tq); - ASSERT(func); + ASSERT(tq); + ASSERT(func); - spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); + spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); /* Taskq being destroyed and all tasks drained */ if (!(tq->tq_flags & TQ_ACTIVE)) @@ -272,7 +272,7 @@ __taskq_dispatch(taskq_t *tq, task_func_t func, void *arg, uint_t flags) if ((flags & TQ_NOQUEUE) && (tq->tq_nactive == tq->tq_nthreads)) SGOTO(out, rc = 0); - if ((t = task_alloc(tq, flags)) == NULL) + if ((t = task_alloc(tq, flags)) == NULL) SGOTO(out, rc = 0); spin_lock(&t->tqent_lock); @@ -285,8 +285,8 @@ __taskq_dispatch(taskq_t *tq, task_func_t func, void *arg, uint_t flags) t->tqent_id = rc = tq->tq_next_id; tq->tq_next_id++; - t->tqent_func = func; - t->tqent_arg = arg; + t->tqent_func = func; + t->tqent_arg = arg; ASSERT(!(t->tqent_flags & TQENT_FLAG_PREALLOC)); @@ -374,7 +374,7 @@ static taskqid_t taskq_lowest_id(taskq_t *tq) { taskqid_t lowest_id = tq->tq_next_id; - taskq_ent_t *t; + taskq_ent_t *t; taskq_thread_t *tqt; SENTRY; @@ -393,7 +393,7 @@ taskq_lowest_id(taskq_t *tq) if (!list_empty(&tq->tq_active_list)) { tqt = list_entry(tq->tq_active_list.next, taskq_thread_t, - tqt_active_list); + tqt_active_list); ASSERT(tqt->tqt_id != 0); lowest_id = MIN(lowest_id, tqt->tqt_id); } @@ -402,8 +402,7 @@ taskq_lowest_id(taskq_t *tq) } /* - * Insert a task into a list keeping the list sorted by increasing - * taskqid. + * Insert a task into a list keeping the list sorted by increasing taskqid. */ static void taskq_insert_in_order(taskq_t *tq, taskq_thread_t *tqt) @@ -432,28 +431,28 @@ taskq_insert_in_order(taskq_t *tq, taskq_thread_t *tqt) static int taskq_thread(void *args) { - DECLARE_WAITQUEUE(wait, current); - sigset_t blocked; + DECLARE_WAITQUEUE(wait, current); + sigset_t blocked; taskq_thread_t *tqt = args; - taskq_t *tq; - taskq_ent_t *t; + taskq_t *tq; + taskq_ent_t *t; struct list_head *pend_list; SENTRY; - ASSERT(tqt); + ASSERT(tqt); tq = tqt->tqt_tq; - current->flags |= PF_NOFREEZE; + current->flags |= PF_NOFREEZE; - sigfillset(&blocked); - sigprocmask(SIG_BLOCK, &blocked, NULL); - flush_signals(current); + sigfillset(&blocked); + sigprocmask(SIG_BLOCK, &blocked, NULL); + flush_signals(current); - spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); - tq->tq_nthreads++; - wake_up(&tq->tq_wait_waitq); - set_current_state(TASK_INTERRUPTIBLE); + spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); + tq->tq_nthreads++; + wake_up(&tq->tq_wait_waitq); + set_current_state(TASK_INTERRUPTIBLE); - while (!kthread_should_stop()) { + while (!kthread_should_stop()) { if (list_empty(&tq->tq_pend_list) && list_empty(&tq->tq_prio_list)) { @@ -475,8 +474,8 @@ taskq_thread(void *args) pend_list = NULL; if (pend_list) { - t = list_entry(pend_list->next, taskq_ent_t, tqent_list); - list_del_init(&t->tqent_list); + t = list_entry(pend_list->next,taskq_ent_t,tqent_list); + list_del_init(&t->tqent_list); /* In order to support recursively dispatching a * preallocated taskq_ent_t, tqent_id must be @@ -491,14 +490,14 @@ taskq_thread(void *args) tqt->tqt_flags = t->tqent_flags; taskq_insert_in_order(tq, tqt); - tq->tq_nactive++; + tq->tq_nactive++; spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); /* Perform the requested task */ - t->tqent_func(t->tqent_arg); + t->tqent_func(t->tqent_arg); spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); - tq->tq_nactive--; + tq->tq_nactive--; list_del_init(&tqt->tqt_active_list); /* For prealloc'd tasks, we don't free anything. */ @@ -515,37 +514,37 @@ taskq_thread(void *args) tqt->tqt_id = 0; tqt->tqt_flags = 0; - wake_up_all(&tq->tq_wait_waitq); + wake_up_all(&tq->tq_wait_waitq); } set_current_state(TASK_INTERRUPTIBLE); - } + } __set_current_state(TASK_RUNNING); - tq->tq_nthreads--; + tq->tq_nthreads--; list_del_init(&tqt->tqt_thread_list); kmem_free(tqt, sizeof(taskq_thread_t)); - spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); + spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); SRETURN(0); } taskq_t * __taskq_create(const char *name, int nthreads, pri_t pri, - int minalloc, int maxalloc, uint_t flags) + int minalloc, int maxalloc, uint_t flags) { - taskq_t *tq; + taskq_t *tq; taskq_thread_t *tqt; - int rc = 0, i, j = 0; - SENTRY; + int rc = 0, i, j = 0; + SENTRY; - ASSERT(name != NULL); - ASSERT(pri <= maxclsyspri); - ASSERT(minalloc >= 0); - ASSERT(maxalloc <= INT_MAX); - ASSERT(!(flags & (TASKQ_CPR_SAFE | TASKQ_DYNAMIC))); /* Unsupported */ + ASSERT(name != NULL); + ASSERT(pri <= maxclsyspri); + ASSERT(minalloc >= 0); + ASSERT(maxalloc <= INT_MAX); + ASSERT(!(flags & (TASKQ_CPR_SAFE | TASKQ_DYNAMIC))); /* Unsupported */ /* Scale the number of threads using nthreads as a percentage */ if (flags & TASKQ_THREADS_CPU_PCT) { @@ -556,35 +555,35 @@ __taskq_create(const char *name, int nthreads, pri_t pri, nthreads = MAX((num_online_cpus() * nthreads) / 100, 1); } - tq = kmem_alloc(sizeof(*tq), KM_PUSHPAGE); - if (tq == NULL) - SRETURN(NULL); + tq = kmem_alloc(sizeof(*tq), KM_PUSHPAGE); + if (tq == NULL) + SRETURN(NULL); - spin_lock_init(&tq->tq_lock); - spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); - INIT_LIST_HEAD(&tq->tq_thread_list); - INIT_LIST_HEAD(&tq->tq_active_list); - tq->tq_name = name; - tq->tq_nactive = 0; + spin_lock_init(&tq->tq_lock); + spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); + INIT_LIST_HEAD(&tq->tq_thread_list); + INIT_LIST_HEAD(&tq->tq_active_list); + tq->tq_name = name; + tq->tq_nactive = 0; tq->tq_nthreads = 0; - tq->tq_pri = pri; - tq->tq_minalloc = minalloc; - tq->tq_maxalloc = maxalloc; + tq->tq_pri = pri; + tq->tq_minalloc = minalloc; + tq->tq_maxalloc = maxalloc; tq->tq_nalloc = 0; - tq->tq_flags = (flags | TQ_ACTIVE); + tq->tq_flags = (flags | TQ_ACTIVE); tq->tq_next_id = 1; tq->tq_lowest_id = 1; - INIT_LIST_HEAD(&tq->tq_free_list); - INIT_LIST_HEAD(&tq->tq_pend_list); - INIT_LIST_HEAD(&tq->tq_prio_list); - init_waitqueue_head(&tq->tq_work_waitq); - init_waitqueue_head(&tq->tq_wait_waitq); + INIT_LIST_HEAD(&tq->tq_free_list); + INIT_LIST_HEAD(&tq->tq_pend_list); + INIT_LIST_HEAD(&tq->tq_prio_list); + init_waitqueue_head(&tq->tq_work_waitq); + init_waitqueue_head(&tq->tq_wait_waitq); - if (flags & TASKQ_PREPOPULATE) - for (i = 0; i < minalloc; i++) - task_done(tq, task_alloc(tq, TQ_PUSHPAGE | TQ_NEW)); + if (flags & TASKQ_PREPOPULATE) + for (i = 0; i < minalloc; i++) + task_done(tq, task_alloc(tq, TQ_PUSHPAGE | TQ_NEW)); - spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); + spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); for (i = 0; i < nthreads; i++) { tqt = kmem_alloc(sizeof(*tqt), KM_PUSHPAGE); @@ -594,7 +593,7 @@ __taskq_create(const char *name, int nthreads, pri_t pri, tqt->tqt_id = 0; tqt->tqt_thread = kthread_create(taskq_thread, tqt, - "%s/%d", name, i); + "%s/%d", name, i); if (tqt->tqt_thread) { list_add(&tqt->tqt_thread_list, &tq->tq_thread_list); kthread_bind(tqt->tqt_thread, i % num_online_cpus()); @@ -607,15 +606,15 @@ __taskq_create(const char *name, int nthreads, pri_t pri, } } - /* Wait for all threads to be started before potential destroy */ + /* Wait for all threads to be started before potential destroy */ wait_event(tq->tq_wait_waitq, tq->tq_nthreads == j); - if (rc) { - __taskq_destroy(tq); - tq = NULL; - } + if (rc) { + __taskq_destroy(tq); + tq = NULL; + } - SRETURN(tq); + SRETURN(tq); } EXPORT_SYMBOL(__taskq_create); @@ -629,13 +628,13 @@ __taskq_destroy(taskq_t *tq) ASSERT(tq); spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); - tq->tq_flags &= ~TQ_ACTIVE; + tq->tq_flags &= ~TQ_ACTIVE; spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); /* TQ_ACTIVE cleared prevents new tasks being added to pending */ - __taskq_wait(tq); + __taskq_wait(tq); - spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); + spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); /* * Signal each thread to exit and block until it does. Each thread @@ -651,29 +650,29 @@ __taskq_destroy(taskq_t *tq) kthread_stop(thread); - spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); + spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); } - while (!list_empty(&tq->tq_free_list)) { + while (!list_empty(&tq->tq_free_list)) { t = list_entry(tq->tq_free_list.next, taskq_ent_t, tqent_list); ASSERT(!(t->tqent_flags & TQENT_FLAG_PREALLOC)); - list_del_init(&t->tqent_list); - task_free(tq, t); - } + list_del_init(&t->tqent_list); + task_free(tq, t); + } - ASSERT(tq->tq_nthreads == 0); - ASSERT(tq->tq_nalloc == 0); - ASSERT(list_empty(&tq->tq_thread_list)); - ASSERT(list_empty(&tq->tq_active_list)); - ASSERT(list_empty(&tq->tq_free_list)); - ASSERT(list_empty(&tq->tq_pend_list)); - ASSERT(list_empty(&tq->tq_prio_list)); + ASSERT(tq->tq_nthreads == 0); + ASSERT(tq->tq_nalloc == 0); + ASSERT(list_empty(&tq->tq_thread_list)); + ASSERT(list_empty(&tq->tq_active_list)); + ASSERT(list_empty(&tq->tq_free_list)); + ASSERT(list_empty(&tq->tq_pend_list)); + ASSERT(list_empty(&tq->tq_prio_list)); - spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); + spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); - kmem_free(tq, sizeof(taskq_t)); + kmem_free(tq, sizeof(taskq_t)); SEXIT; } @@ -682,22 +681,22 @@ EXPORT_SYMBOL(__taskq_destroy); int spl_taskq_init(void) { - SENTRY; + SENTRY; /* Solaris creates a dynamic taskq of up to 64 threads, however in * a Linux environment 1 thread per-core is usually about right */ - system_taskq = taskq_create("spl_system_taskq", num_online_cpus(), + system_taskq = taskq_create("spl_system_taskq", num_online_cpus(), minclsyspri, 4, 512, TASKQ_PREPOPULATE); if (system_taskq == NULL) SRETURN(1); - SRETURN(0); + SRETURN(0); } void spl_taskq_fini(void) { - SENTRY; + SENTRY; taskq_destroy(system_taskq); - SEXIT; + SEXIT; } -- cgit v1.2.3 From aed8671cb0bfc18f6cd034ecad2e9cf49536d965 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Thu, 6 Dec 2012 13:04:27 -0800 Subject: taskq style, remove #define wrappers When the taskq implementation was originally written I wrapped all the API functions in #define's. This was done as a preventative measure to ensure that a taskq symbol never conflicted with an existing kernel symbol. However, in practice the taskq symbols never conflicted. The only major conflicts occured with the kmem cache API. Since this added layer of obfuscation never bought us anything for the taskq's I'm removing it. Signed-off-by: Brian Behlendorf --- include/sys/taskq.h | 40 +++++++++++++++------------------------- module/spl/spl-taskq.c | 42 +++++++++++++++++++++--------------------- 2 files changed, 36 insertions(+), 46 deletions(-) (limited to 'module/spl/spl-taskq.c') diff --git a/include/sys/taskq.h b/include/sys/taskq.h index 8260cf935..84b563208 100644 --- a/include/sys/taskq.h +++ b/include/sys/taskq.h @@ -103,33 +103,23 @@ typedef struct taskq_thread { /* Global system-wide dynamic task queue available for all consumers */ extern taskq_t *system_taskq; -extern taskqid_t __taskq_dispatch(taskq_t *, task_func_t, void *, uint_t); -extern void __taskq_dispatch_ent(taskq_t *, task_func_t, void *, uint_t, taskq_ent_t *); -extern int __taskq_empty_ent(taskq_ent_t *); -extern void __taskq_init_ent(taskq_ent_t *); -extern taskq_t *__taskq_create(const char *, int, pri_t, int, int, uint_t); -extern void __taskq_destroy(taskq_t *); -extern void __taskq_wait_id(taskq_t *, taskqid_t); -extern void __taskq_wait(taskq_t *); -extern int __taskq_member(taskq_t *, void *); +extern taskqid_t taskq_dispatch(taskq_t *, task_func_t, void *, uint_t); +extern void taskq_dispatch_ent(taskq_t *, task_func_t, void *, uint_t, + taskq_ent_t *); +extern int taskq_empty_ent(taskq_ent_t *); +extern void taskq_init_ent(taskq_ent_t *); +extern taskq_t *taskq_create(const char *, int, pri_t, int, int, uint_t); +extern void taskq_destroy(taskq_t *); +extern void taskq_wait_id(taskq_t *, taskqid_t); +extern void taskq_wait(taskq_t *); +extern int taskq_member(taskq_t *, void *); + +#define taskq_create_proc(name, nthreads, pri, min, max, proc, flags) \ + taskq_create(name, nthreads, pri, min, max, flags) +#define taskq_create_sysdc(name, nthreads, min, max, proc, dc, flags) \ + taskq_create(name, nthreads, maxclsyspri, min, max, flags) int spl_taskq_init(void); void spl_taskq_fini(void); -#define taskq_member(tq, t) __taskq_member(tq, t) -#define taskq_wait_id(tq, id) __taskq_wait_id(tq, id) -#define taskq_wait(tq) __taskq_wait(tq) -#define taskq_dispatch(tq, f, p, fl) __taskq_dispatch(tq, f, p, fl) -#define taskq_dispatch_ent(tq, f, p, fl, t) \ - __taskq_dispatch_ent(tq, f, p, fl, t) -#define taskq_empty_ent(t) __taskq_empty_ent(t) -#define taskq_init_ent(t) __taskq_init_ent(t) -#define taskq_create(n, th, p, mi, ma, fl) \ - __taskq_create(n, th, p, mi, ma, fl) -#define taskq_create_proc(n, th, p, mi, ma, pr, fl) \ - __taskq_create(n, th, p, mi, ma, fl) -#define taskq_create_sysdc(n, th, mi, ma, pr, dc, fl) \ - __taskq_create(n, th, maxclsyspri, mi, ma, fl) -#define taskq_destroy(tq) __taskq_destroy(tq) - #endif /* _SPL_TASKQ_H */ diff --git a/module/spl/spl-taskq.c b/module/spl/spl-taskq.c index 99bd361ad..2007cf084 100644 --- a/module/spl/spl-taskq.c +++ b/module/spl/spl-taskq.c @@ -201,7 +201,7 @@ taskq_wait_check(taskq_t *tq, taskqid_t id) } void -__taskq_wait_id(taskq_t *tq, taskqid_t id) +taskq_wait_id(taskq_t *tq, taskqid_t id) { SENTRY; ASSERT(tq); @@ -210,10 +210,10 @@ __taskq_wait_id(taskq_t *tq, taskqid_t id) SEXIT; } -EXPORT_SYMBOL(__taskq_wait_id); +EXPORT_SYMBOL(taskq_wait_id); void -__taskq_wait(taskq_t *tq) +taskq_wait(taskq_t *tq) { taskqid_t id; SENTRY; @@ -224,15 +224,15 @@ __taskq_wait(taskq_t *tq) id = tq->tq_next_id - 1; spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); - __taskq_wait_id(tq, id); + taskq_wait_id(tq, id); SEXIT; } -EXPORT_SYMBOL(__taskq_wait); +EXPORT_SYMBOL(taskq_wait); int -__taskq_member(taskq_t *tq, void *t) +taskq_member(taskq_t *tq, void *t) { struct list_head *l; taskq_thread_t *tqt; @@ -249,10 +249,10 @@ __taskq_member(taskq_t *tq, void *t) SRETURN(0); } -EXPORT_SYMBOL(__taskq_member); +EXPORT_SYMBOL(taskq_member); taskqid_t -__taskq_dispatch(taskq_t *tq, task_func_t func, void *arg, uint_t flags) +taskq_dispatch(taskq_t *tq, task_func_t func, void *arg, uint_t flags) { taskq_ent_t *t; taskqid_t rc = 0; @@ -297,10 +297,10 @@ out: spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); SRETURN(rc); } -EXPORT_SYMBOL(__taskq_dispatch); +EXPORT_SYMBOL(taskq_dispatch); void -__taskq_dispatch_ent(taskq_t *tq, task_func_t func, void *arg, uint_t flags, +taskq_dispatch_ent(taskq_t *tq, task_func_t func, void *arg, uint_t flags, taskq_ent_t *t) { SENTRY; @@ -343,17 +343,17 @@ out: spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); SEXIT; } -EXPORT_SYMBOL(__taskq_dispatch_ent); +EXPORT_SYMBOL(taskq_dispatch_ent); int -__taskq_empty_ent(taskq_ent_t *t) +taskq_empty_ent(taskq_ent_t *t) { return list_empty(&t->tqent_list); } -EXPORT_SYMBOL(__taskq_empty_ent); +EXPORT_SYMBOL(taskq_empty_ent); void -__taskq_init_ent(taskq_ent_t *t) +taskq_init_ent(taskq_ent_t *t) { spin_lock_init(&t->tqent_lock); INIT_LIST_HEAD(&t->tqent_list); @@ -362,7 +362,7 @@ __taskq_init_ent(taskq_ent_t *t) t->tqent_arg = NULL; t->tqent_flags = 0; } -EXPORT_SYMBOL(__taskq_init_ent); +EXPORT_SYMBOL(taskq_init_ent); /* * Returns the lowest incomplete taskqid_t. The taskqid_t may @@ -532,7 +532,7 @@ taskq_thread(void *args) } taskq_t * -__taskq_create(const char *name, int nthreads, pri_t pri, +taskq_create(const char *name, int nthreads, pri_t pri, int minalloc, int maxalloc, uint_t flags) { taskq_t *tq; @@ -610,16 +610,16 @@ __taskq_create(const char *name, int nthreads, pri_t pri, wait_event(tq->tq_wait_waitq, tq->tq_nthreads == j); if (rc) { - __taskq_destroy(tq); + taskq_destroy(tq); tq = NULL; } SRETURN(tq); } -EXPORT_SYMBOL(__taskq_create); +EXPORT_SYMBOL(taskq_create); void -__taskq_destroy(taskq_t *tq) +taskq_destroy(taskq_t *tq) { struct task_struct *thread; taskq_thread_t *tqt; @@ -632,7 +632,7 @@ __taskq_destroy(taskq_t *tq) spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); /* TQ_ACTIVE cleared prevents new tasks being added to pending */ - __taskq_wait(tq); + taskq_wait(tq); spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); @@ -676,7 +676,7 @@ __taskq_destroy(taskq_t *tq) SEXIT; } -EXPORT_SYMBOL(__taskq_destroy); +EXPORT_SYMBOL(taskq_destroy); int spl_taskq_init(void) -- cgit v1.2.3 From d9acd930b52503582425c6398fc8dbc1d7d4a01b Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Thu, 6 Dec 2012 12:38:19 -0800 Subject: taskq delay/cancel functionality Add the ability to dispatch a delayed task to a taskq. The desired behavior is for the task to be queued but not executed by a worker thread until the expiration time is reached. To achieve this two new functions were added. * taskq_dispatch_delay() - This function behaves exactly like taskq_dispatch() however it takes a third 'expire_time' argument. The caller should pass the desired time the task should be executed as an absolute value in jiffies. The task is guarenteed not to run before this time, it may run slightly latter if all the worker threads are busy. * taskq_cancel_id() - Given a task id attempt to cancel the task before it gets executed. This is primarily useful for canceling delay tasks but can be used for canceling any previously dispatched task. There are three possible return values. 0 - The task was found and canceled before it was executed. ENOENT - The task was not found, either it was already run or an invalid task id was supplied by the caller. EBUSY - The task is currently executing any may not be canceled. This function will block until the task has been completed. * taskq_wait_all() - The taskq_wait_id() function was renamed taskq_wait_all() to more clearly reflect its actual behavior. It is only curreny used by the splat taskq regression tests. * taskq_wait_id() - Historically, the only difference between this function and taskq_wait() was that you passed the task id. In both functions you would block until ALL lower task ids which executed. This was semantically correct but could be very slow particularly if there were delay tasks submitted. To better accomidate the delay tasks this function was reimplemnted. It will now only block until the passed task id has been completed. This is actually a fairly low risk change for a few reasons. * Only new ZFS callers will make use of the new interfaces and very little common code was changed to support the new functions. * The existing taskq_wait() implementation was not changed just slightly refactored. * The newly optimized taskq_wait_id() implementation was never used by ZFS we can't accidentally introduce a new bug there. NOTE: This functionality does not exist in the Illumos taskqs. Signed-off-by: Brian Behlendorf --- include/sys/taskq.h | 38 ++-- module/spl/spl-taskq.c | 452 +++++++++++++++++++++++++++++++++++---------- module/splat/splat-taskq.c | 18 +- 3 files changed, 389 insertions(+), 119 deletions(-) (limited to 'module/spl/spl-taskq.c') diff --git a/include/sys/taskq.h b/include/sys/taskq.h index 84b563208..3839de288 100644 --- a/include/sys/taskq.h +++ b/include/sys/taskq.h @@ -41,20 +41,6 @@ #define TASKQ_THREADS_CPU_PCT 0x00000008 #define TASKQ_DC_BATCH 0x00000010 -typedef unsigned long taskqid_t; -typedef void (task_func_t)(void *); - -typedef struct taskq_ent { - spinlock_t tqent_lock; - struct list_head tqent_list; - taskqid_t tqent_id; - task_func_t *tqent_func; - void *tqent_arg; - uintptr_t tqent_flags; -} taskq_ent_t; - -#define TQENT_FLAG_PREALLOC 0x1 - /* * Flags for taskq_dispatch. TQ_SLEEP/TQ_NOSLEEP should be same as * KM_SLEEP/KM_NOSLEEP. TQ_NOQUEUE/TQ_NOALLOC are set particularly @@ -69,6 +55,9 @@ typedef struct taskq_ent { #define TQ_FRONT 0x08000000 #define TQ_ACTIVE 0x80000000 +typedef unsigned long taskqid_t; +typedef void (task_func_t)(void *); + typedef struct taskq { spinlock_t tq_lock; /* protects taskq_t */ unsigned long tq_lock_flags; /* interrupt state */ @@ -87,16 +76,33 @@ typedef struct taskq { struct list_head tq_free_list; /* free task_t's */ struct list_head tq_pend_list; /* pending task_t's */ struct list_head tq_prio_list; /* priority pending task_t's */ + struct list_head tq_delay_list; /* delayed task_t's */ wait_queue_head_t tq_work_waitq; /* new work waitq */ wait_queue_head_t tq_wait_waitq; /* wait waitq */ } taskq_t; +typedef struct taskq_ent { + spinlock_t tqent_lock; + wait_queue_head_t tqent_waitq; + struct timer_list tqent_timer; + struct list_head tqent_list; + taskqid_t tqent_id; + task_func_t *tqent_func; + void *tqent_arg; + taskq_t *tqent_taskq; + uintptr_t tqent_flags; +} taskq_ent_t; + +#define TQENT_FLAG_PREALLOC 0x1 +#define TQENT_FLAG_CANCEL 0x2 + typedef struct taskq_thread { struct list_head tqt_thread_list; struct list_head tqt_active_list; struct task_struct *tqt_thread; taskq_t *tqt_tq; taskqid_t tqt_id; + taskq_ent_t *tqt_task; uintptr_t tqt_flags; } taskq_thread_t; @@ -104,6 +110,8 @@ typedef struct taskq_thread { extern taskq_t *system_taskq; extern taskqid_t taskq_dispatch(taskq_t *, task_func_t, void *, uint_t); +extern taskqid_t taskq_dispatch_delay(taskq_t *, task_func_t, void *, + uint_t, clock_t); extern void taskq_dispatch_ent(taskq_t *, task_func_t, void *, uint_t, taskq_ent_t *); extern int taskq_empty_ent(taskq_ent_t *); @@ -111,7 +119,9 @@ extern void taskq_init_ent(taskq_ent_t *); extern taskq_t *taskq_create(const char *, int, pri_t, int, int, uint_t); extern void taskq_destroy(taskq_t *); extern void taskq_wait_id(taskq_t *, taskqid_t); +extern void taskq_wait_all(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_create_proc(name, nthreads, pri, min, max, proc, flags) \ diff --git a/module/spl/spl-taskq.c b/module/spl/spl-taskq.c index 2007cf084..c9ae0a50b 100644 --- a/module/spl/spl-taskq.c +++ b/module/spl/spl-taskq.c @@ -69,6 +69,8 @@ retry: t = list_entry(tq->tq_free_list.next, taskq_ent_t, tqent_list); ASSERT(!(t->tqent_flags & TQENT_FLAG_PREALLOC)); + ASSERT(!(t->tqent_flags & TQENT_FLAG_CANCEL)); + ASSERT(!timer_pending(&t->tqent_timer)); list_del_init(&t->tqent_list); SRETURN(t); @@ -126,6 +128,7 @@ task_free(taskq_t *tq, taskq_ent_t *t) ASSERT(t); ASSERT(spin_is_locked(&tq->tq_lock)); ASSERT(list_empty(&t->tqent_list)); + ASSERT(!timer_pending(&t->tqent_timer)); kmem_free(t, sizeof(taskq_ent_t)); tq->tq_nalloc--; @@ -145,6 +148,9 @@ task_done(taskq_t *tq, taskq_ent_t *t) ASSERT(t); ASSERT(spin_is_locked(&tq->tq_lock)); + /* Wake tasks blocked in taskq_wait_id() */ + wake_up_all(&t->tqent_waitq); + list_del_init(&t->tqent_list); if (tq->tq_nalloc <= tq->tq_minalloc) { @@ -162,56 +168,261 @@ task_done(taskq_t *tq, taskq_ent_t *t) } /* - * As tasks are submitted to the task queue they are assigned a - * monotonically increasing taskqid and added to the tail of the pending - * list. As worker threads become available the tasks are removed from - * the head of the pending or priority list, giving preference to the - * priority list. The tasks are then removed from their respective - * list, and the taskq_thread servicing the task is added to the active - * list, preserving the order using the serviced task's taskqid. - * Finally, as tasks complete the taskq_thread servicing the task is - * removed from the active list. This means that the pending task and - * active taskq_thread lists are always kept sorted by taskqid. Thus the - * lowest outstanding incomplete taskqid can be determined simply by - * checking the min taskqid for each head item on the pending, priority, - * and active taskq_thread list. This value is stored in - * tq->tq_lowest_id and only updated to the new lowest id when the - * previous lowest id completes. All taskqids lower than - * tq->tq_lowest_id must have completed. It is also possible larger - * taskqid's have completed because they may be processed in parallel by - * several worker threads. However, this is not a problem because the - * behavior of taskq_wait_id() is to block until all previously - * submitted taskqid's have completed. - * - * XXX: Taskqid_t wrapping is not handled. However, taskqid_t's are - * 64-bit values so even if a taskq is processing 2^24 (16,777,216) - * taskqid_ts per second it will still take 2^40 seconds, 34,865 years, - * before the wrap occurs. I can live with that for now. + * When a delayed task timer expires remove it from the delay list and + * add it to the priority list in order for immediate processing. */ -static int -taskq_wait_check(taskq_t *tq, taskqid_t id) +static void +task_expire(unsigned long data) { - int rc; + taskq_ent_t *w, *t = (taskq_ent_t *)data; + taskq_t *tq = t->tqent_taskq; + struct list_head *l; spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); - rc = (id < tq->tq_lowest_id); + + if (t->tqent_flags & TQENT_FLAG_CANCEL) { + ASSERT(list_empty(&t->tqent_list)); + spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); + return; + } + + /* + * The priority list must be maintained in strict task id order + * from lowest to highest for lowest_id to be easily calculable. + */ + list_del(&t->tqent_list); + list_for_each_prev(l, &tq->tq_prio_list) { + w = list_entry(l, taskq_ent_t, tqent_list); + if (w->tqent_id < t->tqent_id) { + list_add(&t->tqent_list, l); + break; + } + } + if (l == &tq->tq_prio_list) + list_add(&t->tqent_list, &tq->tq_prio_list); + spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); - SRETURN(rc); + wake_up(&tq->tq_work_waitq); +} + +/* + * Returns the lowest incomplete taskqid_t. The taskqid_t may + * be queued on the pending list, on the priority list, on the + * delay list, or on the work list currently being handled, but + * it is not 100% complete yet. + */ +static taskqid_t +taskq_lowest_id(taskq_t *tq) +{ + taskqid_t lowest_id = tq->tq_next_id; + taskq_ent_t *t; + taskq_thread_t *tqt; + SENTRY; + + ASSERT(tq); + ASSERT(spin_is_locked(&tq->tq_lock)); + + if (!list_empty(&tq->tq_pend_list)) { + t = list_entry(tq->tq_pend_list.next, taskq_ent_t, tqent_list); + lowest_id = MIN(lowest_id, t->tqent_id); + } + + if (!list_empty(&tq->tq_prio_list)) { + t = list_entry(tq->tq_prio_list.next, taskq_ent_t, tqent_list); + lowest_id = MIN(lowest_id, t->tqent_id); + } + + if (!list_empty(&tq->tq_delay_list)) { + t = list_entry(tq->tq_delay_list.next, taskq_ent_t, tqent_list); + lowest_id = MIN(lowest_id, t->tqent_id); + } + + if (!list_empty(&tq->tq_active_list)) { + tqt = list_entry(tq->tq_active_list.next, taskq_thread_t, + tqt_active_list); + ASSERT(tqt->tqt_id != 0); + lowest_id = MIN(lowest_id, tqt->tqt_id); + } + + SRETURN(lowest_id); +} + +/* + * Insert a task into a list keeping the list sorted by increasing taskqid. + */ +static void +taskq_insert_in_order(taskq_t *tq, taskq_thread_t *tqt) +{ + taskq_thread_t *w; + struct list_head *l; + + SENTRY; + ASSERT(tq); + ASSERT(tqt); + ASSERT(spin_is_locked(&tq->tq_lock)); + + list_for_each_prev(l, &tq->tq_active_list) { + w = list_entry(l, taskq_thread_t, tqt_active_list); + if (w->tqt_id < tqt->tqt_id) { + list_add(&tqt->tqt_active_list, l); + break; + } + } + if (l == &tq->tq_active_list) + list_add(&tqt->tqt_active_list, &tq->tq_active_list); + + SEXIT; +} + +/* + * Find and return a task from the given list if it exists. The list + * must be in lowest to highest task id order. + */ +static taskq_ent_t * +taskq_find_list(taskq_t *tq, struct list_head *lh, taskqid_t id) +{ + struct list_head *l; + taskq_ent_t *t; + SENTRY; + + ASSERT(spin_is_locked(&tq->tq_lock)); + + list_for_each(l, lh) { + t = list_entry(l, taskq_ent_t, tqent_list); + + if (t->tqent_id == id) + SRETURN(t); + + if (t->tqent_id > id) + break; + } + + SRETURN(NULL); } +/* + * Find an already dispatched task given the task id regardless of what + * state it is in. If a task is still pending or executing it will be + * returned and 'active' set appropriately. If the task has already + * been run then NULL is returned. + */ +static taskq_ent_t * +taskq_find(taskq_t *tq, taskqid_t id, int *active) +{ + taskq_thread_t *tqt; + struct list_head *l; + taskq_ent_t *t; + SENTRY; + + ASSERT(spin_is_locked(&tq->tq_lock)); + *active = 0; + + t = taskq_find_list(tq, &tq->tq_delay_list, id); + if (t) + SRETURN(t); + + t = taskq_find_list(tq, &tq->tq_prio_list, id); + if (t) + SRETURN(t); + + t = taskq_find_list(tq, &tq->tq_pend_list, id); + if (t) + SRETURN(t); + + list_for_each(l, &tq->tq_active_list) { + tqt = list_entry(l, taskq_thread_t, tqt_active_list); + if (tqt->tqt_id == id) { + t = tqt->tqt_task; + *active = 1; + SRETURN(t); + } + } + + SRETURN(NULL); +} + +/* + * The taskq_wait_id() function blocks until the passed task id completes. + * This does not guarantee that all lower task id's have completed. + */ void taskq_wait_id(taskq_t *tq, taskqid_t id) { + DEFINE_WAIT(wait); + taskq_ent_t *t; + int active = 0; SENTRY; + ASSERT(tq); + ASSERT(id > 0); - wait_event(tq->tq_wait_waitq, taskq_wait_check(tq, id)); + spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); + t = taskq_find(tq, id, &active); + if (t) + prepare_to_wait(&t->tqent_waitq, &wait, TASK_UNINTERRUPTIBLE); + spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); + + /* + * We rely on the kernels autoremove_wake_function() function to + * remove us from the wait queue in the context of wake_up(). + * Once woken the taskq_ent_t pointer must never be accessed. + */ + if (t) { + t = NULL; + schedule(); + __set_current_state(TASK_RUNNING); + } SEXIT; } EXPORT_SYMBOL(taskq_wait_id); +/* + * The taskq_wait() function will block until all previously submitted + * tasks have been completed. A previously submitted task is defined as + * a task with a lower task id than the current task queue id. Note that + * all task id's are assigned monotonically at dispatch time. + * + * Waiting for all previous tasks to complete is accomplished by tracking + * the lowest outstanding task id. As tasks are dispatched they are added + * added to the tail of the pending, priority, or delay lists. And as + * worker threads become available the tasks are removed from the heads + * of these lists and linked to the worker threads. This ensures the + * lists are kept in lowest to highest task id order. + * + * Therefore the lowest outstanding task id can be quickly determined by + * checking the head item from all of these lists. This value is stored + * with the task queue as the lowest id. It only needs to be recalculated + * when either the task with the current lowest id completes or is canceled. + * + * By blocking until the lowest task id exceeds the current task id when + * the function was called we ensure all previous tasks have completed. + * + * NOTE: When there are multiple worked threads it is possible for larger + * task ids to complete before smaller ones. Conversely when the task + * queue contains delay tasks with small task ids, you may block for a + * considerable length of time waiting for them to expire and execute. + */ +static int +taskq_wait_check(taskq_t *tq, taskqid_t id) +{ + int rc; + + spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); + rc = (id < tq->tq_lowest_id); + spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); + + SRETURN(rc); +} + +void +taskq_wait_all(taskq_t *tq, taskqid_t id) +{ + wait_event(tq->tq_wait_waitq, taskq_wait_check(tq, id)); +} +EXPORT_SYMBOL(taskq_wait_all); + void taskq_wait(taskq_t *tq) { @@ -224,7 +435,7 @@ taskq_wait(taskq_t *tq) id = tq->tq_next_id - 1; spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); - taskq_wait_id(tq, id); + taskq_wait_all(tq, id); SEXIT; @@ -251,6 +462,63 @@ taskq_member(taskq_t *tq, void *t) } EXPORT_SYMBOL(taskq_member); +/* + * Cancel an already dispatched task given the task id. Still pending tasks + * will be immediately canceled, and if the task is active the function will + * block until it completes. Preallocated tasks which are canceled must be + * freed by the caller. + */ +int +taskq_cancel_id(taskq_t *tq, taskqid_t id) +{ + taskq_ent_t *t; + int active = 0; + int rc = ENOENT; + SENTRY; + + ASSERT(tq); + + spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); + t = taskq_find(tq, id, &active); + if (t && !active) { + list_del_init(&t->tqent_list); + t->tqent_flags |= TQENT_FLAG_CANCEL; + + /* + * When canceling the lowest outstanding task id we + * must recalculate the new lowest outstanding id. + */ + if (tq->tq_lowest_id == t->tqent_id) { + tq->tq_lowest_id = taskq_lowest_id(tq); + ASSERT3S(tq->tq_lowest_id, >, t->tqent_id); + } + + /* + * The task_expire() function takes the tq->tq_lock so drop + * drop the lock before synchronously cancelling the timer. + */ + if (timer_pending(&t->tqent_timer)) { + spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); + del_timer_sync(&t->tqent_timer); + spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); + } + + if (!(t->tqent_flags & TQENT_FLAG_PREALLOC)) + task_done(tq, t); + + rc = 0; + } + spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); + + if (active) { + taskq_wait_id(tq, id); + rc = EBUSY; + } + + SRETURN(rc); +} +EXPORT_SYMBOL(taskq_cancel_id); + taskqid_t taskq_dispatch(taskq_t *tq, task_func_t func, void *arg, uint_t flags) { @@ -287,6 +555,10 @@ taskq_dispatch(taskq_t *tq, task_func_t func, void *arg, uint_t flags) tq->tq_next_id++; t->tqent_func = func; t->tqent_arg = arg; + t->tqent_taskq = tq; + t->tqent_timer.data = 0; + t->tqent_timer.function = NULL; + t->tqent_timer.expires = 0; ASSERT(!(t->tqent_flags & TQENT_FLAG_PREALLOC)); @@ -299,6 +571,50 @@ out: } EXPORT_SYMBOL(taskq_dispatch); +taskqid_t +taskq_dispatch_delay(taskq_t *tq, task_func_t func, void *arg, + uint_t flags, clock_t expire_time) +{ + taskq_ent_t *t; + taskqid_t rc = 0; + SENTRY; + + ASSERT(tq); + ASSERT(func); + + spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); + + /* Taskq being destroyed and all tasks drained */ + if (!(tq->tq_flags & TQ_ACTIVE)) + SGOTO(out, rc = 0); + + if ((t = task_alloc(tq, flags)) == NULL) + SGOTO(out, rc = 0); + + spin_lock(&t->tqent_lock); + + /* Queue to the delay list for subsequent execution */ + list_add_tail(&t->tqent_list, &tq->tq_delay_list); + + t->tqent_id = rc = tq->tq_next_id; + tq->tq_next_id++; + t->tqent_func = func; + t->tqent_arg = arg; + t->tqent_taskq = tq; + t->tqent_timer.data = (unsigned long)t; + t->tqent_timer.function = task_expire; + t->tqent_timer.expires = (unsigned long)expire_time; + add_timer(&t->tqent_timer); + + ASSERT(!(t->tqent_flags & TQENT_FLAG_PREALLOC)); + + spin_unlock(&t->tqent_lock); +out: + spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); + SRETURN(rc); +} +EXPORT_SYMBOL(taskq_dispatch_delay); + void taskq_dispatch_ent(taskq_t *tq, task_func_t func, void *arg, uint_t flags, taskq_ent_t *t) @@ -335,6 +651,7 @@ taskq_dispatch_ent(taskq_t *tq, task_func_t func, void *arg, uint_t flags, tq->tq_next_id++; t->tqent_func = func; t->tqent_arg = arg; + t->tqent_taskq = tq; spin_unlock(&t->tqent_lock); @@ -356,78 +673,17 @@ void taskq_init_ent(taskq_ent_t *t) { spin_lock_init(&t->tqent_lock); + init_waitqueue_head(&t->tqent_waitq); + init_timer(&t->tqent_timer); INIT_LIST_HEAD(&t->tqent_list); t->tqent_id = 0; t->tqent_func = NULL; t->tqent_arg = NULL; t->tqent_flags = 0; + t->tqent_taskq = NULL; } EXPORT_SYMBOL(taskq_init_ent); -/* - * Returns the lowest incomplete taskqid_t. The taskqid_t may - * be queued on the pending list, on the priority list, or on - * the work list currently being handled, but it is not 100% - * complete yet. - */ -static taskqid_t -taskq_lowest_id(taskq_t *tq) -{ - taskqid_t lowest_id = tq->tq_next_id; - taskq_ent_t *t; - taskq_thread_t *tqt; - SENTRY; - - ASSERT(tq); - ASSERT(spin_is_locked(&tq->tq_lock)); - - if (!list_empty(&tq->tq_pend_list)) { - t = list_entry(tq->tq_pend_list.next, taskq_ent_t, tqent_list); - lowest_id = MIN(lowest_id, t->tqent_id); - } - - if (!list_empty(&tq->tq_prio_list)) { - t = list_entry(tq->tq_prio_list.next, taskq_ent_t, tqent_list); - lowest_id = MIN(lowest_id, t->tqent_id); - } - - if (!list_empty(&tq->tq_active_list)) { - tqt = list_entry(tq->tq_active_list.next, taskq_thread_t, - tqt_active_list); - ASSERT(tqt->tqt_id != 0); - lowest_id = MIN(lowest_id, tqt->tqt_id); - } - - SRETURN(lowest_id); -} - -/* - * Insert a task into a list keeping the list sorted by increasing taskqid. - */ -static void -taskq_insert_in_order(taskq_t *tq, taskq_thread_t *tqt) -{ - taskq_thread_t *w; - struct list_head *l; - - SENTRY; - ASSERT(tq); - ASSERT(tqt); - ASSERT(spin_is_locked(&tq->tq_lock)); - - list_for_each_prev(l, &tq->tq_active_list) { - w = list_entry(l, taskq_thread_t, tqt_active_list); - if (w->tqt_id < tqt->tqt_id) { - list_add(&tqt->tqt_active_list, l); - break; - } - } - if (l == &tq->tq_active_list) - list_add(&tqt->tqt_active_list, &tq->tq_active_list); - - SEXIT; -} - static int taskq_thread(void *args) { @@ -481,6 +737,7 @@ taskq_thread(void *args) * preallocated taskq_ent_t, tqent_id must be * stored prior to executing tqent_func. */ tqt->tqt_id = t->tqent_id; + tqt->tqt_task = t; /* We must store a copy of the flags prior to * servicing the task (servicing a prealloc'd task @@ -499,6 +756,7 @@ taskq_thread(void *args) spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); tq->tq_nactive--; list_del_init(&tqt->tqt_active_list); + tqt->tqt_task = NULL; /* For prealloc'd tasks, we don't free anything. */ if ((tq->tq_flags & TASKQ_DYNAMIC) || @@ -576,6 +834,7 @@ taskq_create(const char *name, int nthreads, pri_t pri, INIT_LIST_HEAD(&tq->tq_free_list); INIT_LIST_HEAD(&tq->tq_pend_list); INIT_LIST_HEAD(&tq->tq_prio_list); + INIT_LIST_HEAD(&tq->tq_delay_list); init_waitqueue_head(&tq->tq_work_waitq); init_waitqueue_head(&tq->tq_wait_waitq); @@ -669,6 +928,7 @@ taskq_destroy(taskq_t *tq) ASSERT(list_empty(&tq->tq_free_list)); ASSERT(list_empty(&tq->tq_pend_list)); ASSERT(list_empty(&tq->tq_prio_list)); + ASSERT(list_empty(&tq->tq_delay_list)); spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); diff --git a/module/splat/splat-taskq.c b/module/splat/splat-taskq.c index b94930cc9..7fad4627e 100644 --- a/module/splat/splat-taskq.c +++ b/module/splat/splat-taskq.c @@ -548,10 +548,10 @@ splat_taskq_test4(struct file *file, void *arg) * next pending task as soon as it completes its current task. This * means that tasks do not strictly complete in order in which they * were dispatched (increasing task id). This is fine but we need to - * verify that taskq_wait_id() blocks until the passed task id and all + * verify that taskq_wait_all() blocks until the passed task id and all * lower task ids complete. We do this by dispatching the following * specific sequence of tasks each of which block for N time units. - * We then use taskq_wait_id() to unblock at specific task id and + * We then use taskq_wait_all() to unblock at specific task id and * verify the only the expected task ids have completed and in the * correct order. The two cases of interest are: * @@ -562,17 +562,17 @@ splat_taskq_test4(struct file *file, void *arg) * * The following table shows each task id and how they will be * scheduled. Each rows represent one time unit and each column - * one of the three worker threads. The places taskq_wait_id() + * one of the three worker threads. The places taskq_wait_all() * must unblock for a specific id are identified as well as the * task ids which must have completed and their order. * - * +-----+ <--- taskq_wait_id(tq, 8) unblocks + * +-----+ <--- taskq_wait_all(tq, 8) unblocks * | | Required Completion Order: 1,2,4,5,3,8,6,7 * +-----+ | * | | | * | | +-----+ * | | | 8 | - * | | +-----+ <--- taskq_wait_id(tq, 3) unblocks + * | | +-----+ <--- taskq_wait_all(tq, 3) unblocks * | | 7 | | Required Completion Order: 1,2,4,5,3 * | +-----+ | * | 6 | | | @@ -712,13 +712,13 @@ splat_taskq_test5_impl(struct file *file, void *arg, boolean_t prealloc) splat_vprint(file, SPLAT_TASKQ_TEST5_NAME, "Taskq '%s' " "waiting for taskqid %d completion\n", tq_arg.name, 3); - taskq_wait_id(tq, 3); + taskq_wait_all(tq, 3); if ((rc = splat_taskq_test_order(&tq_arg, order1))) goto out; splat_vprint(file, SPLAT_TASKQ_TEST5_NAME, "Taskq '%s' " "waiting for taskqid %d completion\n", tq_arg.name, 8); - taskq_wait_id(tq, 8); + taskq_wait_all(tq, 8); rc = splat_taskq_test_order(&tq_arg, order2); out: @@ -874,7 +874,7 @@ splat_taskq_test6_impl(struct file *file, void *arg, boolean_t prealloc) splat_vprint(file, SPLAT_TASKQ_TEST6_NAME, "Taskq '%s' " "waiting for taskqid %d completion\n", tq_arg.name, SPLAT_TASKQ_ORDER_MAX); - taskq_wait_id(tq, SPLAT_TASKQ_ORDER_MAX); + taskq_wait_all(tq, SPLAT_TASKQ_ORDER_MAX); rc = splat_taskq_test_order(&tq_arg, order); out: @@ -975,7 +975,7 @@ splat_taskq_test7_impl(struct file *file, void *arg, boolean_t prealloc) if (tq_arg.flag == 0) { splat_vprint(file, SPLAT_TASKQ_TEST7_NAME, "Taskq '%s' waiting\n", tq_arg.name); - taskq_wait_id(tq, SPLAT_TASKQ_DEPTH_MAX); + taskq_wait_all(tq, SPLAT_TASKQ_DEPTH_MAX); } splat_vprint(file, SPLAT_TASKQ_TEST7_NAME, -- cgit v1.2.3 From 3d6af2dd6d598bebf6ab04d0e2b6f6ba6e5d0f00 Mon Sep 17 00:00:00 2001 From: Ned Bass Date: Mon, 4 Mar 2013 17:26:55 -0800 Subject: Refresh links to web site Update links to refer to the official ZFS on Linux website instead of @behlendorf's personal fork on github. Signed-off-by: Brian Behlendorf --- cmd/spl.c | 2 +- cmd/splat.c | 2 +- cmd/splat.h | 2 +- configure.ac | 2 +- include/fs/fs_subr.h | 2 +- include/linux/bitops_compat.h | 2 +- include/linux/compiler_compat.h | 2 +- include/linux/file_compat.h | 2 +- include/linux/kallsyms_compat.h | 2 +- include/linux/list_compat.h | 2 +- include/linux/math64_compat.h | 2 +- include/linux/mm_compat.h | 2 +- include/linux/module_compat.h | 2 +- include/linux/mutex_compat.h | 2 +- include/linux/proc_compat.h | 2 +- include/linux/rwsem_compat.h | 2 +- include/linux/smp_compat.h | 2 +- include/linux/sysctl_compat.h | 2 +- include/linux/time_compat.h | 2 +- include/linux/uaccess_compat.h | 2 +- include/linux/zlib_compat.h | 2 +- include/rpc/types.h | 2 +- include/rpc/xdr.h | 2 +- include/sharefs/share.h | 2 +- include/spl-ctl.h | 2 +- include/spl-debug.h | 2 +- include/spl-device.h | 2 +- include/spl-trace.h | 2 +- include/splat-ctl.h | 2 +- include/strings.h | 2 +- include/sys/acl.h | 2 +- include/sys/acl_impl.h | 2 +- include/sys/atomic.h | 2 +- include/sys/attr.h | 2 +- include/sys/bitmap.h | 2 +- include/sys/bootconf.h | 2 +- include/sys/bootprops.h | 2 +- include/sys/buf.h | 2 +- include/sys/byteorder.h | 2 +- include/sys/callb.h | 2 +- include/sys/cmn_err.h | 2 +- include/sys/compress.h | 2 +- include/sys/condvar.h | 2 +- include/sys/conf.h | 2 +- include/sys/console.h | 2 +- include/sys/cpupart.h | 2 +- include/sys/cpuvar.h | 2 +- include/sys/crc32.h | 2 +- include/sys/cred.h | 2 +- include/sys/ctype.h | 2 +- include/sys/ddi.h | 2 +- include/sys/debug.h | 2 +- include/sys/dirent.h | 2 +- include/sys/disp.h | 2 +- include/sys/dkio.h | 2 +- include/sys/dklabel.h | 2 +- include/sys/dnlc.h | 2 +- include/sys/dumphdr.h | 2 +- include/sys/efi_partition.h | 2 +- include/sys/errno.h | 2 +- include/sys/extdirent.h | 2 +- include/sys/fcntl.h | 2 +- include/sys/file.h | 2 +- include/sys/fm/protocol.h | 2 +- include/sys/fm/util.h | 2 +- include/sys/fs/swapnode.h | 2 +- include/sys/idmap.h | 2 +- include/sys/int_limits.h | 2 +- include/sys/int_types.h | 2 +- include/sys/inttypes.h | 2 +- include/sys/isa_defs.h | 2 +- include/sys/kidmap.h | 2 +- include/sys/kmem.h | 2 +- include/sys/kobj.h | 2 +- include/sys/kstat.h | 2 +- include/sys/list.h | 2 +- include/sys/mkdev.h | 2 +- include/sys/mntent.h | 2 +- include/sys/modctl.h | 2 +- include/sys/mode.h | 2 +- include/sys/mount.h | 2 +- include/sys/mutex.h | 2 +- include/sys/note.h | 2 +- include/sys/open.h | 2 +- include/sys/param.h | 2 +- include/sys/pathname.h | 2 +- include/sys/policy.h | 2 +- include/sys/pool.h | 2 +- include/sys/priv_impl.h | 2 +- include/sys/proc.h | 2 +- include/sys/processor.h | 2 +- include/sys/pset.h | 2 +- include/sys/random.h | 2 +- include/sys/refstr.h | 2 +- include/sys/resource.h | 2 +- include/sys/rwlock.h | 2 +- include/sys/sdt.h | 2 +- include/sys/sid.h | 2 +- include/sys/signal.h | 2 +- include/sys/stat.h | 2 +- include/sys/stropts.h | 2 +- include/sys/sunddi.h | 2 +- include/sys/sunldi.h | 2 +- include/sys/sysdc.h | 2 +- include/sys/sysevent.h | 2 +- include/sys/sysevent/eventdefs.h | 2 +- include/sys/sysmacros.h | 2 +- include/sys/systeminfo.h | 2 +- include/sys/systm.h | 2 +- include/sys/t_lock.h | 2 +- include/sys/taskq.h | 2 +- include/sys/thread.h | 2 +- include/sys/time.h | 2 +- include/sys/timer.h | 2 +- include/sys/tsd.h | 2 +- include/sys/types.h | 2 +- include/sys/types32.h | 2 +- include/sys/u8_textprep.h | 2 +- include/sys/uio.h | 2 +- include/sys/unistd.h | 2 +- include/sys/utsname.h | 2 +- include/sys/va_list.h | 2 +- include/sys/varargs.h | 2 +- include/sys/vfs.h | 2 +- include/sys/vfs_opreg.h | 2 +- include/sys/vmsystm.h | 2 +- include/sys/vnode.h | 2 +- include/sys/zmod.h | 2 +- include/sys/zone.h | 2 +- include/unistd.h | 2 +- include/util/qsort.h | 2 +- include/util/sscanf.h | 2 +- include/vm/anon.h | 2 +- include/vm/pvn.h | 2 +- include/vm/seg_kmem.h | 2 +- module/spl/spl-atomic.c | 2 +- module/spl/spl-condvar.c | 2 +- module/spl/spl-cred.c | 2 +- module/spl/spl-debug.c | 2 +- module/spl/spl-err.c | 2 +- module/spl/spl-generic.c | 2 +- module/spl/spl-kmem.c | 2 +- module/spl/spl-kobj.c | 2 +- module/spl/spl-kstat.c | 2 +- module/spl/spl-mutex.c | 2 +- module/spl/spl-proc.c | 2 +- module/spl/spl-rwlock.c | 2 +- module/spl/spl-taskq.c | 2 +- module/spl/spl-thread.c | 2 +- module/spl/spl-time.c | 2 +- module/spl/spl-tsd.c | 2 +- module/spl/spl-vnode.c | 2 +- module/spl/spl-xdr.c | 2 +- module/spl/spl-zlib.c | 2 +- module/splat/splat-atomic.c | 2 +- module/splat/splat-condvar.c | 2 +- module/splat/splat-cred.c | 2 +- module/splat/splat-ctl.c | 2 +- module/splat/splat-generic.c | 2 +- module/splat/splat-internal.h | 2 +- module/splat/splat-kmem.c | 2 +- module/splat/splat-kobj.c | 2 +- module/splat/splat-linux.c | 2 +- module/splat/splat-list.c | 2 +- module/splat/splat-mutex.c | 2 +- module/splat/splat-random.c | 2 +- module/splat/splat-rwlock.c | 2 +- module/splat/splat-taskq.c | 2 +- module/splat/splat-thread.c | 2 +- module/splat/splat-time.c | 2 +- module/splat/splat-vnode.c | 2 +- module/splat/splat-zlib.c | 2 +- scripts/check.sh | 2 +- 173 files changed, 173 insertions(+), 173 deletions(-) (limited to 'module/spl/spl-taskq.c') diff --git a/cmd/spl.c b/cmd/spl.c index a77ad9ca4..3028e3ab0 100644 --- a/cmd/spl.c +++ b/cmd/spl.c @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/cmd/splat.c b/cmd/splat.c index f4caa5639..92962393d 100644 --- a/cmd/splat.c +++ b/cmd/splat.c @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/cmd/splat.h b/cmd/splat.h index dd943124e..5b838af3a 100644 --- a/cmd/splat.h +++ b/cmd/splat.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/configure.ac b/configure.ac index 7a4a729db..c71bc1f53 100644 --- a/configure.ac +++ b/configure.ac @@ -8,7 +8,7 @@ # UCRL-CODE-235197 # # This file is part of the SPL, Solaris Porting Layer. -# For details, see . +# For details, see . # # The SPL is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the diff --git a/include/fs/fs_subr.h b/include/fs/fs_subr.h index 39499b532..33ccc684e 100644 --- a/include/fs/fs_subr.h +++ b/include/fs/fs_subr.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/linux/bitops_compat.h b/include/linux/bitops_compat.h index d466e0718..9c55844ad 100644 --- a/include/linux/bitops_compat.h +++ b/include/linux/bitops_compat.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/linux/compiler_compat.h b/include/linux/compiler_compat.h index de3b3c391..8dbbeee72 100644 --- a/include/linux/compiler_compat.h +++ b/include/linux/compiler_compat.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/linux/file_compat.h b/include/linux/file_compat.h index 3dc33278f..4588d6442 100644 --- a/include/linux/file_compat.h +++ b/include/linux/file_compat.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/linux/kallsyms_compat.h b/include/linux/kallsyms_compat.h index fbe33e8e6..1c7afa5dd 100644 --- a/include/linux/kallsyms_compat.h +++ b/include/linux/kallsyms_compat.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/linux/list_compat.h b/include/linux/list_compat.h index 26d5dfe07..d1e0d9d96 100644 --- a/include/linux/list_compat.h +++ b/include/linux/list_compat.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/linux/math64_compat.h b/include/linux/math64_compat.h index 652082ea2..2c911a64b 100644 --- a/include/linux/math64_compat.h +++ b/include/linux/math64_compat.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/linux/mm_compat.h b/include/linux/mm_compat.h index 21a1ef2c0..cb1bef9a4 100644 --- a/include/linux/mm_compat.h +++ b/include/linux/mm_compat.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/linux/module_compat.h b/include/linux/module_compat.h index 0261f6958..02f42a924 100644 --- a/include/linux/module_compat.h +++ b/include/linux/module_compat.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/linux/mutex_compat.h b/include/linux/mutex_compat.h index 39eb68c34..5955fc9a4 100644 --- a/include/linux/mutex_compat.h +++ b/include/linux/mutex_compat.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/linux/proc_compat.h b/include/linux/proc_compat.h index 3d8eda108..434ffa3f1 100644 --- a/include/linux/proc_compat.h +++ b/include/linux/proc_compat.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/linux/rwsem_compat.h b/include/linux/rwsem_compat.h index 757bb42af..80f348e4c 100644 --- a/include/linux/rwsem_compat.h +++ b/include/linux/rwsem_compat.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/linux/smp_compat.h b/include/linux/smp_compat.h index 31d42f909..8c2b54091 100644 --- a/include/linux/smp_compat.h +++ b/include/linux/smp_compat.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/linux/sysctl_compat.h b/include/linux/sysctl_compat.h index 93210e829..bc226537d 100644 --- a/include/linux/sysctl_compat.h +++ b/include/linux/sysctl_compat.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/linux/time_compat.h b/include/linux/time_compat.h index fa996d346..efa023299 100644 --- a/include/linux/time_compat.h +++ b/include/linux/time_compat.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/linux/uaccess_compat.h b/include/linux/uaccess_compat.h index c00669a57..c84e61d30 100644 --- a/include/linux/uaccess_compat.h +++ b/include/linux/uaccess_compat.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/linux/zlib_compat.h b/include/linux/zlib_compat.h index 410dc485e..ba853c395 100644 --- a/include/linux/zlib_compat.h +++ b/include/linux/zlib_compat.h @@ -5,7 +5,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/rpc/types.h b/include/rpc/types.h index 137a381dc..b57b4bd73 100644 --- a/include/rpc/types.h +++ b/include/rpc/types.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/rpc/xdr.h b/include/rpc/xdr.h index c828a38e3..d0f06b55f 100644 --- a/include/rpc/xdr.h +++ b/include/rpc/xdr.h @@ -3,7 +3,7 @@ * Written by Ricardo Correia * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sharefs/share.h b/include/sharefs/share.h index b3ad6993f..fc248a233 100644 --- a/include/sharefs/share.h +++ b/include/sharefs/share.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/spl-ctl.h b/include/spl-ctl.h index 9db139073..bb24490d9 100644 --- a/include/spl-ctl.h +++ b/include/spl-ctl.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/spl-debug.h b/include/spl-debug.h index 42da3e4e8..c91b864c2 100644 --- a/include/spl-debug.h +++ b/include/spl-debug.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/spl-device.h b/include/spl-device.h index 6c3789cd7..b237cf1b0 100644 --- a/include/spl-device.h +++ b/include/spl-device.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/spl-trace.h b/include/spl-trace.h index 709b1326e..8ef173e76 100644 --- a/include/spl-trace.h +++ b/include/spl-trace.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/splat-ctl.h b/include/splat-ctl.h index b800887b8..ccf3644bd 100644 --- a/include/splat-ctl.h +++ b/include/splat-ctl.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/strings.h b/include/strings.h index 65ee3e7c3..dc0f31466 100644 --- a/include/strings.h +++ b/include/strings.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/acl.h b/include/sys/acl.h index 39a1cc29c..f4a3de599 100644 --- a/include/sys/acl.h +++ b/include/sys/acl.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/acl_impl.h b/include/sys/acl_impl.h index 9bc45ff96..67af71371 100644 --- a/include/sys/acl_impl.h +++ b/include/sys/acl_impl.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/atomic.h b/include/sys/atomic.h index 1d1173894..31d35eb14 100644 --- a/include/sys/atomic.h +++ b/include/sys/atomic.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/attr.h b/include/sys/attr.h index 42f21cfeb..5fb609c93 100644 --- a/include/sys/attr.h +++ b/include/sys/attr.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/bitmap.h b/include/sys/bitmap.h index 85dcb2e3b..e4acb0b7d 100644 --- a/include/sys/bitmap.h +++ b/include/sys/bitmap.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/bootconf.h b/include/sys/bootconf.h index b9d40527c..4e032ad2f 100644 --- a/include/sys/bootconf.h +++ b/include/sys/bootconf.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/bootprops.h b/include/sys/bootprops.h index e4b355032..a562ec9f9 100644 --- a/include/sys/bootprops.h +++ b/include/sys/bootprops.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/buf.h b/include/sys/buf.h index b1ffa479c..8596c835c 100644 --- a/include/sys/buf.h +++ b/include/sys/buf.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/byteorder.h b/include/sys/byteorder.h index d09f5bf3e..5350a0b33 100644 --- a/include/sys/byteorder.h +++ b/include/sys/byteorder.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/callb.h b/include/sys/callb.h index 9db823650..fbe4128f8 100644 --- a/include/sys/callb.h +++ b/include/sys/callb.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/cmn_err.h b/include/sys/cmn_err.h index 9359c1a3b..1291510ec 100644 --- a/include/sys/cmn_err.h +++ b/include/sys/cmn_err.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/compress.h b/include/sys/compress.h index 8095cff9c..55822f0e5 100644 --- a/include/sys/compress.h +++ b/include/sys/compress.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/condvar.h b/include/sys/condvar.h index 62210357d..c825bd2e4 100644 --- a/include/sys/condvar.h +++ b/include/sys/condvar.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/conf.h b/include/sys/conf.h index bca0ebf05..eece0c798 100644 --- a/include/sys/conf.h +++ b/include/sys/conf.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/console.h b/include/sys/console.h index 31d419923..76ef61838 100644 --- a/include/sys/console.h +++ b/include/sys/console.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/cpupart.h b/include/sys/cpupart.h index 8416c99b6..fddeed6d0 100644 --- a/include/sys/cpupart.h +++ b/include/sys/cpupart.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/cpuvar.h b/include/sys/cpuvar.h index ca5a8b0a0..1284f940f 100644 --- a/include/sys/cpuvar.h +++ b/include/sys/cpuvar.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/crc32.h b/include/sys/crc32.h index 000a1dca5..1981f3579 100644 --- a/include/sys/crc32.h +++ b/include/sys/crc32.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/cred.h b/include/sys/cred.h index 778d05255..6c905884b 100644 --- a/include/sys/cred.h +++ b/include/sys/cred.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/ctype.h b/include/sys/ctype.h index 7ec2bc7fa..52037f9a1 100644 --- a/include/sys/ctype.h +++ b/include/sys/ctype.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/ddi.h b/include/sys/ddi.h index 903b1dd13..2fa1388fd 100644 --- a/include/sys/ddi.h +++ b/include/sys/ddi.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/debug.h b/include/sys/debug.h index 271dbc210..25ff88e3a 100644 --- a/include/sys/debug.h +++ b/include/sys/debug.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/dirent.h b/include/sys/dirent.h index b99542e85..68f75da57 100644 --- a/include/sys/dirent.h +++ b/include/sys/dirent.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/disp.h b/include/sys/disp.h index 2a4b4ded8..9614a47c4 100644 --- a/include/sys/disp.h +++ b/include/sys/disp.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/dkio.h b/include/sys/dkio.h index 591fbf51d..d8c700718 100644 --- a/include/sys/dkio.h +++ b/include/sys/dkio.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/dklabel.h b/include/sys/dklabel.h index bd42622d1..74c0d506f 100644 --- a/include/sys/dklabel.h +++ b/include/sys/dklabel.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/dnlc.h b/include/sys/dnlc.h index b63c94fef..6834e067d 100644 --- a/include/sys/dnlc.h +++ b/include/sys/dnlc.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/dumphdr.h b/include/sys/dumphdr.h index 07396e2e6..1b45058ad 100644 --- a/include/sys/dumphdr.h +++ b/include/sys/dumphdr.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/efi_partition.h b/include/sys/efi_partition.h index 75df64f92..c39236423 100644 --- a/include/sys/efi_partition.h +++ b/include/sys/efi_partition.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/errno.h b/include/sys/errno.h index e6b446803..64d8482dc 100644 --- a/include/sys/errno.h +++ b/include/sys/errno.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/extdirent.h b/include/sys/extdirent.h index d9af31039..1a5c03145 100644 --- a/include/sys/extdirent.h +++ b/include/sys/extdirent.h @@ -5,7 +5,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/fcntl.h b/include/sys/fcntl.h index 4e260a4b8..88b7a6928 100644 --- a/include/sys/fcntl.h +++ b/include/sys/fcntl.h @@ -5,7 +5,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/file.h b/include/sys/file.h index fbeb8e258..67b301c6e 100644 --- a/include/sys/file.h +++ b/include/sys/file.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/fm/protocol.h b/include/sys/fm/protocol.h index 8c47f7c9b..e9ce6ff6c 100644 --- a/include/sys/fm/protocol.h +++ b/include/sys/fm/protocol.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/fm/util.h b/include/sys/fm/util.h index 40b8d47b2..7f2dbde9c 100644 --- a/include/sys/fm/util.h +++ b/include/sys/fm/util.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/fs/swapnode.h b/include/sys/fs/swapnode.h index 31be71620..a5df1298d 100644 --- a/include/sys/fs/swapnode.h +++ b/include/sys/fs/swapnode.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/idmap.h b/include/sys/idmap.h index b3c7c0f43..3618c655c 100644 --- a/include/sys/idmap.h +++ b/include/sys/idmap.h @@ -5,7 +5,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/int_limits.h b/include/sys/int_limits.h index ed4ad9d19..64f0a1102 100644 --- a/include/sys/int_limits.h +++ b/include/sys/int_limits.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/int_types.h b/include/sys/int_types.h index c97f47f6b..582fded20 100644 --- a/include/sys/int_types.h +++ b/include/sys/int_types.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/inttypes.h b/include/sys/inttypes.h index 6f7020134..82e555cdd 100644 --- a/include/sys/inttypes.h +++ b/include/sys/inttypes.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/isa_defs.h b/include/sys/isa_defs.h index 02136c596..35aee61c9 100644 --- a/include/sys/isa_defs.h +++ b/include/sys/isa_defs.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/kidmap.h b/include/sys/kidmap.h index ed87b9f7f..3d67b51a8 100644 --- a/include/sys/kidmap.h +++ b/include/sys/kidmap.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/kmem.h b/include/sys/kmem.h index d5d3061a5..516114fd7 100644 --- a/include/sys/kmem.h +++ b/include/sys/kmem.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/kobj.h b/include/sys/kobj.h index b682e3f9d..f95fa8039 100644 --- a/include/sys/kobj.h +++ b/include/sys/kobj.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/kstat.h b/include/sys/kstat.h index 06379f827..9275c1ea4 100644 --- a/include/sys/kstat.h +++ b/include/sys/kstat.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/list.h b/include/sys/list.h index 303b959de..563784ae4 100644 --- a/include/sys/list.h +++ b/include/sys/list.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/mkdev.h b/include/sys/mkdev.h index 89a9000d4..d765b7374 100644 --- a/include/sys/mkdev.h +++ b/include/sys/mkdev.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/mntent.h b/include/sys/mntent.h index 5f0565f4c..66fae87d4 100644 --- a/include/sys/mntent.h +++ b/include/sys/mntent.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/modctl.h b/include/sys/modctl.h index 52f679ad5..8d79e5312 100644 --- a/include/sys/modctl.h +++ b/include/sys/modctl.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/mode.h b/include/sys/mode.h index ddd504f9f..d09965e4a 100644 --- a/include/sys/mode.h +++ b/include/sys/mode.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/mount.h b/include/sys/mount.h index 5b33a6d3a..ca1796d7d 100644 --- a/include/sys/mount.h +++ b/include/sys/mount.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/mutex.h b/include/sys/mutex.h index 905eed50e..ec3cfd529 100644 --- a/include/sys/mutex.h +++ b/include/sys/mutex.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/note.h b/include/sys/note.h index 6fcffc22e..511756272 100644 --- a/include/sys/note.h +++ b/include/sys/note.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/open.h b/include/sys/open.h index aafedd0a1..e3ebd8c84 100644 --- a/include/sys/open.h +++ b/include/sys/open.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/param.h b/include/sys/param.h index 5a1994960..5b5b5f550 100644 --- a/include/sys/param.h +++ b/include/sys/param.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/pathname.h b/include/sys/pathname.h index d22c4f297..71ea441cb 100644 --- a/include/sys/pathname.h +++ b/include/sys/pathname.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/policy.h b/include/sys/policy.h index 950ec9554..45e724bc5 100644 --- a/include/sys/policy.h +++ b/include/sys/policy.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/pool.h b/include/sys/pool.h index 95aea6a09..bf6a0bb7d 100644 --- a/include/sys/pool.h +++ b/include/sys/pool.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/priv_impl.h b/include/sys/priv_impl.h index 28fa203a6..f1507a89e 100644 --- a/include/sys/priv_impl.h +++ b/include/sys/priv_impl.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/proc.h b/include/sys/proc.h index 1c02c676e..dbaf4162f 100644 --- a/include/sys/proc.h +++ b/include/sys/proc.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/processor.h b/include/sys/processor.h index 65438a4da..60b1a211b 100644 --- a/include/sys/processor.h +++ b/include/sys/processor.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/pset.h b/include/sys/pset.h index 9b0ebc4f8..2723d310b 100644 --- a/include/sys/pset.h +++ b/include/sys/pset.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/random.h b/include/sys/random.h index 8960240b1..2bf581f26 100644 --- a/include/sys/random.h +++ b/include/sys/random.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/refstr.h b/include/sys/refstr.h index a8d0edbfe..49a3417d1 100644 --- a/include/sys/refstr.h +++ b/include/sys/refstr.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/resource.h b/include/sys/resource.h index 68e3d2500..fe336555f 100644 --- a/include/sys/resource.h +++ b/include/sys/resource.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/rwlock.h b/include/sys/rwlock.h index 9d29ad679..9dfbfe545 100644 --- a/include/sys/rwlock.h +++ b/include/sys/rwlock.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/sdt.h b/include/sys/sdt.h index ed4680df9..6c8395f99 100644 --- a/include/sys/sdt.h +++ b/include/sys/sdt.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/sid.h b/include/sys/sid.h index 17e32e25f..8ee5d0727 100644 --- a/include/sys/sid.h +++ b/include/sys/sid.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/signal.h b/include/sys/signal.h index 254bf0641..823fea329 100644 --- a/include/sys/signal.h +++ b/include/sys/signal.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/stat.h b/include/sys/stat.h index ccc01a025..cde7556a6 100644 --- a/include/sys/stat.h +++ b/include/sys/stat.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/stropts.h b/include/sys/stropts.h index ae20c4d70..25c7ee18f 100644 --- a/include/sys/stropts.h +++ b/include/sys/stropts.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/sunddi.h b/include/sys/sunddi.h index c3368083b..545803afd 100644 --- a/include/sys/sunddi.h +++ b/include/sys/sunddi.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/sunldi.h b/include/sys/sunldi.h index a1a6a12c2..b4ff7391a 100644 --- a/include/sys/sunldi.h +++ b/include/sys/sunldi.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/sysdc.h b/include/sys/sysdc.h index b1000013f..14ab48aa6 100644 --- a/include/sys/sysdc.h +++ b/include/sys/sysdc.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/sysevent.h b/include/sys/sysevent.h index 723220f0f..5a7ca41ce 100644 --- a/include/sys/sysevent.h +++ b/include/sys/sysevent.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/sysevent/eventdefs.h b/include/sys/sysevent/eventdefs.h index 2112e29ed..592c78a64 100644 --- a/include/sys/sysevent/eventdefs.h +++ b/include/sys/sysevent/eventdefs.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/sysmacros.h b/include/sys/sysmacros.h index 04a62b196..7c4da67fc 100644 --- a/include/sys/sysmacros.h +++ b/include/sys/sysmacros.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/systeminfo.h b/include/sys/systeminfo.h index a32f7142e..e22a08530 100644 --- a/include/sys/systeminfo.h +++ b/include/sys/systeminfo.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/systm.h b/include/sys/systm.h index f3e310a13..3336fb357 100644 --- a/include/sys/systm.h +++ b/include/sys/systm.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/t_lock.h b/include/sys/t_lock.h index 1055f7f6a..6c159f933 100644 --- a/include/sys/t_lock.h +++ b/include/sys/t_lock.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/taskq.h b/include/sys/taskq.h index 3839de288..7b44e8b8a 100644 --- a/include/sys/taskq.h +++ b/include/sys/taskq.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/thread.h b/include/sys/thread.h index 3a708236c..369b3061d 100644 --- a/include/sys/thread.h +++ b/include/sys/thread.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/time.h b/include/sys/time.h index 341b531ef..f8d78d194 100644 --- a/include/sys/time.h +++ b/include/sys/time.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/timer.h b/include/sys/timer.h index ea6043696..096eb1a4e 100644 --- a/include/sys/timer.h +++ b/include/sys/timer.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/tsd.h b/include/sys/tsd.h index a31f60605..ebc55b09b 100644 --- a/include/sys/tsd.h +++ b/include/sys/tsd.h @@ -5,7 +5,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/types.h b/include/sys/types.h index b867be111..decb6bba8 100644 --- a/include/sys/types.h +++ b/include/sys/types.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/types32.h b/include/sys/types32.h index 25c4642dc..6ee580f4e 100644 --- a/include/sys/types32.h +++ b/include/sys/types32.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/u8_textprep.h b/include/sys/u8_textprep.h index 456077c6f..0a21c708c 100644 --- a/include/sys/u8_textprep.h +++ b/include/sys/u8_textprep.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/uio.h b/include/sys/uio.h index 87da72701..25c5f4a01 100644 --- a/include/sys/uio.h +++ b/include/sys/uio.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/unistd.h b/include/sys/unistd.h index a2acfa705..e1d93c61e 100644 --- a/include/sys/unistd.h +++ b/include/sys/unistd.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/utsname.h b/include/sys/utsname.h index fa403ff52..3d979c13a 100644 --- a/include/sys/utsname.h +++ b/include/sys/utsname.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/va_list.h b/include/sys/va_list.h index 644812881..9fa173b58 100644 --- a/include/sys/va_list.h +++ b/include/sys/va_list.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/varargs.h b/include/sys/varargs.h index b74570c21..bf360ff4d 100644 --- a/include/sys/varargs.h +++ b/include/sys/varargs.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/vfs.h b/include/sys/vfs.h index 88ca21d52..f01dc11cb 100644 --- a/include/sys/vfs.h +++ b/include/sys/vfs.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/vfs_opreg.h b/include/sys/vfs_opreg.h index 5dda4d36b..d3540c593 100644 --- a/include/sys/vfs_opreg.h +++ b/include/sys/vfs_opreg.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/vmsystm.h b/include/sys/vmsystm.h index b8191f3ac..9c52d2824 100644 --- a/include/sys/vmsystm.h +++ b/include/sys/vmsystm.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/vnode.h b/include/sys/vnode.h index 99614d55b..35607e1ea 100644 --- a/include/sys/vnode.h +++ b/include/sys/vnode.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/zmod.h b/include/sys/zmod.h index a6519dec2..15b0bc8e7 100644 --- a/include/sys/zmod.h +++ b/include/sys/zmod.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/sys/zone.h b/include/sys/zone.h index 9c2652fd2..6b7a1c65f 100644 --- a/include/sys/zone.h +++ b/include/sys/zone.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/unistd.h b/include/unistd.h index a2acfa705..e1d93c61e 100644 --- a/include/unistd.h +++ b/include/unistd.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/util/qsort.h b/include/util/qsort.h index 890674acd..e55c4f8cc 100644 --- a/include/util/qsort.h +++ b/include/util/qsort.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/util/sscanf.h b/include/util/sscanf.h index 4ea907148..23f0b5db0 100644 --- a/include/util/sscanf.h +++ b/include/util/sscanf.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/vm/anon.h b/include/vm/anon.h index 51e8512ba..9c9c23959 100644 --- a/include/vm/anon.h +++ b/include/vm/anon.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/vm/pvn.h b/include/vm/pvn.h index c206b1b77..f3b308137 100644 --- a/include/vm/pvn.h +++ b/include/vm/pvn.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/include/vm/seg_kmem.h b/include/vm/seg_kmem.h index b21f71a52..17df7b961 100644 --- a/include/vm/seg_kmem.h +++ b/include/vm/seg_kmem.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/module/spl/spl-atomic.c b/module/spl/spl-atomic.c index e37b96907..c46252c10 100644 --- a/module/spl/spl-atomic.c +++ b/module/spl/spl-atomic.c @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/module/spl/spl-condvar.c b/module/spl/spl-condvar.c index fefe98598..60cf726f9 100644 --- a/module/spl/spl-condvar.c +++ b/module/spl/spl-condvar.c @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/module/spl/spl-cred.c b/module/spl/spl-cred.c index ce3425d32..e669cbf5d 100644 --- a/module/spl/spl-cred.c +++ b/module/spl/spl-cred.c @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/module/spl/spl-debug.c b/module/spl/spl-debug.c index 3c3dab0c8..37599acdd 100644 --- a/module/spl/spl-debug.c +++ b/module/spl/spl-debug.c @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/module/spl/spl-err.c b/module/spl/spl-err.c index c837d1eaa..b6d15f019 100644 --- a/module/spl/spl-err.c +++ b/module/spl/spl-err.c @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/module/spl/spl-generic.c b/module/spl/spl-generic.c index 39357617c..3cef48946 100644 --- a/module/spl/spl-generic.c +++ b/module/spl/spl-generic.c @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/module/spl/spl-kmem.c b/module/spl/spl-kmem.c index 413aa1245..e3538b5ff 100644 --- a/module/spl/spl-kmem.c +++ b/module/spl/spl-kmem.c @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/module/spl/spl-kobj.c b/module/spl/spl-kobj.c index 684d57226..f14f47f5d 100644 --- a/module/spl/spl-kobj.c +++ b/module/spl/spl-kobj.c @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/module/spl/spl-kstat.c b/module/spl/spl-kstat.c index ea2d67dd4..b7e4b9426 100644 --- a/module/spl/spl-kstat.c +++ b/module/spl/spl-kstat.c @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/module/spl/spl-mutex.c b/module/spl/spl-mutex.c index d452681b1..f0e786da5 100644 --- a/module/spl/spl-mutex.c +++ b/module/spl/spl-mutex.c @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/module/spl/spl-proc.c b/module/spl/spl-proc.c index 2fb295439..cd4fa1b47 100644 --- a/module/spl/spl-proc.c +++ b/module/spl/spl-proc.c @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/module/spl/spl-rwlock.c b/module/spl/spl-rwlock.c index c0f974f1b..462a6f0de 100644 --- a/module/spl/spl-rwlock.c +++ b/module/spl/spl-rwlock.c @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/module/spl/spl-taskq.c b/module/spl/spl-taskq.c index c9ae0a50b..4feca0452 100644 --- a/module/spl/spl-taskq.c +++ b/module/spl/spl-taskq.c @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/module/spl/spl-thread.c b/module/spl/spl-thread.c index 71e5f331d..6b3bec509 100644 --- a/module/spl/spl-thread.c +++ b/module/spl/spl-thread.c @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/module/spl/spl-time.c b/module/spl/spl-time.c index 6ef9b8fc8..8f43b54cd 100644 --- a/module/spl/spl-time.c +++ b/module/spl/spl-time.c @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/module/spl/spl-tsd.c b/module/spl/spl-tsd.c index c63a55274..d7749cf7b 100644 --- a/module/spl/spl-tsd.c +++ b/module/spl/spl-tsd.c @@ -5,7 +5,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/module/spl/spl-vnode.c b/module/spl/spl-vnode.c index d8da9814b..4d571c6c4 100644 --- a/module/spl/spl-vnode.c +++ b/module/spl/spl-vnode.c @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/module/spl/spl-xdr.c b/module/spl/spl-xdr.c index eba470a4b..62efa31a5 100644 --- a/module/spl/spl-xdr.c +++ b/module/spl/spl-xdr.c @@ -3,7 +3,7 @@ * Written by Ricardo Correia * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/module/spl/spl-zlib.c b/module/spl/spl-zlib.c index 4f88cb4e0..807e743d5 100644 --- a/module/spl/spl-zlib.c +++ b/module/spl/spl-zlib.c @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/module/splat/splat-atomic.c b/module/splat/splat-atomic.c index efb01578a..df3b38f58 100644 --- a/module/splat/splat-atomic.c +++ b/module/splat/splat-atomic.c @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/module/splat/splat-condvar.c b/module/splat/splat-condvar.c index 1fe306cb2..1ddde39bb 100644 --- a/module/splat/splat-condvar.c +++ b/module/splat/splat-condvar.c @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/module/splat/splat-cred.c b/module/splat/splat-cred.c index 0efabd854..47dfa02f6 100644 --- a/module/splat/splat-cred.c +++ b/module/splat/splat-cred.c @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/module/splat/splat-ctl.c b/module/splat/splat-ctl.c index c68281a84..54b2ff459 100644 --- a/module/splat/splat-ctl.c +++ b/module/splat/splat-ctl.c @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/module/splat/splat-generic.c b/module/splat/splat-generic.c index 38df14d3b..ad03651d0 100644 --- a/module/splat/splat-generic.c +++ b/module/splat/splat-generic.c @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/module/splat/splat-internal.h b/module/splat/splat-internal.h index 14303a105..b138196f5 100644 --- a/module/splat/splat-internal.h +++ b/module/splat/splat-internal.h @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/module/splat/splat-kmem.c b/module/splat/splat-kmem.c index 789e75e56..0eab14217 100644 --- a/module/splat/splat-kmem.c +++ b/module/splat/splat-kmem.c @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/module/splat/splat-kobj.c b/module/splat/splat-kobj.c index c76795418..a0d4097d5 100644 --- a/module/splat/splat-kobj.c +++ b/module/splat/splat-kobj.c @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/module/splat/splat-linux.c b/module/splat/splat-linux.c index 0a1808f61..ce809e647 100644 --- a/module/splat/splat-linux.c +++ b/module/splat/splat-linux.c @@ -5,7 +5,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/module/splat/splat-list.c b/module/splat/splat-list.c index 34b570f39..f59394c14 100644 --- a/module/splat/splat-list.c +++ b/module/splat/splat-list.c @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/module/splat/splat-mutex.c b/module/splat/splat-mutex.c index 9e6b24708..cc1d36869 100644 --- a/module/splat/splat-mutex.c +++ b/module/splat/splat-mutex.c @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/module/splat/splat-random.c b/module/splat/splat-random.c index 63d96444f..33b799bad 100644 --- a/module/splat/splat-random.c +++ b/module/splat/splat-random.c @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/module/splat/splat-rwlock.c b/module/splat/splat-rwlock.c index f4a010969..a865fb310 100644 --- a/module/splat/splat-rwlock.c +++ b/module/splat/splat-rwlock.c @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/module/splat/splat-taskq.c b/module/splat/splat-taskq.c index 5a9681e21..e4793d457 100644 --- a/module/splat/splat-taskq.c +++ b/module/splat/splat-taskq.c @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/module/splat/splat-thread.c b/module/splat/splat-thread.c index c54cbcd8a..a1e70db47 100644 --- a/module/splat/splat-thread.c +++ b/module/splat/splat-thread.c @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/module/splat/splat-time.c b/module/splat/splat-time.c index e6f8dc682..ca60c45c6 100644 --- a/module/splat/splat-time.c +++ b/module/splat/splat-time.c @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/module/splat/splat-vnode.c b/module/splat/splat-vnode.c index a7034c115..f3f17ec92 100644 --- a/module/splat/splat-vnode.c +++ b/module/splat/splat-vnode.c @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/module/splat/splat-zlib.c b/module/splat/splat-zlib.c index 852cf818f..c614c5e6c 100644 --- a/module/splat/splat-zlib.c +++ b/module/splat/splat-zlib.c @@ -6,7 +6,7 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see . + * For details, see . * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/scripts/check.sh b/scripts/check.sh index 4334ff3a5..fc97cec23 100755 --- a/scripts/check.sh +++ b/scripts/check.sh @@ -7,7 +7,7 @@ # UCRL-CODE-235197 # # This file is part of the SPL, Solaris Porting Layer. -# For details, see . +# For details, see . # # The SPL is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the -- cgit v1.2.3 From 99c452bbbaeaa8fae498da1774d81e146bdd45ed Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Mon, 29 Apr 2013 13:47:59 -0700 Subject: Fix taskq_wait_id() The existing taskq_wait_id() function can incorrectly block indefinitely. Reimplement it more simply using wait_event() in a similar fashion to taskq_wait_all(). This flaw was uncovered in the context of moving vn_rdwr() to a taskq. Previously taskq_wait_id() had no consumers outside the SPLAT task framework which is why the issue went unnoticed. Signed-off-by: Brian Behlendorf --- module/spl/spl-taskq.c | 40 ++++++++++++++-------------------------- 1 file changed, 14 insertions(+), 26 deletions(-) (limited to 'module/spl/spl-taskq.c') diff --git a/module/spl/spl-taskq.c b/module/spl/spl-taskq.c index 4feca0452..bcdc98f97 100644 --- a/module/spl/spl-taskq.c +++ b/module/spl/spl-taskq.c @@ -342,39 +342,27 @@ taskq_find(taskq_t *tq, taskqid_t id, int *active) SRETURN(NULL); } -/* - * The taskq_wait_id() function blocks until the passed task id completes. - * This does not guarantee that all lower task id's have completed. - */ -void -taskq_wait_id(taskq_t *tq, taskqid_t id) +static int +taskq_wait_id_check(taskq_t *tq, taskqid_t id) { - DEFINE_WAIT(wait); - taskq_ent_t *t; int active = 0; - SENTRY; - - ASSERT(tq); - ASSERT(id > 0); + int rc; spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); - t = taskq_find(tq, id, &active); - if (t) - prepare_to_wait(&t->tqent_waitq, &wait, TASK_UNINTERRUPTIBLE); + rc = (taskq_find(tq, id, &active) == NULL); spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); - /* - * We rely on the kernels autoremove_wake_function() function to - * remove us from the wait queue in the context of wake_up(). - * Once woken the taskq_ent_t pointer must never be accessed. - */ - if (t) { - t = NULL; - schedule(); - __set_current_state(TASK_RUNNING); - } + return (rc); +} - SEXIT; +/* + * The taskq_wait_id() function blocks until the passed task id completes. + * This does not guarantee that all lower task ids have completed. + */ +void +taskq_wait_id(taskq_t *tq, taskqid_t id) +{ + wait_event(tq->tq_wait_waitq, taskq_wait_id_check(tq, id)); } EXPORT_SYMBOL(taskq_wait_id); -- cgit v1.2.3 From aeeb4e0c0ae75b99ebbaa3056f0afc8e12949532 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Mon, 6 Jan 2014 16:31:49 -0800 Subject: Remove default taskq thread to CPU bindings When this code was written it appears to have been assumed that every taskq would have a large number of threads. In this case it would make sense to attempt to evenly bind the threads over all available CPUs. However, it failed to consider that creating taskqs with a small number of threads will cause the CPUs with lower ids become over-subscribed. For this reason the kthread_bind() call is being removed and we're leaving the kernel to schedule these threads as it sees fit. Signed-off-by: Brian Behlendorf Closes #325 --- module/spl/spl-taskq.c | 1 - 1 file changed, 1 deletion(-) (limited to 'module/spl/spl-taskq.c') diff --git a/module/spl/spl-taskq.c b/module/spl/spl-taskq.c index bcdc98f97..3605a0f3b 100644 --- a/module/spl/spl-taskq.c +++ b/module/spl/spl-taskq.c @@ -843,7 +843,6 @@ taskq_create(const char *name, int nthreads, pri_t pri, "%s/%d", name, i); if (tqt->tqt_thread) { list_add(&tqt->tqt_thread_list, &tq->tq_thread_list); - kthread_bind(tqt->tqt_thread, i % num_online_cpus()); set_user_nice(tqt->tqt_thread, PRIO_TO_NICE(pri)); wake_up_process(tqt->tqt_thread); j++; -- cgit v1.2.3 From 17a527cb0f44cef6582583e502621541061d8817 Mon Sep 17 00:00:00 2001 From: Tim Chase Date: Wed, 26 Mar 2014 08:29:24 -0500 Subject: Support post-3.13 kthread_create() semantics. Provide spl_kthread_create() as a wrapper to the kernel's kthread_create() to provide pre-3.13 semantics. Re-try if the call is interrupted or if it would have returned -ENOMEM. Otherwise return NULL. Signed-off-by: Chunwei Chen Signed-off-by: Tim Chase Signed-off-by: Brian Behlendorf Closes #339 --- include/sys/thread.h | 28 ++++++++++++++++++++++++++++ module/spl/spl-debug.c | 3 ++- module/spl/spl-taskq.c | 2 +- module/spl/spl-thread.c | 2 +- module/splat/splat-condvar.c | 8 ++++---- module/splat/splat-rwlock.c | 4 ++-- 6 files changed, 38 insertions(+), 9 deletions(-) (limited to 'module/spl/spl-taskq.c') diff --git a/include/sys/thread.h b/include/sys/thread.h index 864a74bba..f6c197255 100644 --- a/include/sys/thread.h +++ b/include/sys/thread.h @@ -60,4 +60,32 @@ extern kthread_t *__thread_create(caddr_t stk, size_t stksize, int state, pri_t pri); extern void __thread_exit(void); +/* + * spl_kthread_create - Wrapper providing pre-3.13 semantics for + * kthread_create() in which it is not killable and less likely + * to return -ENOMEM. + */ +static inline struct task_struct * +spl_kthread_create(int (*func)(void *), void *data, const char namefmt[], ...) +{ + struct task_struct *tsk; + va_list args; + + va_start(args, namefmt); + do { + tsk = kthread_create_on_node(func, data, + -1, namefmt, args); + if (IS_ERR(tsk)) { + if (signal_pending(current)) { + clear_thread_flag(TIF_SIGPENDING); + continue; + } + if (PTR_ERR(tsk) == -ENOMEM) + continue; + return (NULL); + } else + return (tsk); + } while (1); +} + #endif /* _SPL_THREAD_H */ diff --git a/module/spl/spl-debug.c b/module/spl/spl-debug.c index d450368b1..93c3f31b8 100644 --- a/module/spl/spl-debug.c +++ b/module/spl/spl-debug.c @@ -38,6 +38,7 @@ #include #include #include +#include #include #include #include @@ -415,7 +416,7 @@ spl_debug_dumplog(int flags) spl_debug_dumplog_internal(&dp); } else { - tsk = kthread_create(spl_debug_dumplog_thread,(void *)&dp,"spl_debug"); + tsk = spl_kthread_create(spl_debug_dumplog_thread,(void *)&dp,"spl_debug"); if (tsk == NULL) return -ENOMEM; diff --git a/module/spl/spl-taskq.c b/module/spl/spl-taskq.c index 3605a0f3b..48feb1d22 100644 --- a/module/spl/spl-taskq.c +++ b/module/spl/spl-taskq.c @@ -839,7 +839,7 @@ taskq_create(const char *name, int nthreads, pri_t pri, tqt->tqt_tq = tq; tqt->tqt_id = 0; - tqt->tqt_thread = kthread_create(taskq_thread, tqt, + tqt->tqt_thread = spl_kthread_create(taskq_thread, tqt, "%s/%d", name, i); if (tqt->tqt_thread) { list_add(&tqt->tqt_thread_list, &tq->tq_thread_list); diff --git a/module/spl/spl-thread.c b/module/spl/spl-thread.c index 6b3bec509..b0fa4d795 100644 --- a/module/spl/spl-thread.c +++ b/module/spl/spl-thread.c @@ -126,7 +126,7 @@ __thread_create(caddr_t stk, size_t stksize, thread_func_t func, tp->tp_state = state; tp->tp_pri = pri; - tsk = kthread_create(thread_generic_wrapper, (void *)tp, + tsk = spl_kthread_create(thread_generic_wrapper, (void *)tp, "%s", tp->tp_name); if (IS_ERR(tsk)) { SERROR("Failed to create thread: %ld\n", PTR_ERR(tsk)); diff --git a/module/splat/splat-condvar.c b/module/splat/splat-condvar.c index 1ddde39bb..3ee2ffc9e 100644 --- a/module/splat/splat-condvar.c +++ b/module/splat/splat-condvar.c @@ -108,7 +108,7 @@ splat_condvar_test1(struct file *file, void *arg) ct[i].ct_cvp = &cv; ct[i].ct_name = SPLAT_CONDVAR_TEST1_NAME; ct[i].ct_rc = 0; - ct[i].ct_thread = kthread_create(splat_condvar_test12_thread, + ct[i].ct_thread = spl_kthread_create(splat_condvar_test12_thread, &ct[i], "%s/%d", SPLAT_CONDVAR_TEST_NAME, i); if (!IS_ERR(ct[i].ct_thread)) { @@ -173,7 +173,7 @@ splat_condvar_test2(struct file *file, void *arg) ct[i].ct_cvp = &cv; ct[i].ct_name = SPLAT_CONDVAR_TEST2_NAME; ct[i].ct_rc = 0; - ct[i].ct_thread = kthread_create(splat_condvar_test12_thread, + ct[i].ct_thread = spl_kthread_create(splat_condvar_test12_thread, &ct[i], "%s/%d", SPLAT_CONDVAR_TEST_NAME, i); if (!IS_ERR(ct[i].ct_thread)) { @@ -254,7 +254,7 @@ splat_condvar_test3(struct file *file, void *arg) ct[i].ct_cvp = &cv; ct[i].ct_name = SPLAT_CONDVAR_TEST3_NAME; ct[i].ct_rc = 0; - ct[i].ct_thread = kthread_create(splat_condvar_test34_thread, + ct[i].ct_thread = spl_kthread_create(splat_condvar_test34_thread, &ct[i], "%s/%d", SPLAT_CONDVAR_TEST_NAME, i); if (!IS_ERR(ct[i].ct_thread)) { @@ -324,7 +324,7 @@ splat_condvar_test4(struct file *file, void *arg) ct[i].ct_cvp = &cv; ct[i].ct_name = SPLAT_CONDVAR_TEST3_NAME; ct[i].ct_rc = 0; - ct[i].ct_thread = kthread_create(splat_condvar_test34_thread, + ct[i].ct_thread = spl_kthread_create(splat_condvar_test34_thread, &ct[i], "%s/%d", SPLAT_CONDVAR_TEST_NAME, i); if (!IS_ERR(ct[i].ct_thread)) { diff --git a/module/splat/splat-rwlock.c b/module/splat/splat-rwlock.c index a865fb310..6faf7d24e 100644 --- a/module/splat/splat-rwlock.c +++ b/module/splat/splat-rwlock.c @@ -215,10 +215,10 @@ splat_rwlock_test1(struct file *file, void *arg) /* The first thread will be the writer */ if (i == 0) - rwt[i].rwt_thread = kthread_create(splat_rwlock_wr_thr, + rwt[i].rwt_thread = spl_kthread_create(splat_rwlock_wr_thr, &rwt[i], "%s/%d", SPLAT_RWLOCK_TEST_NAME, i); else - rwt[i].rwt_thread = kthread_create(splat_rwlock_rd_thr, + rwt[i].rwt_thread = spl_kthread_create(splat_rwlock_rd_thr, &rwt[i], "%s/%d", SPLAT_RWLOCK_TEST_NAME, i); if (!IS_ERR(rwt[i].rwt_thread)) { -- cgit v1.2.3 From 703371d8c734bc2cc6350f1bca014f08245dcc69 Mon Sep 17 00:00:00 2001 From: Andrey Vesnovaty Date: Wed, 28 Aug 2013 05:09:25 +0300 Subject: Evenly distribute the taskq threads across available CPUs The problem is described in commit aeeb4e0c0ae75b99ebbaa3056f0afc8e12949532. However, instead of disabling the binding to CPU altogether we just keep the last CPU index across calls to taskq_create() and thus achieve even distribution of the taskq threads across all available CPUs. The implementation based on assumption that task queues initialization performed in serial manner. Signed-off-by: Andrey Vesnovaty Signed-off-by: Andrey Vesnovaty Signed-off-by: Brian Behlendorf Closes #336 --- man/man5/spl-module-parameters.5 | 12 ++++++++++++ module/spl/spl-taskq.c | 9 +++++++++ 2 files changed, 21 insertions(+) (limited to 'module/spl/spl-taskq.c') diff --git a/man/man5/spl-module-parameters.5 b/man/man5/spl-module-parameters.5 index 3c134f775..9b351762c 100644 --- a/man/man5/spl-module-parameters.5 +++ b/man/man5/spl-module-parameters.5 @@ -124,3 +124,15 @@ Spin a maximum of N times to acquire lock .sp .ne -4 Default value: \fB0\fR. +.RE + +.sp +.ne 2 +.na +\fBspl_taskq_thread_bind\fR (int) +.ad +.RS 12n +Bind taskq thread to CPU +.sp +Default value: \fB0\fR. +.RE diff --git a/module/spl/spl-taskq.c b/module/spl/spl-taskq.c index 48feb1d22..0cb2ceeaf 100644 --- a/module/spl/spl-taskq.c +++ b/module/spl/spl-taskq.c @@ -34,6 +34,10 @@ #define SS_DEBUG_SUBSYS SS_TASKQ +int spl_taskq_thread_bind = 0; +module_param(spl_taskq_thread_bind, int, 0644); +MODULE_PARM_DESC(spl_taskq_thread_bind, "Bind taskq thread to CPU by default"); + /* Global system-wide dynamic task queue available for all consumers */ taskq_t *system_taskq; EXPORT_SYMBOL(system_taskq); @@ -781,6 +785,7 @@ taskq_t * taskq_create(const char *name, int nthreads, pri_t pri, int minalloc, int maxalloc, uint_t flags) { + static int last_used_cpu = 0; taskq_t *tq; taskq_thread_t *tqt; int rc = 0, i, j = 0; @@ -843,6 +848,10 @@ taskq_create(const char *name, int nthreads, pri_t pri, "%s/%d", name, i); if (tqt->tqt_thread) { list_add(&tqt->tqt_thread_list, &tq->tq_thread_list); + if (spl_taskq_thread_bind) { + last_used_cpu = (last_used_cpu + 1) % num_online_cpus(); + kthread_bind(tqt->tqt_thread, last_used_cpu); + } set_user_nice(tqt->tqt_thread, PRIO_TO_NICE(pri)); wake_up_process(tqt->tqt_thread); j++; -- cgit v1.2.3 From 8d9a23e82cea5d897e9357d569ef364106703d5a Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Wed, 5 Nov 2014 17:30:35 -0500 Subject: Retire legacy debugging infrastructure When the SPL was originally written Linux tracepoints were still in their infancy. Therefore, an entire debugging subsystem was added to facilite tracing which served us well for many years. Now that Linux tracepoints have matured they provide all the functionality of the previous tracing subsystem. Rather than maintain parallel functionality it makes sense to fully adopt tracepoints. Therefore, this patch retires the legacy debugging infrastructure. See zfsonlinux/zfs@bc9f413 for the tracepoint changes. Signed-off-by: Ned Bass Signed-off-by: Brian Behlendorf Closes #408 --- cmd/Makefile.am | 3 - cmd/spl.c | 243 -------- config/spl-build.m4 | 36 +- include/Makefile.am | 2 - include/spl-debug.h | 276 --------- include/spl-trace.h | 132 ----- include/sys/debug.h | 140 ++--- include/sys/kmem.h | 22 +- module/spl/Makefile.in | 1 - module/spl/spl-condvar.c | 30 +- module/spl/spl-debug.c | 1265 ----------------------------------------- module/spl/spl-err.c | 96 ++-- module/spl/spl-generic.c | 36 +- module/spl/spl-kmem.c | 302 ++++------ module/spl/spl-kobj.c | 24 +- module/spl/spl-kstat.c | 26 +- module/spl/spl-proc.c | 373 +----------- module/spl/spl-taskq.c | 106 ++-- module/spl/spl-thread.c | 22 +- module/spl/spl-tsd.c | 87 +-- module/spl/spl-vnode.c | 133 ++--- module/spl/spl-xdr.c | 13 +- module/spl/spl-zlib.c | 14 +- module/splat/splat-internal.h | 1 - module/splat/splat-kmem.c | 2 +- scripts/dkms.mkconf | 4 - 26 files changed, 389 insertions(+), 3000 deletions(-) delete mode 100644 cmd/spl.c delete mode 100644 include/spl-debug.h delete mode 100644 include/spl-trace.h delete mode 100644 module/spl/spl-debug.c (limited to 'module/spl/spl-taskq.c') diff --git a/cmd/Makefile.am b/cmd/Makefile.am index fed6feec2..01afdcf25 100644 --- a/cmd/Makefile.am +++ b/cmd/Makefile.am @@ -3,11 +3,8 @@ include $(top_srcdir)/config/Rules.am DEFAULT_INCLUDES += \ -I$(top_srcdir)/lib -noinst_PROGRAMS = spl sbin_PROGRAMS = splat -spl_SOURCES = spl.c - splat_SOURCES = splat.c splat_LDFLAGS = $(top_builddir)/lib/libcommon.la diff --git a/cmd/spl.c b/cmd/spl.c deleted file mode 100644 index 3028e3ab0..000000000 --- a/cmd/spl.c +++ /dev/null @@ -1,243 +0,0 @@ -/*****************************************************************************\ - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf . - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see . - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see . - ***************************************************************************** - * Solaris Porting Layer (SPL) User Space Interface. -\*****************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include "../include/spl-ctl.h" - -static int spl_debug_mask = ~0; -static int spl_debug_subsystem = ~0; - -/* all strings nul-terminated; only the struct and hdr need to be freed */ -struct dbg_line { - struct spl_debug_header *hdr; - char *file; - char *fn; - char *text; -}; - -static int -cmp_rec(const void *p1, const void *p2) -{ - struct dbg_line *d1 = *(struct dbg_line **)p1; - struct dbg_line *d2 = *(struct dbg_line **)p2; - - if (d1->hdr->ph_sec < d2->hdr->ph_sec) - return -1; - - if (d1->hdr->ph_sec == d2->hdr->ph_sec && - d1->hdr->ph_usec < d2->hdr->ph_usec) - return -1; - - if (d1->hdr->ph_sec == d2->hdr->ph_sec && - d1->hdr->ph_usec == d2->hdr->ph_usec) - return 0; - - return 1; -} - -static void -print_rec(struct dbg_line **linev, int used, FILE *out) -{ - int i; - - for (i = 0; i < used; i++) { - struct dbg_line *line = linev[i]; - struct spl_debug_header *hdr = line->hdr; - - fprintf(out, "%08x:%08x:%u:%u.%06llu:%u:%u:%u:(%s:%u:%s()) %s", - hdr->ph_subsys, hdr->ph_mask, hdr->ph_cpu_id, - hdr->ph_sec, (unsigned long long)hdr->ph_usec, - hdr->ph_stack, hdr->ph_pid, hdr->ph_stack, line->file, - hdr->ph_line_num, line->fn, line->text); - free(line->hdr); - free(line); - } - - free(linev); -} - -static int -add_rec(struct dbg_line *line, struct dbg_line ***linevp, int *lenp, int used) -{ - struct dbg_line **linev = *linevp; - - if (used == *lenp) { - int nlen = *lenp + 512; - int nsize = nlen * sizeof(struct dbg_line *); - - linev = *linevp ? realloc(*linevp, nsize) : malloc(nsize); - if (!linev) - return 0; - *linevp = linev; - *lenp = nlen; - } - linev[used] = line; - return 1; -} - -static int -parse_buffer(FILE *in, FILE *out) -{ - struct dbg_line *line; - struct spl_debug_header *hdr; - char buf[4097], *p; - unsigned long dropped = 0, kept = 0; - struct dbg_line **linev = NULL; - const int phl = sizeof(hdr->ph_len); - const int phf = sizeof(hdr->ph_flags); - int rc, linev_len = 0; - - while (1) { - rc = fread(buf, phl + phf, 1, in); - if (rc <= 0) - break; - - hdr = (void *)buf; - if (hdr->ph_len == 0) - break; - if (hdr->ph_len > 4094) { - fprintf(stderr, "unexpected large record: %d bytes. " - "aborting.\n", hdr->ph_len); - break; - } - - rc = fread(buf + phl + phf, 1, hdr->ph_len - phl - phf, in); - if (rc <= 0) - break; - - if (hdr->ph_mask && - (!(spl_debug_subsystem & hdr->ph_subsys) || - (!(spl_debug_mask & hdr->ph_mask)))) { - dropped++; - continue; - } - - line = malloc(sizeof(*line)); - if (line == NULL) { - fprintf(stderr, "malloc failed; printing accumulated " - "records and exiting.\n"); - break; - } - - line->hdr = malloc(hdr->ph_len + 1); - if (line->hdr == NULL) { - free(line); - fprintf(stderr, "malloc failed; printing accumulated " - "records and exiting.\n"); - break; - } - - p = (void *)line->hdr; - memcpy(line->hdr, buf, hdr->ph_len); - p[hdr->ph_len] = '\0'; - - p += sizeof(*hdr); - line->file = p; - p += strlen(line->file) + 1; - line->fn = p; - p += strlen(line->fn) + 1; - line->text = p; - - if (!add_rec(line, &linev, &linev_len, kept)) { - fprintf(stderr, "malloc failed; printing accumulated " - "records and exiting.\n"); - break; - } - kept++; - } - - if (linev) { - qsort(linev, kept, sizeof(struct dbg_line *), cmp_rec); - print_rec(linev, kept, out); - } - - printf("Debug log: %lu lines, %lu kept, %lu dropped.\n", - dropped + kept, kept, dropped); - return 0; -} - -int -main(int argc, char *argv[]) -{ - int fdin, fdout; - FILE *in, *out = stdout; - int rc, o_lf = 0; - - if (argc > 3 || argc < 2) { - fprintf(stderr, "usage: %s [output]\n", argv[0]); - return 0; - } - -#ifdef __USE_LARGEFILE64 - o_lf = O_LARGEFILE; -#endif - - fdin = open(argv[1], O_RDONLY | o_lf); - if (fdin == -1) { - fprintf(stderr, "open(%s) failed: %s\n", argv[1], - strerror(errno)); - return 1; - } - in = fdopen(fdin, "r"); - if (in == NULL) { - fprintf(stderr, "fopen(%s) failed: %s\n", argv[1], - strerror(errno)); - close(fdin); - return 1; - } - if (argc > 2) { - fdout = open(argv[2], O_CREAT | O_TRUNC | O_WRONLY | o_lf, 0600); - if (fdout == -1) { - fprintf(stderr, "open(%s) failed: %s\n", argv[2], - strerror(errno)); - fclose(in); - return 1; - } - out = fdopen(fdout, "w"); - if (out == NULL) { - fprintf(stderr, "fopen(%s) failed: %s\n", argv[2], - strerror(errno)); - fclose(in); - close(fdout); - return 1; - } - } - - rc = parse_buffer(in, out); - - fclose(in); - if (out != stdout) - fclose(out); - - return rc; -} diff --git a/config/spl-build.m4 b/config/spl-build.m4 index 5a33f5e8e..d2cb68b6b 100644 --- a/config/spl-build.m4 +++ b/config/spl-build.m4 @@ -18,7 +18,6 @@ AC_DEFUN([SPL_AC_CONFIG_KERNEL], [ AC_SUBST(KERNELCPPFLAGS) SPL_AC_DEBUG - SPL_AC_DEBUG_LOG SPL_AC_DEBUG_KMEM SPL_AC_DEBUG_KMEM_TRACKING SPL_AC_TEST_MODULE @@ -219,7 +218,7 @@ AC_DEFUN([SPL_AC_RPM], [ AC_MSG_RESULT([$HAVE_RPMBUILD]) ]) - RPM_DEFINE_COMMON='--define "$(DEBUG_SPL) 1" --define "$(DEBUG_LOG) 1" --define "$(DEBUG_KMEM) 1" --define "$(DEBUG_KMEM_TRACKING) 1"' + RPM_DEFINE_COMMON='--define "$(DEBUG_SPL) 1" --define "$(DEBUG_KMEM) 1" --define "$(DEBUG_KMEM_TRACKING) 1"' RPM_DEFINE_UTIL= RPM_DEFINE_KMOD='--define "kernels $(LINUX_VERSION)"' RPM_DEFINE_DKMS= @@ -452,39 +451,6 @@ AC_DEFUN([SPL_AC_DEBUG], [ AC_MSG_RESULT([$enable_debug]) ]) -dnl # -dnl # Enabled by default it provides a basic debug log infrastructure. -dnl # Each subsystem registers itself with a name and logs messages -dnl # using predefined types. If the debug mask it set to allow the -dnl # message type it will be written to the internal log. The log -dnl # can be dumped to a file by echoing 1 to the 'dump' proc entry, -dnl # after dumping the log it must be decoded using the spl utility. -dnl # -dnl # echo 1 >/proc/sys/kernel/spl/debug/dump -dnl # spl /tmp/spl-log.xxx.yyy /tmp/spl-log.xxx.yyy.txt -dnl # -AC_DEFUN([SPL_AC_DEBUG_LOG], [ - AC_ARG_ENABLE([debug-log], - [AS_HELP_STRING([--enable-debug-log], - [Enable basic debug logging @<:@default=yes@:>@])], - [], - [enable_debug_log=yes]) - - AS_IF([test "x$enable_debug_log" = xyes], - [ - KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG_LOG" - DEBUG_LOG="_with_debug_log" - AC_DEFINE([DEBUG_LOG], [1], - [Define to 1 to enable basic debug logging]) - ], [ - DEBUG_LOG="_without_debug_log" - ]) - - AC_SUBST(DEBUG_LOG) - AC_MSG_CHECKING([whether basic debug logging is enabled]) - AC_MSG_RESULT([$enable_debug_log]) -]) - dnl # dnl # Enabled by default it provides a minimal level of memory tracking. dnl # A total count of bytes allocated is kept for each alloc and free. diff --git a/include/Makefile.am b/include/Makefile.am index f9b812de3..3200222db 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -5,8 +5,6 @@ COMMON_H = KERNEL_H = \ $(top_srcdir)/include/splat-ctl.h \ $(top_srcdir)/include/spl-ctl.h \ - $(top_srcdir)/include/spl-debug.h \ - $(top_srcdir)/include/spl-trace.h \ $(top_srcdir)/include/strings.h \ $(top_srcdir)/include/unistd.h diff --git a/include/spl-debug.h b/include/spl-debug.h deleted file mode 100644 index c91b864c2..000000000 --- a/include/spl-debug.h +++ /dev/null @@ -1,276 +0,0 @@ -/*****************************************************************************\ - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf . - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see . - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see . -\*****************************************************************************/ - -/* - * Available debug functions. These function should be used by any - * package which needs to integrate with the SPL log infrastructure. - * - * SDEBUG() - Log debug message with specified mask. - * SDEBUG_LIMIT() - Log just 1 debug message with specified mask. - * SWARN() - Log a warning message. - * SERROR() - Log an error message. - * SEMERG() - Log an emergency error message. - * SCONSOLE() - Log a generic message to the console. - * - * SENTRY - Log entry point to a function. - * SEXIT - Log exit point from a function. - * SRETURN(x) - Log return from a function. - * SGOTO(x, y) - Log goto within a function. - */ - -#ifndef _SPL_DEBUG_INTERNAL_H -#define _SPL_DEBUG_INTERNAL_H - -#include -#include - -#define SS_UNDEFINED 0x00000001 -#define SS_ATOMIC 0x00000002 -#define SS_KOBJ 0x00000004 -#define SS_VNODE 0x00000008 -#define SS_TIME 0x00000010 -#define SS_RWLOCK 0x00000020 -#define SS_THREAD 0x00000040 -#define SS_CONDVAR 0x00000080 -#define SS_MUTEX 0x00000100 -#define SS_RNG 0x00000200 -#define SS_TASKQ 0x00000400 -#define SS_KMEM 0x00000800 -#define SS_DEBUG 0x00001000 -#define SS_GENERIC 0x00002000 -#define SS_PROC 0x00004000 -#define SS_MODULE 0x00008000 -#define SS_CRED 0x00010000 -#define SS_KSTAT 0x00020000 -#define SS_XDR 0x00040000 -#define SS_TSD 0x00080000 -#define SS_ZLIB 0x00100000 -#define SS_USER1 0x01000000 -#define SS_USER2 0x02000000 -#define SS_USER3 0x04000000 -#define SS_USER4 0x08000000 -#define SS_USER5 0x10000000 -#define SS_USER6 0x20000000 -#define SS_USER7 0x40000000 -#define SS_USER8 0x80000000 -#define SS_DEBUG_SUBSYS SS_UNDEFINED - -#define SD_TRACE 0x00000001 -#define SD_INFO 0x00000002 -#define SD_WARNING 0x00000004 -#define SD_ERROR 0x00000008 -#define SD_EMERG 0x00000010 -#define SD_CONSOLE 0x00000020 -#define SD_IOCTL 0x00000040 -#define SD_DPRINTF 0x00000080 -#define SD_OTHER 0x00000100 -#define SD_CANTMASK (SD_ERROR | SD_EMERG | SD_WARNING | SD_CONSOLE) - -/* Debug log support enabled */ -#ifdef DEBUG_LOG - -#define __SDEBUG(cdls, subsys, mask, format, a...) \ -do { \ - if (((mask) & SD_CANTMASK) != 0 || \ - ((spl_debug_mask & (mask)) != 0 && \ - (spl_debug_subsys & (subsys)) != 0)) \ - spl_debug_msg(cdls, subsys, mask, __FILE__, \ - __FUNCTION__, __LINE__, format, ## a); \ -} while (0) - -#define SDEBUG(mask, format, a...) \ - __SDEBUG(NULL, SS_DEBUG_SUBSYS, mask, format, ## a) - -#define __SDEBUG_LIMIT(subsys, mask, format, a...) \ -do { \ - static spl_debug_limit_state_t cdls; \ - \ - __SDEBUG(&cdls, subsys, mask, format, ## a); \ -} while (0) - -#define SDEBUG_LIMIT(mask, format, a...) \ - __SDEBUG_LIMIT(SS_DEBUG_SUBSYS, mask, format, ## a) - -#define SWARN(fmt, a...) SDEBUG_LIMIT(SD_WARNING, fmt, ## a) -#define SERROR(fmt, a...) SDEBUG_LIMIT(SD_ERROR, fmt, ## a) -#define SEMERG(fmt, a...) SDEBUG_LIMIT(SD_EMERG, fmt, ## a) -#define SCONSOLE(mask, fmt, a...) SDEBUG(SD_CONSOLE | (mask), fmt, ## a) - -#define SENTRY SDEBUG(SD_TRACE, "Process entered\n") -#define SEXIT SDEBUG(SD_TRACE, "Process leaving\n") - -#define SRETURN(rc) \ -do { \ - typeof(rc) RETURN__ret = (rc); \ - SDEBUG(SD_TRACE, "Process leaving (rc=%lu : %ld : %lx)\n", \ - (long)RETURN__ret, (long)RETURN__ret, (long)RETURN__ret); \ - return RETURN__ret; \ -} while (0) - -#define SGOTO(label, rc) \ -do { \ - long GOTO__ret = (long)(rc); \ - SDEBUG(SD_TRACE,"Process leaving via %s (rc=%lu : %ld : %lx)\n",\ - #label, (unsigned long)GOTO__ret, (signed long)GOTO__ret, \ - (signed long)GOTO__ret); \ - goto label; \ -} while (0) - -typedef struct { - unsigned long cdls_next; - int cdls_count; - long cdls_delay; -} spl_debug_limit_state_t; - -/* Global debug variables */ -extern unsigned long spl_debug_subsys; -extern unsigned long spl_debug_mask; -extern unsigned long spl_debug_printk; -extern int spl_debug_mb; -extern unsigned int spl_debug_binary; -extern unsigned int spl_debug_catastrophe; -extern unsigned int spl_debug_panic_on_bug; -extern char spl_debug_file_path[PATH_MAX]; -extern unsigned int spl_console_ratelimit; -extern long spl_console_max_delay; -extern long spl_console_min_delay; -extern unsigned int spl_console_backoff; -extern unsigned int spl_debug_stack; - -/* Exported debug functions */ -extern int spl_debug_mask2str(char *str, int size, unsigned long mask, int ss); -extern int spl_debug_str2mask(unsigned long *mask, const char *str, int ss); -extern unsigned long spl_debug_set_mask(unsigned long mask); -extern unsigned long spl_debug_get_mask(void); -extern unsigned long spl_debug_set_subsys(unsigned long mask); -extern unsigned long spl_debug_get_subsys(void); -extern int spl_debug_set_mb(int mb); -extern int spl_debug_get_mb(void); -extern int spl_debug_dumplog(int flags); -extern void spl_debug_dumpstack(struct task_struct *tsk); -extern void spl_debug_bug(char *file, const char *fn, const int line, int fl); -extern int spl_debug_msg(void *arg, int subsys, int mask, const char *file, - const char *fn, const int line, const char *format, ...); -extern int spl_debug_clear_buffer(void); -extern int spl_debug_mark_buffer(char *text); - -int spl_debug_init(void); -void spl_debug_fini(void); - -/* Debug log support disabled */ -#else /* DEBUG_LOG */ - -#define __SDEBUG(x, y, mask, fmt, a...) ((void)0) -#define SDEBUG(mask, fmt, a...) ((void)0) -#define SDEBUG_LIMIT(x, y, fmt, a...) ((void)0) -#define SWARN(fmt, a...) ((void)0) -#define SERROR(fmt, a...) ((void)0) -#define SEMERG(fmt, a...) ((void)0) -#define SCONSOLE(mask, fmt, a...) ((void)0) - -#define SENTRY ((void)0) -#define SEXIT ((void)0) -#define SRETURN(x) return (x) -#define SGOTO(x, y) { ((void)(y)); goto x; } - -static inline unsigned long -spl_debug_set_mask(unsigned long mask) { - return (0); -} - -static inline unsigned long -spl_debug_get_mask(void) { - return (0); -} - -static inline unsigned long -spl_debug_set_subsys(unsigned long mask) { - return (0); -} - -static inline unsigned long -spl_debug_get_subsys(void) { - return (0); -} - -static inline int -spl_debug_set_mb(int mb) { - return (0); -} - -static inline int -spl_debug_get_mb(void) { - return (0); -} - -static inline int -spl_debug_dumplog(int flags) -{ - return (0); -} - -static inline void -spl_debug_dumpstack(struct task_struct *tsk) -{ - return; -} - -static inline void -spl_debug_bug(char *file, const char *fn, const int line, int fl) -{ - return; -} - -static inline int -spl_debug_msg(void *arg, int subsys, int mask, const char *file, - const char *fn, const int line, const char *format, ...) -{ - return (0); -} - -static inline int -spl_debug_clear_buffer(void) -{ - return (0); -} - -static inline int -spl_debug_mark_buffer(char *text) -{ - return (0); -} - -static inline int -spl_debug_init(void) { - return (0); -} - -static inline void -spl_debug_fini(void) { - return; -} - -#endif /* DEBUG_LOG */ - -#endif /* SPL_DEBUG_INTERNAL_H */ diff --git a/include/spl-trace.h b/include/spl-trace.h deleted file mode 100644 index 8ef173e76..000000000 --- a/include/spl-trace.h +++ /dev/null @@ -1,132 +0,0 @@ -/*****************************************************************************\ - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf . - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see . - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see . -\*****************************************************************************/ - -#ifndef _SPL_TRACE_H -#define _SPL_TRACE_H - -#define TCD_MAX_PAGES (5 << (20 - PAGE_SHIFT)) -#define TCD_STOCK_PAGES (TCD_MAX_PAGES) -#define TRACE_CONSOLE_BUFFER_SIZE 1024 - -#define SPL_DEFAULT_MAX_DELAY (600 * HZ) -#define SPL_DEFAULT_MIN_DELAY ((HZ + 1) / 2) -#define SPL_DEFAULT_BACKOFF 2 - -#define DL_NOTHREAD 0x0001 /* Do not create a new thread */ -#define DL_SINGLE_CPU 0x0002 /* Collect pages from this CPU*/ - -typedef struct dumplog_priv { - wait_queue_head_t dp_waitq; - pid_t dp_pid; - int dp_flags; - atomic_t dp_done; -} dumplog_priv_t; - -/* Three trace data types */ -typedef enum { - TCD_TYPE_PROC, - TCD_TYPE_SOFTIRQ, - TCD_TYPE_IRQ, - TCD_TYPE_MAX -} tcd_type_t; - -union trace_data_union { - struct trace_cpu_data { - /* pages with trace records not yet processed by tracefiled */ - struct list_head tcd_pages; - /* number of pages on ->tcd_pages */ - unsigned long tcd_cur_pages; - /* Max number of pages allowed on ->tcd_pages */ - unsigned long tcd_max_pages; - - /* - * preallocated pages to write trace records into. Pages from - * ->tcd_stock_pages are moved to ->tcd_pages by spl_debug_msg(). - * - * This list is necessary, because on some platforms it's - * impossible to perform efficient atomic page allocation in a - * non-blockable context. - * - * Such platforms fill ->tcd_stock_pages "on occasion", when - * tracing code is entered in blockable context. - * - * trace_get_tage_try() tries to get a page from - * ->tcd_stock_pages first and resorts to atomic page - * allocation only if this queue is empty. ->tcd_stock_pages - * is replenished when tracing code is entered in blocking - * context (darwin-tracefile.c:trace_get_tcd()). We try to - * maintain TCD_STOCK_PAGES (40 by default) pages in this - * queue. Atomic allocation is only required if more than - * TCD_STOCK_PAGES pagesful are consumed by trace records all - * emitted in non-blocking contexts. Which is quite unlikely. - */ - struct list_head tcd_stock_pages; - /* number of pages on ->tcd_stock_pages */ - unsigned long tcd_cur_stock_pages; - - unsigned short tcd_shutting_down; - unsigned short tcd_cpu; - unsigned short tcd_type; - /* The factors to share debug memory. */ - unsigned short tcd_pages_factor; - - /* - * This spinlock is needed to workaround the problem of - * set_cpus_allowed() being GPL-only. Since we cannot - * schedule a thread on a specific CPU when dumping the - * pages, we must use the spinlock for mutual exclusion. - */ - spinlock_t tcd_lock; - unsigned long tcd_lock_flags; - } tcd; - char __pad[L1_CACHE_ALIGN(sizeof(struct trace_cpu_data))]; -}; - -extern union trace_data_union (*trace_data[TCD_TYPE_MAX])[NR_CPUS]; - -#define tcd_for_each(tcd, i, j) \ - for (i = 0; i < TCD_TYPE_MAX && trace_data[i]; i++) \ - for (j = 0, ((tcd) = &(*trace_data[i])[j].tcd); \ - j < num_possible_cpus(); j++, (tcd) = &(*trace_data[i])[j].tcd) - -#define tcd_for_each_type_lock(tcd, i, cpu) \ - for (i = 0; i < TCD_TYPE_MAX && trace_data[i] && \ - (tcd = &(*trace_data[i])[cpu].tcd) && \ - trace_lock_tcd(tcd); trace_unlock_tcd(tcd), i++) - -struct trace_page { - struct page *page; /* page itself */ - struct list_head linkage; /* Used by trace_data_union */ - unsigned int used; /* number of bytes used within this page */ - unsigned short cpu; /* cpu that owns this page */ - unsigned short type; /* type(context) of this page */ -}; - -struct page_collection { - struct list_head pc_pages; - spinlock_t pc_lock; - int pc_want_daemon_pages; -}; - -#endif /* SPL_TRACE_H */ diff --git a/include/sys/debug.h b/include/sys/debug.h index 3a4b1352f..cae2d49e4 100644 --- a/include/sys/debug.h +++ b/include/sys/debug.h @@ -30,7 +30,6 @@ * * PANIC() - Panic the node and print message. * ASSERT() - Assert X is true, if not panic. - * ASSERTF() - Assert X is true, if not panic and print message. * ASSERTV() - Wraps a variable declaration which is only used by ASSERT(). * ASSERT3S() - Assert signed X OP Y is true, if not panic. * ASSERT3U() - Assert unsigned X OP Y is true, if not panic. @@ -44,110 +43,69 @@ */ #ifndef _SPL_DEBUG_H -#define _SPL_DEBUG_H +#define _SPL_DEBUG_H -#include - -#ifdef NDEBUG /* Debugging Disabled */ - -/* Define SPL_DEBUG_STR to make clear which ASSERT definitions are used */ -#define SPL_DEBUG_STR "" - -#define PANIC(fmt, a...) \ - spl_PANIC(__FILE__, __FUNCTION__, __LINE__, fmt, ## a) - -#define __ASSERT(x) ((void)0) -#define ASSERT(x) ((void)0) -#define ASSERTF(x, y, z...) ((void)0) -#define ASSERTV(x) -#define VERIFY(cond) \ - (void)(unlikely(!(cond)) && \ - spl_PANIC(__FILE__, __FUNCTION__, __LINE__, \ - "%s", "VERIFY(" #cond ") failed\n")) - -#define VERIFY3_IMPL(LEFT, OP, RIGHT, TYPE, FMT, CAST) \ - (void)((!((TYPE)(LEFT) OP (TYPE)(RIGHT))) && \ - spl_PANIC(__FILE__, __FUNCTION__, __LINE__, \ - "VERIFY3(" #LEFT " " #OP " " #RIGHT ") " \ - "failed (" FMT " " #OP " " FMT ")\n", \ - CAST (LEFT), CAST (RIGHT))) - -#define VERIFY3S(x,y,z) VERIFY3_IMPL(x, y, z, int64_t, "%lld", (long long)) -#define VERIFY3U(x,y,z) VERIFY3_IMPL(x, y, z, uint64_t, "%llu", \ - (unsigned long long)) -#define VERIFY3P(x,y,z) VERIFY3_IMPL(x, y, z, uintptr_t, "%p", (void *)) -#define VERIFY0(x) VERIFY3_IMPL(0, ==, x, int64_t, "%lld", (long long)) - -#define ASSERT3S(x,y,z) ((void)0) -#define ASSERT3U(x,y,z) ((void)0) -#define ASSERT3P(x,y,z) ((void)0) -#define ASSERT0(x) ((void)0) - -#else /* Debugging Enabled */ - -/* Define SPL_DEBUG_STR to make clear which ASSERT definitions are used */ -#define SPL_DEBUG_STR " (DEBUG mode)" - -#define PANIC(fmt, a...) \ - spl_PANIC(__FILE__, __FUNCTION__, __LINE__, fmt, ## a) - -/* ASSERTION that is safe to use within the debug system */ -#define __ASSERT(cond) \ -do { \ - if (unlikely(!(cond))) { \ - printk(KERN_EMERG "ASSERTION(" #cond ") failed\n"); \ - BUG(); \ - } \ -} while (0) +/* + * Common DEBUG functionality. + */ +int spl_panic(const char *file, const char *func, int line, + const char *fmt, ...); +void spl_dumpstack(void); -/* ASSERTION that will debug log used outside the debug sysytem */ -#define ASSERT(cond) \ - (void)(unlikely(!(cond)) && \ - spl_PANIC(__FILE__, __FUNCTION__, __LINE__, \ - "%s", "ASSERTION(" #cond ") failed\n")) +#define PANIC(fmt, a...) \ + spl_panic(__FILE__, __FUNCTION__, __LINE__, fmt, ## a) -#define ASSERTF(cond, fmt, a...) \ +#define VERIFY(cond) \ (void)(unlikely(!(cond)) && \ - spl_PANIC(__FILE__, __FUNCTION__, __LINE__, \ - "ASSERTION(" #cond ") failed: " fmt, ## a)) + spl_panic(__FILE__, __FUNCTION__, __LINE__, \ + "%s", "VERIFY(" #cond ") failed\n")) -#define VERIFY3_IMPL(LEFT, OP, RIGHT, TYPE, FMT, CAST) \ +#define VERIFY3_IMPL(LEFT, OP, RIGHT, TYPE, FMT, CAST) \ (void)((!((TYPE)(LEFT) OP (TYPE)(RIGHT))) && \ - spl_PANIC(__FILE__, __FUNCTION__, __LINE__, \ - "VERIFY3(" #LEFT " " #OP " " #RIGHT ") " \ - "failed (" FMT " " #OP " " FMT ")\n", \ - CAST (LEFT), CAST (RIGHT))) + spl_panic(__FILE__, __FUNCTION__, __LINE__, \ + "VERIFY3(" #LEFT " " #OP " " #RIGHT ") " \ + "failed (" FMT " " #OP " " FMT ")\n", \ + CAST (LEFT), CAST (RIGHT))) -#define VERIFY3S(x,y,z) VERIFY3_IMPL(x, y, z, int64_t, "%lld", (long long)) -#define VERIFY3U(x,y,z) VERIFY3_IMPL(x, y, z, uint64_t, "%llu", \ +#define VERIFY3S(x,y,z) VERIFY3_IMPL(x, y, z, int64_t, "%lld", (long long)) +#define VERIFY3U(x,y,z) VERIFY3_IMPL(x, y, z, uint64_t, "%llu", \ (unsigned long long)) -#define VERIFY3P(x,y,z) VERIFY3_IMPL(x, y, z, uintptr_t, "%p", (void *)) -#define VERIFY0(x) VERIFY3_IMPL(0, ==, x, int64_t, "%lld", (long long)) - -#define ASSERT3S(x,y,z) VERIFY3S(x, y, z) -#define ASSERT3U(x,y,z) VERIFY3U(x, y, z) -#define ASSERT3P(x,y,z) VERIFY3P(x, y, z) -#define ASSERT0(x) VERIFY0(x) +#define VERIFY3P(x,y,z) VERIFY3_IMPL(x, y, z, uintptr_t, "%p", (void *)) +#define VERIFY0(x) VERIFY3_IMPL(0, ==, x, int64_t, "%lld", (long long)) -#define ASSERTV(x) x -#define VERIFY(x) ASSERT(x) - -#endif /* NDEBUG */ +#define CTASSERT_GLOBAL(x) _CTASSERT(x, __LINE__) +#define CTASSERT(x) { _CTASSERT(x, __LINE__); } +#define _CTASSERT(x, y) __CTASSERT(x, y) +#define __CTASSERT(x, y) \ + typedef char __attribute__ ((unused)) \ + __compile_time_assertion__ ## y[(x) ? 1 : -1] /* - * Helpers for the Solaris debug macros above + * Debugging disabled (--disable-debug) */ -extern int spl_PANIC(char *filename, const char *functionname, - int lineno, const char *fmt, ...); +#ifdef NDEBUG + +#define SPL_DEBUG_STR "" +#define ASSERT(x) ((void)0) +#define ASSERTV(x) +#define ASSERT3S(x,y,z) ((void)0) +#define ASSERT3U(x,y,z) ((void)0) +#define ASSERT3P(x,y,z) ((void)0) +#define ASSERT0(x) ((void)0) /* - * Compile-time assertion. The condition 'x' must be constant. + * Debugging enabled (--enable-debug) */ -#define CTASSERT_GLOBAL(x) _CTASSERT(x, __LINE__) -#define CTASSERT(x) { _CTASSERT(x, __LINE__); } -#define _CTASSERT(x, y) __CTASSERT(x, y) -#define __CTASSERT(x, y) \ - typedef char __attribute__ ((unused)) \ - __compile_time_assertion__ ## y[(x) ? 1 : -1] +#else + +#define SPL_DEBUG_STR " (DEBUG mode)" +#define ASSERT(cond) VERIFY(cond) +#define ASSERTV(x) x +#define ASSERT3S(x,y,z) VERIFY3S(x, y, z) +#define ASSERT3U(x,y,z) VERIFY3U(x, y, z) +#define ASSERT3P(x,y,z) VERIFY3P(x, y, z) +#define ASSERT0(x) VERIFY0(x) + +#endif /* NDEBUG */ #endif /* SPL_DEBUG_H */ diff --git a/include/sys/kmem.h b/include/sys/kmem.h index 5875dfff6..936e49d6d 100644 --- a/include/sys/kmem.h +++ b/include/sys/kmem.h @@ -74,27 +74,27 @@ * ship a kernel with CONFIG_RT_MUTEX_TESTER disabled. */ #if !defined(CONFIG_RT_MUTEX_TESTER) && defined(PF_MUTEX_TESTER) -# define PF_NOFS PF_MUTEX_TESTER +#define PF_NOFS PF_MUTEX_TESTER static inline void sanitize_flags(struct task_struct *p, gfp_t *flags) { if (unlikely((p->flags & PF_NOFS) && (*flags & (__GFP_IO|__GFP_FS)))) { -# ifdef NDEBUG - SDEBUG_LIMIT(SD_CONSOLE | SD_WARNING, "Fixing allocation for " - "task %s (%d) which used GFP flags 0x%x with PF_NOFS set\n", - p->comm, p->pid, flags); - spl_debug_dumpstack(p); +#ifdef NDEBUG + printk(KERN_WARNING "Fixing allocation for task %s (%d) " + "which used GFP flags 0x%x with PF_NOFS set\n", + p->comm, p->pid, *flags); + spl_dumpstack(); *flags &= ~(__GFP_IO|__GFP_FS); -# else +#else PANIC("FATAL allocation for task %s (%d) which used GFP " - "flags 0x%x with PF_NOFS set\n", p->comm, p->pid, flags); -# endif /* NDEBUG */ + "flags 0x%x with PF_NOFS set\n", p->comm, p->pid, *flags); +#endif /* NDEBUG */ } } #else -# define PF_NOFS 0x00000000 -# define sanitize_flags(p, fl) ((void)0) +#define PF_NOFS 0x00000000 +#define sanitize_flags(p, fl) ((void)0) #endif /* !defined(CONFIG_RT_MUTEX_TESTER) && defined(PF_MUTEX_TESTER) */ /* diff --git a/module/spl/Makefile.in b/module/spl/Makefile.in index 30620349f..9f67ed646 100644 --- a/module/spl/Makefile.in +++ b/module/spl/Makefile.in @@ -6,7 +6,6 @@ EXTRA_CFLAGS = $(SPL_MODULE_CFLAGS) @KERNELCPPFLAGS@ # Solaris porting layer module obj-$(CONFIG_SPL) := $(MODULE).o -$(MODULE)-objs += @top_srcdir@/module/spl/spl-debug.o $(MODULE)-objs += @top_srcdir@/module/spl/spl-proc.o $(MODULE)-objs += @top_srcdir@/module/spl/spl-kmem.o $(MODULE)-objs += @top_srcdir@/module/spl/spl-thread.o diff --git a/module/spl/spl-condvar.c b/module/spl/spl-condvar.c index 8236412dd..2a0052f56 100644 --- a/module/spl/spl-condvar.c +++ b/module/spl/spl-condvar.c @@ -25,18 +25,10 @@ \*****************************************************************************/ #include -#include - -#ifdef SS_DEBUG_SUBSYS -#undef SS_DEBUG_SUBSYS -#endif - -#define SS_DEBUG_SUBSYS SS_CONDVAR void __cv_init(kcondvar_t *cvp, char *name, kcv_type_t type, void *arg) { - SENTRY; ASSERT(cvp); ASSERT(name == NULL); ASSERT(type == CV_DEFAULT); @@ -48,8 +40,6 @@ __cv_init(kcondvar_t *cvp, char *name, kcv_type_t type, void *arg) atomic_set(&cvp->cv_waiters, 0); atomic_set(&cvp->cv_refs, 1); cvp->cv_mutex = NULL; - - SEXIT; } EXPORT_SYMBOL(__cv_init); @@ -68,7 +58,6 @@ cv_destroy_wakeup(kcondvar_t *cvp) void __cv_destroy(kcondvar_t *cvp) { - SENTRY; ASSERT(cvp); ASSERT(cvp->cv_magic == CV_MAGIC); @@ -83,8 +72,6 @@ __cv_destroy(kcondvar_t *cvp) ASSERT3S(atomic_read(&cvp->cv_refs), ==, 0); ASSERT3S(atomic_read(&cvp->cv_waiters), ==, 0); ASSERT3S(waitqueue_active(&cvp->cv_event), ==, 0); - - SEXIT; } EXPORT_SYMBOL(__cv_destroy); @@ -92,7 +79,6 @@ static void cv_wait_common(kcondvar_t *cvp, kmutex_t *mp, int state, int io) { DEFINE_WAIT(wait); - SENTRY; ASSERT(cvp); ASSERT(mp); @@ -127,8 +113,6 @@ cv_wait_common(kcondvar_t *cvp, kmutex_t *mp, int state, int io) finish_wait(&cvp->cv_event, &wait); atomic_dec(&cvp->cv_refs); - - SEXIT; } void @@ -161,7 +145,6 @@ __cv_timedwait_common(kcondvar_t *cvp, kmutex_t *mp, { DEFINE_WAIT(wait); clock_t time_left; - SENTRY; ASSERT(cvp); ASSERT(mp); @@ -179,7 +162,7 @@ __cv_timedwait_common(kcondvar_t *cvp, kmutex_t *mp, time_left = expire_time - jiffies; if (time_left <= 0) { atomic_dec(&cvp->cv_refs); - SRETURN(-1); + return (-1); } prepare_to_wait_exclusive(&cvp->cv_event, &wait, state); @@ -201,7 +184,7 @@ __cv_timedwait_common(kcondvar_t *cvp, kmutex_t *mp, finish_wait(&cvp->cv_event, &wait); atomic_dec(&cvp->cv_refs); - SRETURN(time_left > 0 ? time_left : -1); + return (time_left > 0 ? time_left : -1); } clock_t @@ -229,7 +212,6 @@ __cv_timedwait_hires(kcondvar_t *cvp, kmutex_t *mp, DEFINE_WAIT(wait); hrtime_t time_left, now; unsigned long time_left_us; - SENTRY; ASSERT(cvp); ASSERT(mp); @@ -247,7 +229,7 @@ __cv_timedwait_hires(kcondvar_t *cvp, kmutex_t *mp, time_left = expire_time - now; if (time_left <= 0) { atomic_dec(&cvp->cv_refs); - SRETURN(-1); + return (-1); } time_left_us = time_left / NSEC_PER_USEC; @@ -273,7 +255,7 @@ __cv_timedwait_hires(kcondvar_t *cvp, kmutex_t *mp, atomic_dec(&cvp->cv_refs); time_left = expire_time - gethrtime(); - SRETURN(time_left > 0 ? time_left : -1); + return (time_left > 0 ? time_left : -1); } /* @@ -302,7 +284,6 @@ EXPORT_SYMBOL(cv_timedwait_hires); void __cv_signal(kcondvar_t *cvp) { - SENTRY; ASSERT(cvp); ASSERT(cvp->cv_magic == CV_MAGIC); atomic_inc(&cvp->cv_refs); @@ -315,14 +296,12 @@ __cv_signal(kcondvar_t *cvp) wake_up(&cvp->cv_event); atomic_dec(&cvp->cv_refs); - SEXIT; } EXPORT_SYMBOL(__cv_signal); void __cv_broadcast(kcondvar_t *cvp) { - SENTRY; ASSERT(cvp); ASSERT(cvp->cv_magic == CV_MAGIC); atomic_inc(&cvp->cv_refs); @@ -333,6 +312,5 @@ __cv_broadcast(kcondvar_t *cvp) wake_up_all(&cvp->cv_event); atomic_dec(&cvp->cv_refs); - SEXIT; } EXPORT_SYMBOL(__cv_broadcast); diff --git a/module/spl/spl-debug.c b/module/spl/spl-debug.c deleted file mode 100644 index 6c4e043f0..000000000 --- a/module/spl/spl-debug.c +++ /dev/null @@ -1,1265 +0,0 @@ -/*****************************************************************************\ - * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. - * Copyright (C) 2007 The Regents of the University of California. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf . - * UCRL-CODE-235197 - * - * This file is part of the SPL, Solaris Porting Layer. - * For details, see . - * - * The SPL is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The SPL is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the SPL. If not, see . - ***************************************************************************** - * Solaris Porting Layer (SPL) Debug Implementation. -\*****************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef SS_DEBUG_SUBSYS -#undef SS_DEBUG_SUBSYS -#endif - -#define SS_DEBUG_SUBSYS SS_DEBUG - -/* Debug log support enabled */ -#ifdef DEBUG_LOG - -unsigned long spl_debug_subsys = ~0; -EXPORT_SYMBOL(spl_debug_subsys); -module_param(spl_debug_subsys, ulong, 0644); -MODULE_PARM_DESC(spl_debug_subsys, "Subsystem debugging level mask."); - -unsigned long spl_debug_mask = SD_CANTMASK; -EXPORT_SYMBOL(spl_debug_mask); -module_param(spl_debug_mask, ulong, 0644); -MODULE_PARM_DESC(spl_debug_mask, "Debugging level mask."); - -unsigned long spl_debug_printk = SD_CANTMASK; -EXPORT_SYMBOL(spl_debug_printk); -module_param(spl_debug_printk, ulong, 0644); -MODULE_PARM_DESC(spl_debug_printk, "Console printk level mask."); - -int spl_debug_mb = -1; -EXPORT_SYMBOL(spl_debug_mb); -module_param(spl_debug_mb, int, 0644); -MODULE_PARM_DESC(spl_debug_mb, "Total debug buffer size."); - -unsigned int spl_debug_binary = 1; -EXPORT_SYMBOL(spl_debug_binary); - -unsigned int spl_debug_catastrophe; -EXPORT_SYMBOL(spl_debug_catastrophe); - -unsigned int spl_debug_panic_on_bug = 0; -EXPORT_SYMBOL(spl_debug_panic_on_bug); -module_param(spl_debug_panic_on_bug, uint, 0644); -MODULE_PARM_DESC(spl_debug_panic_on_bug, "Panic on BUG"); - -static char spl_debug_file_name[PATH_MAX]; -char spl_debug_file_path[PATH_MAX] = "/tmp/spl-log"; - -unsigned int spl_console_ratelimit = 1; -EXPORT_SYMBOL(spl_console_ratelimit); - -long spl_console_max_delay; -EXPORT_SYMBOL(spl_console_max_delay); - -long spl_console_min_delay; -EXPORT_SYMBOL(spl_console_min_delay); - -unsigned int spl_console_backoff = SPL_DEFAULT_BACKOFF; -EXPORT_SYMBOL(spl_console_backoff); - -unsigned int spl_debug_stack; -EXPORT_SYMBOL(spl_debug_stack); - -static int spl_panic_in_progress; - -union trace_data_union (*trace_data[TCD_TYPE_MAX])[NR_CPUS] __cacheline_aligned; -char *trace_console_buffers[NR_CPUS][3]; -struct rw_semaphore trace_sem; -atomic_t trace_tage_allocated = ATOMIC_INIT(0); - -static int spl_debug_dump_all_pages(dumplog_priv_t *dp, char *); -static void trace_fini(void); - - -/* Memory percentage breakdown by type */ -static unsigned int pages_factor[TCD_TYPE_MAX] = { - 80, /* 80% pages for TCD_TYPE_PROC */ - 10, /* 10% pages for TCD_TYPE_SOFTIRQ */ - 10 /* 10% pages for TCD_TYPE_IRQ */ -}; - -const char * -spl_debug_subsys2str(int subsys) -{ - switch (subsys) { - default: - return NULL; - case SS_UNDEFINED: - return "undefined"; - case SS_ATOMIC: - return "atomic"; - case SS_KOBJ: - return "kobj"; - case SS_VNODE: - return "vnode"; - case SS_TIME: - return "time"; - case SS_RWLOCK: - return "rwlock"; - case SS_THREAD: - return "thread"; - case SS_CONDVAR: - return "condvar"; - case SS_MUTEX: - return "mutex"; - case SS_RNG: - return "rng"; - case SS_TASKQ: - return "taskq"; - case SS_KMEM: - return "kmem"; - case SS_DEBUG: - return "debug"; - case SS_GENERIC: - return "generic"; - case SS_PROC: - return "proc"; - case SS_MODULE: - return "module"; - case SS_CRED: - return "cred"; - case SS_KSTAT: - return "kstat"; - case SS_XDR: - return "xdr"; - case SS_TSD: - return "tsd"; - case SS_ZLIB: - return "zlib"; - case SS_USER1: - return "user1"; - case SS_USER2: - return "user2"; - case SS_USER3: - return "user3"; - case SS_USER4: - return "user4"; - case SS_USER5: - return "user5"; - case SS_USER6: - return "user6"; - case SS_USER7: - return "user7"; - case SS_USER8: - return "user8"; - } -} - -const char * -spl_debug_dbg2str(int debug) -{ - switch (debug) { - default: - return NULL; - case SD_TRACE: - return "trace"; - case SD_INFO: - return "info"; - case SD_WARNING: - return "warning"; - case SD_ERROR: - return "error"; - case SD_EMERG: - return "emerg"; - case SD_CONSOLE: - return "console"; - case SD_IOCTL: - return "ioctl"; - case SD_DPRINTF: - return "dprintf"; - case SD_OTHER: - return "other"; - } -} - -int -spl_debug_mask2str(char *str, int size, unsigned long mask, int is_subsys) -{ - const char *(*fn)(int bit) = is_subsys ? spl_debug_subsys2str : - spl_debug_dbg2str; - const char *token; - int i, bit, len = 0; - - if (mask == 0) { /* "0" */ - if (size > 0) - str[0] = '0'; - len = 1; - } else { /* space-separated tokens */ - for (i = 0; i < 32; i++) { - bit = 1 << i; - - if ((mask & bit) == 0) - continue; - - token = fn(bit); - if (token == NULL) /* unused bit */ - continue; - - if (len > 0) { /* separator? */ - if (len < size) - str[len] = ' '; - len++; - } - - while (*token != 0) { - if (len < size) - str[len] = *token; - token++; - len++; - } - } - } - - /* terminate 'str' */ - if (len < size) - str[len] = 0; - else - str[size - 1] = 0; - - return len; -} - -static int -spl_debug_token2mask(int *mask, const char *str, int len, int is_subsys) -{ - const char *(*fn)(int bit) = is_subsys ? spl_debug_subsys2str : - spl_debug_dbg2str; - const char *token; - int i, j, bit; - - /* match against known tokens */ - for (i = 0; i < 32; i++) { - bit = 1 << i; - - token = fn(bit); - if (token == NULL) /* unused? */ - continue; - - /* strcasecmp */ - for (j = 0; ; j++) { - if (j == len) { /* end of token */ - if (token[j] == 0) { - *mask = bit; - return 0; - } - break; - } - - if (token[j] == 0) - break; - - if (str[j] == token[j]) - continue; - - if (str[j] < 'A' || 'Z' < str[j]) - break; - - if (str[j] - 'A' + 'a' != token[j]) - break; - } - } - - return -EINVAL; /* no match */ -} - -int -spl_debug_str2mask(unsigned long *mask, const char *str, int is_subsys) -{ - char op = 0; - int m = 0, matched, n, t; - - /* Allow a number for backwards compatibility */ - for (n = strlen(str); n > 0; n--) - if (!isspace(str[n-1])) - break; - matched = n; - - if ((t = sscanf(str, "%i%n", &m, &matched)) >= 1 && matched == n) { - *mask = m; - return 0; - } - - /* must be a list of debug tokens or numbers separated by - * whitespace and optionally an operator ('+' or '-'). If an operator - * appears first in , '*mask' is used as the starting point - * (relative), otherwise 0 is used (absolute). An operator applies to - * all following tokens up to the next operator. */ - matched = 0; - while (*str != 0) { - while (isspace(*str)) /* skip whitespace */ - str++; - - if (*str == 0) - break; - - if (*str == '+' || *str == '-') { - op = *str++; - - /* op on first token == relative */ - if (!matched) - m = *mask; - - while (isspace(*str)) /* skip whitespace */ - str++; - - if (*str == 0) /* trailing op */ - return -EINVAL; - } - - /* find token length */ - for (n = 0; str[n] != 0 && !isspace(str[n]); n++); - - /* match token */ - if (spl_debug_token2mask(&t, str, n, is_subsys) != 0) - return -EINVAL; - - matched = 1; - if (op == '-') - m &= ~t; - else - m |= t; - - str += n; - } - - if (!matched) - return -EINVAL; - - *mask = m; - return 0; -} - -static void -spl_debug_dumplog_internal(dumplog_priv_t *dp) -{ - void *journal_info; - - journal_info = current->journal_info; - current->journal_info = NULL; - - snprintf(spl_debug_file_name, sizeof(spl_debug_file_path) - 1, - "%s.%ld.%ld", spl_debug_file_path, - get_seconds(), (long)dp->dp_pid); - printk("SPL: Dumping log to %s\n", spl_debug_file_name); - spl_debug_dump_all_pages(dp, spl_debug_file_name); - - current->journal_info = journal_info; -} - -static int -spl_debug_dumplog_thread(void *arg) -{ - dumplog_priv_t *dp = (dumplog_priv_t *)arg; - - spl_debug_dumplog_internal(dp); - atomic_set(&dp->dp_done, 1); - wake_up(&dp->dp_waitq); - complete_and_exit(NULL, 0); - - return 0; /* Unreachable */ -} - -/* When flag is set do not use a new thread for the debug dump */ -int -spl_debug_dumplog(int flags) -{ - struct task_struct *tsk; - dumplog_priv_t dp; - - init_waitqueue_head(&dp.dp_waitq); - dp.dp_pid = current->pid; - dp.dp_flags = flags; - atomic_set(&dp.dp_done, 0); - - if (dp.dp_flags & DL_NOTHREAD) { - spl_debug_dumplog_internal(&dp); - } else { - - tsk = spl_kthread_create(spl_debug_dumplog_thread,(void *)&dp,"spl_debug"); - if (tsk == NULL) - return -ENOMEM; - - wake_up_process(tsk); - wait_event(dp.dp_waitq, atomic_read(&dp.dp_done)); - } - - return 0; -} -EXPORT_SYMBOL(spl_debug_dumplog); - -static char * -trace_get_console_buffer(void) -{ - int cpu = get_cpu(); - int idx; - - if (in_irq()) { - idx = 0; - } else if (in_softirq()) { - idx = 1; - } else { - idx = 2; - } - - return trace_console_buffers[cpu][idx]; -} - -static void -trace_put_console_buffer(char *buffer) -{ - put_cpu(); -} - -static int -trace_lock_tcd(struct trace_cpu_data *tcd) -{ - __ASSERT(tcd->tcd_type < TCD_TYPE_MAX); - - spin_lock_irqsave(&tcd->tcd_lock, tcd->tcd_lock_flags); - - return 1; -} - -static void -trace_unlock_tcd(struct trace_cpu_data *tcd) -{ - __ASSERT(tcd->tcd_type < TCD_TYPE_MAX); - - spin_unlock_irqrestore(&tcd->tcd_lock, tcd->tcd_lock_flags); -} - -static struct trace_cpu_data * -trace_get_tcd(void) -{ - int cpu; - struct trace_cpu_data *tcd; - - cpu = get_cpu(); - if (in_irq()) - tcd = &(*trace_data[TCD_TYPE_IRQ])[cpu].tcd; - else if (in_softirq()) - tcd = &(*trace_data[TCD_TYPE_SOFTIRQ])[cpu].tcd; - else - tcd = &(*trace_data[TCD_TYPE_PROC])[cpu].tcd; - - trace_lock_tcd(tcd); - - return tcd; -} - -static void -trace_put_tcd (struct trace_cpu_data *tcd) -{ - trace_unlock_tcd(tcd); - - put_cpu(); -} - -static void -trace_set_debug_header(struct spl_debug_header *header, int subsys, - int mask, const int line, unsigned long stack) -{ - struct timeval tv; - - do_gettimeofday(&tv); - - header->ph_subsys = subsys; - header->ph_mask = mask; - header->ph_cpu_id = smp_processor_id(); - header->ph_sec = (__u32)tv.tv_sec; - header->ph_usec = tv.tv_usec; - header->ph_stack = stack; - header->ph_pid = current->pid; - header->ph_line_num = line; - - return; -} - -static void -trace_print_to_console(struct spl_debug_header *hdr, int mask, const char *buf, - int len, const char *file, const char *fn) -{ - char *prefix = "SPL", *ptype = NULL; - - if ((mask & SD_EMERG) != 0) { - prefix = "SPLError"; - ptype = KERN_EMERG; - } else if ((mask & SD_ERROR) != 0) { - prefix = "SPLError"; - ptype = KERN_ERR; - } else if ((mask & SD_WARNING) != 0) { - prefix = "SPL"; - ptype = KERN_WARNING; - } else if ((mask & (SD_CONSOLE | spl_debug_printk)) != 0) { - prefix = "SPL"; - ptype = KERN_INFO; - } - - if ((mask & SD_CONSOLE) != 0) { - printk("%s%s: %.*s", ptype, prefix, len, buf); - } else { - printk("%s%s: %d:%d:(%s:%d:%s()) %.*s", ptype, prefix, - hdr->ph_pid, hdr->ph_stack, file, - hdr->ph_line_num, fn, len, buf); - } - - return; -} - -static int -trace_max_debug_mb(void) -{ - return MAX(512, ((totalram_pages >> (20 - PAGE_SHIFT)) * 80) / 100); -} - -static struct trace_page * -tage_alloc(int gfp) -{ - struct page *page; - struct trace_page *tage; - - page = alloc_pages(gfp | __GFP_NOWARN, 0); - if (page == NULL) - return NULL; - - tage = kmalloc(sizeof(*tage), gfp); - if (tage == NULL) { - __free_pages(page, 0); - return NULL; - } - - tage->page = page; - atomic_inc(&trace_tage_allocated); - - return tage; -} - -static void -tage_free(struct trace_page *tage) -{ - __ASSERT(tage != NULL); - __ASSERT(tage->page != NULL); - - __free_pages(tage->page, 0); - kfree(tage); - atomic_dec(&trace_tage_allocated); -} - -static struct trace_page * -tage_from_list(struct list_head *list) -{ - return list_entry(list, struct trace_page, linkage); -} - -static void -tage_to_tail(struct trace_page *tage, struct list_head *queue) -{ - __ASSERT(tage != NULL); - __ASSERT(queue != NULL); - - list_move_tail(&tage->linkage, queue); -} - -/* try to return a page that has 'len' bytes left at the end */ -static struct trace_page * -trace_get_tage_try(struct trace_cpu_data *tcd, unsigned long len) -{ - struct trace_page *tage; - - if (tcd->tcd_cur_pages > 0) { - __ASSERT(!list_empty(&tcd->tcd_pages)); - tage = tage_from_list(tcd->tcd_pages.prev); - if (tage->used + len <= PAGE_SIZE) - return tage; - } - - if (tcd->tcd_cur_pages < tcd->tcd_max_pages) { - if (tcd->tcd_cur_stock_pages > 0) { - tage = tage_from_list(tcd->tcd_stock_pages.prev); - tcd->tcd_cur_stock_pages--; - list_del_init(&tage->linkage); - } else { - tage = tage_alloc(GFP_ATOMIC); - if (tage == NULL) { - printk(KERN_WARNING - "failure to allocate a tage (%ld)\n", - tcd->tcd_cur_pages); - return NULL; - } - } - - tage->used = 0; - tage->cpu = smp_processor_id(); - tage->type = tcd->tcd_type; - list_add_tail(&tage->linkage, &tcd->tcd_pages); - tcd->tcd_cur_pages++; - - return tage; - } - - return NULL; -} - -/* return a page that has 'len' bytes left at the end */ -static struct trace_page * -trace_get_tage(struct trace_cpu_data *tcd, unsigned long len) -{ - struct trace_page *tage; - - __ASSERT(len <= PAGE_SIZE); - - tage = trace_get_tage_try(tcd, len); - if (tage) - return tage; - - if (tcd->tcd_cur_pages > 0) { - tage = tage_from_list(tcd->tcd_pages.next); - tage->used = 0; - tage_to_tail(tage, &tcd->tcd_pages); - } - - return tage; -} - -int -spl_debug_msg(void *arg, int subsys, int mask, const char *file, - const char *fn, const int line, const char *format, ...) -{ - spl_debug_limit_state_t *cdls = arg; - struct trace_cpu_data *tcd = NULL; - struct spl_debug_header header = { 0, }; - struct trace_page *tage; - /* string_buf is used only if tcd != NULL, and is always set then */ - char *string_buf = NULL; - char *debug_buf; - int known_size; - int needed = 85; /* average message length */ - int max_nob; - va_list ap; - int i; - - if (subsys == 0) - subsys = SS_DEBUG_SUBSYS; - - if (mask == 0) - mask = SD_EMERG; - - if (strchr(file, '/')) - file = strrchr(file, '/') + 1; - - tcd = trace_get_tcd(); - trace_set_debug_header(&header, subsys, mask, line, 0); - if (tcd == NULL) - goto console; - - if (tcd->tcd_shutting_down) { - trace_put_tcd(tcd); - tcd = NULL; - goto console; - } - - known_size = strlen(file) + 1; - if (fn) - known_size += strlen(fn) + 1; - - if (spl_debug_binary) - known_size += sizeof(header); - - /* '2' used because vsnprintf returns real size required for output - * _without_ terminating NULL. */ - for (i = 0; i < 2; i++) { - tage = trace_get_tage(tcd, needed + known_size + 1); - if (tage == NULL) { - if (needed + known_size > PAGE_SIZE) - mask |= SD_ERROR; - - trace_put_tcd(tcd); - tcd = NULL; - goto console; - } - - string_buf = (char *)page_address(tage->page) + - tage->used + known_size; - - max_nob = PAGE_SIZE - tage->used - known_size; - if (max_nob <= 0) { - printk(KERN_EMERG "negative max_nob: %i\n", max_nob); - mask |= SD_ERROR; - trace_put_tcd(tcd); - tcd = NULL; - goto console; - } - - needed = 0; - if (format) { - va_start(ap, format); - needed += vsnprintf(string_buf, max_nob, format, ap); - va_end(ap); - } - - if (needed < max_nob) - break; - } - - header.ph_len = known_size + needed; - debug_buf = (char *)page_address(tage->page) + tage->used; - - if (spl_debug_binary) { - memcpy(debug_buf, &header, sizeof(header)); - tage->used += sizeof(header); - debug_buf += sizeof(header); - } - - strcpy(debug_buf, file); - tage->used += strlen(file) + 1; - debug_buf += strlen(file) + 1; - - if (fn) { - strcpy(debug_buf, fn); - tage->used += strlen(fn) + 1; - debug_buf += strlen(fn) + 1; - } - - __ASSERT(debug_buf == string_buf); - - tage->used += needed; - __ASSERT (tage->used <= PAGE_SIZE); - -console: - if ((mask & spl_debug_printk) == 0) { - /* no console output requested */ - if (tcd != NULL) - trace_put_tcd(tcd); - return 1; - } - - if (cdls != NULL) { - if (spl_console_ratelimit && cdls->cdls_next != 0 && - !time_before(cdls->cdls_next, jiffies)) { - /* skipping a console message */ - cdls->cdls_count++; - if (tcd != NULL) - trace_put_tcd(tcd); - return 1; - } - - if (time_before(cdls->cdls_next + spl_console_max_delay + - (10 * HZ), jiffies)) { - /* last timeout was a long time ago */ - cdls->cdls_delay /= spl_console_backoff * 4; - } else { - cdls->cdls_delay *= spl_console_backoff; - - if (cdls->cdls_delay < spl_console_min_delay) - cdls->cdls_delay = spl_console_min_delay; - else if (cdls->cdls_delay > spl_console_max_delay) - cdls->cdls_delay = spl_console_max_delay; - } - - /* ensure cdls_next is never zero after it's been seen */ - cdls->cdls_next = (jiffies + cdls->cdls_delay) | 1; - } - - if (tcd != NULL) { - trace_print_to_console(&header, mask, string_buf, needed, file, fn); - trace_put_tcd(tcd); - } else { - string_buf = trace_get_console_buffer(); - - needed = 0; - if (format != NULL) { - va_start(ap, format); - needed += vsnprintf(string_buf, - TRACE_CONSOLE_BUFFER_SIZE, format, ap); - va_end(ap); - } - trace_print_to_console(&header, mask, - string_buf, needed, file, fn); - - trace_put_console_buffer(string_buf); - } - - if (cdls != NULL && cdls->cdls_count != 0) { - string_buf = trace_get_console_buffer(); - - needed = snprintf(string_buf, TRACE_CONSOLE_BUFFER_SIZE, - "Skipped %d previous similar message%s\n", - cdls->cdls_count, (cdls->cdls_count > 1) ? "s" : ""); - - trace_print_to_console(&header, mask, - string_buf, needed, file, fn); - - trace_put_console_buffer(string_buf); - cdls->cdls_count = 0; - } - - return 0; -} -EXPORT_SYMBOL(spl_debug_msg); - -/* Do the collect_pages job on a single CPU: assumes that all other - * CPUs have been stopped during a panic. If this isn't true for - * some arch, this will have to be implemented separately in each arch. - */ -static void -collect_pages_from_single_cpu(struct page_collection *pc) -{ - struct trace_cpu_data *tcd; - int i, j; - - tcd_for_each(tcd, i, j) { - list_splice_init(&tcd->tcd_pages, &pc->pc_pages); - tcd->tcd_cur_pages = 0; - } -} - -static void -collect_pages_on_all_cpus(struct page_collection *pc) -{ - struct trace_cpu_data *tcd; - int i, cpu; - - spin_lock(&pc->pc_lock); - for_each_possible_cpu(cpu) { - tcd_for_each_type_lock(tcd, i, cpu) { - list_splice_init(&tcd->tcd_pages, &pc->pc_pages); - tcd->tcd_cur_pages = 0; - } - } - spin_unlock(&pc->pc_lock); -} - -static void -collect_pages(dumplog_priv_t *dp, struct page_collection *pc) -{ - INIT_LIST_HEAD(&pc->pc_pages); - - if (spl_panic_in_progress || dp->dp_flags & DL_SINGLE_CPU) - collect_pages_from_single_cpu(pc); - else - collect_pages_on_all_cpus(pc); -} - -static void -put_pages_back_on_all_cpus(struct page_collection *pc) -{ - struct trace_cpu_data *tcd; - struct list_head *cur_head; - struct trace_page *tage; - struct trace_page *tmp; - int i, cpu; - - spin_lock(&pc->pc_lock); - - for_each_possible_cpu(cpu) { - tcd_for_each_type_lock(tcd, i, cpu) { - cur_head = tcd->tcd_pages.next; - - list_for_each_entry_safe(tage, tmp, &pc->pc_pages, - linkage) { - if (tage->cpu != cpu || tage->type != i) - continue; - - tage_to_tail(tage, cur_head); - tcd->tcd_cur_pages++; - } - } - } - - spin_unlock(&pc->pc_lock); -} - -static void -put_pages_back(struct page_collection *pc) -{ - if (!spl_panic_in_progress) - put_pages_back_on_all_cpus(pc); -} - -static int -spl_debug_dump_all_pages(dumplog_priv_t *dp, char *filename) -{ - struct page_collection pc; - struct file *filp; - struct trace_page *tage; - struct trace_page *tmp; - mm_segment_t oldfs; - int rc = 0; - - down_write(&trace_sem); - - filp = spl_filp_open(filename, O_CREAT|O_EXCL|O_WRONLY|O_LARGEFILE, - 0600, &rc); - if (filp == NULL) { - if (rc != -EEXIST) - printk(KERN_ERR "SPL: Can't open %s for dump: %d\n", - filename, rc); - goto out; - } - - spin_lock_init(&pc.pc_lock); - collect_pages(dp, &pc); - if (list_empty(&pc.pc_pages)) { - rc = 0; - goto close; - } - - oldfs = get_fs(); - set_fs(get_ds()); - - list_for_each_entry_safe(tage, tmp, &pc.pc_pages, linkage) { - rc = spl_filp_write(filp, page_address(tage->page), - tage->used, spl_filp_poff(filp)); - if (rc != (int)tage->used) { - printk(KERN_WARNING "SPL: Wanted to write %u " - "but wrote %d\n", tage->used, rc); - put_pages_back(&pc); - __ASSERT(list_empty(&pc.pc_pages)); - break; - } - list_del(&tage->linkage); - tage_free(tage); - } - - set_fs(oldfs); - - rc = spl_filp_fsync(filp, 1); - if (rc) - printk(KERN_ERR "SPL: Unable to sync: %d\n", rc); - close: - spl_filp_close(filp); - out: - up_write(&trace_sem); - - return rc; -} - -static void -spl_debug_flush_pages(void) -{ - dumplog_priv_t dp; - struct page_collection pc; - struct trace_page *tage; - struct trace_page *tmp; - - spin_lock_init(&pc.pc_lock); - init_waitqueue_head(&dp.dp_waitq); - dp.dp_pid = current->pid; - dp.dp_flags = 0; - atomic_set(&dp.dp_done, 0); - - collect_pages(&dp, &pc); - list_for_each_entry_safe(tage, tmp, &pc.pc_pages, linkage) { - list_del(&tage->linkage); - tage_free(tage); - } -} - -unsigned long -spl_debug_set_mask(unsigned long mask) { - spl_debug_mask = mask; - return 0; -} -EXPORT_SYMBOL(spl_debug_set_mask); - -unsigned long -spl_debug_get_mask(void) { - return spl_debug_mask; -} -EXPORT_SYMBOL(spl_debug_get_mask); - -unsigned long -spl_debug_set_subsys(unsigned long subsys) { - spl_debug_subsys = subsys; - return 0; -} -EXPORT_SYMBOL(spl_debug_set_subsys); - -unsigned long -spl_debug_get_subsys(void) { - return spl_debug_subsys; -} -EXPORT_SYMBOL(spl_debug_get_subsys); - -int -spl_debug_set_mb(int mb) -{ - int i, j, pages; - int limit = trace_max_debug_mb(); - struct trace_cpu_data *tcd; - - if (mb < num_possible_cpus()) { - printk(KERN_ERR "SPL: Refusing to set debug buffer size to " - "%dMB - lower limit is %d\n", mb, num_possible_cpus()); - return -EINVAL; - } - - if (mb > limit) { - printk(KERN_ERR "SPL: Refusing to set debug buffer size to " - "%dMB - upper limit is %d\n", mb, limit); - return -EINVAL; - } - - mb /= num_possible_cpus(); - pages = mb << (20 - PAGE_SHIFT); - - down_write(&trace_sem); - - tcd_for_each(tcd, i, j) - tcd->tcd_max_pages = (pages * tcd->tcd_pages_factor) / 100; - - up_write(&trace_sem); - - return 0; -} -EXPORT_SYMBOL(spl_debug_set_mb); - -int -spl_debug_get_mb(void) -{ - int i, j; - struct trace_cpu_data *tcd; - int total_pages = 0; - - down_read(&trace_sem); - - tcd_for_each(tcd, i, j) - total_pages += tcd->tcd_max_pages; - - up_read(&trace_sem); - - return (total_pages >> (20 - PAGE_SHIFT)) + 1; -} -EXPORT_SYMBOL(spl_debug_get_mb); - -/* - * Limit the number of stack traces dumped to not more than 5 every - * 60 seconds to prevent denial-of-service attacks from debug code. - */ -DEFINE_RATELIMIT_STATE(dumpstack_ratelimit_state, 60 * HZ, 5); - -void -spl_debug_dumpstack(struct task_struct *tsk) -{ - if (__ratelimit(&dumpstack_ratelimit_state)) { - if (tsk == NULL) - tsk = current; - - printk("SPL: Showing stack for process %d\n", tsk->pid); - dump_stack(); - } -} -EXPORT_SYMBOL(spl_debug_dumpstack); - -void spl_debug_bug(char *file, const char *func, const int line, int flags) -{ - spl_debug_catastrophe = 1; - spl_debug_msg(NULL, 0, SD_EMERG, file, func, line, "SPL PANIC\n"); - - if (in_interrupt()) - panic("SPL PANIC in interrupt.\n"); - - if (in_atomic() || irqs_disabled()) - flags |= DL_NOTHREAD; - - /* Ensure all debug pages and dumped by current cpu */ - if (spl_debug_panic_on_bug) - spl_panic_in_progress = 1; - - spl_debug_dumpstack(NULL); - - if (spl_debug_panic_on_bug) { - spl_debug_dumplog(flags); - panic("SPL PANIC"); - } - - set_task_state(current, TASK_UNINTERRUPTIBLE); - while (1) - schedule(); -} -EXPORT_SYMBOL(spl_debug_bug); - -int -spl_debug_clear_buffer(void) -{ - spl_debug_flush_pages(); - return 0; -} -EXPORT_SYMBOL(spl_debug_clear_buffer); - -int -spl_debug_mark_buffer(char *text) -{ - SDEBUG(SD_WARNING, "*************************************\n"); - SDEBUG(SD_WARNING, "DEBUG MARKER: %s\n", text); - SDEBUG(SD_WARNING, "*************************************\n"); - - return 0; -} -EXPORT_SYMBOL(spl_debug_mark_buffer); - -static int -trace_init(int max_pages) -{ - struct trace_cpu_data *tcd; - int i, j; - - init_rwsem(&trace_sem); - - /* initialize trace_data */ - memset(trace_data, 0, sizeof(trace_data)); - for (i = 0; i < TCD_TYPE_MAX; i++) { - trace_data[i] = kmalloc(sizeof(union trace_data_union) * - NR_CPUS, GFP_KERNEL); - if (trace_data[i] == NULL) - goto out; - } - - tcd_for_each(tcd, i, j) { - spin_lock_init(&tcd->tcd_lock); - tcd->tcd_pages_factor = pages_factor[i]; - tcd->tcd_type = i; - tcd->tcd_cpu = j; - INIT_LIST_HEAD(&tcd->tcd_pages); - INIT_LIST_HEAD(&tcd->tcd_stock_pages); - tcd->tcd_cur_pages = 0; - tcd->tcd_cur_stock_pages = 0; - tcd->tcd_max_pages = (max_pages * pages_factor[i]) / 100; - tcd->tcd_shutting_down = 0; - } - - for (i = 0; i < num_possible_cpus(); i++) { - for (j = 0; j < 3; j++) { - trace_console_buffers[i][j] = - kmalloc(TRACE_CONSOLE_BUFFER_SIZE, - GFP_KERNEL); - - if (trace_console_buffers[i][j] == NULL) - goto out; - } - } - - return 0; -out: - trace_fini(); - printk(KERN_ERR "SPL: Insufficient memory for debug logs\n"); - return -ENOMEM; -} - -int -spl_debug_init(void) -{ - int rc, max = spl_debug_mb; - - spl_console_max_delay = SPL_DEFAULT_MAX_DELAY; - spl_console_min_delay = SPL_DEFAULT_MIN_DELAY; - - /* If spl_debug_mb is set to an invalid value or uninitialized - * then just make the total buffers smp_num_cpus TCD_MAX_PAGES */ - if (max > (totalram_pages >> (20 - 2 - PAGE_SHIFT)) / 5 || - max >= 512 || max < 0) { - max = TCD_MAX_PAGES; - } else { - max = (max / num_online_cpus()) << (20 - PAGE_SHIFT); - } - - rc = trace_init(max); - if (rc) - return rc; - - return rc; -} - -static void -trace_cleanup_on_all_cpus(void) -{ - struct trace_cpu_data *tcd; - struct trace_page *tage; - struct trace_page *tmp; - int i, cpu; - - for_each_possible_cpu(cpu) { - tcd_for_each_type_lock(tcd, i, cpu) { - tcd->tcd_shutting_down = 1; - - list_for_each_entry_safe(tage, tmp, &tcd->tcd_pages, - linkage) { - list_del(&tage->linkage); - tage_free(tage); - } - tcd->tcd_cur_pages = 0; - } - } -} - -static void -trace_fini(void) -{ - int i, j; - - trace_cleanup_on_all_cpus(); - - for (i = 0; i < num_possible_cpus(); i++) { - for (j = 0; j < 3; j++) { - if (trace_console_buffers[i][j] != NULL) { - kfree(trace_console_buffers[i][j]); - trace_console_buffers[i][j] = NULL; - } - } - } - - for (i = 0; i < TCD_TYPE_MAX && trace_data[i] != NULL; i++) { - kfree(trace_data[i]); - trace_data[i] = NULL; - } -} - -void -spl_debug_fini(void) -{ - trace_fini(); -} - -#endif /* DEBUG_LOG */ diff --git a/module/spl/spl-err.c b/module/spl/spl-err.c index 2706f9bd1..14ff8a337 100644 --- a/module/spl/spl-err.c +++ b/module/spl/spl-err.c @@ -26,66 +26,81 @@ #include #include -#include +#include -#ifdef SS_DEBUG_SUBSYS -#undef SS_DEBUG_SUBSYS -#endif +/* + * Limit the number of stack traces dumped to not more than 5 every + * 60 seconds to prevent denial-of-service attacks from debug code. + */ +DEFINE_RATELIMIT_STATE(dumpstack_ratelimit_state, 60 * HZ, 5); -#define SS_DEBUG_SUBSYS SS_GENERIC - -#ifdef DEBUG_LOG -static char ce_prefix[CE_IGNORE][10] = { "", "NOTICE: ", "WARNING: ", "" }; -static char ce_suffix[CE_IGNORE][2] = { "", "\n", "\n", "" }; -#endif +void +spl_dumpstack(void) +{ + if (__ratelimit(&dumpstack_ratelimit_state)) { + printk("Showing stack for process %d\n", current->pid); + dump_stack(); + } +} +EXPORT_SYMBOL(spl_dumpstack); int -spl_PANIC(char *filename, const char *functionname, - int lineno, const char *fmt, ...) { +spl_panic(const char *file, const char *func, int line, const char *fmt, ...) { + const char *newfile; char msg[MAXMSGLEN]; va_list ap; + newfile = strrchr(file, '/'); + if (newfile != NULL) + newfile = newfile + 1; + else + newfile = file; + va_start(ap, fmt); - if (vsnprintf(msg, sizeof (msg), fmt, ap) == sizeof (msg)) - msg[sizeof (msg) - 1] = '\0'; + (void) vsnprintf(msg, sizeof (msg), fmt, ap); va_end(ap); -#ifdef NDEBUG + printk(KERN_EMERG "%s", msg); -#else - spl_debug_msg(NULL, 0, 0, - filename, functionname, lineno, "%s", msg); -#endif - spl_debug_bug(filename, functionname, lineno, 0); - return 1; -} -EXPORT_SYMBOL(spl_PANIC); + printk(KERN_EMERG "PANIC at %s:%d:%s()\n", newfile, line, func); + spl_dumpstack(); -void -vpanic(const char *fmt, va_list ap) -{ - char msg[MAXMSGLEN]; + /* Halt the thread to facilitate further debugging */ + set_task_state(current, TASK_UNINTERRUPTIBLE); + while (1) + schedule(); - vsnprintf(msg, MAXMSGLEN - 1, fmt, ap); - PANIC("%s", msg); -} /* vpanic() */ -EXPORT_SYMBOL(vpanic); + /* Unreachable */ + return (1); +} +EXPORT_SYMBOL(spl_panic); void vcmn_err(int ce, const char *fmt, va_list ap) { char msg[MAXMSGLEN]; - if (ce == CE_PANIC) - vpanic(fmt, ap); + vsnprintf(msg, MAXMSGLEN - 1, fmt, ap); - if (ce != CE_NOTE) { - vsnprintf(msg, MAXMSGLEN - 1, fmt, ap); + switch (ce) { + case CE_IGNORE: + break; + case CE_CONT: + printk("%s", msg); + break; + case CE_NOTE: + printk(KERN_NOTICE "NOTICE: %s\n", msg); + break; + case CE_WARN: + printk(KERN_WARNING "WARNING: %s\n", msg); + break; + case CE_PANIC: + printk(KERN_EMERG "PANIC: %s\n", msg); + spl_dumpstack(); - if (fmt[0] == '!') - SDEBUG(SD_INFO, "%s%s%s", - ce_prefix[ce], msg, ce_suffix[ce]); - else - SERROR("%s%s%s", ce_prefix[ce], msg, ce_suffix[ce]); + /* Halt the thread to facilitate further debugging */ + set_task_state(current, TASK_UNINTERRUPTIBLE); + while (1) + schedule(); } } /* vcmn_err() */ EXPORT_SYMBOL(vcmn_err); @@ -100,4 +115,3 @@ cmn_err(int ce, const char *fmt, ...) va_end(ap); } /* cmn_err() */ EXPORT_SYMBOL(cmn_err); - diff --git a/module/spl/spl-generic.c b/module/spl/spl-generic.c index fd68789bc..ecfb663de 100644 --- a/module/spl/spl-generic.c +++ b/module/spl/spl-generic.c @@ -40,13 +40,6 @@ #include #include #include -#include - -#ifdef SS_DEBUG_SUBSYS -#undef SS_DEBUG_SUBSYS -#endif - -#define SS_DEBUG_SUBSYS SS_GENERIC char spl_version[32] = "SPL v" SPL_META_VERSION "-" SPL_META_RELEASE; EXPORT_SYMBOL(spl_version); @@ -490,39 +483,36 @@ __init spl_init(void) { int rc = 0; - if ((rc = spl_debug_init())) - return rc; - if ((rc = spl_kmem_init())) - SGOTO(out1, rc); + goto out1; if ((rc = spl_mutex_init())) - SGOTO(out2, rc); + goto out2; if ((rc = spl_rw_init())) - SGOTO(out3, rc); + goto out3; if ((rc = spl_taskq_init())) - SGOTO(out4, rc); + goto out4; if ((rc = spl_vn_init())) - SGOTO(out5, rc); + goto out5; if ((rc = spl_proc_init())) - SGOTO(out6, rc); + goto out6; if ((rc = spl_kstat_init())) - SGOTO(out7, rc); + goto out7; if ((rc = spl_tsd_init())) - SGOTO(out8, rc); + goto out8; if ((rc = spl_zlib_init())) - SGOTO(out9, rc); + goto out9; printk(KERN_NOTICE "SPL: Loaded module v%s-%s%s\n", SPL_META_VERSION, SPL_META_RELEASE, SPL_DEBUG_STR); - SRETURN(rc); + return (rc); out9: spl_tsd_fini(); @@ -541,19 +531,16 @@ out3: out2: spl_kmem_fini(); out1: - spl_debug_fini(); - printk(KERN_NOTICE "SPL: Failed to Load Solaris Porting Layer " "v%s-%s%s, rc = %d\n", SPL_META_VERSION, SPL_META_RELEASE, SPL_DEBUG_STR, rc); + return rc; } static void spl_fini(void) { - SENTRY; - printk(KERN_NOTICE "SPL: Unloaded module v%s-%s%s\n", SPL_META_VERSION, SPL_META_RELEASE, SPL_DEBUG_STR); spl_zlib_fini(); @@ -565,7 +552,6 @@ spl_fini(void) spl_rw_fini(); spl_mutex_fini(); spl_kmem_fini(); - spl_debug_fini(); } /* Called when a dependent module is loaded */ diff --git a/module/spl/spl-kmem.c b/module/spl/spl-kmem.c index 65aa27739..37849f504 100644 --- a/module/spl/spl-kmem.c +++ b/module/spl/spl-kmem.c @@ -25,13 +25,6 @@ \*****************************************************************************/ #include -#include - -#ifdef SS_DEBUG_SUBSYS -#undef SS_DEBUG_SUBSYS -#endif - -#define SS_DEBUG_SUBSYS SS_KMEM /* * Within the scope of spl-kmem.c file the kmem_cache_* definitions @@ -265,7 +258,6 @@ kmem_del_init(spinlock_t *lock, struct hlist_head *table, int bits, const void * struct hlist_node *node; struct kmem_debug *p; unsigned long flags; - SENTRY; spin_lock_irqsave(lock, flags); @@ -282,7 +274,7 @@ kmem_del_init(spinlock_t *lock, struct hlist_head *table, int bits, const void * spin_unlock_irqrestore(lock, flags); - SRETURN(NULL); + return (NULL); } void * @@ -292,28 +284,26 @@ kmem_alloc_track(size_t size, int flags, const char *func, int line, void *ptr = NULL; kmem_debug_t *dptr; unsigned long irq_flags; - SENTRY; /* Function may be called with KM_NOSLEEP so failure is possible */ dptr = (kmem_debug_t *) kmalloc_nofail(sizeof(kmem_debug_t), flags & ~__GFP_ZERO); if (unlikely(dptr == NULL)) { - SDEBUG_LIMIT(SD_CONSOLE | SD_WARNING, "debug " - "kmem_alloc(%ld, 0x%x) at %s:%d failed (%lld/%llu)\n", - sizeof(kmem_debug_t), flags, func, line, - kmem_alloc_used_read(), kmem_alloc_max); + printk(KERN_WARNING "debug kmem_alloc(%ld, 0x%x) at %s:%d " + "failed (%lld/%llu)\n", sizeof(kmem_debug_t), flags, + func, line, kmem_alloc_used_read(), kmem_alloc_max); } else { /* * Marked unlikely because we should never be doing this, * we tolerate to up 2 pages but a single page is best. */ if (unlikely((size > PAGE_SIZE*2) && !(flags & KM_NODEBUG))) { - SDEBUG_LIMIT(SD_CONSOLE | SD_WARNING, "large " - "kmem_alloc(%llu, 0x%x) at %s:%d (%lld/%llu)\n", - (unsigned long long) size, flags, func, line, + printk(KERN_WARNING "large kmem_alloc(%llu, 0x%x) " + "at %s:%d failed (%lld/%llu)\n", + (unsigned long long)size, flags, func, line, kmem_alloc_used_read(), kmem_alloc_max); - spl_debug_dumpstack(NULL); + spl_dumpstack(); } /* @@ -325,9 +315,9 @@ kmem_alloc_track(size_t size, int flags, const char *func, int line, dptr->kd_func = __strdup(func, flags & ~__GFP_ZERO); if (unlikely(dptr->kd_func == NULL)) { kfree(dptr); - SDEBUG_LIMIT(SD_CONSOLE | SD_WARNING, - "debug __strdup() at %s:%d failed (%lld/%llu)\n", - func, line, kmem_alloc_used_read(), kmem_alloc_max); + printk(KERN_WARNING "debug __strdup() at %s:%d " + "failed (%lld/%llu)\n", func, line, + kmem_alloc_used_read(), kmem_alloc_max); goto out; } @@ -344,8 +334,8 @@ kmem_alloc_track(size_t size, int flags, const char *func, int line, if (unlikely(ptr == NULL)) { kfree(dptr->kd_func); kfree(dptr); - SDEBUG_LIMIT(SD_CONSOLE | SD_WARNING, "kmem_alloc" - "(%llu, 0x%x) at %s:%d failed (%lld/%llu)\n", + printk(KERN_WARNING "kmem_alloc(%llu, 0x%x) " + "at %s:%d failed (%lld/%llu)\n", (unsigned long long) size, flags, func, line, kmem_alloc_used_read(), kmem_alloc_max); goto out; @@ -367,14 +357,9 @@ kmem_alloc_track(size_t size, int flags, const char *func, int line, &kmem_table[hash_ptr(ptr, KMEM_HASH_BITS)]); list_add_tail(&dptr->kd_list, &kmem_list); spin_unlock_irqrestore(&kmem_lock, irq_flags); - - SDEBUG_LIMIT(SD_INFO, - "kmem_alloc(%llu, 0x%x) at %s:%d = %p (%lld/%llu)\n", - (unsigned long long) size, flags, func, line, ptr, - kmem_alloc_used_read(), kmem_alloc_max); } out: - SRETURN(ptr); + return (ptr); } EXPORT_SYMBOL(kmem_alloc_track); @@ -382,14 +367,12 @@ void kmem_free_track(const void *ptr, size_t size) { kmem_debug_t *dptr; - SENTRY; ASSERTF(ptr || size > 0, "ptr: %p, size: %llu", ptr, (unsigned long long) size); - dptr = kmem_del_init(&kmem_lock, kmem_table, KMEM_HASH_BITS, ptr); - /* Must exist in hash due to kmem_alloc() */ + dptr = kmem_del_init(&kmem_lock, kmem_table, KMEM_HASH_BITS, ptr); ASSERT(dptr); /* Size must match */ @@ -398,10 +381,6 @@ kmem_free_track(const void *ptr, size_t size) (unsigned long long) size, dptr->kd_func, dptr->kd_line); kmem_alloc_used_sub(size); - SDEBUG_LIMIT(SD_INFO, "kmem_free(%p, %llu) (%lld/%llu)\n", ptr, - (unsigned long long) size, kmem_alloc_used_read(), - kmem_alloc_max); - kfree(dptr->kd_func); memset((void *)dptr, 0x5a, sizeof(kmem_debug_t)); @@ -409,8 +388,6 @@ kmem_free_track(const void *ptr, size_t size) memset((void *)ptr, 0x5a, size); kfree(ptr); - - SEXIT; } EXPORT_SYMBOL(kmem_free_track); @@ -420,7 +397,6 @@ vmem_alloc_track(size_t size, int flags, const char *func, int line) void *ptr = NULL; kmem_debug_t *dptr; unsigned long irq_flags; - SENTRY; ASSERT(flags & KM_SLEEP); @@ -428,8 +404,8 @@ vmem_alloc_track(size_t size, int flags, const char *func, int line) dptr = (kmem_debug_t *) kmalloc_nofail(sizeof(kmem_debug_t), flags & ~__GFP_ZERO); if (unlikely(dptr == NULL)) { - SDEBUG_LIMIT(SD_CONSOLE | SD_WARNING, "debug " - "vmem_alloc(%ld, 0x%x) at %s:%d failed (%lld/%llu)\n", + printk(KERN_WARNING "debug vmem_alloc(%ld, 0x%x) " + "at %s:%d failed (%lld/%llu)\n", sizeof(kmem_debug_t), flags, func, line, vmem_alloc_used_read(), vmem_alloc_max); } else { @@ -443,9 +419,9 @@ vmem_alloc_track(size_t size, int flags, const char *func, int line) dptr->kd_func = __strdup(func, flags & ~__GFP_ZERO); if (unlikely(dptr->kd_func == NULL)) { kfree(dptr); - SDEBUG_LIMIT(SD_CONSOLE | SD_WARNING, - "debug __strdup() at %s:%d failed (%lld/%llu)\n", - func, line, vmem_alloc_used_read(), vmem_alloc_max); + printk(KERN_WARNING "debug __strdup() at %s:%d " + "failed (%lld/%llu)\n", func, line, + vmem_alloc_used_read(), vmem_alloc_max); goto out; } @@ -459,8 +435,8 @@ vmem_alloc_track(size_t size, int flags, const char *func, int line) if (unlikely(ptr == NULL)) { kfree(dptr->kd_func); kfree(dptr); - SDEBUG_LIMIT(SD_CONSOLE | SD_WARNING, "vmem_alloc" - "(%llu, 0x%x) at %s:%d failed (%lld/%llu)\n", + printk(KERN_WARNING "vmem_alloc (%llu, 0x%x) " + "at %s:%d failed (%lld/%llu)\n", (unsigned long long) size, flags, func, line, vmem_alloc_used_read(), vmem_alloc_max); goto out; @@ -482,14 +458,9 @@ vmem_alloc_track(size_t size, int flags, const char *func, int line) &vmem_table[hash_ptr(ptr, VMEM_HASH_BITS)]); list_add_tail(&dptr->kd_list, &vmem_list); spin_unlock_irqrestore(&vmem_lock, irq_flags); - - SDEBUG_LIMIT(SD_INFO, - "vmem_alloc(%llu, 0x%x) at %s:%d = %p (%lld/%llu)\n", - (unsigned long long) size, flags, func, line, - ptr, vmem_alloc_used_read(), vmem_alloc_max); } out: - SRETURN(ptr); + return (ptr); } EXPORT_SYMBOL(vmem_alloc_track); @@ -497,14 +468,12 @@ void vmem_free_track(const void *ptr, size_t size) { kmem_debug_t *dptr; - SENTRY; ASSERTF(ptr || size > 0, "ptr: %p, size: %llu", ptr, (unsigned long long) size); - dptr = kmem_del_init(&vmem_lock, vmem_table, VMEM_HASH_BITS, ptr); - /* Must exist in hash due to vmem_alloc() */ + dptr = kmem_del_init(&vmem_lock, vmem_table, VMEM_HASH_BITS, ptr); ASSERT(dptr); /* Size must match */ @@ -513,10 +482,6 @@ vmem_free_track(const void *ptr, size_t size) (unsigned long long) size, dptr->kd_func, dptr->kd_line); vmem_alloc_used_sub(size); - SDEBUG_LIMIT(SD_INFO, "vmem_free(%p, %llu) (%lld/%llu)\n", ptr, - (unsigned long long) size, vmem_alloc_used_read(), - vmem_alloc_max); - kfree(dptr->kd_func); memset((void *)dptr, 0x5a, sizeof(kmem_debug_t)); @@ -524,8 +489,6 @@ vmem_free_track(const void *ptr, size_t size) memset((void *)ptr, 0x5a, size); vfree(ptr); - - SEXIT; } EXPORT_SYMBOL(vmem_free_track); @@ -536,18 +499,17 @@ kmem_alloc_debug(size_t size, int flags, const char *func, int line, int node_alloc, int node) { void *ptr; - SENTRY; /* * Marked unlikely because we should never be doing this, * we tolerate to up 2 pages but a single page is best. */ if (unlikely((size > PAGE_SIZE * 2) && !(flags & KM_NODEBUG))) { - SDEBUG(SD_CONSOLE | SD_WARNING, + printk(KERN_WARNING "large kmem_alloc(%llu, 0x%x) at %s:%d (%lld/%llu)\n", - (unsigned long long) size, flags, func, line, - kmem_alloc_used_read(), kmem_alloc_max); - spl_debug_dumpstack(NULL); + (unsigned long long)size, flags, func, line, + (unsigned long long)kmem_alloc_used_read(), kmem_alloc_max); + spl_dumpstack(); } /* Use the correct allocator */ @@ -561,40 +523,26 @@ kmem_alloc_debug(size_t size, int flags, const char *func, int line, } if (unlikely(ptr == NULL)) { - SDEBUG_LIMIT(SD_CONSOLE | SD_WARNING, + printk(KERN_WARNING "kmem_alloc(%llu, 0x%x) at %s:%d failed (%lld/%llu)\n", - (unsigned long long) size, flags, func, line, - kmem_alloc_used_read(), kmem_alloc_max); + (unsigned long long)size, flags, func, line, + (unsigned long long)kmem_alloc_used_read(), kmem_alloc_max); } else { kmem_alloc_used_add(size); if (unlikely(kmem_alloc_used_read() > kmem_alloc_max)) kmem_alloc_max = kmem_alloc_used_read(); - - SDEBUG_LIMIT(SD_INFO, - "kmem_alloc(%llu, 0x%x) at %s:%d = %p (%lld/%llu)\n", - (unsigned long long) size, flags, func, line, ptr, - kmem_alloc_used_read(), kmem_alloc_max); } - SRETURN(ptr); + return (ptr); } EXPORT_SYMBOL(kmem_alloc_debug); void kmem_free_debug(const void *ptr, size_t size) { - SENTRY; - - ASSERTF(ptr || size > 0, "ptr: %p, size: %llu", ptr, - (unsigned long long) size); - + ASSERT(ptr || size > 0); kmem_alloc_used_sub(size); - SDEBUG_LIMIT(SD_INFO, "kmem_free(%p, %llu) (%lld/%llu)\n", ptr, - (unsigned long long) size, kmem_alloc_used_read(), - kmem_alloc_max); kfree(ptr); - - SEXIT; } EXPORT_SYMBOL(kmem_free_debug); @@ -602,7 +550,6 @@ void * vmem_alloc_debug(size_t size, int flags, const char *func, int line) { void *ptr; - SENTRY; ASSERT(flags & KM_SLEEP); @@ -614,39 +561,26 @@ vmem_alloc_debug(size_t size, int flags, const char *func, int line) } if (unlikely(ptr == NULL)) { - SDEBUG_LIMIT(SD_CONSOLE | SD_WARNING, + printk(KERN_WARNING "vmem_alloc(%llu, 0x%x) at %s:%d failed (%lld/%llu)\n", - (unsigned long long) size, flags, func, line, - vmem_alloc_used_read(), vmem_alloc_max); + (unsigned long long)size, flags, func, line, + (unsigned long long)vmem_alloc_used_read(), vmem_alloc_max); } else { vmem_alloc_used_add(size); if (unlikely(vmem_alloc_used_read() > vmem_alloc_max)) vmem_alloc_max = vmem_alloc_used_read(); - - SDEBUG_LIMIT(SD_INFO, "vmem_alloc(%llu, 0x%x) = %p " - "(%lld/%llu)\n", (unsigned long long) size, flags, ptr, - vmem_alloc_used_read(), vmem_alloc_max); } - SRETURN(ptr); + return (ptr); } EXPORT_SYMBOL(vmem_alloc_debug); void vmem_free_debug(const void *ptr, size_t size) { - SENTRY; - - ASSERTF(ptr || size > 0, "ptr: %p, size: %llu", ptr, - (unsigned long long) size); - + ASSERT(ptr || size > 0); vmem_alloc_used_sub(size); - SDEBUG_LIMIT(SD_INFO, "vmem_free(%p, %llu) (%lld/%llu)\n", ptr, - (unsigned long long) size, vmem_alloc_used_read(), - vmem_alloc_max); vfree(ptr); - - SEXIT; } EXPORT_SYMBOL(vmem_free_debug); @@ -833,7 +767,7 @@ spl_slab_alloc(spl_kmem_cache_t *skc, int flags) base = kv_alloc(skc, skc->skc_slab_size, flags); if (base == NULL) - SRETURN(NULL); + return (NULL); sks = (spl_kmem_slab_t *)base; sks->sks_magic = SKS_MAGIC; @@ -851,8 +785,10 @@ spl_slab_alloc(spl_kmem_cache_t *skc, int flags) for (i = 0; i < sks->sks_objs; i++) { if (skc->skc_flags & KMC_OFFSLAB) { obj = kv_alloc(skc, offslab_size, flags); - if (!obj) - SGOTO(out, rc = -ENOMEM); + if (!obj) { + rc = -ENOMEM; + goto out; + } } else { obj = base + spl_sks_size(skc) + (i * obj_size); } @@ -877,7 +813,7 @@ out: sks = NULL; } - SRETURN(sks); + return (sks); } /* @@ -890,7 +826,6 @@ spl_slab_free(spl_kmem_slab_t *sks, struct list_head *sks_list, struct list_head *sko_list) { spl_kmem_cache_t *skc; - SENTRY; ASSERT(sks->sks_magic == SKS_MAGIC); ASSERT(sks->sks_ref == 0); @@ -910,8 +845,6 @@ spl_slab_free(spl_kmem_slab_t *sks, list_del(&sks->sks_list); list_add(&sks->sks_list, sks_list); list_splice_init(&sks->sks_free_list, sko_list); - - SEXIT; } /* @@ -931,7 +864,6 @@ spl_slab_reclaim(spl_kmem_cache_t *skc, int count, int flag) LIST_HEAD(sko_list); uint32_t size = 0; int i = 0; - SENTRY; /* * Move empty slabs and objects which have not been touched in @@ -979,8 +911,6 @@ spl_slab_reclaim(spl_kmem_cache_t *skc, int count, int flag) ASSERT(sks->sks_magic == SKS_MAGIC); kv_free(skc, sks, skc->skc_slab_size); } - - SEXIT; } static spl_kmem_emergency_t * @@ -1037,23 +967,22 @@ spl_emergency_alloc(spl_kmem_cache_t *skc, int flags, void **obj) { spl_kmem_emergency_t *ske; int empty; - SENTRY; /* Last chance use a partial slab if one now exists */ spin_lock(&skc->skc_lock); empty = list_empty(&skc->skc_partial_list); spin_unlock(&skc->skc_lock); if (!empty) - SRETURN(-EEXIST); + return (-EEXIST); ske = kmalloc(sizeof(*ske), flags); if (ske == NULL) - SRETURN(-ENOMEM); + return (-ENOMEM); ske->ske_obj = kmalloc(skc->skc_obj_size, flags); if (ske->ske_obj == NULL) { kfree(ske); - SRETURN(-ENOMEM); + return (-ENOMEM); } spin_lock(&skc->skc_lock); @@ -1069,12 +998,12 @@ spl_emergency_alloc(spl_kmem_cache_t *skc, int flags, void **obj) if (unlikely(!empty)) { kfree(ske->ske_obj); kfree(ske); - SRETURN(-EINVAL); + return (-EINVAL); } *obj = ske->ske_obj; - SRETURN(0); + return (0); } /* @@ -1084,7 +1013,6 @@ static int spl_emergency_free(spl_kmem_cache_t *skc, void *obj) { spl_kmem_emergency_t *ske; - SENTRY; spin_lock(&skc->skc_lock); ske = spl_emergency_search(&skc->skc_emergency_tree, obj); @@ -1096,12 +1024,12 @@ spl_emergency_free(spl_kmem_cache_t *skc, void *obj) spin_unlock(&skc->skc_lock); if (unlikely(ske == NULL)) - SRETURN(-ENOENT); + return (-ENOENT); kfree(ske->ske_obj); kfree(ske); - SRETURN(0); + return (0); } /* @@ -1112,7 +1040,6 @@ static void __spl_cache_flush(spl_kmem_cache_t *skc, spl_kmem_magazine_t *skm, int flush) { int i, count = MIN(flush, skm->skm_avail); - SENTRY; ASSERT(skc->skc_magic == SKC_MAGIC); ASSERT(skm->skm_magic == SKM_MAGIC); @@ -1124,8 +1051,6 @@ __spl_cache_flush(spl_kmem_cache_t *skc, spl_kmem_magazine_t *skm, int flush) skm->skm_avail -= count; memmove(skm->skm_objs, &(skm->skm_objs[count]), sizeof(void *) * skm->skm_avail); - - SEXIT; } static void @@ -1227,7 +1152,7 @@ spl_slab_size(spl_kmem_cache_t *skc, uint32_t *objs, uint32_t *size) if (skc->skc_flags & KMC_OFFSLAB) { *objs = spl_kmem_cache_obj_per_slab; *size = P2ROUNDUP(sizeof(spl_kmem_slab_t), PAGE_SIZE); - SRETURN(0); + return (0); } else { sks_size = spl_sks_size(skc); obj_size = spl_obj_size(skc); @@ -1241,7 +1166,7 @@ spl_slab_size(spl_kmem_cache_t *skc, uint32_t *objs, uint32_t *size) for (*size = PAGE_SIZE; *size <= max_size; *size *= 2) { *objs = (*size - sks_size) / obj_size; if (*objs >= spl_kmem_cache_obj_per_slab) - SRETURN(0); + return (0); } /* @@ -1252,10 +1177,10 @@ spl_slab_size(spl_kmem_cache_t *skc, uint32_t *objs, uint32_t *size) *size = max_size; *objs = (*size - sks_size) / obj_size; if (*objs >= (spl_kmem_cache_obj_per_slab_min)) - SRETURN(0); + return (0); } - SRETURN(-ENOSPC); + return (-ENOSPC); } /* @@ -1268,7 +1193,6 @@ spl_magazine_size(spl_kmem_cache_t *skc) { uint32_t obj_size = spl_obj_size(skc); int size; - SENTRY; /* Per-magazine sizes below assume a 4Kib page size */ if (obj_size > (PAGE_SIZE * 256)) @@ -1282,7 +1206,7 @@ spl_magazine_size(spl_kmem_cache_t *skc) else size = 256; - SRETURN(size); + return (size); } /* @@ -1294,7 +1218,6 @@ spl_magazine_alloc(spl_kmem_cache_t *skc, int cpu) spl_kmem_magazine_t *skm; int size = sizeof(spl_kmem_magazine_t) + sizeof(void *) * skc->skc_mag_size; - SENTRY; skm = kmem_alloc_node(size, KM_SLEEP, cpu_to_node(cpu)); if (skm) { @@ -1307,7 +1230,7 @@ spl_magazine_alloc(spl_kmem_cache_t *skc, int cpu) skm->skm_cpu = cpu; } - SRETURN(skm); + return (skm); } /* @@ -1319,12 +1242,10 @@ spl_magazine_free(spl_kmem_magazine_t *skm) int size = sizeof(spl_kmem_magazine_t) + sizeof(void *) * skm->skm_size; - SENTRY; ASSERT(skm->skm_magic == SKM_MAGIC); ASSERT(skm->skm_avail == 0); kmem_free(skm, size); - SEXIT; } /* @@ -1334,10 +1255,9 @@ static int spl_magazine_create(spl_kmem_cache_t *skc) { int i; - SENTRY; if (skc->skc_flags & KMC_NOMAGAZINE) - SRETURN(0); + return (0); skc->skc_mag_size = spl_magazine_size(skc); skc->skc_mag_refill = (skc->skc_mag_size + 1) / 2; @@ -1348,11 +1268,11 @@ spl_magazine_create(spl_kmem_cache_t *skc) for (i--; i >= 0; i--) spl_magazine_free(skc->skc_mag[i]); - SRETURN(-ENOMEM); + return (-ENOMEM); } } - SRETURN(0); + return (0); } /* @@ -1363,20 +1283,15 @@ spl_magazine_destroy(spl_kmem_cache_t *skc) { spl_kmem_magazine_t *skm; int i; - SENTRY; - if (skc->skc_flags & KMC_NOMAGAZINE) { - SEXIT; + if (skc->skc_flags & KMC_NOMAGAZINE) return; - } for_each_online_cpu(i) { skm = skc->skc_mag[i]; spl_cache_flush(skc, skm, skm->skm_avail); spl_magazine_free(skm); } - - SEXIT; } /* @@ -1409,11 +1324,13 @@ spl_kmem_cache_create(char *name, size_t size, size_t align, { spl_kmem_cache_t *skc; int rc; - SENTRY; - ASSERTF(!(flags & KMC_NOMAGAZINE), "Bad KMC_NOMAGAZINE (%x)\n", flags); - ASSERTF(!(flags & KMC_NOHASH), "Bad KMC_NOHASH (%x)\n", flags); - ASSERTF(!(flags & KMC_QCACHE), "Bad KMC_QCACHE (%x)\n", flags); + /* + * Unsupported flags + */ + ASSERT0(flags & KMC_NOMAGAZINE); + ASSERT0(flags & KMC_NOHASH); + ASSERT0(flags & KMC_QCACHE); ASSERT(vmp == NULL); might_sleep(); @@ -1427,14 +1344,14 @@ spl_kmem_cache_create(char *name, size_t size, size_t align, */ skc = kmem_zalloc(sizeof(*skc), KM_SLEEP| KM_NODEBUG); if (skc == NULL) - SRETURN(NULL); + return (NULL); skc->skc_magic = SKC_MAGIC; skc->skc_name_size = strlen(name) + 1; skc->skc_name = (char *)kmem_alloc(skc->skc_name_size, KM_SLEEP); if (skc->skc_name == NULL) { kmem_free(skc, sizeof(*skc)); - SRETURN(NULL); + return (NULL); } strncpy(skc->skc_name, name, skc->skc_name_size); @@ -1519,16 +1436,18 @@ spl_kmem_cache_create(char *name, size_t size, size_t align, rc = spl_slab_size(skc, &skc->skc_slab_objs, &skc->skc_slab_size); if (rc) - SGOTO(out, rc); + goto out; rc = spl_magazine_create(skc); if (rc) - SGOTO(out, rc); + goto out; } else { skc->skc_linux_cache = kmem_cache_create( skc->skc_name, size, align, 0, NULL); - if (skc->skc_linux_cache == NULL) - SGOTO(out, rc = ENOMEM); + if (skc->skc_linux_cache == NULL) { + rc = ENOMEM; + goto out; + } kmem_cache_set_allocflags(skc, __GFP_COMP); skc->skc_flags |= KMC_NOMAGAZINE; @@ -1543,11 +1462,11 @@ spl_kmem_cache_create(char *name, size_t size, size_t align, list_add_tail(&skc->skc_list, &spl_kmem_cache_list); up_write(&spl_kmem_cache_sem); - SRETURN(skc); + return (skc); out: kmem_free(skc->skc_name, skc->skc_name_size); kmem_free(skc, sizeof(*skc)); - SRETURN(NULL); + return (NULL); } EXPORT_SYMBOL(spl_kmem_cache_create); @@ -1571,7 +1490,6 @@ spl_kmem_cache_destroy(spl_kmem_cache_t *skc) { DECLARE_WAIT_QUEUE_HEAD(wq); taskqid_t id; - SENTRY; ASSERT(skc->skc_magic == SKC_MAGIC); ASSERT(skc->skc_flags & (KMC_KMEM | KMC_VMEM | KMC_SLAB)); @@ -1617,8 +1535,6 @@ spl_kmem_cache_destroy(spl_kmem_cache_t *skc) spin_unlock(&skc->skc_lock); kmem_free(skc, sizeof(*skc)); - - SEXIT; } EXPORT_SYMBOL(spl_kmem_cache_destroy); @@ -1708,7 +1624,6 @@ static int spl_cache_grow(spl_kmem_cache_t *skc, int flags, void **obj) { int remaining, rc; - SENTRY; ASSERT(skc->skc_magic == SKC_MAGIC); ASSERT((skc->skc_flags & KMC_SLAB) == 0); @@ -1722,7 +1637,7 @@ spl_cache_grow(spl_kmem_cache_t *skc, int flags, void **obj) if (test_bit(KMC_BIT_REAPING, &skc->skc_flags)) { rc = spl_wait_on_bit(&skc->skc_flags, KMC_BIT_REAPING, TASK_UNINTERRUPTIBLE); - SRETURN(rc ? rc : -EAGAIN); + return (rc ? rc : -EAGAIN); } /* @@ -1738,7 +1653,7 @@ spl_cache_grow(spl_kmem_cache_t *skc, int flags, void **obj) if (ska == NULL) { clear_bit(KMC_BIT_GROWING, &skc->skc_flags); wake_up_all(&skc->skc_waitq); - SRETURN(-ENOMEM); + return (-ENOMEM); } atomic_inc(&skc->skc_ref); @@ -1776,7 +1691,7 @@ spl_cache_grow(spl_kmem_cache_t *skc, int flags, void **obj) rc = -ENOMEM; } - SRETURN(rc); + return (rc); } /* @@ -1792,7 +1707,6 @@ spl_cache_refill(spl_kmem_cache_t *skc, spl_kmem_magazine_t *skm, int flags) spl_kmem_slab_t *sks; int count = 0, rc, refill; void *obj = NULL; - SENTRY; ASSERT(skc->skc_magic == SKC_MAGIC); ASSERT(skm->skm_magic == SKM_MAGIC); @@ -1811,14 +1725,14 @@ spl_cache_refill(spl_kmem_cache_t *skc, spl_kmem_magazine_t *skm, int flags) /* Emergency object for immediate use by caller */ if (rc == 0 && obj != NULL) - SRETURN(obj); + return (obj); if (rc) - SGOTO(out, rc); + goto out; /* Rescheduled to different CPU skm is not local */ if (skm != skc->skc_mag[smp_processor_id()]) - SGOTO(out, rc); + goto out; /* Potentially rescheduled to the same CPU but * allocations may have occurred from this CPU while @@ -1853,7 +1767,7 @@ spl_cache_refill(spl_kmem_cache_t *skc, spl_kmem_magazine_t *skm, int flags) spin_unlock(&skc->skc_lock); out: - SRETURN(NULL); + return (NULL); } /* @@ -1864,7 +1778,6 @@ spl_cache_shrink(spl_kmem_cache_t *skc, void *obj) { spl_kmem_slab_t *sks = NULL; spl_kmem_obj_t *sko = NULL; - SENTRY; ASSERT(skc->skc_magic == SKC_MAGIC); ASSERT(spin_is_locked(&skc->skc_lock)); @@ -1895,8 +1808,6 @@ spl_cache_shrink(spl_kmem_cache_t *skc, void *obj) list_add_tail(&sks->sks_list, &skc->skc_partial_list); skc->skc_slab_alloc--; } - - SEXIT; } /* @@ -1908,7 +1819,6 @@ spl_kmem_cache_alloc(spl_kmem_cache_t *skc, int flags) { spl_kmem_magazine_t *skm; void *obj = NULL; - SENTRY; ASSERT(skc->skc_magic == SKC_MAGIC); ASSERT(!test_bit(KMC_BIT_DESTROY, &skc->skc_flags)); @@ -1939,9 +1849,7 @@ restart: * the local magazine since this may have changed * when we need to grow the cache. */ skm = skc->skc_mag[smp_processor_id()]; - ASSERTF(skm->skm_magic == SKM_MAGIC, "%x != %x: %s/%p/%p %x/%x/%x\n", - skm->skm_magic, SKM_MAGIC, skc->skc_name, skc, skm, - skm->skm_size, skm->skm_refill, skm->skm_avail); + ASSERT(skm->skm_magic == SKM_MAGIC); if (likely(skm->skm_avail)) { /* Object available in CPU cache, use it */ @@ -1950,7 +1858,7 @@ restart: } else { obj = spl_cache_refill(skc, skm, flags); if (obj == NULL) - SGOTO(restart, obj = NULL); + goto restart; } local_irq_enable(); @@ -1968,7 +1876,7 @@ ret: atomic_dec(&skc->skc_ref); - SRETURN(obj); + return (obj); } EXPORT_SYMBOL(spl_kmem_cache_alloc); @@ -1984,7 +1892,6 @@ spl_kmem_cache_free(spl_kmem_cache_t *skc, void *obj) { spl_kmem_magazine_t *skm; unsigned long flags; - SENTRY; ASSERT(skc->skc_magic == SKC_MAGIC); ASSERT(!test_bit(KMC_BIT_DESTROY, &skc->skc_flags)); @@ -2009,8 +1916,10 @@ spl_kmem_cache_free(spl_kmem_cache_t *skc, void *obj) * are guaranteed to have physical addresses. They must be removed * from the tree of emergency objects and the freed. */ - if ((skc->skc_flags & KMC_VMEM) && !kmem_virt(obj)) - SGOTO(out, spl_emergency_free(skc, obj)); + if ((skc->skc_flags & KMC_VMEM) && !kmem_virt(obj)) { + spl_emergency_free(skc, obj); + goto out; + } local_irq_save(flags); @@ -2031,8 +1940,6 @@ spl_kmem_cache_free(spl_kmem_cache_t *skc, void *obj) local_irq_restore(flags); out: atomic_dec(&skc->skc_ref); - - SEXIT; } EXPORT_SYMBOL(spl_kmem_cache_free); @@ -2113,8 +2020,6 @@ SPL_SHRINKER_CALLBACK_WRAPPER(spl_kmem_cache_generic_shrinker); void spl_kmem_cache_reap_now(spl_kmem_cache_t *skc, int count) { - SENTRY; - ASSERT(skc->skc_magic == SKC_MAGIC); ASSERT(!test_bit(KMC_BIT_DESTROY, &skc->skc_flags)); @@ -2131,14 +2036,14 @@ spl_kmem_cache_reap_now(spl_kmem_cache_t *skc, int count) if (spl_kmem_cache_expire & KMC_EXPIRE_MEM) kmem_cache_shrink(skc->skc_linux_cache); - SGOTO(out, 0); + goto out; } /* * Prevent concurrent cache reaping when contended. */ if (test_and_set_bit(KMC_BIT_REAPING, &skc->skc_flags)) - SGOTO(out, 0); + goto out; /* * When a reclaim function is available it may be invoked repeatedly @@ -2190,8 +2095,6 @@ spl_kmem_cache_reap_now(spl_kmem_cache_t *skc, int count) wake_up_bit(&skc->skc_flags, KMC_BIT_REAPING); out: atomic_dec(&skc->skc_ref); - - SEXIT; } EXPORT_SYMBOL(spl_kmem_cache_reap_now); @@ -2256,7 +2159,6 @@ static int spl_kmem_init_tracking(struct list_head *list, spinlock_t *lock, int size) { int i; - SENTRY; spin_lock_init(lock); INIT_LIST_HEAD(list); @@ -2264,7 +2166,7 @@ spl_kmem_init_tracking(struct list_head *list, spinlock_t *lock, int size) for (i = 0; i < size; i++) INIT_HLIST_HEAD(&kmem_table[i]); - SRETURN(0); + return (0); } static void @@ -2273,7 +2175,6 @@ spl_kmem_fini_tracking(struct list_head *list, spinlock_t *lock) unsigned long flags; kmem_debug_t *kd; char str[17]; - SENTRY; spin_lock_irqsave(lock, flags); if (!list_empty(list)) @@ -2286,7 +2187,6 @@ spl_kmem_fini_tracking(struct list_head *list, spinlock_t *lock) kd->kd_func, kd->kd_line); spin_unlock_irqrestore(lock, flags); - SEXIT; } #else /* DEBUG_KMEM && DEBUG_KMEM_TRACKING */ #define spl_kmem_init_tracking(list, lock, size) @@ -2297,7 +2197,6 @@ int spl_kmem_init(void) { int rc = 0; - SENTRY; #ifdef DEBUG_KMEM kmem_alloc_used_set(0); @@ -2314,14 +2213,12 @@ spl_kmem_init(void) spl_register_shrinker(&spl_kmem_cache_shrinker); - SRETURN(rc); + return (rc); } void spl_kmem_fini(void) { - SENTRY; - spl_unregister_shrinker(&spl_kmem_cache_shrinker); taskq_destroy(spl_kmem_cache_taskq); @@ -2331,19 +2228,14 @@ spl_kmem_fini(void) * at that address to aid in debugging. Performance is not * a serious concern here since it is module unload time. */ if (kmem_alloc_used_read() != 0) - SDEBUG_LIMIT(SD_CONSOLE | SD_WARNING, - "kmem leaked %ld/%ld bytes\n", + printk(KERN_WARNING "kmem leaked %ld/%llu bytes\n", kmem_alloc_used_read(), kmem_alloc_max); - if (vmem_alloc_used_read() != 0) - SDEBUG_LIMIT(SD_CONSOLE | SD_WARNING, - "vmem leaked %ld/%ld bytes\n", + printk(KERN_WARNING "vmem leaked %ld/%llu bytes\n", vmem_alloc_used_read(), vmem_alloc_max); spl_kmem_fini_tracking(&kmem_list, &kmem_lock); spl_kmem_fini_tracking(&vmem_list, &vmem_lock); #endif /* DEBUG_KMEM */ - - SEXIT; } diff --git a/module/spl/spl-kobj.c b/module/spl/spl-kobj.c index f14f47f5d..5b29fdb58 100644 --- a/module/spl/spl-kobj.c +++ b/module/spl/spl-kobj.c @@ -25,13 +25,6 @@ \*****************************************************************************/ #include -#include - -#ifdef SS_DEBUG_SUBSYS -#undef SS_DEBUG_SUBSYS -#endif - -#define SS_DEBUG_SUBSYS SS_KOBJ struct _buf * kobj_open_file(const char *name) @@ -39,38 +32,34 @@ kobj_open_file(const char *name) struct _buf *file; vnode_t *vp; int rc; - SENTRY; file = kmalloc(sizeof(_buf_t), GFP_KERNEL); if (file == NULL) - SRETURN((_buf_t *)-1UL); + return ((_buf_t *)-1UL); if ((rc = vn_open(name, UIO_SYSSPACE, FREAD, 0644, &vp, 0, 0))) { kfree(file); - SRETURN((_buf_t *)-1UL); + return ((_buf_t *)-1UL); } file->vp = vp; - SRETURN(file); + return (file); } /* kobj_open_file() */ EXPORT_SYMBOL(kobj_open_file); void kobj_close_file(struct _buf *file) { - SENTRY; VOP_CLOSE(file->vp, 0, 0, 0, 0, 0); kfree(file); - SEXIT; } /* kobj_close_file() */ EXPORT_SYMBOL(kobj_close_file); int kobj_read_file(struct _buf *file, char *buf, ssize_t size, offset_t off) { - SENTRY; - SRETURN(vn_rdwr(UIO_READ, file->vp, buf, size, off, + return (vn_rdwr(UIO_READ, file->vp, buf, size, off, UIO_SYSSPACE, 0, RLIM64_INFINITY, 0, NULL)); } /* kobj_read_file() */ EXPORT_SYMBOL(kobj_read_file); @@ -80,14 +69,13 @@ kobj_get_filesize(struct _buf *file, uint64_t *size) { vattr_t vap; int rc; - SENTRY; rc = VOP_GETATTR(file->vp, &vap, 0, 0, NULL); if (rc) - SRETURN(rc); + return (rc); *size = vap.va_size; - SRETURN(rc); + return (rc); } /* kobj_get_filesize() */ EXPORT_SYMBOL(kobj_get_filesize); diff --git a/module/spl/spl-kstat.c b/module/spl/spl-kstat.c index c604a32f2..cb27ed3d3 100644 --- a/module/spl/spl-kstat.c +++ b/module/spl/spl-kstat.c @@ -26,13 +26,7 @@ #include #include -#include -#ifdef SS_DEBUG_SUBSYS -#undef SS_DEBUG_SUBSYS -#endif - -#define SS_DEBUG_SUBSYS SS_KSTAT #ifndef HAVE_PDE_DATA #define PDE_DATA(x) (PDE(x)->data) #endif @@ -344,7 +338,6 @@ static void * kstat_seq_data_addr(kstat_t *ksp, loff_t n) { void *rc = NULL; - SENTRY; switch (ksp->ks_type) { case KSTAT_TYPE_RAW: @@ -369,7 +362,7 @@ kstat_seq_data_addr(kstat_t *ksp, loff_t n) PANIC("Undefined kstat type %d\n", ksp->ks_type); } - SRETURN(rc); + return (rc); } static void * @@ -378,7 +371,6 @@ kstat_seq_start(struct seq_file *f, loff_t *pos) loff_t n = *pos; kstat_t *ksp = (kstat_t *)f->private; ASSERT(ksp->ks_magic == KS_MAGIC); - SENTRY; mutex_enter(ksp->ks_lock); @@ -393,12 +385,12 @@ kstat_seq_start(struct seq_file *f, loff_t *pos) ksp->ks_snaptime = gethrtime(); if (!n && kstat_seq_show_headers(f)) - SRETURN(NULL); + return (NULL); if (n >= ksp->ks_ndata) - SRETURN(NULL); + return (NULL); - SRETURN(kstat_seq_data_addr(ksp, n)); + return (kstat_seq_data_addr(ksp, n)); } static void * @@ -406,13 +398,12 @@ kstat_seq_next(struct seq_file *f, void *p, loff_t *pos) { kstat_t *ksp = (kstat_t *)f->private; ASSERT(ksp->ks_magic == KS_MAGIC); - SENTRY; ++*pos; if (*pos >= ksp->ks_ndata) - SRETURN(NULL); + return (NULL); - SRETURN(kstat_seq_data_addr(ksp, *pos)); + return (kstat_seq_data_addr(ksp, *pos)); } static void @@ -689,19 +680,16 @@ EXPORT_SYMBOL(__kstat_delete); int spl_kstat_init(void) { - SENTRY; mutex_init(&kstat_module_lock, NULL, MUTEX_DEFAULT, NULL); INIT_LIST_HEAD(&kstat_module_list); kstat_id = 0; - SRETURN(0); + return (0); } void spl_kstat_fini(void) { - SENTRY; ASSERT(list_empty(&kstat_module_list)); mutex_destroy(&kstat_module_lock); - SEXIT; } diff --git a/module/spl/spl-proc.c b/module/spl/spl-proc.c index 6ecc0c31c..137af7188 100644 --- a/module/spl/spl-proc.c +++ b/module/spl/spl-proc.c @@ -30,13 +30,6 @@ #include #include #include -#include - -#ifdef SS_DEBUG_SUBSYS -#undef SS_DEBUG_SUBSYS -#endif - -#define SS_DEBUG_SUBSYS SS_PROC #if defined(CONSTIFY_PLUGIN) && LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) typedef struct ctl_table __no_const spl_ctl_table; @@ -110,209 +103,6 @@ proc_copyout_string(char *ubuffer, int ubuffer_size, return size; } -#ifdef DEBUG_LOG -static int -proc_dobitmasks(struct ctl_table *table, int write, - void __user *buffer, size_t *lenp, loff_t *ppos) -{ - unsigned long *mask = table->data; - int is_subsys = (mask == &spl_debug_subsys) ? 1 : 0; - int is_printk = (mask == &spl_debug_printk) ? 1 : 0; - int size = 512, rc; - char *str; - SENTRY; - - str = kmem_alloc(size, KM_SLEEP); - if (str == NULL) - SRETURN(-ENOMEM); - - if (write) { - rc = proc_copyin_string(str, size, buffer, *lenp); - if (rc < 0) - SRETURN(rc); - - rc = spl_debug_str2mask(mask, str, is_subsys); - /* Always print BUG/ASSERT to console, so keep this mask */ - if (is_printk) - *mask |= SD_EMERG; - - *ppos += *lenp; - } else { - rc = spl_debug_mask2str(str, size, *mask, is_subsys); - if (*ppos >= rc) - rc = 0; - else - rc = proc_copyout_string(buffer, *lenp, - str + *ppos, "\n"); - if (rc >= 0) { - *lenp = rc; - *ppos += rc; - } - } - - kmem_free(str, size); - SRETURN(rc); -} - -static int -proc_debug_mb(struct ctl_table *table, int write, - void __user *buffer, size_t *lenp, loff_t *ppos) -{ - char str[32]; - int rc, len; - SENTRY; - - if (write) { - rc = proc_copyin_string(str, sizeof(str), buffer, *lenp); - if (rc < 0) - SRETURN(rc); - - rc = spl_debug_set_mb(simple_strtoul(str, NULL, 0)); - *ppos += *lenp; - } else { - len = snprintf(str, sizeof(str), "%d", spl_debug_get_mb()); - if (*ppos >= len) - rc = 0; - else - rc = proc_copyout_string(buffer,*lenp,str+*ppos,"\n"); - - if (rc >= 0) { - *lenp = rc; - *ppos += rc; - } - } - - SRETURN(rc); -} - -static int -proc_dump_kernel(struct ctl_table *table, int write, - void __user *buffer, size_t *lenp, loff_t *ppos) -{ - SENTRY; - - if (write) { - spl_debug_dumplog(0); - *ppos += *lenp; - } else { - *lenp = 0; - } - - SRETURN(0); -} - -static int -proc_force_bug(struct ctl_table *table, int write, - void __user *buffer, size_t *lenp, loff_t *ppos) -{ - SENTRY; - - if (write) - PANIC("Crashing due to forced panic\n"); - else - *lenp = 0; - - SRETURN(0); -} - -static int -proc_console_max_delay_cs(struct ctl_table *table, int write, - void __user *buffer, size_t *lenp, loff_t *ppos) -{ - int rc, max_delay_cs; - spl_ctl_table dummy = *table; - long d; - SENTRY; - - dummy.data = &max_delay_cs; - dummy.proc_handler = &proc_dointvec; - - if (write) { - max_delay_cs = 0; - rc = proc_dointvec(&dummy, write, buffer, lenp, ppos); - if (rc < 0) - SRETURN(rc); - - if (max_delay_cs <= 0) - SRETURN(-EINVAL); - - d = (max_delay_cs * HZ) / 100; - if (d == 0 || d < spl_console_min_delay) - SRETURN(-EINVAL); - - spl_console_max_delay = d; - } else { - max_delay_cs = (spl_console_max_delay * 100) / HZ; - rc = proc_dointvec(&dummy, write, buffer, lenp, ppos); - } - - SRETURN(rc); -} - -static int -proc_console_min_delay_cs(struct ctl_table *table, int write, - void __user *buffer, size_t *lenp, loff_t *ppos) -{ - int rc, min_delay_cs; - spl_ctl_table dummy = *table; - long d; - SENTRY; - - dummy.data = &min_delay_cs; - dummy.proc_handler = &proc_dointvec; - - if (write) { - min_delay_cs = 0; - rc = proc_dointvec(&dummy, write, buffer, lenp, ppos); - if (rc < 0) - SRETURN(rc); - - if (min_delay_cs <= 0) - SRETURN(-EINVAL); - - d = (min_delay_cs * HZ) / 100; - if (d == 0 || d > spl_console_max_delay) - SRETURN(-EINVAL); - - spl_console_min_delay = d; - } else { - min_delay_cs = (spl_console_min_delay * 100) / HZ; - rc = proc_dointvec(&dummy, write, buffer, lenp, ppos); - } - - SRETURN(rc); -} - -static int -proc_console_backoff(struct ctl_table *table, int write, - void __user *buffer, size_t *lenp, loff_t *ppos) -{ - int rc, backoff; - spl_ctl_table dummy = *table; - SENTRY; - - dummy.data = &backoff; - dummy.proc_handler = &proc_dointvec; - - if (write) { - backoff = 0; - rc = proc_dointvec(&dummy, write, buffer, lenp, ppos); - if (rc < 0) - SRETURN(rc); - - if (backoff <= 0) - SRETURN(-EINVAL); - - spl_console_backoff = backoff; - } else { - backoff = spl_console_backoff; - rc = proc_dointvec(&dummy, write, buffer, lenp, ppos); - } - - SRETURN(rc); -} -#endif /* DEBUG_LOG */ - #ifdef DEBUG_KMEM static int proc_domemused(struct ctl_table *table, int write, @@ -321,7 +111,6 @@ proc_domemused(struct ctl_table *table, int write, int rc = 0; unsigned long min = 0, max = ~0, val; spl_ctl_table dummy = *table; - SENTRY; dummy.data = &val; dummy.proc_handler = &proc_dointvec; @@ -339,7 +128,7 @@ proc_domemused(struct ctl_table *table, int write, rc = proc_doulongvec_minmax(&dummy, write, buffer, lenp, ppos); } - SRETURN(rc); + return (rc); } static int @@ -350,7 +139,6 @@ proc_doslab(struct ctl_table *table, int write, unsigned long min = 0, max = ~0, val = 0, mask; spl_ctl_table dummy = *table; spl_kmem_cache_t *skc; - SENTRY; dummy.data = &val; dummy.proc_handler = &proc_dointvec; @@ -387,7 +175,7 @@ proc_doslab(struct ctl_table *table, int write, rc = proc_doulongvec_minmax(&dummy, write, buffer, lenp, ppos); } - SRETURN(rc); + return (rc); } #endif /* DEBUG_KMEM */ @@ -397,7 +185,6 @@ proc_dohostid(struct ctl_table *table, int write, { int len, rc = 0; char *end, str[32]; - SENTRY; if (write) { /* We can't use proc_doulongvec_minmax() in the write @@ -405,11 +192,11 @@ proc_dohostid(struct ctl_table *table, int write, * leading 0x which confuses the helper function. */ rc = proc_copyin_string(str, sizeof(str), buffer, *lenp); if (rc < 0) - SRETURN(rc); + return (rc); spl_hostid = simple_strtoul(str, &end, 16); if (str == end) - SRETURN(-EINVAL); + return (-EINVAL); } else { len = snprintf(str, sizeof(str), "%lx", spl_hostid); @@ -424,7 +211,7 @@ proc_dohostid(struct ctl_table *table, int write, } } - SRETURN(rc); + return (rc); } #ifdef DEBUG_KMEM @@ -487,7 +274,6 @@ slab_seq_start(struct seq_file *f, loff_t *pos) { struct list_head *p; loff_t n = *pos; - SENTRY; down_read(&spl_kmem_cache_sem); if (!n) @@ -497,20 +283,19 @@ slab_seq_start(struct seq_file *f, loff_t *pos) while (n--) { p = p->next; if (p == &spl_kmem_cache_list) - SRETURN(NULL); + return (NULL); } - SRETURN(list_entry(p, spl_kmem_cache_t, skc_list)); + return (list_entry(p, spl_kmem_cache_t, skc_list)); } static void * slab_seq_next(struct seq_file *f, void *p, loff_t *pos) { spl_kmem_cache_t *skc = p; - SENTRY; ++*pos; - SRETURN((skc->skc_list.next == &spl_kmem_cache_list) ? + return ((skc->skc_list.next == &spl_kmem_cache_list) ? NULL : list_entry(skc->skc_list.next,spl_kmem_cache_t,skc_list)); } @@ -541,108 +326,6 @@ static struct file_operations proc_slab_operations = { }; #endif /* DEBUG_KMEM */ -#ifdef DEBUG_LOG -static struct ctl_table spl_debug_table[] = { - { - .procname = "subsystem", - .data = &spl_debug_subsys, - .maxlen = sizeof(unsigned long), - .mode = 0644, - .proc_handler = &proc_dobitmasks - }, - { - .procname = "mask", - .data = &spl_debug_mask, - .maxlen = sizeof(unsigned long), - .mode = 0644, - .proc_handler = &proc_dobitmasks - }, - { - .procname = "printk", - .data = &spl_debug_printk, - .maxlen = sizeof(unsigned long), - .mode = 0644, - .proc_handler = &proc_dobitmasks - }, - { - .procname = "mb", - .mode = 0644, - .proc_handler = &proc_debug_mb, - }, - { - .procname = "binary", - .data = &spl_debug_binary, - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = &proc_dointvec, - }, - { - .procname = "catastrophe", - .data = &spl_debug_catastrophe, - .maxlen = sizeof(int), - .mode = 0444, - .proc_handler = &proc_dointvec, - }, - { - .procname = "panic_on_bug", - .data = &spl_debug_panic_on_bug, - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = &proc_dointvec - }, - { - .procname = "path", - .data = spl_debug_file_path, - .maxlen = sizeof(spl_debug_file_path), - .mode = 0644, - .proc_handler = &proc_dostring, - }, - { - .procname = "dump", - .mode = 0200, - .proc_handler = &proc_dump_kernel, - }, - { - .procname = "force_bug", - .mode = 0200, - .proc_handler = &proc_force_bug, - }, - { - .procname = "console_ratelimit", - .data = &spl_console_ratelimit, - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = &proc_dointvec, - }, - { - .procname = "console_max_delay_centisecs", - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = &proc_console_max_delay_cs, - }, - { - .procname = "console_min_delay_centisecs", - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = &proc_console_min_delay_cs, - }, - { - .procname = "console_backoff", - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = &proc_console_backoff, - }, - { - .procname = "stack_max", - .data = &spl_debug_stack, - .maxlen = sizeof(int), - .mode = 0444, - .proc_handler = &proc_dointvec, - }, - {0}, -}; -#endif /* DEBUG_LOG */ - #ifdef DEBUG_KMEM static struct ctl_table spl_kmem_table[] = { { @@ -765,13 +448,6 @@ static struct ctl_table spl_table[] = { .mode = 0644, .proc_handler = &proc_dohostid, }, -#ifdef DEBUG_LOG - { - .procname = "debug", - .mode = 0555, - .child = spl_debug_table, - }, -#endif #ifdef DEBUG_KMEM { .procname = "kmem", @@ -812,31 +488,38 @@ int spl_proc_init(void) { int rc = 0; - SENTRY; spl_header = register_sysctl_table(spl_root); if (spl_header == NULL) - SRETURN(-EUNATCH); + return (-EUNATCH); proc_spl = proc_mkdir("spl", NULL); - if (proc_spl == NULL) - SGOTO(out, rc = -EUNATCH); + if (proc_spl == NULL) { + rc = -EUNATCH; + goto out; + } #ifdef DEBUG_KMEM proc_spl_kmem = proc_mkdir("kmem", proc_spl); - if (proc_spl_kmem == NULL) - SGOTO(out, rc = -EUNATCH); + if (proc_spl_kmem == NULL) { + rc = -EUNATCH; + goto out; + } proc_spl_kmem_slab = proc_create_data("slab", 0444, proc_spl_kmem, &proc_slab_operations, NULL); - if (proc_spl_kmem_slab == NULL) - SGOTO(out, rc = -EUNATCH); + if (proc_spl_kmem_slab == NULL) { + rc = -EUNATCH; + goto out; + } #endif /* DEBUG_KMEM */ proc_spl_kstat = proc_mkdir("kstat", proc_spl); - if (proc_spl_kstat == NULL) - SGOTO(out, rc = -EUNATCH); + if (proc_spl_kstat == NULL) { + rc = -EUNATCH; + goto out; + } out: if (rc) { remove_proc_entry("kstat", proc_spl); @@ -848,14 +531,12 @@ out: unregister_sysctl_table(spl_header); } - SRETURN(rc); + return (rc); } void spl_proc_fini(void) { - SENTRY; - remove_proc_entry("kstat", proc_spl); #ifdef DEBUG_KMEM remove_proc_entry("slab", proc_spl_kmem); @@ -865,6 +546,4 @@ spl_proc_fini(void) ASSERT(spl_header != NULL); unregister_sysctl_table(spl_header); - - SEXIT; } diff --git a/module/spl/spl-taskq.c b/module/spl/spl-taskq.c index 0cb2ceeaf..951298d9f 100644 --- a/module/spl/spl-taskq.c +++ b/module/spl/spl-taskq.c @@ -26,13 +26,6 @@ #include #include -#include - -#ifdef SS_DEBUG_SUBSYS -#undef SS_DEBUG_SUBSYS -#endif - -#define SS_DEBUG_SUBSYS SS_TASKQ int spl_taskq_thread_bind = 0; module_param(spl_taskq_thread_bind, int, 0644); @@ -63,7 +56,6 @@ task_alloc(taskq_t *tq, uint_t flags) { taskq_ent_t *t; int count = 0; - SENTRY; ASSERT(tq); ASSERT(spin_is_locked(&tq->tq_lock)); @@ -77,17 +69,17 @@ retry: ASSERT(!timer_pending(&t->tqent_timer)); list_del_init(&t->tqent_list); - SRETURN(t); + return (t); } /* Free list is empty and memory allocations are prohibited */ if (flags & TQ_NOALLOC) - SRETURN(NULL); + return (NULL); /* Hit maximum taskq_ent_t pool size */ if (tq->tq_nalloc >= tq->tq_maxalloc) { if (flags & TQ_NOSLEEP) - SRETURN(NULL); + return (NULL); /* * Sleep periodically polling the free list for an available @@ -103,8 +95,10 @@ retry: spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); schedule_timeout(HZ / 100); spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); - if (count < 100) - SGOTO(retry, count++); + if (count < 100) { + count++; + goto retry; + } } spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); @@ -116,7 +110,7 @@ retry: tq->tq_nalloc++; } - SRETURN(t); + return (t); } /* @@ -126,8 +120,6 @@ retry: static void task_free(taskq_t *tq, taskq_ent_t *t) { - SENTRY; - ASSERT(tq); ASSERT(t); ASSERT(spin_is_locked(&tq->tq_lock)); @@ -136,8 +128,6 @@ task_free(taskq_t *tq, taskq_ent_t *t) kmem_free(t, sizeof(taskq_ent_t)); tq->tq_nalloc--; - - SEXIT; } /* @@ -147,7 +137,6 @@ task_free(taskq_t *tq, taskq_ent_t *t) static void task_done(taskq_t *tq, taskq_ent_t *t) { - SENTRY; ASSERT(tq); ASSERT(t); ASSERT(spin_is_locked(&tq->tq_lock)); @@ -167,8 +156,6 @@ task_done(taskq_t *tq, taskq_ent_t *t) } else { task_free(tq, t); } - - SEXIT; } /* @@ -222,7 +209,6 @@ taskq_lowest_id(taskq_t *tq) taskqid_t lowest_id = tq->tq_next_id; taskq_ent_t *t; taskq_thread_t *tqt; - SENTRY; ASSERT(tq); ASSERT(spin_is_locked(&tq->tq_lock)); @@ -249,7 +235,7 @@ taskq_lowest_id(taskq_t *tq) lowest_id = MIN(lowest_id, tqt->tqt_id); } - SRETURN(lowest_id); + return (lowest_id); } /* @@ -261,7 +247,6 @@ taskq_insert_in_order(taskq_t *tq, taskq_thread_t *tqt) taskq_thread_t *w; struct list_head *l; - SENTRY; ASSERT(tq); ASSERT(tqt); ASSERT(spin_is_locked(&tq->tq_lock)); @@ -275,8 +260,6 @@ taskq_insert_in_order(taskq_t *tq, taskq_thread_t *tqt) } if (l == &tq->tq_active_list) list_add(&tqt->tqt_active_list, &tq->tq_active_list); - - SEXIT; } /* @@ -288,7 +271,6 @@ taskq_find_list(taskq_t *tq, struct list_head *lh, taskqid_t id) { struct list_head *l; taskq_ent_t *t; - SENTRY; ASSERT(spin_is_locked(&tq->tq_lock)); @@ -296,13 +278,13 @@ taskq_find_list(taskq_t *tq, struct list_head *lh, taskqid_t id) t = list_entry(l, taskq_ent_t, tqent_list); if (t->tqent_id == id) - SRETURN(t); + return (t); if (t->tqent_id > id) break; } - SRETURN(NULL); + return (NULL); } /* @@ -317,33 +299,32 @@ taskq_find(taskq_t *tq, taskqid_t id, int *active) taskq_thread_t *tqt; struct list_head *l; taskq_ent_t *t; - SENTRY; ASSERT(spin_is_locked(&tq->tq_lock)); *active = 0; t = taskq_find_list(tq, &tq->tq_delay_list, id); if (t) - SRETURN(t); + return (t); t = taskq_find_list(tq, &tq->tq_prio_list, id); if (t) - SRETURN(t); + return (t); t = taskq_find_list(tq, &tq->tq_pend_list, id); if (t) - SRETURN(t); + return (t); list_for_each(l, &tq->tq_active_list) { tqt = list_entry(l, taskq_thread_t, tqt_active_list); if (tqt->tqt_id == id) { t = tqt->tqt_task; *active = 1; - SRETURN(t); + return (t); } } - SRETURN(NULL); + return (NULL); } static int @@ -405,7 +386,7 @@ taskq_wait_check(taskq_t *tq, taskqid_t id) rc = (id < tq->tq_lowest_id); spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); - SRETURN(rc); + return (rc); } void @@ -419,7 +400,7 @@ void taskq_wait(taskq_t *tq) { taskqid_t id; - SENTRY; + ASSERT(tq); /* Wait for the largest outstanding taskqid */ @@ -428,9 +409,6 @@ taskq_wait(taskq_t *tq) spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); taskq_wait_all(tq, id); - - SEXIT; - } EXPORT_SYMBOL(taskq_wait); @@ -439,7 +417,6 @@ taskq_member(taskq_t *tq, void *t) { struct list_head *l; taskq_thread_t *tqt; - SENTRY; ASSERT(tq); ASSERT(t); @@ -447,10 +424,10 @@ taskq_member(taskq_t *tq, void *t) list_for_each(l, &tq->tq_thread_list) { tqt = list_entry(l, taskq_thread_t, tqt_thread_list); if (tqt->tqt_thread == (struct task_struct *)t) - SRETURN(1); + return (1); } - SRETURN(0); + return (0); } EXPORT_SYMBOL(taskq_member); @@ -466,7 +443,6 @@ taskq_cancel_id(taskq_t *tq, taskqid_t id) taskq_ent_t *t; int active = 0; int rc = ENOENT; - SENTRY; ASSERT(tq); @@ -507,7 +483,7 @@ taskq_cancel_id(taskq_t *tq, taskqid_t id) rc = EBUSY; } - SRETURN(rc); + return (rc); } EXPORT_SYMBOL(taskq_cancel_id); @@ -516,7 +492,6 @@ taskq_dispatch(taskq_t *tq, task_func_t func, void *arg, uint_t flags) { taskq_ent_t *t; taskqid_t rc = 0; - SENTRY; ASSERT(tq); ASSERT(func); @@ -525,15 +500,15 @@ taskq_dispatch(taskq_t *tq, task_func_t func, void *arg, uint_t flags) /* Taskq being destroyed and all tasks drained */ if (!(tq->tq_flags & TQ_ACTIVE)) - SGOTO(out, rc = 0); + goto out; /* Do not queue the task unless there is idle thread for it */ ASSERT(tq->tq_nactive <= tq->tq_nthreads); if ((flags & TQ_NOQUEUE) && (tq->tq_nactive == tq->tq_nthreads)) - SGOTO(out, rc = 0); + goto out; if ((t = task_alloc(tq, flags)) == NULL) - SGOTO(out, rc = 0); + goto out; spin_lock(&t->tqent_lock); @@ -559,7 +534,7 @@ taskq_dispatch(taskq_t *tq, task_func_t func, void *arg, uint_t flags) wake_up(&tq->tq_work_waitq); out: spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); - SRETURN(rc); + return (rc); } EXPORT_SYMBOL(taskq_dispatch); @@ -567,9 +542,8 @@ taskqid_t taskq_dispatch_delay(taskq_t *tq, task_func_t func, void *arg, uint_t flags, clock_t expire_time) { - taskq_ent_t *t; taskqid_t rc = 0; - SENTRY; + taskq_ent_t *t; ASSERT(tq); ASSERT(func); @@ -578,10 +552,10 @@ taskq_dispatch_delay(taskq_t *tq, task_func_t func, void *arg, /* Taskq being destroyed and all tasks drained */ if (!(tq->tq_flags & TQ_ACTIVE)) - SGOTO(out, rc = 0); + goto out; if ((t = task_alloc(tq, flags)) == NULL) - SGOTO(out, rc = 0); + goto out; spin_lock(&t->tqent_lock); @@ -603,7 +577,7 @@ taskq_dispatch_delay(taskq_t *tq, task_func_t func, void *arg, spin_unlock(&t->tqent_lock); out: spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); - SRETURN(rc); + return (rc); } EXPORT_SYMBOL(taskq_dispatch_delay); @@ -611,8 +585,6 @@ void taskq_dispatch_ent(taskq_t *tq, task_func_t func, void *arg, uint_t flags, taskq_ent_t *t) { - SENTRY; - ASSERT(tq); ASSERT(func); ASSERT(!(tq->tq_flags & TASKQ_DYNAMIC)); @@ -650,7 +622,6 @@ taskq_dispatch_ent(taskq_t *tq, task_func_t func, void *arg, uint_t flags, wake_up(&tq->tq_work_waitq); out: spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); - SEXIT; } EXPORT_SYMBOL(taskq_dispatch_ent); @@ -685,7 +656,6 @@ taskq_thread(void *args) taskq_t *tq; taskq_ent_t *t; struct list_head *pend_list; - SENTRY; ASSERT(tqt); tq = tqt->tqt_tq; @@ -778,7 +748,7 @@ taskq_thread(void *args) spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); - SRETURN(0); + return (0); } taskq_t * @@ -789,7 +759,6 @@ taskq_create(const char *name, int nthreads, pri_t pri, taskq_t *tq; taskq_thread_t *tqt; int rc = 0, i, j = 0; - SENTRY; ASSERT(name != NULL); ASSERT(pri <= maxclsyspri); @@ -808,7 +777,7 @@ taskq_create(const char *name, int nthreads, pri_t pri, tq = kmem_alloc(sizeof(*tq), KM_PUSHPAGE); if (tq == NULL) - SRETURN(NULL); + return (NULL); spin_lock_init(&tq->tq_lock); spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); @@ -869,7 +838,7 @@ taskq_create(const char *name, int nthreads, pri_t pri, tq = NULL; } - SRETURN(tq); + return (tq); } EXPORT_SYMBOL(taskq_create); @@ -879,7 +848,6 @@ taskq_destroy(taskq_t *tq) struct task_struct *thread; taskq_thread_t *tqt; taskq_ent_t *t; - SENTRY; ASSERT(tq); spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); @@ -929,30 +897,24 @@ taskq_destroy(taskq_t *tq) spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); kmem_free(tq, sizeof(taskq_t)); - - SEXIT; } EXPORT_SYMBOL(taskq_destroy); int spl_taskq_init(void) { - SENTRY; - /* Solaris creates a dynamic taskq of up to 64 threads, however in * a Linux environment 1 thread per-core is usually about right */ system_taskq = taskq_create("spl_system_taskq", num_online_cpus(), minclsyspri, 4, 512, TASKQ_PREPOPULATE); if (system_taskq == NULL) - SRETURN(1); + return (1); - SRETURN(0); + return (0); } void spl_taskq_fini(void) { - SENTRY; taskq_destroy(system_taskq); - SEXIT; } diff --git a/module/spl/spl-thread.c b/module/spl/spl-thread.c index 5c8514051..b0f4d5715 100644 --- a/module/spl/spl-thread.c +++ b/module/spl/spl-thread.c @@ -27,13 +27,6 @@ #include #include #include -#include - -#ifdef SS_DEBUG_SUBSYS -#undef SS_DEBUG_SUBSYS -#endif - -#define SS_DEBUG_SUBSYS SS_THREAD /* * Thread interfaces @@ -73,8 +66,6 @@ thread_generic_wrapper(void *arg) void __thread_exit(void) { - SENTRY; - SEXIT; tsd_exit(); complete_and_exit(NULL, 0); /* Unreachable */ @@ -92,7 +83,6 @@ __thread_create(caddr_t stk, size_t stksize, thread_func_t func, thread_priv_t *tp; struct task_struct *tsk; char *p; - SENTRY; /* Option pp is simply ignored */ /* Variable stack size unsupported */ @@ -100,7 +90,7 @@ __thread_create(caddr_t stk, size_t stksize, thread_func_t func, tp = kmem_alloc(sizeof(thread_priv_t), KM_PUSHPAGE); if (tp == NULL) - SRETURN(NULL); + return (NULL); tp->tp_magic = TP_MAGIC; tp->tp_name_size = strlen(name) + 1; @@ -108,7 +98,7 @@ __thread_create(caddr_t stk, size_t stksize, thread_func_t func, tp->tp_name = kmem_alloc(tp->tp_name_size, KM_PUSHPAGE); if (tp->tp_name == NULL) { kmem_free(tp, sizeof(thread_priv_t)); - SRETURN(NULL); + return (NULL); } strncpy(tp->tp_name, name, tp->tp_name_size); @@ -128,13 +118,11 @@ __thread_create(caddr_t stk, size_t stksize, thread_func_t func, tsk = spl_kthread_create(thread_generic_wrapper, (void *)tp, "%s", tp->tp_name); - if (IS_ERR(tsk)) { - SERROR("Failed to create thread: %ld\n", PTR_ERR(tsk)); - SRETURN(NULL); - } + if (IS_ERR(tsk)) + return (NULL); wake_up_process(tsk); - SRETURN((kthread_t *)tsk); + return ((kthread_t *)tsk); } EXPORT_SYMBOL(__thread_create); diff --git a/module/spl/spl-tsd.c b/module/spl/spl-tsd.c index 6e5605b9d..c9d532f4e 100644 --- a/module/spl/spl-tsd.c +++ b/module/spl/spl-tsd.c @@ -61,14 +61,6 @@ #include #include #include -#include - -#ifdef DEBUG_SUBSYSTEM -#undef DEBUG_SUBSYSTEM -#endif - -#define DEBUG_SUBSYSTEM SS_TSD -#define DEBUG_SUBSYSTEM SS_TSD typedef struct tsd_hash_bin { spinlock_t hb_lock; @@ -108,7 +100,6 @@ tsd_hash_search(tsd_hash_table_t *table, uint_t key, pid_t pid) tsd_hash_entry_t *entry; tsd_hash_bin_t *bin; ulong_t hash; - SENTRY; hash = hash_long((ulong_t)key * (ulong_t)pid, table->ht_bits); bin = &table->ht_bins[hash]; @@ -117,12 +108,12 @@ tsd_hash_search(tsd_hash_table_t *table, uint_t key, pid_t pid) entry = list_entry(node, tsd_hash_entry_t, he_list); if ((entry->he_key == key) && (entry->he_pid == pid)) { spin_unlock(&bin->hb_lock); - SRETURN(entry); + return (entry); } } spin_unlock(&bin->hb_lock); - SRETURN(NULL); + return (NULL); } /* @@ -136,7 +127,6 @@ static void tsd_hash_dtor(struct hlist_head *work) { tsd_hash_entry_t *entry; - SENTRY; while (!hlist_empty(work)) { entry = hlist_entry(work->first, tsd_hash_entry_t, he_list); @@ -147,8 +137,6 @@ tsd_hash_dtor(struct hlist_head *work) kmem_free(entry, sizeof(tsd_hash_entry_t)); } - - SEXIT; } /* @@ -170,14 +158,13 @@ tsd_hash_add(tsd_hash_table_t *table, uint_t key, pid_t pid, void *value) tsd_hash_bin_t *bin; ulong_t hash; int rc = 0; - SENTRY; ASSERT3P(tsd_hash_search(table, key, pid), ==, NULL); /* New entry allocate structure, set value, and add to hash */ entry = kmem_alloc(sizeof(tsd_hash_entry_t), KM_PUSHPAGE); if (entry == NULL) - SRETURN(ENOMEM); + return (ENOMEM); entry->he_key = key; entry->he_pid = pid; @@ -209,7 +196,7 @@ tsd_hash_add(tsd_hash_table_t *table, uint_t key, pid_t pid, void *value) spin_unlock(&bin->hb_lock); spin_unlock(&table->ht_lock); - SRETURN(rc); + return (rc); } /* @@ -230,14 +217,13 @@ tsd_hash_add_key(tsd_hash_table_t *table, uint_t *keyp, dtor_func_t dtor) tsd_hash_bin_t *bin; ulong_t hash; int keys_checked = 0; - SENTRY; ASSERT3P(table, !=, NULL); /* Allocate entry to be used as a destructor for this key */ entry = kmem_alloc(sizeof(tsd_hash_entry_t), KM_PUSHPAGE); if (entry == NULL) - SRETURN(ENOMEM); + return (ENOMEM); /* Determine next available key value */ spin_lock(&table->ht_lock); @@ -249,7 +235,7 @@ tsd_hash_add_key(tsd_hash_table_t *table, uint_t *keyp, dtor_func_t dtor) /* Ensure failure when all TSD_KEYS_MAX keys are in use */ if (keys_checked++ >= TSD_KEYS_MAX) { spin_unlock(&table->ht_lock); - SRETURN(ENOENT); + return (ENOENT); } tmp_entry = tsd_hash_search(table, table->ht_key, DTOR_PID); @@ -273,7 +259,7 @@ tsd_hash_add_key(tsd_hash_table_t *table, uint_t *keyp, dtor_func_t dtor) spin_unlock(&bin->hb_lock); spin_unlock(&table->ht_lock); - SRETURN(0); + return (0); } /* @@ -291,12 +277,11 @@ tsd_hash_add_pid(tsd_hash_table_t *table, pid_t pid) tsd_hash_entry_t *entry; tsd_hash_bin_t *bin; ulong_t hash; - SENTRY; /* Allocate entry to be used as the process reference */ entry = kmem_alloc(sizeof(tsd_hash_entry_t), KM_PUSHPAGE); if (entry == NULL) - SRETURN(ENOMEM); + return (ENOMEM); spin_lock(&table->ht_lock); entry->he_key = PID_KEY; @@ -316,7 +301,7 @@ tsd_hash_add_pid(tsd_hash_table_t *table, pid_t pid) spin_unlock(&bin->hb_lock); spin_unlock(&table->ht_lock); - SRETURN(0); + return (0); } /* @@ -328,14 +313,10 @@ tsd_hash_add_pid(tsd_hash_table_t *table, pid_t pid) static void tsd_hash_del(tsd_hash_table_t *table, tsd_hash_entry_t *entry) { - SENTRY; - ASSERT(spin_is_locked(&table->ht_lock)); hlist_del(&entry->he_list); list_del_init(&entry->he_key_list); list_del_init(&entry->he_pid_list); - - SEXIT; } /* @@ -350,17 +331,16 @@ tsd_hash_table_init(uint_t bits) { tsd_hash_table_t *table; int hash, size = (1 << bits); - SENTRY; table = kmem_zalloc(sizeof(tsd_hash_table_t), KM_SLEEP); if (table == NULL) - SRETURN(NULL); + return (NULL); table->ht_bins = kmem_zalloc(sizeof(tsd_hash_bin_t) * size, KM_SLEEP | KM_NODEBUG); if (table->ht_bins == NULL) { kmem_free(table, sizeof(tsd_hash_table_t)); - SRETURN(NULL); + return (NULL); } for (hash = 0; hash < size; hash++) { @@ -372,7 +352,7 @@ tsd_hash_table_init(uint_t bits) table->ht_bits = bits; table->ht_key = 1; - SRETURN(table); + return (table); } /* @@ -390,7 +370,6 @@ tsd_hash_table_fini(tsd_hash_table_t *table) tsd_hash_bin_t *bin; tsd_hash_entry_t *entry; int size, i; - SENTRY; ASSERT3P(table, !=, NULL); spin_lock(&table->ht_lock); @@ -410,8 +389,6 @@ tsd_hash_table_fini(tsd_hash_table_t *table) tsd_hash_dtor(&work); kmem_free(table->ht_bins, sizeof(tsd_hash_bin_t)*(1<ht_bits)); kmem_free(table, sizeof(tsd_hash_table_t)); - - SEXIT; } /* @@ -432,20 +409,19 @@ tsd_set(uint_t key, void *value) tsd_hash_entry_t *entry; pid_t pid; int rc; - SENTRY; table = tsd_hash_table; pid = curthread->pid; ASSERT3P(table, !=, NULL); if ((key == 0) || (key > TSD_KEYS_MAX)) - SRETURN(EINVAL); + return (EINVAL); /* Entry already exists in hash table update value */ entry = tsd_hash_search(table, key, pid); if (entry) { entry->he_value = value; - SRETURN(0); + return (0); } /* Add a process entry to the hash if not yet exists */ @@ -453,11 +429,11 @@ tsd_set(uint_t key, void *value) if (entry == NULL) { rc = tsd_hash_add_pid(table, pid); if (rc) - SRETURN(rc); + return (rc); } rc = tsd_hash_add(table, key, pid, value); - SRETURN(rc); + return (rc); } EXPORT_SYMBOL(tsd_set); @@ -473,18 +449,17 @@ void * tsd_get(uint_t key) { tsd_hash_entry_t *entry; - SENTRY; ASSERT3P(tsd_hash_table, !=, NULL); if ((key == 0) || (key > TSD_KEYS_MAX)) - SRETURN(NULL); + return (NULL); entry = tsd_hash_search(tsd_hash_table, key, curthread->pid); if (entry == NULL) - SRETURN(NULL); + return (NULL); - SRETURN(entry->he_value); + return (entry->he_value); } EXPORT_SYMBOL(tsd_get); @@ -503,17 +478,11 @@ EXPORT_SYMBOL(tsd_get); void tsd_create(uint_t *keyp, dtor_func_t dtor) { - SENTRY; - ASSERT3P(keyp, !=, NULL); - if (*keyp) { - SEXIT; + if (*keyp) return; - } (void)tsd_hash_add_key(tsd_hash_table, keyp, dtor); - - SEXIT; } EXPORT_SYMBOL(tsd_create); @@ -534,7 +503,6 @@ tsd_destroy(uint_t *keyp) tsd_hash_entry_t *dtor_entry, *entry; tsd_hash_bin_t *dtor_entry_bin, *entry_bin; ulong_t hash; - SENTRY; table = tsd_hash_table; ASSERT3P(table, !=, NULL); @@ -543,7 +511,6 @@ tsd_destroy(uint_t *keyp) dtor_entry = tsd_hash_search(table, *keyp, DTOR_PID); if (dtor_entry == NULL) { spin_unlock(&table->ht_lock); - SEXIT; return; } @@ -580,8 +547,6 @@ tsd_destroy(uint_t *keyp) tsd_hash_dtor(&work); *keyp = 0; - - SEXIT; } EXPORT_SYMBOL(tsd_destroy); @@ -601,7 +566,6 @@ tsd_exit(void) tsd_hash_entry_t *pid_entry, *entry; tsd_hash_bin_t *pid_entry_bin, *entry_bin; ulong_t hash; - SENTRY; table = tsd_hash_table; ASSERT3P(table, !=, NULL); @@ -610,7 +574,6 @@ tsd_exit(void) pid_entry = tsd_hash_search(table, PID_KEY, curthread->pid); if (pid_entry == NULL) { spin_unlock(&table->ht_lock); - SEXIT; return; } @@ -646,28 +609,22 @@ tsd_exit(void) spin_unlock(&table->ht_lock); tsd_hash_dtor(&work); - - SEXIT; } EXPORT_SYMBOL(tsd_exit); int spl_tsd_init(void) { - SENTRY; - tsd_hash_table = tsd_hash_table_init(TSD_HASH_TABLE_BITS_DEFAULT); if (tsd_hash_table == NULL) - SRETURN(1); + return (1); - SRETURN(0); + return (0); } void spl_tsd_fini(void) { - SENTRY; tsd_hash_table_fini(tsd_hash_table); tsd_hash_table = NULL; - SEXIT; } diff --git a/module/spl/spl-vnode.c b/module/spl/spl-vnode.c index b9f9d7b1f..cac0aaf29 100644 --- a/module/spl/spl-vnode.c +++ b/module/spl/spl-vnode.c @@ -27,13 +27,6 @@ #include #include #include -#include - -#ifdef SS_DEBUG_SUBSYS -#undef SS_DEBUG_SUBSYS -#endif - -#define SS_DEBUG_SUBSYS SS_VNODE vnode_t *rootdir = (vnode_t *)0xabcd1234; EXPORT_SYMBOL(rootdir); @@ -107,7 +100,6 @@ vnode_t * vn_alloc(int flag) { vnode_t *vp; - SENTRY; vp = kmem_cache_alloc(vn_cache, flag); if (vp != NULL) { @@ -115,16 +107,14 @@ vn_alloc(int flag) vp->v_type = 0; } - SRETURN(vp); + return (vp); } /* vn_alloc() */ EXPORT_SYMBOL(vn_alloc); void vn_free(vnode_t *vp) { - SENTRY; kmem_cache_free(vn_cache, vp); - SEXIT; } /* vn_free() */ EXPORT_SYMBOL(vn_free); @@ -137,7 +127,6 @@ vn_open(const char *path, uio_seg_t seg, int flags, int mode, int rc, saved_umask = 0; gfp_t saved_gfp; vnode_t *vp; - SENTRY; ASSERT(flags & (FWRITE | FREAD)); ASSERT(seg == UIO_SYSSPACE); @@ -163,7 +152,7 @@ vn_open(const char *path, uio_seg_t seg, int flags, int mode, (void)xchg(¤t->fs->umask, saved_umask); if (IS_ERR(fp)) - SRETURN(-PTR_ERR(fp)); + return (-PTR_ERR(fp)); #ifdef HAVE_2ARGS_VFS_GETATTR rc = vfs_getattr(&fp->f_path, &stat); @@ -172,13 +161,13 @@ vn_open(const char *path, uio_seg_t seg, int flags, int mode, #endif if (rc) { filp_close(fp, 0); - SRETURN(-rc); + return (-rc); } vp = vn_alloc(KM_SLEEP); if (!vp) { filp_close(fp, 0); - SRETURN(ENOMEM); + return (ENOMEM); } saved_gfp = mapping_gfp_mask(fp->f_mapping); @@ -191,7 +180,7 @@ vn_open(const char *path, uio_seg_t seg, int flags, int mode, *vpp = vp; mutex_exit(&vp->v_lock); - SRETURN(0); + return (0); } /* vn_open() */ EXPORT_SYMBOL(vn_open); @@ -201,20 +190,19 @@ vn_openat(const char *path, uio_seg_t seg, int flags, int mode, { char *realpath; int len, rc; - SENTRY; ASSERT(vp == rootdir); len = strlen(path) + 2; realpath = kmalloc(len, GFP_KERNEL); if (!realpath) - SRETURN(ENOMEM); + return (ENOMEM); (void)snprintf(realpath, len, "/%s", path); rc = vn_open(realpath, seg, flags, mode, vpp, x1, x2); kfree(realpath); - SRETURN(rc); + return (rc); } /* vn_openat() */ EXPORT_SYMBOL(vn_openat); @@ -226,7 +214,6 @@ vn_rdwr(uio_rw_t uio, vnode_t *vp, void *addr, ssize_t len, offset_t off, mm_segment_t saved_fs; struct file *fp; int rc; - SENTRY; ASSERT(uio == UIO_WRITE || uio == UIO_READ); ASSERT(vp); @@ -256,16 +243,16 @@ vn_rdwr(uio_rw_t uio, vnode_t *vp, void *addr, ssize_t len, offset_t off, fp->f_pos = offset; if (rc < 0) - SRETURN(-rc); + return (-rc); if (residp) { *residp = len - rc; } else { if (rc != len) - SRETURN(EIO); + return (EIO); } - SRETURN(0); + return (0); } /* vn_rdwr() */ EXPORT_SYMBOL(vn_rdwr); @@ -273,7 +260,6 @@ int vn_close(vnode_t *vp, int flags, int x1, int x2, void *x3, void *x4) { int rc; - SENTRY; ASSERT(vp); ASSERT(vp->v_file); @@ -282,7 +268,7 @@ vn_close(vnode_t *vp, int flags, int x1, int x2, void *x3, void *x4) rc = filp_close(vp->v_file, 0); vn_free(vp); - SRETURN(-rc); + return (-rc); } /* vn_close() */ EXPORT_SYMBOL(vn_close); @@ -386,7 +372,6 @@ vn_remove(const char *path, uio_seg_t seg, int flags) struct path parent; struct inode *inode = NULL; int rc = 0; - SENTRY; ASSERT(seg == UIO_SYSSPACE); ASSERT(flags == RMFILE); @@ -394,14 +379,18 @@ vn_remove(const char *path, uio_seg_t seg, int flags) dentry = spl_kern_path_locked(path, &parent); rc = PTR_ERR(dentry); if (!IS_ERR(dentry)) { - if (parent.dentry->d_name.name[parent.dentry->d_name.len]) - SGOTO(slashes, rc = 0); + if (parent.dentry->d_name.name[parent.dentry->d_name.len]) { + rc = 0; + goto slashes; + } inode = dentry->d_inode; - if (inode) + if (inode) { atomic_inc(&inode->i_count); - else - SGOTO(slashes, rc = 0); + } else { + rc = 0; + goto slashes; + } #ifdef HAVE_2ARGS_VFS_UNLINK rc = vfs_unlink(parent.dentry->d_inode, dentry); @@ -419,12 +408,12 @@ exit1: iput(inode); /* truncate the inode here */ path_put(&parent); - SRETURN(-rc); + return (-rc); slashes: rc = !dentry->d_inode ? -ENOENT : S_ISDIR(dentry->d_inode->i_mode) ? -EISDIR : -ENOTDIR; - SGOTO(exit1, rc); + goto exit1; } /* vn_remove() */ EXPORT_SYMBOL(vn_remove); @@ -437,23 +426,26 @@ vn_rename(const char *oldname, const char *newname, int x1) struct dentry *trap; struct path old_parent, new_parent; int rc = 0; - SENTRY; old_dentry = spl_kern_path_locked(oldname, &old_parent); - if (IS_ERR(old_dentry)) - SGOTO(exit, rc = PTR_ERR(old_dentry)); + if (IS_ERR(old_dentry)) { + rc = PTR_ERR(old_dentry); + goto exit; + } spl_inode_unlock(old_parent.dentry->d_inode); new_dentry = spl_kern_path_locked(newname, &new_parent); - if (IS_ERR(new_dentry)) - SGOTO(exit2, rc = PTR_ERR(new_dentry)); + if (IS_ERR(new_dentry)) { + rc = PTR_ERR(new_dentry); + goto exit2; + } spl_inode_unlock(new_parent.dentry->d_inode); rc = -EXDEV; if (old_parent.mnt != new_parent.mnt) - SGOTO(exit3, rc); + goto exit3; old_dir = old_parent.dentry; new_dir = new_parent.dentry; @@ -462,25 +454,25 @@ vn_rename(const char *oldname, const char *newname, int x1) /* source should not be ancestor of target */ rc = -EINVAL; if (old_dentry == trap) - SGOTO(exit4, rc); + goto exit4; /* target should not be an ancestor of source */ rc = -ENOTEMPTY; if (new_dentry == trap) - SGOTO(exit4, rc); + goto exit4; /* source must exist */ rc = -ENOENT; if (!old_dentry->d_inode) - SGOTO(exit4, rc); + goto exit4; /* unless the source is a directory trailing slashes give -ENOTDIR */ if (!S_ISDIR(old_dentry->d_inode->i_mode)) { rc = -ENOTDIR; if (old_dentry->d_name.name[old_dentry->d_name.len]) - SGOTO(exit4, rc); + goto exit4; if (new_dentry->d_name.name[new_dentry->d_name.len]) - SGOTO(exit4, rc); + goto exit4; } #if defined(HAVE_4ARGS_VFS_RENAME) @@ -502,7 +494,7 @@ exit2: dput(old_dentry); path_put(&old_parent); exit: - SRETURN(-rc); + return (-rc); } EXPORT_SYMBOL(vn_rename); @@ -512,7 +504,6 @@ vn_getattr(vnode_t *vp, vattr_t *vap, int flags, void *x3, void *x4) struct file *fp; struct kstat stat; int rc; - SENTRY; ASSERT(vp); ASSERT(vp->v_file); @@ -526,7 +517,7 @@ vn_getattr(vnode_t *vp, vattr_t *vap, int flags, void *x3, void *x4) rc = vfs_getattr(fp->f_path.mnt, fp->f_dentry, &stat); #endif if (rc) - SRETURN(-rc); + return (-rc); vap->va_type = vn_mode_to_vtype(stat.mode); vap->va_mode = stat.mode; @@ -543,14 +534,13 @@ vn_getattr(vnode_t *vp, vattr_t *vap, int flags, void *x3, void *x4) vap->va_rdev = stat.rdev; vap->va_nblocks = stat.blocks; - SRETURN(0); + return (0); } EXPORT_SYMBOL(vn_getattr); int vn_fsync(vnode_t *vp, int flags, void *x3, void *x4) { int datasync = 0; - SENTRY; ASSERT(vp); ASSERT(vp->v_file); @@ -558,7 +548,7 @@ int vn_fsync(vnode_t *vp, int flags, void *x3, void *x4) if (flags & FDSYNC) datasync = 1; - SRETURN(-spl_filp_fsync(vp->v_file, datasync)); + return (-spl_filp_fsync(vp->v_file, datasync)); } /* vn_fsync() */ EXPORT_SYMBOL(vn_fsync); @@ -566,10 +556,9 @@ int vn_space(vnode_t *vp, int cmd, struct flock *bfp, int flag, offset_t offset, void *x6, void *x7) { int error = EOPNOTSUPP; - SENTRY; if (cmd != F_FREESP || bfp->l_whence != 0) - SRETURN(EOPNOTSUPP); + return (EOPNOTSUPP); ASSERT(vp); ASSERT(vp->v_file); @@ -584,7 +573,7 @@ int vn_space(vnode_t *vp, int cmd, struct flock *bfp, int flag, FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE, bfp->l_start, bfp->l_len); if (error == 0) - SRETURN(0); + return (0); #endif #ifdef HAVE_INODE_TRUNCATE_RANGE @@ -600,7 +589,7 @@ int vn_space(vnode_t *vp, int cmd, struct flock *bfp, int flag, if (end % PAGE_SIZE != 0) { end &= ~(off_t)(PAGE_SIZE - 1); if (end <= bfp->l_start) - SRETURN(0); + return (0); } --end; @@ -608,11 +597,11 @@ int vn_space(vnode_t *vp, int cmd, struct flock *bfp, int flag, vp->v_file->f_dentry->d_inode, bfp->l_start, end ); - SRETURN(0); + return (0); } #endif - SRETURN(error); + return (error); } EXPORT_SYMBOL(vn_space); @@ -642,7 +631,6 @@ vn_getf(int fd) file_t *fp; vnode_t *vp; int rc = 0; - SENTRY; /* Already open just take an extra reference */ spin_lock(&vn_file_lock); @@ -651,7 +639,7 @@ vn_getf(int fd) if (fp) { atomic_inc(&fp->f_ref); spin_unlock(&vn_file_lock); - SRETURN(fp); + return (fp); } spin_unlock(&vn_file_lock); @@ -659,7 +647,7 @@ vn_getf(int fd) /* File was not yet opened create the object and setup */ fp = kmem_cache_alloc(vn_file_cache, KM_SLEEP); if (fp == NULL) - SGOTO(out, rc); + goto out; mutex_enter(&fp->f_lock); @@ -670,11 +658,11 @@ vn_getf(int fd) lfp = fget(fd); if (lfp == NULL) - SGOTO(out_mutex, rc); + goto out_mutex; vp = vn_alloc(KM_SLEEP); if (vp == NULL) - SGOTO(out_fget, rc); + goto out_fget; #ifdef HAVE_2ARGS_VFS_GETATTR rc = vfs_getattr(&lfp->f_path, &stat); @@ -682,7 +670,7 @@ vn_getf(int fd) rc = vfs_getattr(lfp->f_path.mnt, lfp->f_dentry, &stat); #endif if (rc) - SGOTO(out_vnode, rc); + goto out_vnode; mutex_enter(&vp->v_lock); vp->v_type = vn_mode_to_vtype(stat.mode); @@ -698,7 +686,7 @@ vn_getf(int fd) spin_unlock(&vn_file_lock); mutex_exit(&fp->f_lock); - SRETURN(fp); + return (fp); out_vnode: vn_free(vp); @@ -708,7 +696,7 @@ out_mutex: mutex_exit(&fp->f_lock); kmem_cache_free(vn_file_cache, fp); out: - SRETURN(NULL); + return (NULL); } /* getf() */ EXPORT_SYMBOL(getf); @@ -728,7 +716,6 @@ void vn_releasef(int fd) { file_t *fp; - SENTRY; spin_lock(&vn_file_lock); fp = file_find(fd); @@ -736,7 +723,6 @@ vn_releasef(int fd) atomic_dec(&fp->f_ref); if (atomic_read(&fp->f_ref) > 0) { spin_unlock(&vn_file_lock); - SEXIT; return; } @@ -745,7 +731,6 @@ vn_releasef(int fd) } spin_unlock(&vn_file_lock); - SEXIT; return; } /* releasef() */ EXPORT_SYMBOL(releasef); @@ -783,7 +768,6 @@ vn_set_pwd(const char *filename) struct path path; mm_segment_t saved_fs; int rc; - SENTRY; /* * user_path_dir() and __user_walk() both expect 'filename' to be @@ -795,11 +779,11 @@ vn_set_pwd(const char *filename) rc = user_path_dir(filename, &path); if (rc) - SGOTO(out, rc); + goto out; rc = inode_permission(path.dentry->d_inode, MAY_EXEC | MAY_ACCESS); if (rc) - SGOTO(dput_and_out, rc); + goto dput_and_out; vn_set_fs_pwd(current->fs, &path); @@ -808,7 +792,7 @@ dput_and_out: out: set_fs(saved_fs); - SRETURN(-rc); + return (-rc); } /* vn_set_pwd() */ EXPORT_SYMBOL(vn_set_pwd); @@ -853,7 +837,6 @@ vn_file_cache_destructor(void *buf, void *cdrarg) int spl_vn_init(void) { - SENTRY; vn_cache = kmem_cache_create("spl_vn_cache", sizeof(struct vnode), 64, vn_cache_constructor, @@ -865,7 +848,7 @@ spl_vn_init(void) vn_file_cache_constructor, vn_file_cache_destructor, NULL, NULL, NULL, KMC_KMEM); - SRETURN(0); + return (0); } /* vn_init() */ void @@ -873,7 +856,6 @@ spl_vn_fini(void) { file_t *fp, *next_fp; int leaked = 0; - SENTRY; spin_lock(&vn_file_lock); @@ -886,11 +868,10 @@ spl_vn_fini(void) spin_unlock(&vn_file_lock); if (leaked > 0) - SWARN("Warning %d files leaked\n", leaked); + printk(KERN_WARNING "WARNING: %d vnode files leaked\n", leaked); kmem_cache_destroy(vn_file_cache); kmem_cache_destroy(vn_cache); - SEXIT; return; } /* vn_fini() */ diff --git a/module/spl/spl-xdr.c b/module/spl/spl-xdr.c index 62efa31a5..9405dc88d 100644 --- a/module/spl/spl-xdr.c +++ b/module/spl/spl-xdr.c @@ -27,13 +27,6 @@ #include #include #include -#include - -#ifdef SS_DEBUG_SUBSYS -#undef SS_DEBUG_SUBSYS -#endif - -#define SS_DEBUG_SUBSYS SS_XDR /* * SPL's XDR mem implementation. @@ -150,7 +143,6 @@ xdrmem_create(XDR *xdrs, const caddr_t addr, const uint_t size, xdrs->x_ops = &xdrmem_decode_ops; break; default: - SWARN("Invalid op value: %d\n", op); xdrs->x_ops = NULL; /* Let the caller know we failed */ return; } @@ -160,7 +152,6 @@ xdrmem_create(XDR *xdrs, const caddr_t addr, const uint_t size, xdrs->x_addr_end = addr + size; if (xdrs->x_addr_end < xdrs->x_addr) { - SWARN("Overflow while creating xdrmem: %p, %u\n", addr, size); xdrs->x_ops = NULL; } } @@ -171,10 +162,8 @@ xdrmem_control(XDR *xdrs, int req, void *info) { struct xdr_bytesrec *rec = (struct xdr_bytesrec *) info; - if (req != XDR_GET_BYTES_AVAIL) { - SWARN("Called with unknown request: %d\n", req); + if (req != XDR_GET_BYTES_AVAIL) return FALSE; - } rec->xc_is_last_record = TRUE; /* always TRUE in xdrmem streams */ rec->xc_num_avail = xdrs->x_addr_end - xdrs->x_addr; diff --git a/module/spl/spl-zlib.c b/module/spl/spl-zlib.c index 807e743d5..2b8aab865 100644 --- a/module/spl/spl-zlib.c +++ b/module/spl/spl-zlib.c @@ -55,13 +55,6 @@ #include #include -#include - -#ifdef DEBUG_SUBSYSTEM -#undef DEBUG_SUBSYSTEM -#endif - -#define DEBUG_SUBSYSTEM SS_ZLIB static spl_kmem_cache_t *zlib_workspace_cache; @@ -200,7 +193,6 @@ int spl_zlib_init(void) { int size; - SENTRY; size = MAX(spl_zlib_deflate_workspacesize(MAX_WBITS, MAX_MEM_LEVEL), zlib_inflate_workspacesize()); @@ -210,16 +202,14 @@ spl_zlib_init(void) size, 0, NULL, NULL, NULL, NULL, NULL, KMC_VMEM | KMC_NOEMERGENCY); if (!zlib_workspace_cache) - SRETURN(1); + return (1); - SRETURN(0); + return (0); } void spl_zlib_fini(void) { - SENTRY; kmem_cache_destroy(zlib_workspace_cache); zlib_workspace_cache = NULL; - SEXIT; } diff --git a/module/splat/splat-internal.h b/module/splat/splat-internal.h index ea0a88f0c..eff8a9e74 100644 --- a/module/splat/splat-internal.h +++ b/module/splat/splat-internal.h @@ -25,7 +25,6 @@ #ifndef _SPLAT_INTERNAL_H #define _SPLAT_INTERNAL_H -#include "spl-debug.h" #include "splat-ctl.h" #include diff --git a/module/splat/splat-kmem.c b/module/splat/splat-kmem.c index db787ae92..cf47ce65a 100644 --- a/module/splat/splat-kmem.c +++ b/module/splat/splat-kmem.c @@ -313,7 +313,7 @@ splat_kmem_cache_test_kct_alloc(kmem_cache_priv_t *kcp, int id) { kmem_cache_thread_t *kct; - ASSERTF(id < SPLAT_KMEM_THREADS, "id=%d\n", id); + ASSERT3S(id, <, SPLAT_KMEM_THREADS); ASSERT(kcp->kcp_kct[id] == NULL); kct = kmem_zalloc(sizeof(kmem_cache_thread_t), KM_SLEEP); diff --git a/scripts/dkms.mkconf b/scripts/dkms.mkconf index 2fa3dd2b4..67b9dad58 100755 --- a/scripts/dkms.mkconf +++ b/scripts/dkms.mkconf @@ -37,10 +37,6 @@ PRE_BUILD="configure then echo --enable-debug fi - if [[ \${SPL_DKMS_ENABLE_DEBUG_LOG,,} == @(y|yes) ]] - then - echo --enable-debug-log - fi if [[ \${SPL_DKMS_ENABLE_DEBUG_KMEM,,} == @(y|yes) ]] then echo --enable-debug-kmem -- cgit v1.2.3 From a876b0305e94eea9505e7ecbae93cf7a1d24f743 Mon Sep 17 00:00:00 2001 From: Chris Dunlop Date: Thu, 14 May 2015 12:26:51 -0700 Subject: Make taskq_wait() block until the queue is empty Under Illumos taskq_wait() returns when there are no more tasks in the queue. This behavior differs from ZoL and FreeBSD where taskq_wait() returns when all the tasks in the queue at the beginning of the taskq_wait() call are complete. New tasks added whilst taskq_wait() is running will be ignored. This difference in semantics makes it possible that new subtle issues could be introduced when porting changes from Illumos. To avoid that possibility the taskq_wait() function is being updated such that it blocks until the queue in empty. The previous behavior remains available through the taskq_wait_outstanding() interface. Note that this function was previously called taskq_wait_all() but has been renamed to avoid confusion. Signed-off-by: Chris Dunlop Signed-off-by: Brian Behlendorf Closes #455 --- include/sys/taskq.h | 2 +- module/spl/spl-taskq.c | 93 +++++++++++++++++++++++++++------------------- module/splat/splat-taskq.c | 20 +++++----- 3 files changed, 66 insertions(+), 49 deletions(-) (limited to 'module/spl/spl-taskq.c') diff --git a/include/sys/taskq.h b/include/sys/taskq.h index 7b44e8b8a..2c437f0e7 100644 --- a/include/sys/taskq.h +++ b/include/sys/taskq.h @@ -119,7 +119,7 @@ extern void taskq_init_ent(taskq_ent_t *); extern taskq_t *taskq_create(const char *, int, pri_t, int, int, uint_t); extern void taskq_destroy(taskq_t *); extern void taskq_wait_id(taskq_t *, taskqid_t); -extern void taskq_wait_all(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 *); diff --git a/module/spl/spl-taskq.c b/module/spl/spl-taskq.c index 951298d9f..49bb40a25 100644 --- a/module/spl/spl-taskq.c +++ b/module/spl/spl-taskq.c @@ -327,6 +327,33 @@ taskq_find(taskq_t *tq, taskqid_t id, int *active) return (NULL); } +/* + * Theory for the taskq_wait_id(), taskq_wait_outstanding(), and + * taskq_wait() functions below. + * + * Taskq waiting is accomplished by tracking the lowest outstanding task + * id and the next available task id. As tasks are dispatched they are + * added to the tail of the pending, priority, or delay lists. As worker + * threads become available the tasks are removed from the heads of these + * lists and linked to the worker threads. This ensures the lists are + * kept sorted by lowest to highest task id. + * + * Therefore the lowest outstanding task id can be quickly determined by + * checking the head item from all of these lists. This value is stored + * with the taskq as the lowest id. It only needs to be recalculated when + * either the task with the current lowest id completes or is canceled. + * + * By blocking until the lowest task id exceeds the passed task id the + * taskq_wait_outstanding() function can be easily implemented. Similarly, + * by blocking until the lowest task id matches the next task id taskq_wait() + * can be implemented. + * + * Callers should be aware that when there are multiple worked threads it + * is possible for larger task ids to complete before smaller ones. Also + * when the taskq contains delay tasks with small task ids callers may + * block for a considerable length of time waiting for them to expire and + * execute. + */ static int taskq_wait_id_check(taskq_t *tq, taskqid_t id) { @@ -351,34 +378,8 @@ taskq_wait_id(taskq_t *tq, taskqid_t id) } EXPORT_SYMBOL(taskq_wait_id); -/* - * The taskq_wait() function will block until all previously submitted - * tasks have been completed. A previously submitted task is defined as - * a task with a lower task id than the current task queue id. Note that - * all task id's are assigned monotonically at dispatch time. - * - * Waiting for all previous tasks to complete is accomplished by tracking - * the lowest outstanding task id. As tasks are dispatched they are added - * added to the tail of the pending, priority, or delay lists. And as - * worker threads become available the tasks are removed from the heads - * of these lists and linked to the worker threads. This ensures the - * lists are kept in lowest to highest task id order. - * - * Therefore the lowest outstanding task id can be quickly determined by - * checking the head item from all of these lists. This value is stored - * with the task queue as the lowest id. It only needs to be recalculated - * when either the task with the current lowest id completes or is canceled. - * - * By blocking until the lowest task id exceeds the current task id when - * the function was called we ensure all previous tasks have completed. - * - * NOTE: When there are multiple worked threads it is possible for larger - * task ids to complete before smaller ones. Conversely when the task - * queue contains delay tasks with small task ids, you may block for a - * considerable length of time waiting for them to expire and execute. - */ static int -taskq_wait_check(taskq_t *tq, taskqid_t id) +taskq_wait_outstanding_check(taskq_t *tq, taskqid_t id) { int rc; @@ -389,26 +390,42 @@ taskq_wait_check(taskq_t *tq, taskqid_t id) return (rc); } +/* + * The taskq_wait_outstanding() function will block until all tasks with a + * lower taskqid than the passed 'id' have been completed. Note that all + * task id's are assigned monotonically at dispatch time. Zero may be + * passed for the id to indicate all tasks dispatch up to this point, + * but not after, should be waited for. + */ void -taskq_wait_all(taskq_t *tq, taskqid_t id) +taskq_wait_outstanding(taskq_t *tq, taskqid_t id) { - wait_event(tq->tq_wait_waitq, taskq_wait_check(tq, id)); + wait_event(tq->tq_wait_waitq, + taskq_wait_outstanding_check(tq, id ? id : tq->tq_next_id - 1)); } -EXPORT_SYMBOL(taskq_wait_all); +EXPORT_SYMBOL(taskq_wait_outstanding); -void -taskq_wait(taskq_t *tq) +static int +taskq_wait_check(taskq_t *tq) { - taskqid_t id; - - ASSERT(tq); + int rc; - /* Wait for the largest outstanding taskqid */ spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); - id = tq->tq_next_id - 1; + rc = (tq->tq_lowest_id == tq->tq_next_id); spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); - taskq_wait_all(tq, id); + return (rc); +} + +/* + * The taskq_wait() function will block until the taskq is empty. + * This means that if a taskq re-dispatches work to itself taskq_wait() + * callers will block indefinitely. + */ +void +taskq_wait(taskq_t *tq) +{ + wait_event(tq->tq_wait_waitq, taskq_wait_check(tq)); } EXPORT_SYMBOL(taskq_wait); diff --git a/module/splat/splat-taskq.c b/module/splat/splat-taskq.c index 2787bf401..7d4ad5b69 100644 --- a/module/splat/splat-taskq.c +++ b/module/splat/splat-taskq.c @@ -588,10 +588,10 @@ splat_taskq_test4(struct file *file, void *arg) * next pending task as soon as it completes its current task. This * means that tasks do not strictly complete in order in which they * were dispatched (increasing task id). This is fine but we need to - * verify that taskq_wait_all() blocks until the passed task id and all - * lower task ids complete. We do this by dispatching the following + * verify taskq_wait_outstanding() blocks until the passed task id and + * all lower task ids complete. We do this by dispatching the following * specific sequence of tasks each of which block for N time units. - * We then use taskq_wait_all() to unblock at specific task id and + * We then use taskq_wait_outstanding() to unblock at specific task id and * verify the only the expected task ids have completed and in the * correct order. The two cases of interest are: * @@ -602,17 +602,17 @@ splat_taskq_test4(struct file *file, void *arg) * * The following table shows each task id and how they will be * scheduled. Each rows represent one time unit and each column - * one of the three worker threads. The places taskq_wait_all() + * one of the three worker threads. The places taskq_wait_outstanding() * must unblock for a specific id are identified as well as the * task ids which must have completed and their order. * - * +-----+ <--- taskq_wait_all(tq, 8) unblocks + * +-----+ <--- taskq_wait_outstanding(tq, 8) unblocks * | | Required Completion Order: 1,2,4,5,3,8,6,7 * +-----+ | * | | | * | | +-----+ * | | | 8 | - * | | +-----+ <--- taskq_wait_all(tq, 3) unblocks + * | | +-----+ <--- taskq_wait_outstanding(tq, 3) unblocks * | | 7 | | Required Completion Order: 1,2,4,5,3 * | +-----+ | * | 6 | | | @@ -755,13 +755,13 @@ splat_taskq_test5_impl(struct file *file, void *arg, boolean_t prealloc) splat_vprint(file, SPLAT_TASKQ_TEST5_NAME, "Taskq '%s' " "waiting for taskqid %d completion\n", tq_arg.name, 3); - taskq_wait_all(tq, 3); + taskq_wait_outstanding(tq, 3); if ((rc = splat_taskq_test_order(&tq_arg, order1))) goto out; splat_vprint(file, SPLAT_TASKQ_TEST5_NAME, "Taskq '%s' " "waiting for taskqid %d completion\n", tq_arg.name, 8); - taskq_wait_all(tq, 8); + taskq_wait_outstanding(tq, 8); rc = splat_taskq_test_order(&tq_arg, order2); out: @@ -923,7 +923,7 @@ splat_taskq_test6_impl(struct file *file, void *arg, boolean_t prealloc) splat_vprint(file, SPLAT_TASKQ_TEST6_NAME, "Taskq '%s' " "waiting for taskqid %d completion\n", tq_arg.name, SPLAT_TASKQ_ORDER_MAX); - taskq_wait_all(tq, SPLAT_TASKQ_ORDER_MAX); + taskq_wait_outstanding(tq, SPLAT_TASKQ_ORDER_MAX); rc = splat_taskq_test_order(&tq_arg, order); out: @@ -1030,7 +1030,7 @@ splat_taskq_test7_impl(struct file *file, void *arg, boolean_t prealloc) if (tq_arg->flag == 0) { splat_vprint(file, SPLAT_TASKQ_TEST7_NAME, "Taskq '%s' waiting\n", tq_arg->name); - taskq_wait_all(tq, SPLAT_TASKQ_DEPTH_MAX); + taskq_wait_outstanding(tq, SPLAT_TASKQ_DEPTH_MAX); } error = (tq_arg->depth == SPLAT_TASKQ_DEPTH_MAX ? 0 : -EINVAL); -- cgit v1.2.3 From f7a973d99b5e272f4a6223b8fb7db4fc6d363b41 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Mon, 8 Jun 2015 14:36:27 -0700 Subject: Add TASKQ_DYNAMIC feature Setting the TASKQ_DYNAMIC flag will create a taskq with dynamic semantics. Initially only a single worker thread will be created to service tasks dispatched to the queue. As additional threads are needed they will be dynamically spawned up to the max number specified by 'nthreads'. When the threads are no longer needed, because the taskq is empty, they will automatically terminate. Due to the low cost of creating and destroying threads under Linux by default new threads and spawned and terminated aggressively. There are two modules options which can be tuned to adjust this behavior if needed. * spl_taskq_thread_sequential - The number of sequential tasks, without interruption, which needed to be handled by a worker thread before a new worker thread is spawned. Default 4. * spl_taskq_thread_dynamic - Provides the ability to completely disable the use of dynamic taskqs on the system. This is provided for the purposes of debugging and troubleshooting. Default 1 (enabled). This behavior is fundamentally consistent with the dynamic taskq implementation found in both illumos and FreeBSD. Signed-off-by: Brian Behlendorf Signed-off-by: Tim Chase Closes #458 --- include/sys/taskq.h | 8 +- man/man5/spl-module-parameters.5 | 34 +++++ module/spl/spl-taskq.c | 292 ++++++++++++++++++++++++++++++--------- module/splat/splat-taskq.c | 163 ++++++++++++++-------- 4 files changed, 371 insertions(+), 126 deletions(-) (limited to 'module/spl/spl-taskq.c') diff --git a/include/sys/taskq.h b/include/sys/taskq.h index 2c437f0e7..a43a86da6 100644 --- a/include/sys/taskq.h +++ b/include/sys/taskq.h @@ -40,6 +40,7 @@ #define TASKQ_DYNAMIC 0x00000004 #define TASKQ_THREADS_CPU_PCT 0x00000008 #define TASKQ_DC_BATCH 0x00000010 +#define TASKQ_ACTIVE 0x80000000 /* * Flags for taskq_dispatch. TQ_SLEEP/TQ_NOSLEEP should be same as @@ -53,7 +54,6 @@ #define TQ_NOALLOC 0x02000000 #define TQ_NEW 0x04000000 #define TQ_FRONT 0x08000000 -#define TQ_ACTIVE 0x80000000 typedef unsigned long taskqid_t; typedef void (task_func_t)(void *); @@ -61,11 +61,13 @@ typedef void (task_func_t)(void *); typedef struct taskq { spinlock_t tq_lock; /* protects taskq_t */ unsigned long tq_lock_flags; /* interrupt state */ - const char *tq_name; /* taskq name */ + char *tq_name; /* taskq name */ struct list_head tq_thread_list;/* list of all threads */ struct list_head tq_active_list;/* list of active threads */ int tq_nactive; /* # of active threads */ - int tq_nthreads; /* # of total threads */ + int tq_nthreads; /* # of existing threads */ + int tq_nspawn; /* # of threads being spawned */ + int tq_maxthreads; /* # of threads maximum */ int tq_pri; /* priority */ int tq_minalloc; /* min task_t pool size */ int tq_maxalloc; /* max task_t pool size */ diff --git a/man/man5/spl-module-parameters.5 b/man/man5/spl-module-parameters.5 index 3e7e877fb..fc38605b2 100644 --- a/man/man5/spl-module-parameters.5 +++ b/man/man5/spl-module-parameters.5 @@ -249,3 +249,37 @@ where a thread should run. .sp Default value: \fB0\fR .RE + +.sp +.ne 2 +.na +\fBspl_taskq_thread_dynamic\fR (int) +.ad +.RS 12n +Allow dynamic taskqs. When enabled taskqs which set the TASKQ_DYNAMIC flag +will by default create only a single thread. New threads will be created on +demand up to a maximum allowed number to facilitate the completion of +outstanding tasks. Threads which are no longer needed will be promptly +destroyed. By default this behavior is enabled but it can be disabled to +aid performance analysis or troubleshooting. +.sp +Default value: \fB1\fR +.RE + +.sp +.ne 2 +.na +\fBspl_taskq_thread_sequential\fR (int) +.ad +.RS 12n +The number of items a taskq worker thread must handle without interruption +before requesting a new worker thread be spawned. This is used to control +how quickly taskqs ramp up the number of threads processing the queue. +Because Linux thread creation and destruction are relatively inexpensive a +small default value has been selected. This means that normally threads will +be created aggressively which is desirable. Increasing this value will +result in a slower thread creation rate which may be preferable for some +configurations. +.sp +Default value: \fB4\fR +.RE diff --git a/module/spl/spl-taskq.c b/module/spl/spl-taskq.c index 49bb40a25..9cd193369 100644 --- a/module/spl/spl-taskq.c +++ b/module/spl/spl-taskq.c @@ -31,10 +31,24 @@ int spl_taskq_thread_bind = 0; module_param(spl_taskq_thread_bind, int, 0644); MODULE_PARM_DESC(spl_taskq_thread_bind, "Bind taskq thread to CPU by default"); + +int spl_taskq_thread_dynamic = 1; +module_param(spl_taskq_thread_dynamic, int, 0644); +MODULE_PARM_DESC(spl_taskq_thread_dynamic, "Allow dynamic taskq threads"); + +int spl_taskq_thread_sequential = 4; +module_param(spl_taskq_thread_sequential, int, 0644); +MODULE_PARM_DESC(spl_taskq_thread_sequential, + "Create new taskq threads after N sequential tasks"); + /* Global system-wide dynamic task queue available for all consumers */ taskq_t *system_taskq; EXPORT_SYMBOL(system_taskq); +/* Private dedicated taskq for creating new taskq threads on demand. */ +static taskq_t *dynamic_taskq; +static taskq_thread_t *taskq_thread_create(taskq_t *); + static int task_km_flags(uint_t flags) { @@ -434,17 +448,22 @@ taskq_member(taskq_t *tq, void *t) { struct list_head *l; taskq_thread_t *tqt; + int found = 0; ASSERT(tq); ASSERT(t); + spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); list_for_each(l, &tq->tq_thread_list) { tqt = list_entry(l, taskq_thread_t, tqt_thread_list); - if (tqt->tqt_thread == (struct task_struct *)t) - return (1); + if (tqt->tqt_thread == (struct task_struct *)t) { + found = 1; + break; + } } + spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); - return (0); + return (found); } EXPORT_SYMBOL(taskq_member); @@ -516,7 +535,7 @@ taskq_dispatch(taskq_t *tq, task_func_t func, void *arg, uint_t flags) spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); /* Taskq being destroyed and all tasks drained */ - if (!(tq->tq_flags & TQ_ACTIVE)) + if (!(tq->tq_flags & TASKQ_ACTIVE)) goto out; /* Do not queue the task unless there is idle thread for it */ @@ -568,7 +587,7 @@ taskq_dispatch_delay(taskq_t *tq, task_func_t func, void *arg, spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); /* Taskq being destroyed and all tasks drained */ - if (!(tq->tq_flags & TQ_ACTIVE)) + if (!(tq->tq_flags & TASKQ_ACTIVE)) goto out; if ((t = task_alloc(tq, flags)) == NULL) @@ -604,12 +623,11 @@ taskq_dispatch_ent(taskq_t *tq, task_func_t func, void *arg, uint_t flags, { ASSERT(tq); ASSERT(func); - ASSERT(!(tq->tq_flags & TASKQ_DYNAMIC)); spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); /* Taskq being destroyed and all tasks drained */ - if (!(tq->tq_flags & TQ_ACTIVE)) { + if (!(tq->tq_flags & TASKQ_ACTIVE)) { t->tqent_id = 0; goto out; } @@ -664,6 +682,97 @@ taskq_init_ent(taskq_ent_t *t) } EXPORT_SYMBOL(taskq_init_ent); +/* + * Return the next pending task, preference is given to tasks on the + * priority list which were dispatched with TQ_FRONT. + */ +static taskq_ent_t * +taskq_next_ent(taskq_t *tq) +{ + struct list_head *list; + + ASSERT(spin_is_locked(&tq->tq_lock)); + + if (!list_empty(&tq->tq_prio_list)) + list = &tq->tq_prio_list; + else if (!list_empty(&tq->tq_pend_list)) + list = &tq->tq_pend_list; + else + return (NULL); + + return (list_entry(list->next, taskq_ent_t, tqent_list)); +} + +/* + * Spawns a new thread for the specified taskq. + */ +static void +taskq_thread_spawn_task(void *arg) +{ + taskq_t *tq = (taskq_t *)arg; + + (void) taskq_thread_create(tq); + + spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); + tq->tq_nspawn--; + spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); +} + +/* + * Spawn addition threads for dynamic taskqs (TASKQ_DYNMAIC) the current + * number of threads is insufficient to handle the pending tasks. These + * new threads must be created by the dedicated dynamic_taskq to avoid + * deadlocks between thread creation and memory reclaim. The system_taskq + * which is also a dynamic taskq cannot be safely used for this. + */ +static int +taskq_thread_spawn(taskq_t *tq, int seq_tasks) +{ + int spawning = 0; + + if (!(tq->tq_flags & TASKQ_DYNAMIC)) + return (0); + + if ((seq_tasks > spl_taskq_thread_sequential) && + (tq->tq_nthreads + tq->tq_nspawn < tq->tq_maxthreads) && + (tq->tq_flags & TASKQ_ACTIVE)) { + spawning = (++tq->tq_nspawn); + taskq_dispatch(dynamic_taskq, taskq_thread_spawn_task, + tq, TQ_NOSLEEP); + } + + return (spawning); +} + +/* + * Threads in a dynamic taskq should only exit once it has been completely + * drained and no other threads are actively servicing tasks. This prevents + * threads from being created and destroyed more than is required. + * + * The first thread is the thread list is treated as the primary thread. + * There is nothing special about the primary thread but in order to avoid + * all the taskq pids from changing we opt to make it long running. + */ +static int +taskq_thread_should_stop(taskq_t *tq, taskq_thread_t *tqt) +{ + ASSERT(spin_is_locked(&tq->tq_lock)); + + if (!(tq->tq_flags & TASKQ_DYNAMIC)) + return (0); + + if (list_first_entry(&(tq->tq_thread_list), taskq_thread_t, + tqt_thread_list) == tqt) + return (0); + + return + ((tq->tq_nspawn == 0) && /* No threads are being spawned */ + (tq->tq_nactive == 0) && /* No threads are handling tasks */ + (tq->tq_nthreads > 1) && /* More than 1 thread is running */ + (!taskq_next_ent(tq)) && /* There are no pending tasks */ + (spl_taskq_thread_dynamic));/* Dynamic taskqs are allowed */ +} + static int taskq_thread(void *args) { @@ -672,7 +781,7 @@ taskq_thread(void *args) taskq_thread_t *tqt = args; taskq_t *tq; taskq_ent_t *t; - struct list_head *pend_list; + int seq_tasks = 0; ASSERT(tqt); tq = tqt->tqt_tq; @@ -683,7 +792,13 @@ taskq_thread(void *args) flush_signals(current); spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); + + /* Immediately exit if more threads than allowed were created. */ + if (tq->tq_nthreads >= tq->tq_maxthreads) + goto error; + tq->tq_nthreads++; + list_add_tail(&tqt->tqt_thread_list, &tq->tq_thread_list); wake_up(&tq->tq_wait_waitq); set_current_state(TASK_INTERRUPTIBLE); @@ -691,25 +806,25 @@ taskq_thread(void *args) if (list_empty(&tq->tq_pend_list) && list_empty(&tq->tq_prio_list)) { + + if (taskq_thread_should_stop(tq, tqt)) { + wake_up_all(&tq->tq_wait_waitq); + break; + } + add_wait_queue_exclusive(&tq->tq_work_waitq, &wait); spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); + schedule(); + seq_tasks = 0; + spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); remove_wait_queue(&tq->tq_work_waitq, &wait); } else { __set_current_state(TASK_RUNNING); } - - if (!list_empty(&tq->tq_prio_list)) - pend_list = &tq->tq_prio_list; - else if (!list_empty(&tq->tq_pend_list)) - pend_list = &tq->tq_pend_list; - else - pend_list = NULL; - - if (pend_list) { - t = list_entry(pend_list->next,taskq_ent_t,tqent_list); + if ((t = taskq_next_ent(tq)) != NULL) { list_del_init(&t->tqent_list); /* In order to support recursively dispatching a @@ -738,8 +853,7 @@ taskq_thread(void *args) tqt->tqt_task = NULL; /* For prealloc'd tasks, we don't free anything. */ - if ((tq->tq_flags & TASKQ_DYNAMIC) || - !(tqt->tqt_flags & TQENT_FLAG_PREALLOC)) + if (!(tqt->tqt_flags & TQENT_FLAG_PREALLOC)) task_done(tq, t); /* When the current lowest outstanding taskqid is @@ -749,9 +863,16 @@ taskq_thread(void *args) ASSERT3S(tq->tq_lowest_id, >, tqt->tqt_id); } + /* Spawn additional taskq threads if required. */ + if (taskq_thread_spawn(tq, ++seq_tasks)) + seq_tasks = 0; + tqt->tqt_id = 0; tqt->tqt_flags = 0; wake_up_all(&tq->tq_wait_waitq); + } else { + if (taskq_thread_should_stop(tq, tqt)) + break; } set_current_state(TASK_INTERRUPTIBLE); @@ -761,27 +882,56 @@ taskq_thread(void *args) __set_current_state(TASK_RUNNING); tq->tq_nthreads--; list_del_init(&tqt->tqt_thread_list); - kmem_free(tqt, sizeof(taskq_thread_t)); - +error: + kmem_free(tqt, sizeof (taskq_thread_t)); spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); return (0); } +static taskq_thread_t * +taskq_thread_create(taskq_t *tq) +{ + static int last_used_cpu = 0; + taskq_thread_t *tqt; + + tqt = kmem_alloc(sizeof (*tqt), KM_PUSHPAGE); + INIT_LIST_HEAD(&tqt->tqt_thread_list); + INIT_LIST_HEAD(&tqt->tqt_active_list); + tqt->tqt_tq = tq; + tqt->tqt_id = 0; + + tqt->tqt_thread = spl_kthread_create(taskq_thread, tqt, + "%s", tq->tq_name); + if (tqt->tqt_thread == NULL) { + kmem_free(tqt, sizeof (taskq_thread_t)); + return (NULL); + } + + if (spl_taskq_thread_bind) { + last_used_cpu = (last_used_cpu + 1) % num_online_cpus(); + kthread_bind(tqt->tqt_thread, last_used_cpu); + } + + set_user_nice(tqt->tqt_thread, PRIO_TO_NICE(tq->tq_pri)); + wake_up_process(tqt->tqt_thread); + + return (tqt); +} + taskq_t * taskq_create(const char *name, int nthreads, pri_t pri, int minalloc, int maxalloc, uint_t flags) { - static int last_used_cpu = 0; taskq_t *tq; taskq_thread_t *tqt; - int rc = 0, i, j = 0; + int count = 0, rc = 0, i; ASSERT(name != NULL); ASSERT(pri <= maxclsyspri); ASSERT(minalloc >= 0); ASSERT(maxalloc <= INT_MAX); - ASSERT(!(flags & (TASKQ_CPR_SAFE | TASKQ_DYNAMIC))); /* Unsupported */ + ASSERT(!(flags & (TASKQ_CPR_SAFE))); /* Unsupported */ /* Scale the number of threads using nthreads as a percentage */ if (flags & TASKQ_THREADS_CPU_PCT) { @@ -792,24 +942,25 @@ taskq_create(const char *name, int nthreads, pri_t pri, nthreads = MAX((num_online_cpus() * nthreads) / 100, 1); } - tq = kmem_alloc(sizeof(*tq), KM_PUSHPAGE); + tq = kmem_alloc(sizeof (*tq), KM_PUSHPAGE); if (tq == NULL) return (NULL); spin_lock_init(&tq->tq_lock); - spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); INIT_LIST_HEAD(&tq->tq_thread_list); INIT_LIST_HEAD(&tq->tq_active_list); - tq->tq_name = name; - tq->tq_nactive = 0; - tq->tq_nthreads = 0; - tq->tq_pri = pri; - tq->tq_minalloc = minalloc; - tq->tq_maxalloc = maxalloc; - tq->tq_nalloc = 0; - tq->tq_flags = (flags | TQ_ACTIVE); - tq->tq_next_id = 1; - tq->tq_lowest_id = 1; + tq->tq_name = strdup(name); + tq->tq_nactive = 0; + tq->tq_nthreads = 0; + tq->tq_nspawn = 0; + tq->tq_maxthreads = nthreads; + tq->tq_pri = pri; + tq->tq_minalloc = minalloc; + tq->tq_maxalloc = maxalloc; + tq->tq_nalloc = 0; + tq->tq_flags = (flags | TASKQ_ACTIVE); + tq->tq_next_id = 1; + tq->tq_lowest_id = 1; INIT_LIST_HEAD(&tq->tq_free_list); INIT_LIST_HEAD(&tq->tq_pend_list); INIT_LIST_HEAD(&tq->tq_prio_list); @@ -817,38 +968,28 @@ taskq_create(const char *name, int nthreads, pri_t pri, init_waitqueue_head(&tq->tq_work_waitq); init_waitqueue_head(&tq->tq_wait_waitq); - if (flags & TASKQ_PREPOPULATE) + if (flags & TASKQ_PREPOPULATE) { + spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); + for (i = 0; i < minalloc; i++) task_done(tq, task_alloc(tq, TQ_PUSHPAGE | TQ_NEW)); - spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); + spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); + } + + if ((flags & TASKQ_DYNAMIC) && spl_taskq_thread_dynamic) + nthreads = 1; for (i = 0; i < nthreads; i++) { - tqt = kmem_alloc(sizeof(*tqt), KM_PUSHPAGE); - INIT_LIST_HEAD(&tqt->tqt_thread_list); - INIT_LIST_HEAD(&tqt->tqt_active_list); - tqt->tqt_tq = tq; - tqt->tqt_id = 0; - - tqt->tqt_thread = spl_kthread_create(taskq_thread, tqt, - "%s/%d", name, i); - if (tqt->tqt_thread) { - list_add(&tqt->tqt_thread_list, &tq->tq_thread_list); - if (spl_taskq_thread_bind) { - last_used_cpu = (last_used_cpu + 1) % num_online_cpus(); - kthread_bind(tqt->tqt_thread, last_used_cpu); - } - set_user_nice(tqt->tqt_thread, PRIO_TO_NICE(pri)); - wake_up_process(tqt->tqt_thread); - j++; - } else { - kmem_free(tqt, sizeof(taskq_thread_t)); + tqt = taskq_thread_create(tq); + if (tqt == NULL) rc = 1; - } + else + count++; } /* Wait for all threads to be started before potential destroy */ - wait_event(tq->tq_wait_waitq, tq->tq_nthreads == j); + wait_event(tq->tq_wait_waitq, tq->tq_nthreads == count); if (rc) { taskq_destroy(tq); @@ -868,10 +1009,16 @@ taskq_destroy(taskq_t *tq) ASSERT(tq); spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); - tq->tq_flags &= ~TQ_ACTIVE; + tq->tq_flags &= ~TASKQ_ACTIVE; spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); - /* TQ_ACTIVE cleared prevents new tasks being added to pending */ + /* + * When TASKQ_ACTIVE is clear new tasks may not be added nor may + * new worker threads be spawned for dynamic taskq. + */ + if (dynamic_taskq != NULL) + taskq_wait_outstanding(dynamic_taskq, 0); + taskq_wait(tq); spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); @@ -884,7 +1031,7 @@ taskq_destroy(taskq_t *tq) */ while (!list_empty(&tq->tq_thread_list)) { tqt = list_entry(tq->tq_thread_list.next, - taskq_thread_t, tqt_thread_list); + taskq_thread_t, tqt_thread_list); thread = tqt->tqt_thread; spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); @@ -902,8 +1049,9 @@ taskq_destroy(taskq_t *tq) task_free(tq, t); } - ASSERT(tq->tq_nthreads == 0); - ASSERT(tq->tq_nalloc == 0); + ASSERT0(tq->tq_nthreads); + ASSERT0(tq->tq_nalloc); + ASSERT0(tq->tq_nspawn); ASSERT(list_empty(&tq->tq_thread_list)); ASSERT(list_empty(&tq->tq_active_list)); ASSERT(list_empty(&tq->tq_free_list)); @@ -913,7 +1061,8 @@ taskq_destroy(taskq_t *tq) spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); - kmem_free(tq, sizeof(taskq_t)); + strfree(tq->tq_name); + kmem_free(tq, sizeof (taskq_t)); } EXPORT_SYMBOL(taskq_destroy); @@ -927,11 +1076,22 @@ spl_taskq_init(void) if (system_taskq == NULL) return (1); + dynamic_taskq = taskq_create("spl_dynamic_taskq", 1, + minclsyspri, boot_ncpus, INT_MAX, TASKQ_PREPOPULATE); + if (dynamic_taskq == NULL) { + taskq_destroy(system_taskq); + return (1); + } + return (0); } void spl_taskq_fini(void) { + taskq_destroy(dynamic_taskq); + dynamic_taskq = NULL; + taskq_destroy(system_taskq); + system_taskq = NULL; } diff --git a/module/splat/splat-taskq.c b/module/splat/splat-taskq.c index 7d4ad5b69..645bc9145 100644 --- a/module/splat/splat-taskq.c +++ b/module/splat/splat-taskq.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include "splat-internal.h" @@ -75,6 +76,10 @@ #define SPLAT_TASKQ_TEST10_NAME "cancel" #define SPLAT_TASKQ_TEST10_DESC "Cancel task execution" +#define SPLAT_TASKQ_TEST11_ID 0x020b +#define SPLAT_TASKQ_TEST11_NAME "dynamic" +#define SPLAT_TASKQ_TEST11_DESC "Dynamic task queue thread creation" + #define SPLAT_TASKQ_ORDER_MAX 8 #define SPLAT_TASKQ_DEPTH_MAX 16 @@ -1052,21 +1057,15 @@ splat_taskq_test7(struct file *file, void *arg) rc = splat_taskq_test7_impl(file, arg, B_FALSE); if (rc) - return rc; + return (rc); rc = splat_taskq_test7_impl(file, arg, B_TRUE); - return rc; + return (rc); } -/* - * Create a taskq with 100 threads and dispatch a huge number of trivial - * tasks to generate contention on tq->tq_lock. This test should always - * pass. The purpose is to provide a benchmark for measuring the - * effectiveness of taskq optimizations. - */ static void -splat_taskq_test8_func(void *arg) +splat_taskq_throughput_func(void *arg) { splat_taskq_arg_t *tq_arg = (splat_taskq_arg_t *)arg; ASSERT(tq_arg); @@ -1074,98 +1073,105 @@ splat_taskq_test8_func(void *arg) atomic_inc(tq_arg->count); } -#define TEST8_NUM_TASKS 0x20000 -#define TEST8_THREADS_PER_TASKQ 100 - static int -splat_taskq_test8_common(struct file *file, void *arg, int minalloc, - int maxalloc) +splat_taskq_throughput(struct file *file, void *arg, const char *name, + int nthreads, int minalloc, int maxalloc, int flags, int tasks, + struct timespec *delta) { taskq_t *tq; taskqid_t id; splat_taskq_arg_t tq_arg; taskq_ent_t **tqes; atomic_t count; + struct timespec start, stop; int i, j, rc = 0; - tqes = vmalloc(sizeof(*tqes) * TEST8_NUM_TASKS); + tqes = vmalloc(sizeof (*tqes) * tasks); if (tqes == NULL) - return -ENOMEM; - memset(tqes, 0, sizeof(*tqes) * TEST8_NUM_TASKS); - - splat_vprint(file, SPLAT_TASKQ_TEST8_NAME, - "Taskq '%s' creating (%d/%d/%d)\n", - SPLAT_TASKQ_TEST8_NAME, - minalloc, maxalloc, TEST8_NUM_TASKS); - if ((tq = taskq_create(SPLAT_TASKQ_TEST8_NAME, TEST8_THREADS_PER_TASKQ, - maxclsyspri, minalloc, maxalloc, - TASKQ_PREPOPULATE)) == NULL) { - splat_vprint(file, SPLAT_TASKQ_TEST8_NAME, - "Taskq '%s' create failed\n", - SPLAT_TASKQ_TEST8_NAME); + return (-ENOMEM); + + memset(tqes, 0, sizeof (*tqes) * tasks); + + splat_vprint(file, name, "Taskq '%s' creating (%d/%d/%d/%d)\n", + name, nthreads, minalloc, maxalloc, tasks); + if ((tq = taskq_create(name, nthreads, maxclsyspri, + minalloc, maxalloc, flags)) == NULL) { + splat_vprint(file, name, "Taskq '%s' create failed\n", name); rc = -EINVAL; goto out_free; } tq_arg.file = file; - tq_arg.name = SPLAT_TASKQ_TEST8_NAME; + tq_arg.name = name; tq_arg.count = &count; atomic_set(tq_arg.count, 0); - for (i = 0; i < TEST8_NUM_TASKS; i++) { - tqes[i] = kmalloc(sizeof(taskq_ent_t), GFP_KERNEL); + getnstimeofday(&start); + + for (i = 0; i < tasks; i++) { + tqes[i] = kmalloc(sizeof (taskq_ent_t), GFP_KERNEL); if (tqes[i] == NULL) { rc = -ENOMEM; goto out; } - taskq_init_ent(tqes[i]); - - taskq_dispatch_ent(tq, splat_taskq_test8_func, - &tq_arg, TQ_SLEEP, tqes[i]); + taskq_init_ent(tqes[i]); + taskq_dispatch_ent(tq, splat_taskq_throughput_func, + &tq_arg, TQ_SLEEP, tqes[i]); id = tqes[i]->tqent_id; if (id == 0) { - splat_vprint(file, SPLAT_TASKQ_TEST8_NAME, - "Taskq '%s' function '%s' dispatch " - "%d failed\n", tq_arg.name, - sym2str(splat_taskq_test8_func), i); - rc = -EINVAL; - goto out; + splat_vprint(file, name, "Taskq '%s' function '%s' " + "dispatch %d failed\n", tq_arg.name, + sym2str(splat_taskq_throughput_func), i); + rc = -EINVAL; + goto out; } } - splat_vprint(file, SPLAT_TASKQ_TEST8_NAME, "Taskq '%s' " - "waiting for %d dispatches\n", tq_arg.name, - TEST8_NUM_TASKS); + splat_vprint(file, name, "Taskq '%s' waiting for %d dispatches\n", + tq_arg.name, tasks); + taskq_wait(tq); - splat_vprint(file, SPLAT_TASKQ_TEST8_NAME, "Taskq '%s' " - "%d/%d dispatches finished\n", tq_arg.name, - atomic_read(tq_arg.count), TEST8_NUM_TASKS); - if (atomic_read(tq_arg.count) != TEST8_NUM_TASKS) + if (delta != NULL) { + getnstimeofday(&stop); + *delta = timespec_sub(stop, start); + } + + splat_vprint(file, name, "Taskq '%s' %d/%d dispatches finished\n", + tq_arg.name, atomic_read(tq_arg.count), tasks); + + if (atomic_read(tq_arg.count) != tasks) rc = -ERANGE; out: - splat_vprint(file, SPLAT_TASKQ_TEST8_NAME, "Taskq '%s' destroying\n", - tq_arg.name); + splat_vprint(file, name, "Taskq '%s' destroying\n", tq_arg.name); taskq_destroy(tq); out_free: - for (j = 0; j < TEST8_NUM_TASKS && tqes[j] != NULL; j++) + for (j = 0; j < tasks && tqes[j] != NULL; j++) kfree(tqes[j]); + vfree(tqes); - return rc; + return (rc); } +/* + * Create a taskq with 100 threads and dispatch a huge number of trivial + * tasks to generate contention on tq->tq_lock. This test should always + * pass. The purpose is to provide a benchmark for measuring the + * effectiveness of taskq optimizations. + */ +#define TEST8_NUM_TASKS 0x20000 +#define TEST8_THREADS_PER_TASKQ 100 + static int splat_taskq_test8(struct file *file, void *arg) { - int rc; - - rc = splat_taskq_test8_common(file, arg, 1, 100); - - return rc; + return (splat_taskq_throughput(file, arg, + SPLAT_TASKQ_TEST8_NAME, TEST8_THREADS_PER_TASKQ, + 1, INT_MAX, TASKQ_PREPOPULATE, TEST8_NUM_TASKS, NULL)); } /* @@ -1433,6 +1439,46 @@ out_free: return rc; } +/* + * Create a dynamic taskq with 100 threads and dispatch a huge number of + * trivial tasks. This will cause the taskq to grow quickly to its max + * thread count. This test should always pass. The purpose is to provide + * a benchmark for measuring the performance of dynamic taskqs. + */ +#define TEST11_NUM_TASKS 100000 +#define TEST11_THREADS_PER_TASKQ 100 + +static int +splat_taskq_test11(struct file *file, void *arg) +{ + struct timespec normal, dynamic; + int error; + + error = splat_taskq_throughput(file, arg, SPLAT_TASKQ_TEST11_NAME, + TEST11_THREADS_PER_TASKQ, 1, INT_MAX, + TASKQ_PREPOPULATE, TEST11_NUM_TASKS, &normal); + if (error) + return (error); + + error = splat_taskq_throughput(file, arg, SPLAT_TASKQ_TEST11_NAME, + TEST11_THREADS_PER_TASKQ, 1, INT_MAX, + TASKQ_PREPOPULATE | TASKQ_DYNAMIC, TEST11_NUM_TASKS, &dynamic); + if (error) + return (error); + + splat_vprint(file, SPLAT_TASKQ_TEST11_NAME, + "Timing taskq_wait(): normal=%ld.%09lds, dynamic=%ld.%09lds\n", + normal.tv_sec, normal.tv_nsec, + dynamic.tv_sec, dynamic.tv_nsec); + + /* A 10x increase in runtime is used to indicate a core problem. */ + if ((dynamic.tv_sec * NANOSEC + dynamic.tv_nsec) > + ((normal.tv_sec * NANOSEC + normal.tv_nsec) * 10)) + error = -ETIME; + + return (error); +} + splat_subsystem_t * splat_taskq_init(void) { @@ -1470,6 +1516,8 @@ splat_taskq_init(void) SPLAT_TASKQ_TEST9_ID, splat_taskq_test9); SPLAT_TEST_INIT(sub, SPLAT_TASKQ_TEST10_NAME, SPLAT_TASKQ_TEST10_DESC, SPLAT_TASKQ_TEST10_ID, splat_taskq_test10); + SPLAT_TEST_INIT(sub, SPLAT_TASKQ_TEST11_NAME, SPLAT_TASKQ_TEST11_DESC, + SPLAT_TASKQ_TEST11_ID, splat_taskq_test11); return sub; } @@ -1478,6 +1526,7 @@ void splat_taskq_fini(splat_subsystem_t *sub) { ASSERT(sub); + SPLAT_TEST_FINI(sub, SPLAT_TASKQ_TEST11_ID); SPLAT_TEST_FINI(sub, SPLAT_TASKQ_TEST10_ID); SPLAT_TEST_FINI(sub, SPLAT_TASKQ_TEST9_ID); SPLAT_TEST_FINI(sub, SPLAT_TASKQ_TEST8_ID); -- cgit v1.2.3 From 3c82160ff2feb86fb7275fd941d203167340a187 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Wed, 24 Jun 2015 09:53:47 -0700 Subject: Set TASKQ_DYNAMIC for kmem and system taskqs Add the TASKQ_DYNAMIC flag to the kmem_cache and system taskqs to reduce the number of idle threads on the system. Additional threads will be created on demand up to the previous maximum thread counts. This should have minimal, if any, impact on performance. This makes the system taskq consistent with illumos which is always created as a dynamic taskq with up to 64 threads. The task limits for the kmem_cache have been increased to avoid any unnessisary throttling and to keep a larger reserve of task_t structures on the free list. Signed-off-by: Brian Behlendorf Signed-off-by: Tim Chase Closes #458 --- module/spl/spl-kmem-cache.c | 4 +++- module/spl/spl-taskq.c | 6 ++---- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'module/spl/spl-taskq.c') diff --git a/module/spl/spl-kmem-cache.c b/module/spl/spl-kmem-cache.c index cd3e543ba..86c26ff05 100644 --- a/module/spl/spl-kmem-cache.c +++ b/module/spl/spl-kmem-cache.c @@ -1725,7 +1725,9 @@ spl_kmem_cache_init(void) init_rwsem(&spl_kmem_cache_sem); INIT_LIST_HEAD(&spl_kmem_cache_list); spl_kmem_cache_taskq = taskq_create("spl_kmem_cache", - spl_kmem_cache_kmem_threads, maxclsyspri, 1, 32, TASKQ_PREPOPULATE); + spl_kmem_cache_kmem_threads, maxclsyspri, + spl_kmem_cache_kmem_threads * 8, INT_MAX, + TASKQ_PREPOPULATE | TASKQ_DYNAMIC); spl_register_shrinker(&spl_kmem_cache_shrinker); return (0); diff --git a/module/spl/spl-taskq.c b/module/spl/spl-taskq.c index 9cd193369..44799de1d 100644 --- a/module/spl/spl-taskq.c +++ b/module/spl/spl-taskq.c @@ -1069,10 +1069,8 @@ EXPORT_SYMBOL(taskq_destroy); int spl_taskq_init(void) { - /* Solaris creates a dynamic taskq of up to 64 threads, however in - * a Linux environment 1 thread per-core is usually about right */ - system_taskq = taskq_create("spl_system_taskq", num_online_cpus(), - minclsyspri, 4, 512, TASKQ_PREPOPULATE); + system_taskq = taskq_create("spl_system_taskq", MAX(boot_ncpus, 64), + minclsyspri, boot_ncpus, INT_MAX, TASKQ_PREPOPULATE|TASKQ_DYNAMIC); if (system_taskq == NULL) return (1); -- cgit v1.2.3 From 62aa81a5776c0bc35f05f8923ea3e293527b5264 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Thu, 23 Jul 2015 11:21:08 -0700 Subject: Add defclsyspri macro Add a new defclsyspri macro which can be used to request the default Linux scheduler priority. Neither the minclsyspri or maxclsyspri map to the default Linux kernel thread priority. This makes it awkward to create taskqs which run with the same priority as the rest of the kernel threads on the system which can lead to performance issues. All SPL callers which previously used minclsyspri or maxclsyspri have been changed to use defclsyspri. The vast majority of callers were part of the test suite which won't have an external impact. The few places where it could impact performance the change was from maxclsyspri to defclsyspri. This makes it more likely the process will be scheduled which may help performance. To facilitate further performance analysis the spl_taskq_thread_priority module option has been added. When disabled (0) all newly created kernel threads will use the default kernel thread priority. When enabled (1) the specified taskq priority will be used. By default this value is enabled (1). Signed-off-by: Brian Behlendorf --- include/sys/sysmacros.h | 1 + include/sys/taskq.h | 2 +- man/man5/spl-module-parameters.5 | 15 +++++++++++++++ module/spl/spl-kmem-cache.c | 2 +- module/spl/spl-taskq.c | 13 ++++++++++--- module/splat/splat-atomic.c | 2 +- module/splat/splat-kmem.c | 2 +- module/splat/splat-mutex.c | 6 +++--- module/splat/splat-rwlock.c | 4 ++-- module/splat/splat-taskq.c | 18 +++++++++--------- module/splat/splat-thread.c | 8 ++++---- 11 files changed, 48 insertions(+), 25 deletions(-) (limited to 'module/spl/spl-taskq.c') diff --git a/include/sys/sysmacros.h b/include/sys/sysmacros.h index 4838ab3be..9f16ac70f 100644 --- a/include/sys/sysmacros.h +++ b/include/sys/sysmacros.h @@ -95,6 +95,7 @@ */ #define minclsyspri (MAX_RT_PRIO) #define maxclsyspri (MAX_PRIO-1) +#define defclsyspri (DEFAULT_PRIO) #ifndef NICE_TO_PRIO #define NICE_TO_PRIO(nice) (MAX_RT_PRIO + (nice) + 20) diff --git a/include/sys/taskq.h b/include/sys/taskq.h index a43a86da6..5c29e8f0e 100644 --- a/include/sys/taskq.h +++ b/include/sys/taskq.h @@ -129,7 +129,7 @@ extern int taskq_member(taskq_t *, void *); #define taskq_create_proc(name, nthreads, pri, min, max, proc, flags) \ taskq_create(name, nthreads, pri, min, max, flags) #define taskq_create_sysdc(name, nthreads, min, max, proc, dc, flags) \ - taskq_create(name, nthreads, maxclsyspri, min, max, flags) + taskq_create(name, nthreads, defclsyspri, min, max, flags) int spl_taskq_init(void); void spl_taskq_fini(void); diff --git a/man/man5/spl-module-parameters.5 b/man/man5/spl-module-parameters.5 index fc38605b2..acdd5b658 100644 --- a/man/man5/spl-module-parameters.5 +++ b/man/man5/spl-module-parameters.5 @@ -266,6 +266,21 @@ aid performance analysis or troubleshooting. Default value: \fB1\fR .RE +.sp +.ne 2 +.na +\fBspl_taskq_thread_priority\fR (int) +.ad +.RS 12n +Allow newly created taskq threads to set a non-default scheduler priority. +When enabled the priority specified when a taskq is created will be applied +to all threads created by that taskq. When disabled all threads will use +the default Linux kernel thread priority. By default, this behavior is +enabled. +.sp +Default value: \fB1\fR +.RE + .sp .ne 2 .na diff --git a/module/spl/spl-kmem-cache.c b/module/spl/spl-kmem-cache.c index 86c26ff05..112d0f876 100644 --- a/module/spl/spl-kmem-cache.c +++ b/module/spl/spl-kmem-cache.c @@ -1725,7 +1725,7 @@ spl_kmem_cache_init(void) init_rwsem(&spl_kmem_cache_sem); INIT_LIST_HEAD(&spl_kmem_cache_list); spl_kmem_cache_taskq = taskq_create("spl_kmem_cache", - spl_kmem_cache_kmem_threads, maxclsyspri, + spl_kmem_cache_kmem_threads, defclsyspri, spl_kmem_cache_kmem_threads * 8, INT_MAX, TASKQ_PREPOPULATE | TASKQ_DYNAMIC); spl_register_shrinker(&spl_kmem_cache_shrinker); diff --git a/module/spl/spl-taskq.c b/module/spl/spl-taskq.c index 44799de1d..b4282333e 100644 --- a/module/spl/spl-taskq.c +++ b/module/spl/spl-taskq.c @@ -36,6 +36,11 @@ int spl_taskq_thread_dynamic = 1; module_param(spl_taskq_thread_dynamic, int, 0644); MODULE_PARM_DESC(spl_taskq_thread_dynamic, "Allow dynamic taskq threads"); +int spl_taskq_thread_priority = 1; +module_param(spl_taskq_thread_priority, int, 0644); +MODULE_PARM_DESC(spl_taskq_thread_priority, + "Allow non-default priority for taskq threads"); + int spl_taskq_thread_sequential = 4; module_param(spl_taskq_thread_sequential, int, 0644); MODULE_PARM_DESC(spl_taskq_thread_sequential, @@ -913,7 +918,9 @@ taskq_thread_create(taskq_t *tq) kthread_bind(tqt->tqt_thread, last_used_cpu); } - set_user_nice(tqt->tqt_thread, PRIO_TO_NICE(tq->tq_pri)); + if (spl_taskq_thread_priority) + set_user_nice(tqt->tqt_thread, PRIO_TO_NICE(tq->tq_pri)); + wake_up_process(tqt->tqt_thread); return (tqt); @@ -1070,12 +1077,12 @@ int spl_taskq_init(void) { system_taskq = taskq_create("spl_system_taskq", MAX(boot_ncpus, 64), - minclsyspri, boot_ncpus, INT_MAX, TASKQ_PREPOPULATE|TASKQ_DYNAMIC); + defclsyspri, boot_ncpus, INT_MAX, TASKQ_PREPOPULATE|TASKQ_DYNAMIC); if (system_taskq == NULL) return (1); dynamic_taskq = taskq_create("spl_dynamic_taskq", 1, - minclsyspri, boot_ncpus, INT_MAX, TASKQ_PREPOPULATE); + defclsyspri, boot_ncpus, INT_MAX, TASKQ_PREPOPULATE); if (dynamic_taskq == NULL) { taskq_destroy(system_taskq); return (1); diff --git a/module/splat/splat-atomic.c b/module/splat/splat-atomic.c index e94f42f00..999f4f058 100644 --- a/module/splat/splat-atomic.c +++ b/module/splat/splat-atomic.c @@ -156,7 +156,7 @@ splat_atomic_test1(struct file *file, void *arg) thr = (kthread_t *)thread_create(NULL, 0, splat_atomic_work, &ap, 0, &p0, TS_RUN, - minclsyspri); + defclsyspri); if (thr == NULL) { rc = -ESRCH; mutex_exit(&ap.ap_lock); diff --git a/module/splat/splat-kmem.c b/module/splat/splat-kmem.c index cd0000bae..b3fd1a84d 100644 --- a/module/splat/splat-kmem.c +++ b/module/splat/splat-kmem.c @@ -739,7 +739,7 @@ splat_kmem_cache_thread_test(struct file *file, void *arg, char *name, for (i = 0; i < SPLAT_KMEM_THREADS; i++) { thr = thread_create(NULL, 0, splat_kmem_cache_test_thread, - kcp, 0, &p0, TS_RUN, minclsyspri); + kcp, 0, &p0, TS_RUN, defclsyspri); if (thr == NULL) { rc = -ESRCH; goto out_cache; diff --git a/module/splat/splat-mutex.c b/module/splat/splat-mutex.c index 909d730cb..86bef8ee3 100644 --- a/module/splat/splat-mutex.c +++ b/module/splat/splat-mutex.c @@ -87,7 +87,7 @@ splat_mutex_test1(struct file *file, void *arg) if (mp == NULL) return -ENOMEM; - tq = taskq_create(SPLAT_MUTEX_TEST_TASKQ, 1, maxclsyspri, + tq = taskq_create(SPLAT_MUTEX_TEST_TASKQ, 1, defclsyspri, 50, INT_MAX, TASKQ_PREPOPULATE); if (tq == NULL) { rc = -ENOMEM; @@ -196,7 +196,7 @@ splat_mutex_test2(struct file *file, void *arg) /* Create several threads allowing tasks to race with each other */ tq = taskq_create(SPLAT_MUTEX_TEST_TASKQ, num_online_cpus(), - maxclsyspri, 50, INT_MAX, TASKQ_PREPOPULATE); + defclsyspri, 50, INT_MAX, TASKQ_PREPOPULATE); if (tq == NULL) { rc = -ENOMEM; goto out; @@ -266,7 +266,7 @@ splat_mutex_test3(struct file *file, void *arg) mp.mp_file = file; mutex_init(&mp.mp_mtx, SPLAT_MUTEX_TEST_NAME, MUTEX_DEFAULT, NULL); - if ((tq = taskq_create(SPLAT_MUTEX_TEST_NAME, 1, maxclsyspri, + if ((tq = taskq_create(SPLAT_MUTEX_TEST_NAME, 1, defclsyspri, 50, INT_MAX, TASKQ_PREPOPULATE)) == NULL) { splat_vprint(file, SPLAT_MUTEX_TEST3_NAME, "Taskq '%s' " "create failed\n", SPLAT_MUTEX_TEST3_NAME); diff --git a/module/splat/splat-rwlock.c b/module/splat/splat-rwlock.c index 6c623792e..284f77370 100644 --- a/module/splat/splat-rwlock.c +++ b/module/splat/splat-rwlock.c @@ -327,7 +327,7 @@ splat_rwlock_test2(struct file *file, void *arg) /* Create several threads allowing tasks to race with each other */ tq = taskq_create(SPLAT_RWLOCK_TEST_TASKQ, num_online_cpus(), - maxclsyspri, 50, INT_MAX, TASKQ_PREPOPULATE); + defclsyspri, 50, INT_MAX, TASKQ_PREPOPULATE); if (tq == NULL) { rc = -ENOMEM; goto out; @@ -500,7 +500,7 @@ splat_rwlock_test4(struct file *file, void *arg) if (rwp == NULL) return -ENOMEM; - tq = taskq_create(SPLAT_RWLOCK_TEST_TASKQ, 1, maxclsyspri, + tq = taskq_create(SPLAT_RWLOCK_TEST_TASKQ, 1, defclsyspri, 50, INT_MAX, TASKQ_PREPOPULATE); if (tq == NULL) { rc = -ENOMEM; diff --git a/module/splat/splat-taskq.c b/module/splat/splat-taskq.c index 645bc9145..8f06f413d 100644 --- a/module/splat/splat-taskq.c +++ b/module/splat/splat-taskq.c @@ -134,7 +134,7 @@ splat_taskq_test1_impl(struct file *file, void *arg, boolean_t prealloc) "Taskq '%s' creating (%s dispatch)\n", SPLAT_TASKQ_TEST1_NAME, prealloc ? "prealloc" : "dynamic"); - if ((tq = taskq_create(SPLAT_TASKQ_TEST1_NAME, 1, maxclsyspri, + if ((tq = taskq_create(SPLAT_TASKQ_TEST1_NAME, 1, defclsyspri, 50, INT_MAX, TASKQ_PREPOPULATE)) == NULL) { splat_vprint(file, SPLAT_TASKQ_TEST1_NAME, "Taskq '%s' create failed\n", @@ -269,7 +269,7 @@ splat_taskq_test2_impl(struct file *file, void *arg, boolean_t prealloc) { prealloc ? "prealloc" : "dynamic"); if ((tq[i] = taskq_create(SPLAT_TASKQ_TEST2_NAME, TEST2_THREADS_PER_TASKQ, - maxclsyspri, 50, INT_MAX, + defclsyspri, 50, INT_MAX, TASKQ_PREPOPULATE)) == NULL) { splat_vprint(file, SPLAT_TASKQ_TEST2_NAME, "Taskq '%s/%d' create failed\n", @@ -494,7 +494,7 @@ splat_taskq_test4_common(struct file *file, void *arg, int minalloc, SPLAT_TASKQ_TEST4_NAME, prealloc ? "prealloc" : "dynamic", minalloc, maxalloc, nr_tasks); - if ((tq = taskq_create(SPLAT_TASKQ_TEST4_NAME, 1, maxclsyspri, + if ((tq = taskq_create(SPLAT_TASKQ_TEST4_NAME, 1, defclsyspri, minalloc, maxalloc, TASKQ_PREPOPULATE)) == NULL) { splat_vprint(file, SPLAT_TASKQ_TEST4_NAME, "Taskq '%s' create failed\n", @@ -712,7 +712,7 @@ splat_taskq_test5_impl(struct file *file, void *arg, boolean_t prealloc) "Taskq '%s' creating (%s dispatch)\n", SPLAT_TASKQ_TEST5_NAME, prealloc ? "prealloc" : "dynamic"); - if ((tq = taskq_create(SPLAT_TASKQ_TEST5_NAME, 3, maxclsyspri, + if ((tq = taskq_create(SPLAT_TASKQ_TEST5_NAME, 3, defclsyspri, 50, INT_MAX, TASKQ_PREPOPULATE)) == NULL) { splat_vprint(file, SPLAT_TASKQ_TEST5_NAME, "Taskq '%s' create failed\n", @@ -873,7 +873,7 @@ splat_taskq_test6_impl(struct file *file, void *arg, boolean_t prealloc) "Taskq '%s' creating (%s dispatch)\n", SPLAT_TASKQ_TEST6_NAME, prealloc ? "prealloc" : "dynamic"); - if ((tq = taskq_create(SPLAT_TASKQ_TEST6_NAME, 3, maxclsyspri, + if ((tq = taskq_create(SPLAT_TASKQ_TEST6_NAME, 3, defclsyspri, 50, INT_MAX, TASKQ_PREPOPULATE)) == NULL) { splat_vprint(file, SPLAT_TASKQ_TEST6_NAME, "Taskq '%s' create failed\n", @@ -1005,7 +1005,7 @@ splat_taskq_test7_impl(struct file *file, void *arg, boolean_t prealloc) "Taskq '%s' creating (%s dispatch)\n", SPLAT_TASKQ_TEST7_NAME, prealloc ? "prealloc" : "dynamic"); - if ((tq = taskq_create(SPLAT_TASKQ_TEST7_NAME, 1, maxclsyspri, + if ((tq = taskq_create(SPLAT_TASKQ_TEST7_NAME, 1, defclsyspri, 50, INT_MAX, TASKQ_PREPOPULATE)) == NULL) { splat_vprint(file, SPLAT_TASKQ_TEST7_NAME, "Taskq '%s' create failed\n", @@ -1094,7 +1094,7 @@ splat_taskq_throughput(struct file *file, void *arg, const char *name, splat_vprint(file, name, "Taskq '%s' creating (%d/%d/%d/%d)\n", name, nthreads, minalloc, maxalloc, tasks); - if ((tq = taskq_create(name, nthreads, maxclsyspri, + if ((tq = taskq_create(name, nthreads, defclsyspri, minalloc, maxalloc, flags)) == NULL) { splat_vprint(file, name, "Taskq '%s' create failed\n", name); rc = -EINVAL; @@ -1203,7 +1203,7 @@ splat_taskq_test9(struct file *file, void *arg) splat_vprint(file, SPLAT_TASKQ_TEST9_NAME, "Taskq '%s' creating (%s dispatch) (%d/%d/%d)\n", SPLAT_TASKQ_TEST9_NAME, "delay", minalloc, maxalloc, nr_tasks); - if ((tq = taskq_create(SPLAT_TASKQ_TEST9_NAME, 3, maxclsyspri, + if ((tq = taskq_create(SPLAT_TASKQ_TEST9_NAME, 3, defclsyspri, minalloc, maxalloc, TASKQ_PREPOPULATE)) == NULL) { splat_vprint(file, SPLAT_TASKQ_TEST9_NAME, "Taskq '%s' create failed\n", SPLAT_TASKQ_TEST9_NAME); @@ -1303,7 +1303,7 @@ splat_taskq_test10(struct file *file, void *arg) splat_vprint(file, SPLAT_TASKQ_TEST10_NAME, "Taskq '%s' creating (%s dispatch) (%d/%d/%d)\n", SPLAT_TASKQ_TEST10_NAME, "delay", minalloc, maxalloc, nr_tasks); - if ((tq = taskq_create(SPLAT_TASKQ_TEST10_NAME, 3, maxclsyspri, + if ((tq = taskq_create(SPLAT_TASKQ_TEST10_NAME, 3, defclsyspri, minalloc, maxalloc, TASKQ_PREPOPULATE)) == NULL) { splat_vprint(file, SPLAT_TASKQ_TEST10_NAME, "Taskq '%s' create failed\n", SPLAT_TASKQ_TEST10_NAME); diff --git a/module/splat/splat-thread.c b/module/splat/splat-thread.c index 3255e37e5..8a4471407 100644 --- a/module/splat/splat-thread.c +++ b/module/splat/splat-thread.c @@ -112,7 +112,7 @@ splat_thread_test1(struct file *file, void *arg) tp.tp_rc = 0; thr = (kthread_t *)thread_create(NULL, 0, splat_thread_work1, &tp, 0, - &p0, TS_RUN, minclsyspri); + &p0, TS_RUN, defclsyspri); /* Must never fail under Solaris, but we check anyway since this * can happen in the linux SPL, we may want to change this behavior */ if (thr == NULL) @@ -161,7 +161,7 @@ splat_thread_test2(struct file *file, void *arg) tp.tp_rc = 0; thr = (kthread_t *)thread_create(NULL, 0, splat_thread_work2, &tp, 0, - &p0, TS_RUN, minclsyspri); + &p0, TS_RUN, defclsyspri); /* Must never fail under Solaris, but we check anyway since this * can happen in the linux SPL, we may want to change this behavior */ if (thr == NULL) @@ -278,7 +278,7 @@ splat_thread_test3(struct file *file, void *arg) /* Start tsd wait threads */ for (i = 0; i < SPLAT_THREAD_TEST_THREADS; i++) { if (thread_create(NULL, 0, splat_thread_work3_wait, - &tp, 0, &p0, TS_RUN, minclsyspri)) + &tp, 0, &p0, TS_RUN, defclsyspri)) wait_count++; } @@ -295,7 +295,7 @@ splat_thread_test3(struct file *file, void *arg) /* Start tsd exit threads */ for (i = 0; i < SPLAT_THREAD_TEST_THREADS; i++) { if (thread_create(NULL, 0, splat_thread_work3_exit, - &tp, 0, &p0, TS_RUN, minclsyspri)) + &tp, 0, &p0, TS_RUN, defclsyspri)) exit_count++; } -- cgit v1.2.3 From 9dc5ffbec845ec9c4d9b109c85569345c0c11766 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Fri, 24 Jul 2015 10:32:55 -0700 Subject: Invert minclsyspri and maxclsyspri On Linux the meaning of a processes priority is inverted with respect to illumos. High values on Linux indicate a _low_ priority while high value on illumos indicate a _high_ priority. In order to preserve the logical meaning of the minclsyspri and maxclsyspri macros when they are used by the illumos wrapper functions their values have been inverted. This way when changes are merged from upstream illumos we won't need to remember to invert the macro. It could also lead to confusion. Note this change also reverts some of the priorities changes in prior commit 62aa81a. The rational is as follows: spl_kmem_cache - High priority may result in blocked memory allocs spl_system_taskq - May perform I/O for file backed VDEVs spl_dynamic_taskq - New taskq threads should be spawned promptly Signed-off-by: Brian Behlendorf Signed-off-by: Ned Bass Issue zfsonlinux/zfs#3607 --- include/sys/sysmacros.h | 4 ++-- include/sys/taskq.h | 2 +- module/spl/spl-kmem-cache.c | 2 +- module/spl/spl-taskq.c | 5 ++--- 4 files changed, 6 insertions(+), 7 deletions(-) (limited to 'module/spl/spl-taskq.c') diff --git a/include/sys/sysmacros.h b/include/sys/sysmacros.h index 9f16ac70f..4dc7cd858 100644 --- a/include/sys/sysmacros.h +++ b/include/sys/sysmacros.h @@ -93,8 +93,8 @@ * * Treat shim tasks as SCHED_NORMAL tasks */ -#define minclsyspri (MAX_RT_PRIO) -#define maxclsyspri (MAX_PRIO-1) +#define minclsyspri (MAX_PRIO-1) +#define maxclsyspri (MAX_RT_PRIO) #define defclsyspri (DEFAULT_PRIO) #ifndef NICE_TO_PRIO diff --git a/include/sys/taskq.h b/include/sys/taskq.h index 5c29e8f0e..a43a86da6 100644 --- a/include/sys/taskq.h +++ b/include/sys/taskq.h @@ -129,7 +129,7 @@ extern int taskq_member(taskq_t *, void *); #define taskq_create_proc(name, nthreads, pri, min, max, proc, flags) \ taskq_create(name, nthreads, pri, min, max, flags) #define taskq_create_sysdc(name, nthreads, min, max, proc, dc, flags) \ - taskq_create(name, nthreads, defclsyspri, min, max, flags) + taskq_create(name, nthreads, maxclsyspri, min, max, flags) int spl_taskq_init(void); void spl_taskq_fini(void); diff --git a/module/spl/spl-kmem-cache.c b/module/spl/spl-kmem-cache.c index 0417f9d0b..a83c9f3ae 100644 --- a/module/spl/spl-kmem-cache.c +++ b/module/spl/spl-kmem-cache.c @@ -1718,7 +1718,7 @@ spl_kmem_cache_init(void) init_rwsem(&spl_kmem_cache_sem); INIT_LIST_HEAD(&spl_kmem_cache_list); spl_kmem_cache_taskq = taskq_create("spl_kmem_cache", - spl_kmem_cache_kmem_threads, defclsyspri, + spl_kmem_cache_kmem_threads, maxclsyspri, spl_kmem_cache_kmem_threads * 8, INT_MAX, TASKQ_PREPOPULATE | TASKQ_DYNAMIC); spl_register_shrinker(&spl_kmem_cache_shrinker); diff --git a/module/spl/spl-taskq.c b/module/spl/spl-taskq.c index b4282333e..7a756af37 100644 --- a/module/spl/spl-taskq.c +++ b/module/spl/spl-taskq.c @@ -935,7 +935,6 @@ taskq_create(const char *name, int nthreads, pri_t pri, int count = 0, rc = 0, i; ASSERT(name != NULL); - ASSERT(pri <= maxclsyspri); ASSERT(minalloc >= 0); ASSERT(maxalloc <= INT_MAX); ASSERT(!(flags & (TASKQ_CPR_SAFE))); /* Unsupported */ @@ -1077,12 +1076,12 @@ int spl_taskq_init(void) { system_taskq = taskq_create("spl_system_taskq", MAX(boot_ncpus, 64), - defclsyspri, boot_ncpus, INT_MAX, TASKQ_PREPOPULATE|TASKQ_DYNAMIC); + maxclsyspri, boot_ncpus, INT_MAX, TASKQ_PREPOPULATE|TASKQ_DYNAMIC); if (system_taskq == NULL) return (1); dynamic_taskq = taskq_create("spl_dynamic_taskq", 1, - defclsyspri, boot_ncpus, INT_MAX, TASKQ_PREPOPULATE); + maxclsyspri, boot_ncpus, INT_MAX, TASKQ_PREPOPULATE); if (dynamic_taskq == NULL) { taskq_destroy(system_taskq); return (1); -- cgit v1.2.3 From 076821eaff146a56aa6a66916d70eda7db3347ed Mon Sep 17 00:00:00 2001 From: Tim Chase Date: Thu, 27 Aug 2015 11:13:20 -0500 Subject: Create a new thread during recursive taskq dispatch if necessary When dynamic taskq is enabled and all threads for a taskq are occupied, a recursive dispatch can cause a deadlock if calling thread depends on the recursively-dispatched thread for its return condition. This patch attempts to create a new thread for recursive dispatch when none are available. Signed-off-by: Tim Chase Signed-off-by: Brian Behlendorf Closes #472 --- module/spl/spl-taskq.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'module/spl/spl-taskq.c') diff --git a/module/spl/spl-taskq.c b/module/spl/spl-taskq.c index 7a756af37..2202aced7 100644 --- a/module/spl/spl-taskq.c +++ b/module/spl/spl-taskq.c @@ -53,6 +53,7 @@ EXPORT_SYMBOL(system_taskq); /* Private dedicated taskq for creating new taskq threads on demand. */ static taskq_t *dynamic_taskq; static taskq_thread_t *taskq_thread_create(taskq_t *); +static int taskq_thread_spawn(taskq_t *tq, int seq_tasks); static int task_km_flags(uint_t flags) @@ -533,6 +534,7 @@ taskq_dispatch(taskq_t *tq, task_func_t func, void *arg, uint_t flags) { taskq_ent_t *t; taskqid_t rc = 0; + boolean_t threadlimit = B_FALSE; ASSERT(tq); ASSERT(func); @@ -574,7 +576,13 @@ taskq_dispatch(taskq_t *tq, task_func_t func, void *arg, uint_t flags) wake_up(&tq->tq_work_waitq); out: + threadlimit = (tq->tq_nactive == tq->tq_nthreads); spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); + + /* Spawn additional taskq threads if required. */ + if (threadlimit && taskq_member(tq, current)) + (void) taskq_thread_spawn(tq, spl_taskq_thread_sequential + 1); + return (rc); } EXPORT_SYMBOL(taskq_dispatch); @@ -585,6 +593,7 @@ taskq_dispatch_delay(taskq_t *tq, task_func_t func, void *arg, { taskqid_t rc = 0; taskq_ent_t *t; + boolean_t threadlimit = B_FALSE; ASSERT(tq); ASSERT(func); @@ -617,7 +626,13 @@ taskq_dispatch_delay(taskq_t *tq, task_func_t func, void *arg, spin_unlock(&t->tqent_lock); out: + threadlimit = (tq->tq_nactive == tq->tq_nthreads); spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); + + /* Spawn additional taskq threads if required. */ + if (threadlimit && taskq_member(tq, current)) + (void) taskq_thread_spawn(tq, spl_taskq_thread_sequential + 1); + return (rc); } EXPORT_SYMBOL(taskq_dispatch_delay); @@ -626,6 +641,8 @@ void taskq_dispatch_ent(taskq_t *tq, task_func_t func, void *arg, uint_t flags, taskq_ent_t *t) { + boolean_t threadlimit = B_FALSE; + ASSERT(tq); ASSERT(func); @@ -661,7 +678,12 @@ taskq_dispatch_ent(taskq_t *tq, task_func_t func, void *arg, uint_t flags, wake_up(&tq->tq_work_waitq); out: + threadlimit = (tq->tq_nactive == tq->tq_nthreads); spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); + + /* Spawn additional taskq threads if required. */ + if (threadlimit && taskq_member(tq, current)) + (void) taskq_thread_spawn(tq, spl_taskq_thread_sequential + 1); } EXPORT_SYMBOL(taskq_dispatch_ent); -- cgit v1.2.3 From 801b56090b42763d1d3b2593bb8d731d0d8fef22 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Mon, 31 Aug 2015 17:00:17 -0700 Subject: Revert "Create a new thread during recursive taskq dispatch if necessary" This reverts commit 076821e due to a locking issue uncovered in subsequent testing. An ASSERT is hit due to tq->tq_nspawn being updated outside the lock. The patch will need to be reworked. VERIFY3(0 == tq->tq_nspawn) failed (0 == -1) Signed-off-by: Brian Behlendorf Issue #472 --- module/spl/spl-taskq.c | 22 ---------------------- 1 file changed, 22 deletions(-) (limited to 'module/spl/spl-taskq.c') diff --git a/module/spl/spl-taskq.c b/module/spl/spl-taskq.c index 2202aced7..7a756af37 100644 --- a/module/spl/spl-taskq.c +++ b/module/spl/spl-taskq.c @@ -53,7 +53,6 @@ EXPORT_SYMBOL(system_taskq); /* Private dedicated taskq for creating new taskq threads on demand. */ static taskq_t *dynamic_taskq; static taskq_thread_t *taskq_thread_create(taskq_t *); -static int taskq_thread_spawn(taskq_t *tq, int seq_tasks); static int task_km_flags(uint_t flags) @@ -534,7 +533,6 @@ taskq_dispatch(taskq_t *tq, task_func_t func, void *arg, uint_t flags) { taskq_ent_t *t; taskqid_t rc = 0; - boolean_t threadlimit = B_FALSE; ASSERT(tq); ASSERT(func); @@ -576,13 +574,7 @@ taskq_dispatch(taskq_t *tq, task_func_t func, void *arg, uint_t flags) wake_up(&tq->tq_work_waitq); out: - threadlimit = (tq->tq_nactive == tq->tq_nthreads); spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); - - /* Spawn additional taskq threads if required. */ - if (threadlimit && taskq_member(tq, current)) - (void) taskq_thread_spawn(tq, spl_taskq_thread_sequential + 1); - return (rc); } EXPORT_SYMBOL(taskq_dispatch); @@ -593,7 +585,6 @@ taskq_dispatch_delay(taskq_t *tq, task_func_t func, void *arg, { taskqid_t rc = 0; taskq_ent_t *t; - boolean_t threadlimit = B_FALSE; ASSERT(tq); ASSERT(func); @@ -626,13 +617,7 @@ taskq_dispatch_delay(taskq_t *tq, task_func_t func, void *arg, spin_unlock(&t->tqent_lock); out: - threadlimit = (tq->tq_nactive == tq->tq_nthreads); spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); - - /* Spawn additional taskq threads if required. */ - if (threadlimit && taskq_member(tq, current)) - (void) taskq_thread_spawn(tq, spl_taskq_thread_sequential + 1); - return (rc); } EXPORT_SYMBOL(taskq_dispatch_delay); @@ -641,8 +626,6 @@ void taskq_dispatch_ent(taskq_t *tq, task_func_t func, void *arg, uint_t flags, taskq_ent_t *t) { - boolean_t threadlimit = B_FALSE; - ASSERT(tq); ASSERT(func); @@ -678,12 +661,7 @@ taskq_dispatch_ent(taskq_t *tq, task_func_t func, void *arg, uint_t flags, wake_up(&tq->tq_work_waitq); out: - threadlimit = (tq->tq_nactive == tq->tq_nthreads); spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); - - /* Spawn additional taskq threads if required. */ - if (threadlimit && taskq_member(tq, current)) - (void) taskq_thread_spawn(tq, spl_taskq_thread_sequential + 1); } EXPORT_SYMBOL(taskq_dispatch_ent); -- cgit v1.2.3 From a64e55752f4e88dcb544f2480100dcd6f6be3277 Mon Sep 17 00:00:00 2001 From: Tim Chase Date: Thu, 27 Aug 2015 11:13:20 -0500 Subject: Create a new thread during recursive taskq dispatch if necessary When dynamic taskq is enabled and all threads for a taskq are occupied, a recursive dispatch can cause a deadlock if calling thread depends on the recursively-dispatched thread for its return condition. This patch attempts to create a new thread for recursive dispatch when none are available. Signed-off-by: Tim Chase Signed-off-by: Brian Behlendorf Closes #472 --- module/spl/spl-taskq.c | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) (limited to 'module/spl/spl-taskq.c') diff --git a/module/spl/spl-taskq.c b/module/spl/spl-taskq.c index 7a756af37..82e71a388 100644 --- a/module/spl/spl-taskq.c +++ b/module/spl/spl-taskq.c @@ -448,8 +448,8 @@ taskq_wait(taskq_t *tq) } EXPORT_SYMBOL(taskq_wait); -int -taskq_member(taskq_t *tq, void *t) +static int +taskq_member_impl(taskq_t *tq, void *t) { struct list_head *l; taskq_thread_t *tqt; @@ -457,8 +457,8 @@ taskq_member(taskq_t *tq, void *t) ASSERT(tq); ASSERT(t); + ASSERT(spin_is_locked(&tq->tq_lock)); - spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); list_for_each(l, &tq->tq_thread_list) { tqt = list_entry(l, taskq_thread_t, tqt_thread_list); if (tqt->tqt_thread == (struct task_struct *)t) { @@ -466,6 +466,16 @@ taskq_member(taskq_t *tq, void *t) break; } } + return (found); +} + +int +taskq_member(taskq_t *tq, void *t) +{ + int found; + + spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); + found = taskq_member_impl(tq, t); spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); return (found); @@ -528,6 +538,8 @@ taskq_cancel_id(taskq_t *tq, taskqid_t id) } EXPORT_SYMBOL(taskq_cancel_id); +static int taskq_thread_spawn(taskq_t *tq, int seq_tasks); + taskqid_t taskq_dispatch(taskq_t *tq, task_func_t func, void *arg, uint_t flags) { @@ -574,6 +586,11 @@ taskq_dispatch(taskq_t *tq, task_func_t func, void *arg, uint_t flags) wake_up(&tq->tq_work_waitq); out: + /* Spawn additional taskq threads if required. */ + if (tq->tq_nactive == tq->tq_nthreads && + taskq_member_impl(tq, current)) + (void) taskq_thread_spawn(tq, spl_taskq_thread_sequential + 1); + spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); return (rc); } @@ -617,6 +634,10 @@ taskq_dispatch_delay(taskq_t *tq, task_func_t func, void *arg, spin_unlock(&t->tqent_lock); out: + /* Spawn additional taskq threads if required. */ + if (tq->tq_nactive == tq->tq_nthreads && + taskq_member_impl(tq, current)) + (void) taskq_thread_spawn(tq, spl_taskq_thread_sequential + 1); spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); return (rc); } @@ -661,6 +682,10 @@ taskq_dispatch_ent(taskq_t *tq, task_func_t func, void *arg, uint_t flags, wake_up(&tq->tq_work_waitq); out: + /* Spawn additional taskq threads if required. */ + if (tq->tq_nactive == tq->tq_nthreads && + taskq_member_impl(tq, current)) + (void) taskq_thread_spawn(tq, spl_taskq_thread_sequential + 1); spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); } EXPORT_SYMBOL(taskq_dispatch_ent); -- cgit v1.2.3 From d4bf6d8429371634b0c6bcc14b5868d849b7c07d Mon Sep 17 00:00:00 2001 From: Richard Yao Date: Mon, 7 Sep 2015 12:35:21 -0400 Subject: Disable direct reclaim in taskq worker threads on Linux 3.9+ Illumos does not have direct reclaim and code run inside taskq worker threads is not designed to deal with it. Allowing direct reclaim inside a worker thread can therefore deadlock. We set PF_MEMALLOC_NOIO through memalloc_noio_save() to indicate to the kernel's reclaim code that we are inside a context where memory allocations cannot be allowed to block on filesystem activity. Signed-off-by: Richard Yao Signed-off-by: Brian Behlendorf Issue zfsonlinux/zfs#1274 Issue zfsonlinux/zfs#2390 Closes #474 --- module/spl/spl-taskq.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'module/spl/spl-taskq.c') diff --git a/module/spl/spl-taskq.c b/module/spl/spl-taskq.c index 82e71a388..f6ef56251 100644 --- a/module/spl/spl-taskq.c +++ b/module/spl/spl-taskq.c @@ -817,6 +817,10 @@ taskq_thread(void *args) tq = tqt->tqt_tq; current->flags |= PF_NOFREEZE; + #if defined(PF_MEMALLOC_NOIO) + (void) memalloc_noio_save(); + #endif + sigfillset(&blocked); sigprocmask(SIG_BLOCK, &blocked, NULL); flush_signals(current); -- cgit v1.2.3 From f5f2b87df0362242b13b8183a2a8d88be63b0e73 Mon Sep 17 00:00:00 2001 From: tuxoko Date: Fri, 6 Nov 2015 15:00:55 -0800 Subject: Fix taskq dynamic spawning Currently taskq_dispatch() will spawn new task with a condition that the caller is also a member of the taskq. However, under this condition, it will still cause deadlock where a task on tq1 is waiting another thread, who is trying to dispatch a task on tq1. So this patch removes the check. For example when you do: zfs send pp/fs0@001 | zfs recv pp/fs0_copy This will easily deadlock before this patch. Also, move the seq_task check from taskq_thread_spawn() to taskq_thread() because it's not used by the caller from taskq_dispatch(). Signed-off-by: Chunwei Chen Signed-off-by: Tim Chase Signed-off-by: Brian Behlendorf Closes #496 --- module/spl/spl-taskq.c | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) (limited to 'module/spl/spl-taskq.c') diff --git a/module/spl/spl-taskq.c b/module/spl/spl-taskq.c index f6ef56251..2c2e3ad46 100644 --- a/module/spl/spl-taskq.c +++ b/module/spl/spl-taskq.c @@ -538,7 +538,7 @@ taskq_cancel_id(taskq_t *tq, taskqid_t id) } EXPORT_SYMBOL(taskq_cancel_id); -static int taskq_thread_spawn(taskq_t *tq, int seq_tasks); +static int taskq_thread_spawn(taskq_t *tq); taskqid_t taskq_dispatch(taskq_t *tq, task_func_t func, void *arg, uint_t flags) @@ -587,9 +587,8 @@ taskq_dispatch(taskq_t *tq, task_func_t func, void *arg, uint_t flags) wake_up(&tq->tq_work_waitq); out: /* Spawn additional taskq threads if required. */ - if (tq->tq_nactive == tq->tq_nthreads && - taskq_member_impl(tq, current)) - (void) taskq_thread_spawn(tq, spl_taskq_thread_sequential + 1); + if (tq->tq_nactive == tq->tq_nthreads) + (void) taskq_thread_spawn(tq); spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); return (rc); @@ -635,9 +634,8 @@ taskq_dispatch_delay(taskq_t *tq, task_func_t func, void *arg, spin_unlock(&t->tqent_lock); out: /* Spawn additional taskq threads if required. */ - if (tq->tq_nactive == tq->tq_nthreads && - taskq_member_impl(tq, current)) - (void) taskq_thread_spawn(tq, spl_taskq_thread_sequential + 1); + if (tq->tq_nactive == tq->tq_nthreads) + (void) taskq_thread_spawn(tq); spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); return (rc); } @@ -683,9 +681,8 @@ taskq_dispatch_ent(taskq_t *tq, task_func_t func, void *arg, uint_t flags, wake_up(&tq->tq_work_waitq); out: /* Spawn additional taskq threads if required. */ - if (tq->tq_nactive == tq->tq_nthreads && - taskq_member_impl(tq, current)) - (void) taskq_thread_spawn(tq, spl_taskq_thread_sequential + 1); + if (tq->tq_nactive == tq->tq_nthreads) + (void) taskq_thread_spawn(tq); spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); } EXPORT_SYMBOL(taskq_dispatch_ent); @@ -756,15 +753,14 @@ taskq_thread_spawn_task(void *arg) * which is also a dynamic taskq cannot be safely used for this. */ static int -taskq_thread_spawn(taskq_t *tq, int seq_tasks) +taskq_thread_spawn(taskq_t *tq) { int spawning = 0; if (!(tq->tq_flags & TASKQ_DYNAMIC)) return (0); - if ((seq_tasks > spl_taskq_thread_sequential) && - (tq->tq_nthreads + tq->tq_nspawn < tq->tq_maxthreads) && + if ((tq->tq_nthreads + tq->tq_nspawn < tq->tq_maxthreads) && (tq->tq_flags & TASKQ_ACTIVE)) { spawning = (++tq->tq_nspawn); taskq_dispatch(dynamic_taskq, taskq_thread_spawn_task, @@ -898,7 +894,8 @@ taskq_thread(void *args) } /* Spawn additional taskq threads if required. */ - if (taskq_thread_spawn(tq, ++seq_tasks)) + if ((++seq_tasks) > spl_taskq_thread_sequential && + taskq_thread_spawn(tq)) seq_tasks = 0; tqt->tqt_id = 0; -- cgit v1.2.3 From a430c11f0b1ef16ca5edf3059e4082709277376c Mon Sep 17 00:00:00 2001 From: Richard Yao Date: Thu, 3 Dec 2015 14:15:16 -0500 Subject: 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 Signed-off-by: Brian Behlendorf Signed-off-by: tuxoko Signed-off-by: Tim Chase Closes #500 --- include/sys/taskq.h | 2 +- module/spl/spl-taskq.c | 37 +++---------------------------------- 2 files changed, 4 insertions(+), 35 deletions(-) (limited to 'module/spl/spl-taskq.c') 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) diff --git a/module/spl/spl-taskq.c b/module/spl/spl-taskq.c index 2c2e3ad46..0c5b230aa 100644 --- a/module/spl/spl-taskq.c +++ b/module/spl/spl-taskq.c @@ -448,40 +448,6 @@ taskq_wait(taskq_t *tq) } EXPORT_SYMBOL(taskq_wait); -static int -taskq_member_impl(taskq_t *tq, void *t) -{ - struct list_head *l; - taskq_thread_t *tqt; - int found = 0; - - ASSERT(tq); - ASSERT(t); - ASSERT(spin_is_locked(&tq->tq_lock)); - - list_for_each(l, &tq->tq_thread_list) { - tqt = list_entry(l, taskq_thread_t, tqt_thread_list); - if (tqt->tqt_thread == (struct task_struct *)t) { - found = 1; - break; - } - } - return (found); -} - -int -taskq_member(taskq_t *tq, void *t) -{ - int found; - - spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); - found = taskq_member_impl(tq, t); - spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); - - return (found); -} -EXPORT_SYMBOL(taskq_member); - /* * Cancel an already dispatched task given the task id. Still pending tasks * will be immediately canceled, and if the task is active the function will @@ -812,6 +778,7 @@ taskq_thread(void *args) ASSERT(tqt); tq = tqt->tqt_tq; current->flags |= PF_NOFREEZE; + current->journal_info = tq; #if defined(PF_MEMALLOC_NOIO) (void) memalloc_noio_save(); @@ -877,6 +844,8 @@ taskq_thread(void *args) /* Perform the requested task */ t->tqent_func(t->tqent_arg); + ASSERT3P(tq, ==, current->journal_info); + spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); tq->tq_nactive--; list_del_init(&tqt->tqt_active_list); -- cgit v1.2.3 From c5a8b1e163179cadcf2c5f81b000bf7f86f41369 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Tue, 8 Dec 2015 17:04:31 -0800 Subject: Revert "Make taskq_member() use ->journal_info" This reverts commit a430c11f0b1ef16ca5edf3059e4082709277376c. Using journal_info like this can cause a BUG at kernel fs/jbd2/transaction.c:425! Signed-off-by: Brian Behlendorf Issue #500 --- include/sys/taskq.h | 2 +- module/spl/spl-taskq.c | 37 ++++++++++++++++++++++++++++++++++--- 2 files changed, 35 insertions(+), 4 deletions(-) (limited to 'module/spl/spl-taskq.c') diff --git a/include/sys/taskq.h b/include/sys/taskq.h index 65f911245..a43a86da6 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); -#define taskq_member(taskq, thread) ((taskq) == ((thread)->journal_info)) +extern int taskq_member(taskq_t *, void *); #define taskq_create_proc(name, nthreads, pri, min, max, proc, flags) \ taskq_create(name, nthreads, pri, min, max, flags) diff --git a/module/spl/spl-taskq.c b/module/spl/spl-taskq.c index 0c5b230aa..2c2e3ad46 100644 --- a/module/spl/spl-taskq.c +++ b/module/spl/spl-taskq.c @@ -448,6 +448,40 @@ taskq_wait(taskq_t *tq) } EXPORT_SYMBOL(taskq_wait); +static int +taskq_member_impl(taskq_t *tq, void *t) +{ + struct list_head *l; + taskq_thread_t *tqt; + int found = 0; + + ASSERT(tq); + ASSERT(t); + ASSERT(spin_is_locked(&tq->tq_lock)); + + list_for_each(l, &tq->tq_thread_list) { + tqt = list_entry(l, taskq_thread_t, tqt_thread_list); + if (tqt->tqt_thread == (struct task_struct *)t) { + found = 1; + break; + } + } + return (found); +} + +int +taskq_member(taskq_t *tq, void *t) +{ + int found; + + spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); + found = taskq_member_impl(tq, t); + spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); + + return (found); +} +EXPORT_SYMBOL(taskq_member); + /* * Cancel an already dispatched task given the task id. Still pending tasks * will be immediately canceled, and if the task is active the function will @@ -778,7 +812,6 @@ taskq_thread(void *args) ASSERT(tqt); tq = tqt->tqt_tq; current->flags |= PF_NOFREEZE; - current->journal_info = tq; #if defined(PF_MEMALLOC_NOIO) (void) memalloc_noio_save(); @@ -844,8 +877,6 @@ taskq_thread(void *args) /* Perform the requested task */ t->tqent_func(t->tqent_arg); - ASSERT3P(tq, ==, current->journal_info); - spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); tq->tq_nactive--; list_del_init(&tqt->tqt_active_list); -- cgit v1.2.3 From 326172d8549e0a34a8e4ef4665d8bdfcf7aeda6e Mon Sep 17 00:00:00 2001 From: Olaf Faaland Date: Tue, 13 Oct 2015 16:56:51 -0700 Subject: Subclass tq_lock to eliminate a lockdep warning When taskq_dispatch() calls taskq_thread_spawn() to create a new thread for a taskq, linux lockdep warns of possible recursive locking. This is a false positive. One such call chain is as follows, when a taskq needs more threads: taskq_dispatch->taskq_thread_spawn->taskq_dispatch The initial taskq_dispatch() holds tq_lock on the taskq that needed more worker threads. The later call into taskq_dispatch() takes dynamic_taskq->tq_lock. Without subclassing, lockdep believes these could potentially be the same lock and complains. A similar case occurs when taskq_dispatch() then calls task_alloc(). This patch uses spin_lock_irqsave_nested() when taking tq_lock, with one of two new lock subclasses: subclass taskq TQ_LOCK_DYNAMIC dynamic_taskq TQ_LOCK_GENERAL any other Signed-off-by: Olaf Faaland Signed-off-by: Brian Behlendorf Issue #480 --- include/sys/taskq.h | 9 +++++++ module/spl/spl-taskq.c | 70 +++++++++++++++++++++++++++++++++++--------------- 2 files changed, 58 insertions(+), 21 deletions(-) (limited to 'module/spl/spl-taskq.c') diff --git a/include/sys/taskq.h b/include/sys/taskq.h index a43a86da6..5830fe2dd 100644 --- a/include/sys/taskq.h +++ b/include/sys/taskq.h @@ -55,6 +55,14 @@ #define TQ_NEW 0x04000000 #define TQ_FRONT 0x08000000 +/* spin_lock(lock) and spin_lock_nested(lock,0) are equivalent, + * so TQ_LOCK_DYNAMIC must not evaluate to 0 + */ +typedef enum tq_lock_role { + TQ_LOCK_GENERAL = 0, + TQ_LOCK_DYNAMIC = 1, +} tq_lock_role_t; + typedef unsigned long taskqid_t; typedef void (task_func_t)(void *); @@ -81,6 +89,7 @@ typedef struct taskq { struct list_head tq_delay_list; /* delayed task_t's */ wait_queue_head_t tq_work_waitq; /* new work waitq */ wait_queue_head_t tq_wait_waitq; /* wait waitq */ + tq_lock_role_t tq_lock_class; /* class used when taking tq_lock */ } taskq_t; typedef struct taskq_ent { diff --git a/module/spl/spl-taskq.c b/module/spl/spl-taskq.c index 2c2e3ad46..588dbc8a4 100644 --- a/module/spl/spl-taskq.c +++ b/module/spl/spl-taskq.c @@ -113,7 +113,8 @@ retry: */ spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); schedule_timeout(HZ / 100); - spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); + spin_lock_irqsave_nested(&tq->tq_lock, tq->tq_lock_flags, + tq->tq_lock_class); if (count < 100) { count++; goto retry; @@ -122,7 +123,8 @@ retry: spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); t = kmem_alloc(sizeof(taskq_ent_t), task_km_flags(flags)); - spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); + spin_lock_irqsave_nested(&tq->tq_lock, tq->tq_lock_flags, + tq->tq_lock_class); if (t) { taskq_init_ent(t); @@ -188,7 +190,8 @@ task_expire(unsigned long data) taskq_t *tq = t->tqent_taskq; struct list_head *l; - spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); + spin_lock_irqsave_nested(&tq->tq_lock, tq->tq_lock_flags, + tq->tq_lock_class); if (t->tqent_flags & TQENT_FLAG_CANCEL) { ASSERT(list_empty(&t->tqent_list)); @@ -379,7 +382,8 @@ taskq_wait_id_check(taskq_t *tq, taskqid_t id) int active = 0; int rc; - spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); + spin_lock_irqsave_nested(&tq->tq_lock, tq->tq_lock_flags, + tq->tq_lock_class); rc = (taskq_find(tq, id, &active) == NULL); spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); @@ -402,7 +406,8 @@ taskq_wait_outstanding_check(taskq_t *tq, taskqid_t id) { int rc; - spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); + spin_lock_irqsave_nested(&tq->tq_lock, tq->tq_lock_flags, + tq->tq_lock_class); rc = (id < tq->tq_lowest_id); spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); @@ -429,7 +434,8 @@ taskq_wait_check(taskq_t *tq) { int rc; - spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); + spin_lock_irqsave_nested(&tq->tq_lock, tq->tq_lock_flags, + tq->tq_lock_class); rc = (tq->tq_lowest_id == tq->tq_next_id); spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); @@ -474,7 +480,8 @@ taskq_member(taskq_t *tq, void *t) { int found; - spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); + spin_lock_irqsave_nested(&tq->tq_lock, tq->tq_lock_flags, + tq->tq_lock_class); found = taskq_member_impl(tq, t); spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); @@ -497,7 +504,8 @@ taskq_cancel_id(taskq_t *tq, taskqid_t id) ASSERT(tq); - spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); + spin_lock_irqsave_nested(&tq->tq_lock, tq->tq_lock_flags, + tq->tq_lock_class); t = taskq_find(tq, id, &active); if (t && !active) { list_del_init(&t->tqent_list); @@ -519,7 +527,8 @@ taskq_cancel_id(taskq_t *tq, taskqid_t id) if (timer_pending(&t->tqent_timer)) { spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); del_timer_sync(&t->tqent_timer); - spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); + spin_lock_irqsave_nested(&tq->tq_lock, + tq->tq_lock_flags, tq->tq_lock_class); } if (!(t->tqent_flags & TQENT_FLAG_PREALLOC)) @@ -549,7 +558,8 @@ taskq_dispatch(taskq_t *tq, task_func_t func, void *arg, uint_t flags) ASSERT(tq); ASSERT(func); - spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); + spin_lock_irqsave_nested(&tq->tq_lock, tq->tq_lock_flags, + tq->tq_lock_class); /* Taskq being destroyed and all tasks drained */ if (!(tq->tq_flags & TASKQ_ACTIVE)) @@ -605,7 +615,8 @@ taskq_dispatch_delay(taskq_t *tq, task_func_t func, void *arg, ASSERT(tq); ASSERT(func); - spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); + spin_lock_irqsave_nested(&tq->tq_lock, tq->tq_lock_flags, + tq->tq_lock_class); /* Taskq being destroyed and all tasks drained */ if (!(tq->tq_flags & TASKQ_ACTIVE)) @@ -648,7 +659,8 @@ taskq_dispatch_ent(taskq_t *tq, task_func_t func, void *arg, uint_t flags, ASSERT(tq); ASSERT(func); - spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); + spin_lock_irqsave_nested(&tq->tq_lock, tq->tq_lock_flags, + tq->tq_lock_class); /* Taskq being destroyed and all tasks drained */ if (!(tq->tq_flags & TASKQ_ACTIVE)) { @@ -740,13 +752,14 @@ taskq_thread_spawn_task(void *arg) (void) taskq_thread_create(tq); - spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); + spin_lock_irqsave_nested(&tq->tq_lock, tq->tq_lock_flags, + tq->tq_lock_class); tq->tq_nspawn--; spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); } /* - * Spawn addition threads for dynamic taskqs (TASKQ_DYNMAIC) the current + * Spawn addition threads for dynamic taskqs (TASKQ_DYNAMIC) the current * number of threads is insufficient to handle the pending tasks. These * new threads must be created by the dedicated dynamic_taskq to avoid * deadlocks between thread creation and memory reclaim. The system_taskq @@ -810,6 +823,7 @@ taskq_thread(void *args) int seq_tasks = 0; ASSERT(tqt); + ASSERT(tqt->tqt_tq); tq = tqt->tqt_tq; current->flags |= PF_NOFREEZE; @@ -821,7 +835,8 @@ taskq_thread(void *args) sigprocmask(SIG_BLOCK, &blocked, NULL); flush_signals(current); - spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); + spin_lock_irqsave_nested(&tq->tq_lock, tq->tq_lock_flags, + tq->tq_lock_class); /* Immediately exit if more threads than allowed were created. */ if (tq->tq_nthreads >= tq->tq_maxthreads) @@ -848,7 +863,8 @@ taskq_thread(void *args) schedule(); seq_tasks = 0; - spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); + spin_lock_irqsave_nested(&tq->tq_lock, + tq->tq_lock_flags, tq->tq_lock_class); remove_wait_queue(&tq->tq_work_waitq, &wait); } else { __set_current_state(TASK_RUNNING); @@ -877,7 +893,8 @@ taskq_thread(void *args) /* Perform the requested task */ t->tqent_func(t->tqent_arg); - spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); + spin_lock_irqsave_nested(&tq->tq_lock, + tq->tq_lock_flags, tq->tq_lock_class); tq->tq_nactive--; list_del_init(&tqt->tqt_active_list); tqt->tqt_task = NULL; @@ -999,9 +1016,11 @@ taskq_create(const char *name, int nthreads, pri_t pri, INIT_LIST_HEAD(&tq->tq_delay_list); init_waitqueue_head(&tq->tq_work_waitq); init_waitqueue_head(&tq->tq_wait_waitq); + tq->tq_lock_class = TQ_LOCK_GENERAL; if (flags & TASKQ_PREPOPULATE) { - spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); + spin_lock_irqsave_nested(&tq->tq_lock, tq->tq_lock_flags, + tq->tq_lock_class); for (i = 0; i < minalloc; i++) task_done(tq, task_alloc(tq, TQ_PUSHPAGE | TQ_NEW)); @@ -1040,7 +1059,8 @@ taskq_destroy(taskq_t *tq) taskq_ent_t *t; ASSERT(tq); - spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); + spin_lock_irqsave_nested(&tq->tq_lock, tq->tq_lock_flags, + tq->tq_lock_class); tq->tq_flags &= ~TASKQ_ACTIVE; spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); @@ -1053,7 +1073,8 @@ taskq_destroy(taskq_t *tq) taskq_wait(tq); - spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); + spin_lock_irqsave_nested(&tq->tq_lock, tq->tq_lock_flags, + tq->tq_lock_class); /* * Signal each thread to exit and block until it does. Each thread @@ -1069,7 +1090,8 @@ taskq_destroy(taskq_t *tq) kthread_stop(thread); - spin_lock_irqsave(&tq->tq_lock, tq->tq_lock_flags); + spin_lock_irqsave_nested(&tq->tq_lock, tq->tq_lock_flags, + tq->tq_lock_class); } while (!list_empty(&tq->tq_free_list)) { @@ -1113,6 +1135,12 @@ spl_taskq_init(void) return (1); } + /* This is used to annotate tq_lock, so + * taskq_dispatch -> taskq_thread_spawn -> taskq_dispatch + * does not trigger a lockdep warning re: possible recursive locking + */ + dynamic_taskq->tq_lock_class = TQ_LOCK_DYNAMIC; + return (0); } -- cgit v1.2.3 From 066b89e68545e1f774124969d0dd7b36ccb04112 Mon Sep 17 00:00:00 2001 From: Chunwei Chen Date: Thu, 3 Dec 2015 15:06:03 -0800 Subject: Don't use tq->tq_lock_flags The flags argument in spin_lock_irqsave is modified out side of spin_lock context. We cannot use a shared variable like tq->tq_lock_flags for them. This patch removes it and uses local variable for the flags. Signed-off-by: Chunwei Chen Signed-off-by: Brian Behlendorf Closes #506 --- include/sys/taskq.h | 1 - module/spl/spl-taskq.c | 123 +++++++++++++++++++++++++------------------------ 2 files changed, 62 insertions(+), 62 deletions(-) (limited to 'module/spl/spl-taskq.c') diff --git a/include/sys/taskq.h b/include/sys/taskq.h index 5830fe2dd..07b4209e6 100644 --- a/include/sys/taskq.h +++ b/include/sys/taskq.h @@ -68,7 +68,6 @@ typedef void (task_func_t)(void *); typedef struct taskq { spinlock_t tq_lock; /* protects taskq_t */ - unsigned long tq_lock_flags; /* interrupt state */ char *tq_name; /* taskq name */ struct list_head tq_thread_list;/* list of all threads */ struct list_head tq_active_list;/* list of active threads */ diff --git a/module/spl/spl-taskq.c b/module/spl/spl-taskq.c index 588dbc8a4..ded6d3b80 100644 --- a/module/spl/spl-taskq.c +++ b/module/spl/spl-taskq.c @@ -71,7 +71,7 @@ task_km_flags(uint_t flags) * is not attached to the free, work, or pending taskq lists. */ static taskq_ent_t * -task_alloc(taskq_t *tq, uint_t flags) +task_alloc(taskq_t *tq, uint_t flags, unsigned long *irqflags) { taskq_ent_t *t; int count = 0; @@ -111,9 +111,9 @@ retry: * end up delaying the task allocation by one second, thereby * throttling the task dispatch rate. */ - spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); + spin_unlock_irqrestore(&tq->tq_lock, *irqflags); schedule_timeout(HZ / 100); - spin_lock_irqsave_nested(&tq->tq_lock, tq->tq_lock_flags, + spin_lock_irqsave_nested(&tq->tq_lock, *irqflags, tq->tq_lock_class); if (count < 100) { count++; @@ -121,10 +121,9 @@ retry: } } - spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); + spin_unlock_irqrestore(&tq->tq_lock, *irqflags); t = kmem_alloc(sizeof(taskq_ent_t), task_km_flags(flags)); - spin_lock_irqsave_nested(&tq->tq_lock, tq->tq_lock_flags, - tq->tq_lock_class); + spin_lock_irqsave_nested(&tq->tq_lock, *irqflags, tq->tq_lock_class); if (t) { taskq_init_ent(t); @@ -189,13 +188,13 @@ task_expire(unsigned long data) taskq_ent_t *w, *t = (taskq_ent_t *)data; taskq_t *tq = t->tqent_taskq; struct list_head *l; + unsigned long flags; - spin_lock_irqsave_nested(&tq->tq_lock, tq->tq_lock_flags, - tq->tq_lock_class); + spin_lock_irqsave_nested(&tq->tq_lock, flags, tq->tq_lock_class); if (t->tqent_flags & TQENT_FLAG_CANCEL) { ASSERT(list_empty(&t->tqent_list)); - spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); + spin_unlock_irqrestore(&tq->tq_lock, flags); return; } @@ -214,7 +213,7 @@ task_expire(unsigned long data) if (l == &tq->tq_prio_list) list_add(&t->tqent_list, &tq->tq_prio_list); - spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); + spin_unlock_irqrestore(&tq->tq_lock, flags); wake_up(&tq->tq_work_waitq); } @@ -381,11 +380,11 @@ taskq_wait_id_check(taskq_t *tq, taskqid_t id) { int active = 0; int rc; + unsigned long flags; - spin_lock_irqsave_nested(&tq->tq_lock, tq->tq_lock_flags, - tq->tq_lock_class); + spin_lock_irqsave_nested(&tq->tq_lock, flags, tq->tq_lock_class); rc = (taskq_find(tq, id, &active) == NULL); - spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); + spin_unlock_irqrestore(&tq->tq_lock, flags); return (rc); } @@ -405,11 +404,11 @@ static int taskq_wait_outstanding_check(taskq_t *tq, taskqid_t id) { int rc; + unsigned long flags; - spin_lock_irqsave_nested(&tq->tq_lock, tq->tq_lock_flags, - tq->tq_lock_class); + spin_lock_irqsave_nested(&tq->tq_lock, flags, tq->tq_lock_class); rc = (id < tq->tq_lowest_id); - spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); + spin_unlock_irqrestore(&tq->tq_lock, flags); return (rc); } @@ -433,11 +432,11 @@ static int taskq_wait_check(taskq_t *tq) { int rc; + unsigned long flags; - spin_lock_irqsave_nested(&tq->tq_lock, tq->tq_lock_flags, - tq->tq_lock_class); + spin_lock_irqsave_nested(&tq->tq_lock, flags, tq->tq_lock_class); rc = (tq->tq_lowest_id == tq->tq_next_id); - spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); + spin_unlock_irqrestore(&tq->tq_lock, flags); return (rc); } @@ -479,11 +478,11 @@ int taskq_member(taskq_t *tq, void *t) { int found; + unsigned long flags; - spin_lock_irqsave_nested(&tq->tq_lock, tq->tq_lock_flags, - tq->tq_lock_class); + spin_lock_irqsave_nested(&tq->tq_lock, flags, tq->tq_lock_class); found = taskq_member_impl(tq, t); - spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); + spin_unlock_irqrestore(&tq->tq_lock, flags); return (found); } @@ -501,11 +500,11 @@ taskq_cancel_id(taskq_t *tq, taskqid_t id) taskq_ent_t *t; int active = 0; int rc = ENOENT; + unsigned long flags; ASSERT(tq); - spin_lock_irqsave_nested(&tq->tq_lock, tq->tq_lock_flags, - tq->tq_lock_class); + spin_lock_irqsave_nested(&tq->tq_lock, flags, tq->tq_lock_class); t = taskq_find(tq, id, &active); if (t && !active) { list_del_init(&t->tqent_list); @@ -525,10 +524,10 @@ taskq_cancel_id(taskq_t *tq, taskqid_t id) * drop the lock before synchronously cancelling the timer. */ if (timer_pending(&t->tqent_timer)) { - spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); + spin_unlock_irqrestore(&tq->tq_lock, flags); del_timer_sync(&t->tqent_timer); - spin_lock_irqsave_nested(&tq->tq_lock, - tq->tq_lock_flags, tq->tq_lock_class); + spin_lock_irqsave_nested(&tq->tq_lock, flags, + tq->tq_lock_class); } if (!(t->tqent_flags & TQENT_FLAG_PREALLOC)) @@ -536,7 +535,7 @@ taskq_cancel_id(taskq_t *tq, taskqid_t id) rc = 0; } - spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); + spin_unlock_irqrestore(&tq->tq_lock, flags); if (active) { taskq_wait_id(tq, id); @@ -554,12 +553,12 @@ taskq_dispatch(taskq_t *tq, task_func_t func, void *arg, uint_t flags) { taskq_ent_t *t; taskqid_t rc = 0; + unsigned long irqflags; ASSERT(tq); ASSERT(func); - spin_lock_irqsave_nested(&tq->tq_lock, tq->tq_lock_flags, - tq->tq_lock_class); + spin_lock_irqsave_nested(&tq->tq_lock, irqflags, tq->tq_lock_class); /* Taskq being destroyed and all tasks drained */ if (!(tq->tq_flags & TASKQ_ACTIVE)) @@ -570,7 +569,7 @@ taskq_dispatch(taskq_t *tq, task_func_t func, void *arg, uint_t flags) if ((flags & TQ_NOQUEUE) && (tq->tq_nactive == tq->tq_nthreads)) goto out; - if ((t = task_alloc(tq, flags)) == NULL) + if ((t = task_alloc(tq, flags, &irqflags)) == NULL) goto out; spin_lock(&t->tqent_lock); @@ -600,7 +599,7 @@ out: if (tq->tq_nactive == tq->tq_nthreads) (void) taskq_thread_spawn(tq); - spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); + spin_unlock_irqrestore(&tq->tq_lock, irqflags); return (rc); } EXPORT_SYMBOL(taskq_dispatch); @@ -611,18 +610,18 @@ taskq_dispatch_delay(taskq_t *tq, task_func_t func, void *arg, { taskqid_t rc = 0; taskq_ent_t *t; + unsigned long irqflags; ASSERT(tq); ASSERT(func); - spin_lock_irqsave_nested(&tq->tq_lock, tq->tq_lock_flags, - tq->tq_lock_class); + spin_lock_irqsave_nested(&tq->tq_lock, irqflags, tq->tq_lock_class); /* Taskq being destroyed and all tasks drained */ if (!(tq->tq_flags & TASKQ_ACTIVE)) goto out; - if ((t = task_alloc(tq, flags)) == NULL) + if ((t = task_alloc(tq, flags, &irqflags)) == NULL) goto out; spin_lock(&t->tqent_lock); @@ -647,7 +646,7 @@ out: /* Spawn additional taskq threads if required. */ if (tq->tq_nactive == tq->tq_nthreads) (void) taskq_thread_spawn(tq); - spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); + spin_unlock_irqrestore(&tq->tq_lock, irqflags); return (rc); } EXPORT_SYMBOL(taskq_dispatch_delay); @@ -656,10 +655,11 @@ void taskq_dispatch_ent(taskq_t *tq, task_func_t func, void *arg, uint_t flags, taskq_ent_t *t) { + unsigned long irqflags; ASSERT(tq); ASSERT(func); - spin_lock_irqsave_nested(&tq->tq_lock, tq->tq_lock_flags, + spin_lock_irqsave_nested(&tq->tq_lock, irqflags, tq->tq_lock_class); /* Taskq being destroyed and all tasks drained */ @@ -695,7 +695,7 @@ out: /* Spawn additional taskq threads if required. */ if (tq->tq_nactive == tq->tq_nthreads) (void) taskq_thread_spawn(tq); - spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); + spin_unlock_irqrestore(&tq->tq_lock, irqflags); } EXPORT_SYMBOL(taskq_dispatch_ent); @@ -749,13 +749,13 @@ static void taskq_thread_spawn_task(void *arg) { taskq_t *tq = (taskq_t *)arg; + unsigned long flags; (void) taskq_thread_create(tq); - spin_lock_irqsave_nested(&tq->tq_lock, tq->tq_lock_flags, - tq->tq_lock_class); + spin_lock_irqsave_nested(&tq->tq_lock, flags, tq->tq_lock_class); tq->tq_nspawn--; - spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); + spin_unlock_irqrestore(&tq->tq_lock, flags); } /* @@ -821,6 +821,7 @@ taskq_thread(void *args) taskq_t *tq; taskq_ent_t *t; int seq_tasks = 0; + unsigned long flags; ASSERT(tqt); ASSERT(tqt->tqt_tq); @@ -835,8 +836,7 @@ taskq_thread(void *args) sigprocmask(SIG_BLOCK, &blocked, NULL); flush_signals(current); - spin_lock_irqsave_nested(&tq->tq_lock, tq->tq_lock_flags, - tq->tq_lock_class); + spin_lock_irqsave_nested(&tq->tq_lock, flags, tq->tq_lock_class); /* Immediately exit if more threads than allowed were created. */ if (tq->tq_nthreads >= tq->tq_maxthreads) @@ -858,13 +858,13 @@ taskq_thread(void *args) } add_wait_queue_exclusive(&tq->tq_work_waitq, &wait); - spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); + spin_unlock_irqrestore(&tq->tq_lock, flags); schedule(); seq_tasks = 0; - spin_lock_irqsave_nested(&tq->tq_lock, - tq->tq_lock_flags, tq->tq_lock_class); + spin_lock_irqsave_nested(&tq->tq_lock, flags, + tq->tq_lock_class); remove_wait_queue(&tq->tq_work_waitq, &wait); } else { __set_current_state(TASK_RUNNING); @@ -888,13 +888,13 @@ taskq_thread(void *args) taskq_insert_in_order(tq, tqt); tq->tq_nactive++; - spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); + spin_unlock_irqrestore(&tq->tq_lock, flags); /* Perform the requested task */ t->tqent_func(t->tqent_arg); - spin_lock_irqsave_nested(&tq->tq_lock, - tq->tq_lock_flags, tq->tq_lock_class); + spin_lock_irqsave_nested(&tq->tq_lock, flags, + tq->tq_lock_class); tq->tq_nactive--; list_del_init(&tqt->tqt_active_list); tqt->tqt_task = NULL; @@ -932,7 +932,7 @@ taskq_thread(void *args) list_del_init(&tqt->tqt_thread_list); error: kmem_free(tqt, sizeof (taskq_thread_t)); - spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); + spin_unlock_irqrestore(&tq->tq_lock, flags); return (0); } @@ -976,6 +976,7 @@ taskq_create(const char *name, int nthreads, pri_t pri, taskq_t *tq; taskq_thread_t *tqt; int count = 0, rc = 0, i; + unsigned long irqflags; ASSERT(name != NULL); ASSERT(minalloc >= 0); @@ -1019,13 +1020,14 @@ taskq_create(const char *name, int nthreads, pri_t pri, tq->tq_lock_class = TQ_LOCK_GENERAL; if (flags & TASKQ_PREPOPULATE) { - spin_lock_irqsave_nested(&tq->tq_lock, tq->tq_lock_flags, + spin_lock_irqsave_nested(&tq->tq_lock, irqflags, tq->tq_lock_class); for (i = 0; i < minalloc; i++) - task_done(tq, task_alloc(tq, TQ_PUSHPAGE | TQ_NEW)); + task_done(tq, task_alloc(tq, TQ_PUSHPAGE | TQ_NEW, + &irqflags)); - spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); + spin_unlock_irqrestore(&tq->tq_lock, irqflags); } if ((flags & TASKQ_DYNAMIC) && spl_taskq_thread_dynamic) @@ -1057,12 +1059,12 @@ taskq_destroy(taskq_t *tq) struct task_struct *thread; taskq_thread_t *tqt; taskq_ent_t *t; + unsigned long flags; ASSERT(tq); - spin_lock_irqsave_nested(&tq->tq_lock, tq->tq_lock_flags, - tq->tq_lock_class); + spin_lock_irqsave_nested(&tq->tq_lock, flags, tq->tq_lock_class); tq->tq_flags &= ~TASKQ_ACTIVE; - spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); + spin_unlock_irqrestore(&tq->tq_lock, flags); /* * When TASKQ_ACTIVE is clear new tasks may not be added nor may @@ -1073,8 +1075,7 @@ taskq_destroy(taskq_t *tq) taskq_wait(tq); - spin_lock_irqsave_nested(&tq->tq_lock, tq->tq_lock_flags, - tq->tq_lock_class); + spin_lock_irqsave_nested(&tq->tq_lock, flags, tq->tq_lock_class); /* * Signal each thread to exit and block until it does. Each thread @@ -1086,11 +1087,11 @@ taskq_destroy(taskq_t *tq) tqt = list_entry(tq->tq_thread_list.next, taskq_thread_t, tqt_thread_list); thread = tqt->tqt_thread; - spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); + spin_unlock_irqrestore(&tq->tq_lock, flags); kthread_stop(thread); - spin_lock_irqsave_nested(&tq->tq_lock, tq->tq_lock_flags, + spin_lock_irqsave_nested(&tq->tq_lock, flags, tq->tq_lock_class); } @@ -1113,7 +1114,7 @@ taskq_destroy(taskq_t *tq) ASSERT(list_empty(&tq->tq_prio_list)); ASSERT(list_empty(&tq->tq_delay_list)); - spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags); + spin_unlock_irqrestore(&tq->tq_lock, flags); strfree(tq->tq_name); kmem_free(tq, sizeof (taskq_t)); -- cgit v1.2.3 From 2c4332cf793e7c9ca5b2b9b0e6f31c3e41bbc1b1 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Fri, 11 Dec 2015 16:15:50 -0800 Subject: Fix cstyle issues in spl-taskq.c and taskq.h This patch only addresses the issues identified by the style checker. It contains no functional changes. Signed-off-by: Brian Behlendorf --- include/sys/taskq.h | 91 +++++++++++++++++++++++++------------------------- module/spl/spl-taskq.c | 75 ++++++++++++++++++++++------------------- 2 files changed, 87 insertions(+), 79 deletions(-) (limited to 'module/spl/spl-taskq.c') diff --git a/include/sys/taskq.h b/include/sys/taskq.h index 07b4209e6..ed6aff8f8 100644 --- a/include/sys/taskq.h +++ b/include/sys/taskq.h @@ -1,4 +1,4 @@ -/*****************************************************************************\ +/* * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. * Copyright (C) 2007 The Regents of the University of California. * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). @@ -20,10 +20,10 @@ * * You should have received a copy of the GNU General Public License along * with the SPL. If not, see . -\*****************************************************************************/ + */ #ifndef _SPL_TASKQ_H -#define _SPL_TASKQ_H +#define _SPL_TASKQ_H #include #include @@ -33,29 +33,30 @@ #include #include -#define TASKQ_NAMELEN 31 +#define TASKQ_NAMELEN 31 -#define TASKQ_PREPOPULATE 0x00000001 -#define TASKQ_CPR_SAFE 0x00000002 -#define TASKQ_DYNAMIC 0x00000004 -#define TASKQ_THREADS_CPU_PCT 0x00000008 -#define TASKQ_DC_BATCH 0x00000010 -#define TASKQ_ACTIVE 0x80000000 +#define TASKQ_PREPOPULATE 0x00000001 +#define TASKQ_CPR_SAFE 0x00000002 +#define TASKQ_DYNAMIC 0x00000004 +#define TASKQ_THREADS_CPU_PCT 0x00000008 +#define TASKQ_DC_BATCH 0x00000010 +#define TASKQ_ACTIVE 0x80000000 /* * Flags for taskq_dispatch. TQ_SLEEP/TQ_NOSLEEP should be same as * KM_SLEEP/KM_NOSLEEP. TQ_NOQUEUE/TQ_NOALLOC are set particularly * large so as not to conflict with already used GFP_* defines. */ -#define TQ_SLEEP 0x00000000 -#define TQ_NOSLEEP 0x00000001 -#define TQ_PUSHPAGE 0x00000002 -#define TQ_NOQUEUE 0x01000000 -#define TQ_NOALLOC 0x02000000 -#define TQ_NEW 0x04000000 -#define TQ_FRONT 0x08000000 - -/* spin_lock(lock) and spin_lock_nested(lock,0) are equivalent, +#define TQ_SLEEP 0x00000000 +#define TQ_NOSLEEP 0x00000001 +#define TQ_PUSHPAGE 0x00000002 +#define TQ_NOQUEUE 0x01000000 +#define TQ_NOALLOC 0x02000000 +#define TQ_NEW 0x04000000 +#define TQ_FRONT 0x08000000 + +/* + * spin_lock(lock) and spin_lock_nested(lock,0) are equivalent, * so TQ_LOCK_DYNAMIC must not evaluate to 0 */ typedef enum tq_lock_role { @@ -67,28 +68,28 @@ typedef unsigned long taskqid_t; typedef void (task_func_t)(void *); typedef struct taskq { - spinlock_t tq_lock; /* protects taskq_t */ - char *tq_name; /* taskq name */ - struct list_head tq_thread_list;/* list of all threads */ - struct list_head tq_active_list;/* list of active threads */ - int tq_nactive; /* # of active threads */ - int tq_nthreads; /* # of existing threads */ - int tq_nspawn; /* # of threads being spawned */ - int tq_maxthreads; /* # of threads maximum */ - int tq_pri; /* priority */ - int tq_minalloc; /* min task_t pool size */ - int tq_maxalloc; /* max task_t pool size */ - int tq_nalloc; /* cur task_t pool size */ - uint_t tq_flags; /* flags */ - taskqid_t tq_next_id; /* next pend/work id */ - taskqid_t tq_lowest_id; /* lowest pend/work id */ - struct list_head tq_free_list; /* free task_t's */ - struct list_head tq_pend_list; /* pending task_t's */ - struct list_head tq_prio_list; /* priority pending task_t's */ - struct list_head tq_delay_list; /* delayed task_t's */ - wait_queue_head_t tq_work_waitq; /* new work waitq */ - wait_queue_head_t tq_wait_waitq; /* wait waitq */ - tq_lock_role_t tq_lock_class; /* class used when taking tq_lock */ + spinlock_t tq_lock; /* protects taskq_t */ + char *tq_name; /* taskq name */ + struct list_head tq_thread_list; /* list of all threads */ + struct list_head tq_active_list; /* list of active threads */ + int tq_nactive; /* # of active threads */ + int tq_nthreads; /* # of existing threads */ + int tq_nspawn; /* # of threads being spawned */ + int tq_maxthreads; /* # of threads maximum */ + int tq_pri; /* priority */ + int tq_minalloc; /* min task_t pool size */ + int tq_maxalloc; /* max task_t pool size */ + int tq_nalloc; /* cur task_t pool size */ + uint_t tq_flags; /* flags */ + taskqid_t tq_next_id; /* next pend/work id */ + taskqid_t tq_lowest_id; /* lowest pend/work id */ + struct list_head tq_free_list; /* free task_t's */ + struct list_head tq_pend_list; /* pending task_t's */ + struct list_head tq_prio_list; /* priority pending task_t's */ + struct list_head tq_delay_list; /* delayed task_t's */ + wait_queue_head_t tq_work_waitq; /* new work waitq */ + wait_queue_head_t tq_wait_waitq; /* wait waitq */ + tq_lock_role_t tq_lock_class; /* class when taking tq_lock */ } taskq_t; typedef struct taskq_ent { @@ -103,8 +104,8 @@ typedef struct taskq_ent { uintptr_t tqent_flags; } taskq_ent_t; -#define TQENT_FLAG_PREALLOC 0x1 -#define TQENT_FLAG_CANCEL 0x2 +#define TQENT_FLAG_PREALLOC 0x1 +#define TQENT_FLAG_CANCEL 0x2 typedef struct taskq_thread { struct list_head tqt_thread_list; @@ -134,9 +135,9 @@ extern void taskq_wait(taskq_t *); extern int taskq_cancel_id(taskq_t *, taskqid_t); extern int taskq_member(taskq_t *, void *); -#define taskq_create_proc(name, nthreads, pri, min, max, proc, flags) \ +#define taskq_create_proc(name, nthreads, pri, min, max, proc, flags) \ taskq_create(name, nthreads, pri, min, max, flags) -#define taskq_create_sysdc(name, nthreads, min, max, proc, dc, flags) \ +#define taskq_create_sysdc(name, nthreads, min, max, proc, dc, flags) \ taskq_create(name, nthreads, maxclsyspri, min, max, flags) int spl_taskq_init(void); diff --git a/module/spl/spl-taskq.c b/module/spl/spl-taskq.c index ded6d3b80..89d68f33c 100644 --- a/module/spl/spl-taskq.c +++ b/module/spl/spl-taskq.c @@ -1,4 +1,4 @@ -/*****************************************************************************\ +/* * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. * Copyright (C) 2007 The Regents of the University of California. * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). @@ -20,9 +20,9 @@ * * You should have received a copy of the GNU General Public License along * with the SPL. If not, see . - ***************************************************************************** + * * Solaris Porting Layer (SPL) Task Queue Implementation. -\*****************************************************************************/ + */ #include #include @@ -39,12 +39,12 @@ MODULE_PARM_DESC(spl_taskq_thread_dynamic, "Allow dynamic taskq threads"); int spl_taskq_thread_priority = 1; module_param(spl_taskq_thread_priority, int, 0644); MODULE_PARM_DESC(spl_taskq_thread_priority, - "Allow non-default priority for taskq threads"); + "Allow non-default priority for taskq threads"); int spl_taskq_thread_sequential = 4; module_param(spl_taskq_thread_sequential, int, 0644); MODULE_PARM_DESC(spl_taskq_thread_sequential, - "Create new taskq threads after N sequential tasks"); + "Create new taskq threads after N sequential tasks"); /* Global system-wide dynamic task queue available for all consumers */ taskq_t *system_taskq; @@ -58,12 +58,12 @@ static int task_km_flags(uint_t flags) { if (flags & TQ_NOSLEEP) - return KM_NOSLEEP; + return (KM_NOSLEEP); if (flags & TQ_PUSHPAGE) - return KM_PUSHPAGE; + return (KM_PUSHPAGE); - return KM_SLEEP; + return (KM_SLEEP); } /* @@ -122,7 +122,7 @@ retry: } spin_unlock_irqrestore(&tq->tq_lock, *irqflags); - t = kmem_alloc(sizeof(taskq_ent_t), task_km_flags(flags)); + t = kmem_alloc(sizeof (taskq_ent_t), task_km_flags(flags)); spin_lock_irqsave_nested(&tq->tq_lock, *irqflags, tq->tq_lock_class); if (t) { @@ -146,7 +146,7 @@ task_free(taskq_t *tq, taskq_ent_t *t) ASSERT(list_empty(&t->tqent_list)); ASSERT(!timer_pending(&t->tqent_timer)); - kmem_free(t, sizeof(taskq_ent_t)); + kmem_free(t, sizeof (taskq_ent_t)); tq->tq_nalloc--; } @@ -653,7 +653,7 @@ EXPORT_SYMBOL(taskq_dispatch_delay); void taskq_dispatch_ent(taskq_t *tq, task_func_t func, void *arg, uint_t flags, - taskq_ent_t *t) + taskq_ent_t *t) { unsigned long irqflags; ASSERT(tq); @@ -702,7 +702,7 @@ EXPORT_SYMBOL(taskq_dispatch_ent); int taskq_empty_ent(taskq_ent_t *t) { - return list_empty(&t->tqent_list); + return (list_empty(&t->tqent_list)); } EXPORT_SYMBOL(taskq_empty_ent); @@ -809,7 +809,7 @@ taskq_thread_should_stop(taskq_t *tq, taskq_thread_t *tqt) (tq->tq_nactive == 0) && /* No threads are handling tasks */ (tq->tq_nthreads > 1) && /* More than 1 thread is running */ (!taskq_next_ent(tq)) && /* There are no pending tasks */ - (spl_taskq_thread_dynamic));/* Dynamic taskqs are allowed */ + (spl_taskq_thread_dynamic)); /* Dynamic taskqs are allowed */ } static int @@ -828,9 +828,9 @@ taskq_thread(void *args) tq = tqt->tqt_tq; current->flags |= PF_NOFREEZE; - #if defined(PF_MEMALLOC_NOIO) +#if defined(PF_MEMALLOC_NOIO) (void) memalloc_noio_save(); - #endif +#endif sigfillset(&blocked); sigprocmask(SIG_BLOCK, &blocked, NULL); @@ -873,17 +873,21 @@ taskq_thread(void *args) if ((t = taskq_next_ent(tq)) != NULL) { list_del_init(&t->tqent_list); - /* In order to support recursively dispatching a + /* + * In order to support recursively dispatching a * preallocated taskq_ent_t, tqent_id must be - * stored prior to executing tqent_func. */ + * stored prior to executing tqent_func. + */ tqt->tqt_id = t->tqent_id; tqt->tqt_task = t; - /* We must store a copy of the flags prior to + /* + * We must store a copy of the flags prior to * servicing the task (servicing a prealloc'd task * returns the ownership of the tqent back to * the caller of taskq_dispatch). Thus, - * tqent_flags _may_ change within the call. */ + * tqent_flags _may_ change within the call. + */ tqt->tqt_flags = t->tqent_flags; taskq_insert_in_order(tq, tqt); @@ -903,8 +907,10 @@ taskq_thread(void *args) if (!(tqt->tqt_flags & TQENT_FLAG_PREALLOC)) task_done(tq, t); - /* When the current lowest outstanding taskqid is - * done calculate the new lowest outstanding id */ + /* + * When the current lowest outstanding taskqid is + * done calculate the new lowest outstanding id + */ if (tq->tq_lowest_id == tqt->tqt_id) { tq->tq_lowest_id = taskq_lowest_id(tq); ASSERT3S(tq->tq_lowest_id, >, tqt->tqt_id); @@ -999,18 +1005,18 @@ taskq_create(const char *name, int nthreads, pri_t pri, spin_lock_init(&tq->tq_lock); INIT_LIST_HEAD(&tq->tq_thread_list); INIT_LIST_HEAD(&tq->tq_active_list); - tq->tq_name = strdup(name); - tq->tq_nactive = 0; - tq->tq_nthreads = 0; - tq->tq_nspawn = 0; + tq->tq_name = strdup(name); + tq->tq_nactive = 0; + tq->tq_nthreads = 0; + tq->tq_nspawn = 0; tq->tq_maxthreads = nthreads; - tq->tq_pri = pri; - tq->tq_minalloc = minalloc; - tq->tq_maxalloc = maxalloc; - tq->tq_nalloc = 0; - tq->tq_flags = (flags | TASKQ_ACTIVE); - tq->tq_next_id = 1; - tq->tq_lowest_id = 1; + tq->tq_pri = pri; + tq->tq_minalloc = minalloc; + tq->tq_maxalloc = maxalloc; + tq->tq_nalloc = 0; + tq->tq_flags = (flags | TASKQ_ACTIVE); + tq->tq_next_id = 1; + tq->tq_lowest_id = 1; INIT_LIST_HEAD(&tq->tq_free_list); INIT_LIST_HEAD(&tq->tq_pend_list); INIT_LIST_HEAD(&tq->tq_prio_list); @@ -1136,8 +1142,9 @@ spl_taskq_init(void) return (1); } - /* This is used to annotate tq_lock, so - * taskq_dispatch -> taskq_thread_spawn -> taskq_dispatch + /* + * This is used to annotate tq_lock, so + * taskq_dispatch -> taskq_thread_spawn -> taskq_dispatch * does not trigger a lockdep warning re: possible recursive locking */ dynamic_taskq->tq_lock_class = TQ_LOCK_DYNAMIC; -- cgit v1.2.3 From 200366f23f1a16874d78a07936c5a33f2d488022 Mon Sep 17 00:00:00 2001 From: Tim Chase Date: Mon, 19 Oct 2015 07:47:52 -0500 Subject: Provide kstat for taskqs This patch provides 2 new kstats to display task queues: /proc/spl/taskqs-all - Display all task queues /proc/spl/taskqs - Display only "active" task queues A task queue is considered to be "active" if it currently has active (running) threads or if any of its pending, priority, delay or waitq lists are not empty. If the task queue has running threads, displays each thread function's address (symbolically, if possibly) and its argument. If the task queue has a non-empty list of pending, priority or delayed task queue entries (taskq_ent_t), displays each entry's thread function address and arguemnt. If the task queue has any waiters, displays each waiting task's pid. Note: This patch also updates some comments in taskq.h which referred to "taskq_t" when they should have referred to "taskq_ent_t". Signed-off-by: Tim Chase Signed-off-by: Brian Behlendorf Closes #491 --- include/sys/taskq.h | 21 +++-- module/spl/spl-proc.c | 237 +++++++++++++++++++++++++++++++++++++++++++++++++ module/spl/spl-taskq.c | 32 +++++++ 3 files changed, 283 insertions(+), 7 deletions(-) (limited to 'module/spl/spl-taskq.c') diff --git a/include/sys/taskq.h b/include/sys/taskq.h index ed6aff8f8..544dbb2bb 100644 --- a/include/sys/taskq.h +++ b/include/sys/taskq.h @@ -32,6 +32,7 @@ #include #include #include +#include #define TASKQ_NAMELEN 31 @@ -70,6 +71,7 @@ typedef void (task_func_t)(void *); typedef struct taskq { spinlock_t tq_lock; /* protects taskq_t */ char *tq_name; /* taskq name */ + int tq_instance; /* instance of tq_name */ struct list_head tq_thread_list; /* list of all threads */ struct list_head tq_active_list; /* list of active threads */ int tq_nactive; /* # of active threads */ @@ -77,16 +79,17 @@ typedef struct taskq { int tq_nspawn; /* # of threads being spawned */ int tq_maxthreads; /* # of threads maximum */ int tq_pri; /* priority */ - int tq_minalloc; /* min task_t pool size */ - int tq_maxalloc; /* max task_t pool size */ - int tq_nalloc; /* cur task_t pool size */ + int tq_minalloc; /* min taskq_ent_t pool size */ + int tq_maxalloc; /* max taskq_ent_t pool size */ + int tq_nalloc; /* cur taskq_ent_t pool size */ uint_t tq_flags; /* flags */ taskqid_t tq_next_id; /* next pend/work id */ taskqid_t tq_lowest_id; /* lowest pend/work id */ - struct list_head tq_free_list; /* free task_t's */ - struct list_head tq_pend_list; /* pending task_t's */ - struct list_head tq_prio_list; /* priority pending task_t's */ - struct list_head tq_delay_list; /* delayed task_t's */ + struct list_head tq_free_list; /* free taskq_ent_t's */ + struct list_head tq_pend_list; /* pending taskq_ent_t's */ + struct list_head tq_prio_list; /* priority pending taskq_ent_t's */ + struct list_head tq_delay_list; /* delayed taskq_ent_t's */ + struct list_head tq_taskqs; /* all taskq_t's */ wait_queue_head_t tq_work_waitq; /* new work waitq */ wait_queue_head_t tq_wait_waitq; /* wait waitq */ tq_lock_role_t tq_lock_class; /* class when taking tq_lock */ @@ -120,6 +123,10 @@ typedef struct taskq_thread { /* Global system-wide dynamic task queue available for all consumers */ extern taskq_t *system_taskq; +/* List of all taskqs */ +extern struct list_head tq_list; +extern struct rw_semaphore tq_list_sem; + extern taskqid_t taskq_dispatch(taskq_t *, task_func_t, void *, uint_t); extern taskqid_t taskq_dispatch_delay(taskq_t *, task_func_t, void *, uint_t, clock_t); diff --git a/module/spl/spl-proc.c b/module/spl/spl-proc.c index eb00505d6..db546ea61 100644 --- a/module/spl/spl-proc.c +++ b/module/spl/spl-proc.c @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -49,6 +50,8 @@ static struct ctl_table_header *spl_header = NULL; static struct proc_dir_entry *proc_spl = NULL; static struct proc_dir_entry *proc_spl_kmem = NULL; static struct proc_dir_entry *proc_spl_kmem_slab = NULL; +static struct proc_dir_entry *proc_spl_taskq_all = NULL; +static struct proc_dir_entry *proc_spl_taskq = NULL; struct proc_dir_entry *proc_spl_kstat = NULL; static int @@ -215,6 +218,176 @@ proc_dohostid(struct ctl_table *table, int write, return (rc); } +static void +taskq_seq_show_headers(struct seq_file *f) +{ + seq_printf(f, "%-25s %5s %5s %5s %5s %5s %5s %12s %5s %10s\n", + "taskq", "act", "nthr", "spwn", "maxt", "pri", + "mina", "maxa", "cura", "flags"); +} + +/* indices into the lheads array below */ +#define LHEAD_PEND 0 +#define LHEAD_PRIO 1 +#define LHEAD_DELAY 2 +#define LHEAD_WAIT 3 +#define LHEAD_ACTIVE 4 +#define LHEAD_SIZE 5 + +static int +taskq_seq_show_impl(struct seq_file *f, void *p, boolean_t allflag) +{ + taskq_t *tq = p; + taskq_thread_t *tqt; + wait_queue_t *wq; + struct task_struct *tsk; + taskq_ent_t *tqe; + char name[100]; + struct list_head *lheads[LHEAD_SIZE], *lh; + static char *list_names[LHEAD_SIZE] = + {"pend", "prio", "delay", "wait", "active" }; + int i, j, have_lheads = 0; + unsigned long wflags, flags; + + spin_lock_irqsave_nested(&tq->tq_lock, flags, tq->tq_lock_class); + spin_lock_irqsave(&tq->tq_wait_waitq.lock, wflags); + + /* get the various lists and check whether they're empty */ + lheads[LHEAD_PEND] = &tq->tq_pend_list; + lheads[LHEAD_PRIO] = &tq->tq_prio_list; + lheads[LHEAD_DELAY] = &tq->tq_delay_list; + lheads[LHEAD_WAIT] = &tq->tq_wait_waitq.task_list; + lheads[LHEAD_ACTIVE] = &tq->tq_active_list; + + for (i = 0; i < LHEAD_SIZE; ++i) { + if (list_empty(lheads[i])) + lheads[i] = NULL; + else + ++have_lheads; + } + + /* early return in non-"all" mode if lists are all empty */ + if (!allflag && !have_lheads) { + spin_unlock_irqrestore(&tq->tq_wait_waitq.lock, wflags); + spin_unlock_irqrestore(&tq->tq_lock, flags); + return (0); + } + + /* unlock the waitq quickly */ + if (!lheads[LHEAD_WAIT]) + spin_unlock_irqrestore(&tq->tq_wait_waitq.lock, wflags); + + /* show the base taskq contents */ + snprintf(name, sizeof(name), "%s/%d", tq->tq_name, tq->tq_instance); + seq_printf(f, "%-25s ", name); + seq_printf(f, "%5d %5d %5d %5d %5d %5d %12d %5d %10x\n", + tq->tq_nactive, tq->tq_nthreads, tq->tq_nspawn, + tq->tq_maxthreads, tq->tq_pri, tq->tq_minalloc, tq->tq_maxalloc, + tq->tq_nalloc, tq->tq_flags); + + /* show the active list */ + if (lheads[LHEAD_ACTIVE]) { + j = 0; + list_for_each_entry(tqt, &tq->tq_active_list, tqt_active_list) { + if (j == 0) + seq_printf(f, "\t%s:", list_names[LHEAD_ACTIVE]); + else if (j == 2) { + seq_printf(f, "\n\t "); + j = 0; + } + seq_printf(f, " [%d]%pf(%ps)", + tqt->tqt_thread->pid, + tqt->tqt_task->tqent_func, + tqt->tqt_task->tqent_arg); + ++j; + } + seq_printf(f, "\n"); + } + + for (i = LHEAD_PEND; i <= LHEAD_WAIT; ++i) + if (lheads[i]) { + j = 0; + list_for_each(lh, lheads[i]) { + /* show the wait waitq list */ + if (i == LHEAD_WAIT) { + wq = list_entry(lh, wait_queue_t, task_list); + if (j == 0) + seq_printf(f, "\t%s:", + list_names[i]); + else if (j == 12) { + seq_printf(f, "\n\t "); + j = 0; + } + tsk = wq->private; + seq_printf(f, " %d", tsk->pid); + /* pend, prio and delay lists */ + } else { + tqe = list_entry(lh, taskq_ent_t, + tqent_list); + if (j == 0) + seq_printf(f, "\t%s:", + list_names[i]); + else if (j == 2) { + seq_printf(f, "\n\t "); + j = 0; + } + seq_printf(f, " %pf(%ps)", + tqe->tqent_func, + tqe->tqent_arg); + } + ++j; + } + seq_printf(f, "\n"); + } + if (lheads[LHEAD_WAIT]) + spin_unlock_irqrestore(&tq->tq_wait_waitq.lock, wflags); + spin_unlock_irqrestore(&tq->tq_lock, flags); + + return (0); +} + +static int +taskq_all_seq_show(struct seq_file *f, void *p) +{ + return (taskq_seq_show_impl(f, p, B_TRUE)); +} + +static int +taskq_seq_show(struct seq_file *f, void *p) +{ + return (taskq_seq_show_impl(f, p, B_FALSE)); +} + +static void * +taskq_seq_start(struct seq_file *f, loff_t *pos) +{ + struct list_head *p; + loff_t n = *pos; + + down_read(&tq_list_sem); + if (!n) + taskq_seq_show_headers(f); + + p = tq_list.next; + while (n--) { + p = p->next; + if (p == &tq_list) + return (NULL); + } + + return (list_entry(p, taskq_t, tq_taskqs)); +} + +static void * +taskq_seq_next(struct seq_file *f, void *p, loff_t *pos) +{ + taskq_t *tq = p; + + ++*pos; + return ((tq->tq_taskqs.next == &tq_list) ? + NULL : list_entry(tq->tq_taskqs.next, taskq_t, tq_taskqs)); +} + static void slab_seq_show_headers(struct seq_file *f) { @@ -325,6 +498,52 @@ static struct file_operations proc_slab_operations = { .release = seq_release, }; +static void +taskq_seq_stop(struct seq_file *f, void *v) +{ + up_read(&tq_list_sem); +} + +static struct seq_operations taskq_all_seq_ops = { + .show = taskq_all_seq_show, + .start = taskq_seq_start, + .next = taskq_seq_next, + .stop = taskq_seq_stop, +}; + +static struct seq_operations taskq_seq_ops = { + .show = taskq_seq_show, + .start = taskq_seq_start, + .next = taskq_seq_next, + .stop = taskq_seq_stop, +}; + +static int +proc_taskq_all_open(struct inode *inode, struct file *filp) +{ + return seq_open(filp, &taskq_all_seq_ops); +} + +static int +proc_taskq_open(struct inode *inode, struct file *filp) +{ + return seq_open(filp, &taskq_seq_ops); +} + +static struct file_operations proc_taskq_all_operations = { + .open = proc_taskq_all_open, + .read = seq_read, + .llseek = seq_lseek, + .release = seq_release, +}; + +static struct file_operations proc_taskq_operations = { + .open = proc_taskq_open, + .read = seq_read, + .llseek = seq_lseek, + .release = seq_release, +}; + static struct ctl_table spl_kmem_table[] = { #ifdef DEBUG_KMEM { @@ -476,6 +695,20 @@ spl_proc_init(void) goto out; } + proc_spl_taskq_all = proc_create_data("taskq-all", 0444, + proc_spl, &proc_taskq_all_operations, NULL); + if (proc_spl_taskq_all == NULL) { + rc = -EUNATCH; + goto out; + } + + proc_spl_taskq = proc_create_data("taskq", 0444, + proc_spl, &proc_taskq_operations, NULL); + if (proc_spl_taskq == NULL) { + rc = -EUNATCH; + goto out; + } + proc_spl_kmem = proc_mkdir("kmem", proc_spl); if (proc_spl_kmem == NULL) { rc = -EUNATCH; @@ -499,6 +732,8 @@ out: remove_proc_entry("kstat", proc_spl); remove_proc_entry("slab", proc_spl_kmem); remove_proc_entry("kmem", proc_spl); + remove_proc_entry("taskq-all", proc_spl); + remove_proc_entry("taskq", proc_spl); remove_proc_entry("spl", NULL); unregister_sysctl_table(spl_header); } @@ -512,6 +747,8 @@ spl_proc_fini(void) remove_proc_entry("kstat", proc_spl); remove_proc_entry("slab", proc_spl_kmem); remove_proc_entry("kmem", proc_spl); + remove_proc_entry("taskq-all", proc_spl); + remove_proc_entry("taskq", proc_spl); remove_proc_entry("spl", NULL); ASSERT(spl_header != NULL); diff --git a/module/spl/spl-taskq.c b/module/spl/spl-taskq.c index 89d68f33c..db5d8fba1 100644 --- a/module/spl/spl-taskq.c +++ b/module/spl/spl-taskq.c @@ -54,6 +54,10 @@ EXPORT_SYMBOL(system_taskq); static taskq_t *dynamic_taskq; static taskq_thread_t *taskq_thread_create(taskq_t *); +/* List of all taskqs */ +LIST_HEAD(tq_list); +DECLARE_RWSEM(tq_list_sem); + static int task_km_flags(uint_t flags) { @@ -66,6 +70,23 @@ task_km_flags(uint_t flags) return (KM_SLEEP); } +/* + * taskq_find_by_name - Find the largest instance number of a named taskq. + */ +static int +taskq_find_by_name(const char *name) +{ + struct list_head *tql; + taskq_t *tq; + + list_for_each_prev(tql, &tq_list) { + tq = list_entry(tql, taskq_t, tq_taskqs); + if (strcmp(name, tq->tq_name) == 0) + return tq->tq_instance; + } + return (-1); +} + /* * NOTE: Must be called with tq->tq_lock held, returns a list_t which * is not attached to the free, work, or pending taskq lists. @@ -1024,6 +1045,7 @@ taskq_create(const char *name, int nthreads, pri_t pri, init_waitqueue_head(&tq->tq_work_waitq); init_waitqueue_head(&tq->tq_wait_waitq); tq->tq_lock_class = TQ_LOCK_GENERAL; + INIT_LIST_HEAD(&tq->tq_taskqs); if (flags & TASKQ_PREPOPULATE) { spin_lock_irqsave_nested(&tq->tq_lock, irqflags, @@ -1053,6 +1075,11 @@ taskq_create(const char *name, int nthreads, pri_t pri, if (rc) { taskq_destroy(tq); tq = NULL; + } else { + down_write(&tq_list_sem); + tq->tq_instance = taskq_find_by_name(name) + 1; + list_add_tail(&tq->tq_taskqs, &tq_list); + up_write(&tq_list_sem); } return (tq); @@ -1081,6 +1108,11 @@ taskq_destroy(taskq_t *tq) taskq_wait(tq); + /* remove taskq from global list used by the kstats */ + down_write(&tq_list_sem); + list_del(&tq->tq_taskqs); + up_write(&tq_list_sem); + spin_lock_irqsave_nested(&tq->tq_lock, flags, tq->tq_lock_class); /* -- cgit v1.2.3 From b4ad50ac5f16de9220452f0da493e67c060d701b Mon Sep 17 00:00:00 2001 From: Chunwei Chen Date: Thu, 17 Dec 2015 18:31:58 -0800 Subject: Use spl_fstrans_mark instead of memalloc_noio_save For earlier versions of the kernel with memalloc_noio_save, it only turns off __GFP_IO but leaves __GFP_FS untouched during direct reclaim. This would cause threads to direct reclaim into ZFS and cause deadlock. Instead, we should stick to using spl_fstrans_mark. Since we would explicitly turn off both __GFP_IO and __GFP_FS before allocation, it will work on every version of the kernel. This impacts kernel versions 3.9-3.17, see upstream kernel commit torvalds/linux@934f307 for reference. Signed-off-by: Chunwei Chen Signed-off-by: Brian Behlendorf Signed-off-by: Tim Chase Closes #515 Issue zfsonlinux/zfs#4111 --- include/sys/vmem.h | 1 - module/spl/spl-kmem-cache.c | 9 ++------- module/spl/spl-kmem.c | 4 ++-- module/spl/spl-taskq.c | 4 +--- module/spl/spl-vmem.c | 25 ------------------------- 5 files changed, 5 insertions(+), 38 deletions(-) (limited to 'module/spl/spl-taskq.c') diff --git a/include/sys/vmem.h b/include/sys/vmem.h index eb4828052..a9b12eeb9 100644 --- a/include/sys/vmem.h +++ b/include/sys/vmem.h @@ -36,7 +36,6 @@ extern vmem_t *zio_alloc_arena; extern vmem_t *zio_arena; extern size_t vmem_size(vmem_t *vmp, int typemask); -extern void *spl_vmalloc(unsigned long size, gfp_t lflags, pgprot_t prot); /* * Memory allocation interfaces diff --git a/module/spl/spl-kmem-cache.c b/module/spl/spl-kmem-cache.c index 846d24300..e3edca5a0 100644 --- a/module/spl/spl-kmem-cache.c +++ b/module/spl/spl-kmem-cache.c @@ -201,7 +201,7 @@ kv_alloc(spl_kmem_cache_t *skc, int size, int flags) ASSERT(ISP2(size)); ptr = (void *)__get_free_pages(lflags, get_order(size)); } else { - ptr = spl_vmalloc(size, lflags | __GFP_HIGHMEM, PAGE_KERNEL); + ptr = __vmalloc(size, lflags | __GFP_HIGHMEM, PAGE_KERNEL); } /* Resulting allocated memory will be page aligned */ @@ -1156,15 +1156,10 @@ spl_cache_grow_work(void *data) spl_kmem_cache_t *skc = ska->ska_cache; spl_kmem_slab_t *sks; -#if defined(PF_MEMALLOC_NOIO) - unsigned noio_flag = memalloc_noio_save(); - sks = spl_slab_alloc(skc, ska->ska_flags); - memalloc_noio_restore(noio_flag); -#else fstrans_cookie_t cookie = spl_fstrans_mark(); sks = spl_slab_alloc(skc, ska->ska_flags); spl_fstrans_unmark(cookie); -#endif + spin_lock(&skc->skc_lock); if (sks) { skc->skc_slab_total++; diff --git a/module/spl/spl-kmem.c b/module/spl/spl-kmem.c index 92263f8f4..0931fdfcf 100644 --- a/module/spl/spl-kmem.c +++ b/module/spl/spl-kmem.c @@ -185,7 +185,7 @@ spl_kmem_alloc_impl(size_t size, int flags, int node) */ if ((size > spl_kmem_alloc_max) || use_vmem) { if (flags & KM_VMEM) { - ptr = spl_vmalloc(size, lflags, PAGE_KERNEL); + ptr = __vmalloc(size, lflags, PAGE_KERNEL); } else { return (NULL); } @@ -198,7 +198,7 @@ spl_kmem_alloc_impl(size_t size, int flags, int node) /* * For vmem_alloc() and vmem_zalloc() callers retry immediately - * using spl_vmalloc() which is unlikely to fail. + * using __vmalloc() which is unlikely to fail. */ if ((flags & KM_VMEM) && (use_vmem == 0)) { use_vmem = 1; diff --git a/module/spl/spl-taskq.c b/module/spl/spl-taskq.c index db5d8fba1..5f2b725c9 100644 --- a/module/spl/spl-taskq.c +++ b/module/spl/spl-taskq.c @@ -849,9 +849,7 @@ taskq_thread(void *args) tq = tqt->tqt_tq; current->flags |= PF_NOFREEZE; -#if defined(PF_MEMALLOC_NOIO) - (void) memalloc_noio_save(); -#endif + (void) spl_fstrans_mark(); sigfillset(&blocked); sigprocmask(SIG_BLOCK, &blocked, NULL); diff --git a/module/spl/spl-vmem.c b/module/spl/spl-vmem.c index bca27f263..e177988a7 100644 --- a/module/spl/spl-vmem.c +++ b/module/spl/spl-vmem.c @@ -97,31 +97,6 @@ spl_vmem_free(const void *buf, size_t size) } EXPORT_SYMBOL(spl_vmem_free); -/* - * Public vmalloc() interface designed to be safe to be called during I/O. - */ -void * -spl_vmalloc(unsigned long size, gfp_t lflags, pgprot_t prot) -{ -#if defined(PF_MEMALLOC_NOIO) - void *ptr; - unsigned noio_flag = 0; - - if (spl_fstrans_check()) - noio_flag = memalloc_noio_save(); - - ptr = __vmalloc(size, lflags, prot); - - if (spl_fstrans_check()) - memalloc_noio_restore(noio_flag); - - return (ptr); -#else - return (__vmalloc(size, lflags, prot)); -#endif -} -EXPORT_SYMBOL(spl_vmalloc); - int spl_vmem_init(void) { -- cgit v1.2.3 From 16522ac29023d94bc29e97761b01b252117cbbfe Mon Sep 17 00:00:00 2001 From: Chunwei Chen Date: Wed, 2 Dec 2015 14:52:46 -0800 Subject: Use tsd to store tq for taskq_member To prevent taskq_member holding tq_lock and doing linear search, thus causing contention. We store the taskq pointer to which the thread belongs in tsd. This way taskq_member will not need to touch tq_lock, and tsd has per slot spinlock. So the contention should be reduced greatly. Signed-off-by: Chunwei Chen Signed-off-by: Brian Behlendorf Closes #500 Closes #504 Closes #505 --- include/sys/taskq.h | 2 +- include/sys/tsd.h | 1 + module/spl/spl-generic.c | 49 +++++++++++++++++++++++------------------------- module/spl/spl-taskq.c | 41 +++++++++++----------------------------- module/spl/spl-tsd.c | 27 ++++++++++++++++++++++++++ 5 files changed, 63 insertions(+), 57 deletions(-) (limited to 'module/spl/spl-taskq.c') diff --git a/include/sys/taskq.h b/include/sys/taskq.h index 544dbb2bb..e7661f7ce 100644 --- a/include/sys/taskq.h +++ b/include/sys/taskq.h @@ -140,7 +140,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 *); +extern int taskq_member(taskq_t *, kthread_t *); #define taskq_create_proc(name, nthreads, pri, min, max, proc, flags) \ taskq_create(name, nthreads, pri, min, max, flags) diff --git a/include/sys/tsd.h b/include/sys/tsd.h index ebc55b09b..1894a8232 100644 --- a/include/sys/tsd.h +++ b/include/sys/tsd.h @@ -35,6 +35,7 @@ typedef void (*dtor_func_t)(void *); extern int tsd_set(uint_t, void *); extern void *tsd_get(uint_t); +extern void *tsd_get_by_thread(uint_t, kthread_t *); extern void tsd_create(uint_t *, dtor_func_t); extern void tsd_destroy(uint_t *); extern void tsd_exit(void); diff --git a/module/spl/spl-generic.c b/module/spl/spl-generic.c index 4d9846cf5..dc3e74aa5 100644 --- a/module/spl/spl-generic.c +++ b/module/spl/spl-generic.c @@ -491,29 +491,20 @@ spl_kvmem_init(void) rc = spl_kmem_init(); if (rc) - goto out1; + return (rc); rc = spl_vmem_init(); - if (rc) - goto out2; - - rc = spl_kmem_cache_init(); - if (rc) - goto out3; + if (rc) { + spl_kmem_fini(); + return (rc); + } - return (rc); -out3: - spl_vmem_fini(); -out2: - spl_kmem_fini(); -out1: return (rc); } static void spl_kvmem_fini(void) { - spl_kmem_cache_fini(); spl_vmem_fini(); spl_kmem_fini(); } @@ -532,38 +523,43 @@ spl_init(void) if ((rc = spl_rw_init())) goto out3; - if ((rc = spl_taskq_init())) + if ((rc = spl_tsd_init())) goto out4; - if ((rc = spl_vn_init())) + if ((rc = spl_taskq_init())) goto out5; - if ((rc = spl_proc_init())) + if ((rc = spl_kmem_cache_init())) goto out6; - if ((rc = spl_kstat_init())) + if ((rc = spl_vn_init())) goto out7; - if ((rc = spl_tsd_init())) + if ((rc = spl_proc_init())) goto out8; - if ((rc = spl_zlib_init())) + if ((rc = spl_kstat_init())) goto out9; + if ((rc = spl_zlib_init())) + goto out10; + printk(KERN_NOTICE "SPL: Loaded module v%s-%s%s\n", SPL_META_VERSION, SPL_META_RELEASE, SPL_DEBUG_STR); return (rc); +out10: + spl_kstat_fini(); out9: - spl_tsd_fini(); + spl_proc_fini(); out8: - spl_kstat_fini(); + spl_vn_fini(); out7: - spl_proc_fini(); + spl_kmem_cache_fini(); out6: - spl_vn_fini(); -out5: spl_taskq_fini(); +out5: + spl_tsd_fini(); out4: spl_rw_fini(); out3: @@ -584,11 +580,12 @@ spl_fini(void) printk(KERN_NOTICE "SPL: Unloaded module v%s-%s%s\n", SPL_META_VERSION, SPL_META_RELEASE, SPL_DEBUG_STR); spl_zlib_fini(); - spl_tsd_fini(); spl_kstat_fini(); spl_proc_fini(); spl_vn_fini(); + spl_kmem_cache_fini(); spl_taskq_fini(); + spl_tsd_fini(); spl_rw_fini(); spl_mutex_fini(); spl_kvmem_fini(); diff --git a/module/spl/spl-taskq.c b/module/spl/spl-taskq.c index 5f2b725c9..2b3f3f4bc 100644 --- a/module/spl/spl-taskq.c +++ b/module/spl/spl-taskq.c @@ -26,6 +26,7 @@ #include #include +#include int spl_taskq_thread_bind = 0; module_param(spl_taskq_thread_bind, int, 0644); @@ -57,6 +58,7 @@ static taskq_thread_t *taskq_thread_create(taskq_t *); /* List of all taskqs */ LIST_HEAD(tq_list); DECLARE_RWSEM(tq_list_sem); +static uint_t taskq_tsd; static int task_km_flags(uint_t flags) @@ -474,38 +476,10 @@ taskq_wait(taskq_t *tq) } EXPORT_SYMBOL(taskq_wait); -static int -taskq_member_impl(taskq_t *tq, void *t) -{ - struct list_head *l; - taskq_thread_t *tqt; - int found = 0; - - ASSERT(tq); - ASSERT(t); - ASSERT(spin_is_locked(&tq->tq_lock)); - - list_for_each(l, &tq->tq_thread_list) { - tqt = list_entry(l, taskq_thread_t, tqt_thread_list); - if (tqt->tqt_thread == (struct task_struct *)t) { - found = 1; - break; - } - } - return (found); -} - int -taskq_member(taskq_t *tq, void *t) +taskq_member(taskq_t *tq, kthread_t *t) { - int found; - unsigned long flags; - - spin_lock_irqsave_nested(&tq->tq_lock, flags, tq->tq_lock_class); - found = taskq_member_impl(tq, t); - spin_unlock_irqrestore(&tq->tq_lock, flags); - - return (found); + return (tq == (taskq_t *)tsd_get_by_thread(taskq_tsd, t)); } EXPORT_SYMBOL(taskq_member); @@ -855,6 +829,7 @@ taskq_thread(void *args) sigprocmask(SIG_BLOCK, &blocked, NULL); flush_signals(current); + tsd_set(taskq_tsd, tq); spin_lock_irqsave_nested(&tq->tq_lock, flags, tq->tq_lock_class); /* Immediately exit if more threads than allowed were created. */ @@ -959,6 +934,8 @@ error: kmem_free(tqt, sizeof (taskq_thread_t)); spin_unlock_irqrestore(&tq->tq_lock, flags); + tsd_set(taskq_tsd, NULL); + return (0); } @@ -1160,6 +1137,8 @@ EXPORT_SYMBOL(taskq_destroy); int spl_taskq_init(void) { + tsd_create(&taskq_tsd, NULL); + system_taskq = taskq_create("spl_system_taskq", MAX(boot_ncpus, 64), maxclsyspri, boot_ncpus, INT_MAX, TASKQ_PREPOPULATE|TASKQ_DYNAMIC); if (system_taskq == NULL) @@ -1190,4 +1169,6 @@ spl_taskq_fini(void) taskq_destroy(system_taskq); system_taskq = NULL; + + tsd_destroy(&taskq_tsd); } diff --git a/module/spl/spl-tsd.c b/module/spl/spl-tsd.c index 4d0800e5a..bf8235063 100644 --- a/module/spl/spl-tsd.c +++ b/module/spl/spl-tsd.c @@ -527,6 +527,33 @@ tsd_get(uint_t key) } EXPORT_SYMBOL(tsd_get); +/* + * tsd_get_by_thread - get thread specific data for specified thread + * @key: lookup key + * @thread: thread to lookup + * + * Caller must prevent racing tsd_create() or tsd_destroy(). This + * implementation is designed to be fast and scalable, it does not + * lock the entire table only a single hash bin. + */ +void * +tsd_get_by_thread(uint_t key, kthread_t *thread) +{ + tsd_hash_entry_t *entry; + + ASSERT3P(tsd_hash_table, !=, NULL); + + if ((key == 0) || (key > TSD_KEYS_MAX)) + return (NULL); + + entry = tsd_hash_search(tsd_hash_table, key, thread->pid); + if (entry == NULL) + return (NULL); + + return (entry->he_value); +} +EXPORT_SYMBOL(tsd_get_by_thread); + /* * tsd_create - create thread specific data key * @keyp: lookup key address -- cgit v1.2.3 From 8f3b403a73fa9b1db06050edf737e1f051b05070 Mon Sep 17 00:00:00 2001 From: Chunwei Chen Date: Wed, 27 Jan 2016 16:55:14 -0800 Subject: Allow kicking a taskq to spawn more threads This patch add a module parameter spl_taskq_kick. When writing non-zero value to it, it will scan all the taskq, if a taskq contains a task pending for more than 5 seconds, it will be forced to spawn a new thread. This is use as an emergency recovery from deadlock, not a general solution. Signed-off-by: Chunwei Chen Signed-off-by: Brian Behlendorf Closes #529 --- include/sys/taskq.h | 1 + man/man5/spl-module-parameters.5 | 14 ++++++++++ module/spl/spl-taskq.c | 60 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 75 insertions(+) (limited to 'module/spl/spl-taskq.c') diff --git a/include/sys/taskq.h b/include/sys/taskq.h index e7661f7ce..19bc6c1dd 100644 --- a/include/sys/taskq.h +++ b/include/sys/taskq.h @@ -105,6 +105,7 @@ typedef struct taskq_ent { void *tqent_arg; taskq_t *tqent_taskq; uintptr_t tqent_flags; + unsigned long tqent_birth; } taskq_ent_t; #define TQENT_FLAG_PREALLOC 0x1 diff --git a/man/man5/spl-module-parameters.5 b/man/man5/spl-module-parameters.5 index 1d4d73e60..1b760243e 100644 --- a/man/man5/spl-module-parameters.5 +++ b/man/man5/spl-module-parameters.5 @@ -250,6 +250,20 @@ may be overridden for non-standard configurations. Default value: \fB/etc/hostid\fR .RE +.sp +.ne 2 +.na +\fBspl_taskq_kick\fR (uint) +.ad +.RS 12n +Kick stuck taskq to spawn threads. When writing a non-zero value to it, it will +scan all the taskqs. If any of them have a pending task more than 5 seconds old, +it will kick it to spawn more threads. This can be used if you find a rare +deadlock occurs because one or more taskqs didn't spawn a thread when it should. +.sp +Default value: \fB0\fR +.RE + .sp .ne 2 .na diff --git a/module/spl/spl-taskq.c b/module/spl/spl-taskq.c index 2b3f3f4bc..56034c899 100644 --- a/module/spl/spl-taskq.c +++ b/module/spl/spl-taskq.c @@ -221,6 +221,7 @@ task_expire(unsigned long data) return; } + t->tqent_birth = jiffies; /* * The priority list must be maintained in strict task id order * from lowest to highest for lowest_id to be easily calculable. @@ -583,6 +584,7 @@ taskq_dispatch(taskq_t *tq, task_func_t func, void *arg, uint_t flags) t->tqent_timer.data = 0; t->tqent_timer.function = NULL; t->tqent_timer.expires = 0; + t->tqent_birth = jiffies; ASSERT(!(t->tqent_flags & TQENT_FLAG_PREALLOC)); @@ -682,6 +684,7 @@ taskq_dispatch_ent(taskq_t *tq, task_func_t func, void *arg, uint_t flags, t->tqent_func = func; t->tqent_arg = arg; t->tqent_taskq = tq; + t->tqent_birth = jiffies; spin_unlock(&t->tqent_lock); @@ -1134,6 +1137,63 @@ taskq_destroy(taskq_t *tq) } EXPORT_SYMBOL(taskq_destroy); + +static unsigned int spl_taskq_kick = 0; + +/* + * 2.6.36 API Change + * module_param_cb is introduced to take kernel_param_ops and + * module_param_call is marked as obsolete. Also set and get operations + * were changed to take a 'const struct kernel_param *'. + */ +static int +#ifdef module_param_cb +param_set_taskq_kick(const char *val, const struct kernel_param *kp) +#else +param_set_taskq_kick(const char *val, struct kernel_param *kp) +#endif +{ + int ret; + taskq_t *tq; + taskq_ent_t *t; + unsigned long flags; + + ret = param_set_uint(val, kp); + if (ret < 0 || !spl_taskq_kick) + return (ret); + /* reset value */ + spl_taskq_kick = 0; + + down_read(&tq_list_sem); + list_for_each_entry(tq, &tq_list, tq_taskqs) { + spin_lock_irqsave_nested(&tq->tq_lock, flags, + tq->tq_lock_class); + /* Check if the first pending is older than 5 seconds */ + t = taskq_next_ent(tq); + if (t && time_after(jiffies, t->tqent_birth + 5*HZ)) { + (void) taskq_thread_spawn(tq); + printk(KERN_INFO "spl: Kicked taskq %s/%d\n", + tq->tq_name, tq->tq_instance); + } + spin_unlock_irqrestore(&tq->tq_lock, flags); + } + up_read(&tq_list_sem); + return (ret); +} + +#ifdef module_param_cb +static const struct kernel_param_ops param_ops_taskq_kick = { + .set = param_set_taskq_kick, + .get = param_get_uint, +}; +module_param_cb(spl_taskq_kick, ¶m_ops_taskq_kick, &spl_taskq_kick, 0644); +#else +module_param_call(spl_taskq_kick, param_set_taskq_kick, param_get_uint, + &spl_taskq_kick, 0644); +#endif +MODULE_PARM_DESC(spl_taskq_kick, + "Write nonzero to kick stuck taskqs to spawn more threads"); + int spl_taskq_init(void) { -- cgit v1.2.3 From 7bb5d92de8c4d795e9b393aa5ea9c9ad3e43b199 Mon Sep 17 00:00:00 2001 From: Tim Chase Date: Mon, 8 Feb 2016 13:20:05 -0600 Subject: Allow spawning a new thread for TQ_NOQUEUE dispatch with dynamic taskq When a TQ_NOQUEUE dispatch is done on a dynamic taskq, allow another thread to be spawned. This will cause TQ_NOQUEUE to behave similarly as it does with non-dynamic taskqs. Add support for TQ_NOQUEUE to taskq_dispatch_ent(). Signed-off-by: Tim Chase Signed-off-by: Brian Behlendorf Closes #530 --- module/spl/spl-taskq.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'module/spl/spl-taskq.c') diff --git a/module/spl/spl-taskq.c b/module/spl/spl-taskq.c index 56034c899..bfcf651af 100644 --- a/module/spl/spl-taskq.c +++ b/module/spl/spl-taskq.c @@ -562,16 +562,22 @@ taskq_dispatch(taskq_t *tq, task_func_t func, void *arg, uint_t flags) /* Do not queue the task unless there is idle thread for it */ ASSERT(tq->tq_nactive <= tq->tq_nthreads); - if ((flags & TQ_NOQUEUE) && (tq->tq_nactive == tq->tq_nthreads)) - goto out; + if ((flags & TQ_NOQUEUE) && (tq->tq_nactive == tq->tq_nthreads)) { + /* Dynamic taskq may be able to spawn another thread */ + if (!(tq->tq_flags & TASKQ_DYNAMIC) || taskq_thread_spawn(tq) == 0) + goto out; + } if ((t = task_alloc(tq, flags, &irqflags)) == NULL) goto out; spin_lock(&t->tqent_lock); + /* Queue to the front of the list to enforce TQ_NOQUEUE semantics */ + if (flags & TQ_NOQUEUE) + list_add(&t->tqent_list, &tq->tq_prio_list); /* Queue to the priority list instead of the pending list */ - if (flags & TQ_FRONT) + else if (flags & TQ_FRONT) list_add_tail(&t->tqent_list, &tq->tq_prio_list); else list_add_tail(&t->tqent_list, &tq->tq_pend_list); @@ -593,7 +599,7 @@ taskq_dispatch(taskq_t *tq, task_func_t func, void *arg, uint_t flags) wake_up(&tq->tq_work_waitq); out: /* Spawn additional taskq threads if required. */ - if (tq->tq_nactive == tq->tq_nthreads) + if (!(flags & TQ_NOQUEUE) && tq->tq_nactive == tq->tq_nthreads) (void) taskq_thread_spawn(tq); spin_unlock_irqrestore(&tq->tq_lock, irqflags); @@ -665,6 +671,13 @@ taskq_dispatch_ent(taskq_t *tq, task_func_t func, void *arg, uint_t flags, goto out; } + if ((flags & TQ_NOQUEUE) && (tq->tq_nactive == tq->tq_nthreads)) { + /* Dynamic taskq may be able to spawn another thread */ + if (!(tq->tq_flags & TASKQ_DYNAMIC) || taskq_thread_spawn(tq) == 0) + goto out2; + flags |= TQ_FRONT; + } + spin_lock(&t->tqent_lock); /* @@ -693,6 +706,7 @@ out: /* Spawn additional taskq threads if required. */ if (tq->tq_nactive == tq->tq_nthreads) (void) taskq_thread_spawn(tq); +out2: spin_unlock_irqrestore(&tq->tq_lock, irqflags); } EXPORT_SYMBOL(taskq_dispatch_ent); -- cgit v1.2.3 From 5ce028b0d4b650b42cb81b3fdf71b517adce4552 Mon Sep 17 00:00:00 2001 From: Chunwei Chen Date: Fri, 20 May 2016 18:04:03 -0700 Subject: Fix race between taskq_destroy and dynamic spawning thread While taskq_destroy would wait for dynamic_taskq to finish its tasks, but it does not implies the thread being spawned is up and running. This will cause taskq to be freed before the thread can exit. We fix this by using tq_nspawn to indicate how many threads are being spawned before they are inserted to the thread list. And have taskq_destroy to wait for it to drop to zero. Signed-off-by: Chunwei Chen Signed-off-by: Brian Behlendorf Signed-off-by: Tim Chase Issue #553 Closes #550 --- module/spl/spl-taskq.c | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) (limited to 'module/spl/spl-taskq.c') diff --git a/module/spl/spl-taskq.c b/module/spl/spl-taskq.c index bfcf651af..9784473bd 100644 --- a/module/spl/spl-taskq.c +++ b/module/spl/spl-taskq.c @@ -763,11 +763,12 @@ taskq_thread_spawn_task(void *arg) taskq_t *tq = (taskq_t *)arg; unsigned long flags; - (void) taskq_thread_create(tq); - - spin_lock_irqsave_nested(&tq->tq_lock, flags, tq->tq_lock_class); - tq->tq_nspawn--; - spin_unlock_irqrestore(&tq->tq_lock, flags); + if (taskq_thread_create(tq) == NULL) { + /* restore spawning count if failed */ + spin_lock_irqsave_nested(&tq->tq_lock, flags, tq->tq_lock_class); + tq->tq_nspawn--; + spin_unlock_irqrestore(&tq->tq_lock, flags); + } } /* @@ -848,6 +849,14 @@ taskq_thread(void *args) tsd_set(taskq_tsd, tq); spin_lock_irqsave_nested(&tq->tq_lock, flags, tq->tq_lock_class); + /* + * If we are dynamically spawned, decrease spawning count. Note that + * we could be created during taskq_create, in which case we shouldn't + * do the decrement. But it's fine because taskq_create will reset + * tq_nspawn later. + */ + if (tq->tq_flags & TASKQ_DYNAMIC) + tq->tq_nspawn--; /* Immediately exit if more threads than allowed were created. */ if (tq->tq_nthreads >= tq->tq_maxthreads) @@ -1063,6 +1072,11 @@ taskq_create(const char *name, int nthreads, pri_t pri, /* Wait for all threads to be started before potential destroy */ wait_event(tq->tq_wait_waitq, tq->tq_nthreads == count); + /* + * taskq_thread might have touched nspawn, but we don't want them to + * because they're not dynamically spawned. So we reset it to 0 + */ + tq->tq_nspawn = 0; if (rc) { taskq_destroy(tq); @@ -1106,6 +1120,12 @@ taskq_destroy(taskq_t *tq) up_write(&tq_list_sem); spin_lock_irqsave_nested(&tq->tq_lock, flags, tq->tq_lock_class); + /* wait for spawning threads to insert themselves to the list */ + while (tq->tq_nspawn) { + spin_unlock_irqrestore(&tq->tq_lock, flags); + schedule_timeout_interruptible(1); + spin_lock_irqsave_nested(&tq->tq_lock, flags, tq->tq_lock_class); + } /* * Signal each thread to exit and block until it does. Each thread -- cgit v1.2.3 From b3a22a0a005eef22d696cc77baa26ef80d1bdc0c Mon Sep 17 00:00:00 2001 From: Chunwei Chen Date: Mon, 23 May 2016 14:12:22 -0700 Subject: Fix taskq_wait_outstanding re-evaluate tq_next_id wait_event is a macro, so the current implementation will cause re- evaluation of tq_next_id every time it wakes up. This would cause taskq_wait_outstanding(tq, 0) to be equivalent to taskq_wait(tq) Signed-off-by: Chunwei Chen Signed-off-by: Brian Behlendorf Signed-off-by: Tim Chase Issue #553 --- module/spl/spl-taskq.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/spl/spl-taskq.c') diff --git a/module/spl/spl-taskq.c b/module/spl/spl-taskq.c index 9784473bd..320ad3914 100644 --- a/module/spl/spl-taskq.c +++ b/module/spl/spl-taskq.c @@ -447,8 +447,8 @@ taskq_wait_outstanding_check(taskq_t *tq, taskqid_t id) void taskq_wait_outstanding(taskq_t *tq, taskqid_t id) { - wait_event(tq->tq_wait_waitq, - taskq_wait_outstanding_check(tq, id ? id : tq->tq_next_id - 1)); + id = id ? id : tq->tq_next_id - 1; + wait_event(tq->tq_wait_waitq, taskq_wait_outstanding_check(tq, id)); } EXPORT_SYMBOL(taskq_wait_outstanding); -- cgit v1.2.3 From cbba7146676dd145f373bcbe4f4f435d9100ddbb Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Fri, 28 Oct 2016 21:23:30 +0000 Subject: Add TASKQID_INVALID and TASKQID_INITIAL macros Add the TASKQID_INVALID and TASKQID_INITIAL macros and update the taskq implementation and test cases to use them. This is solely for the purposes of readability and introduces no functional change. Signed-off-by: Brian Behlendorf --- include/sys/taskq.h | 6 ++++++ module/spl/spl-taskq.c | 18 +++++++++--------- module/splat/splat-mutex.c | 30 ++++++++++++++++++------------ module/splat/splat-rwlock.c | 5 +++-- module/splat/splat-taskq.c | 26 +++++++++++++------------- 5 files changed, 49 insertions(+), 36 deletions(-) (limited to 'module/spl/spl-taskq.c') diff --git a/include/sys/taskq.h b/include/sys/taskq.h index 19bc6c1dd..1eecda4d2 100644 --- a/include/sys/taskq.h +++ b/include/sys/taskq.h @@ -56,6 +56,12 @@ #define TQ_NEW 0x04000000 #define TQ_FRONT 0x08000000 +/* + * Reserved taskqid values. + */ +#define TASKQID_INVALID ((taskqid_t)0) +#define TASKQID_INITIAL ((taskqid_t)1) + /* * spin_lock(lock) and spin_lock_nested(lock,0) are equivalent, * so TQ_LOCK_DYNAMIC must not evaluate to 0 diff --git a/module/spl/spl-taskq.c b/module/spl/spl-taskq.c index 320ad3914..b362bef54 100644 --- a/module/spl/spl-taskq.c +++ b/module/spl/spl-taskq.c @@ -190,7 +190,7 @@ task_done(taskq_t *tq, taskq_ent_t *t) list_del_init(&t->tqent_list); if (tq->tq_nalloc <= tq->tq_minalloc) { - t->tqent_id = 0; + t->tqent_id = TASKQID_INVALID; t->tqent_func = NULL; t->tqent_arg = NULL; t->tqent_flags = 0; @@ -276,7 +276,7 @@ taskq_lowest_id(taskq_t *tq) if (!list_empty(&tq->tq_active_list)) { tqt = list_entry(tq->tq_active_list.next, taskq_thread_t, tqt_active_list); - ASSERT(tqt->tqt_id != 0); + ASSERT(tqt->tqt_id != TASKQID_INVALID); lowest_id = MIN(lowest_id, tqt->tqt_id); } @@ -548,7 +548,7 @@ taskqid_t taskq_dispatch(taskq_t *tq, task_func_t func, void *arg, uint_t flags) { taskq_ent_t *t; - taskqid_t rc = 0; + taskqid_t rc = TASKQID_INVALID; unsigned long irqflags; ASSERT(tq); @@ -611,7 +611,7 @@ taskqid_t taskq_dispatch_delay(taskq_t *tq, task_func_t func, void *arg, uint_t flags, clock_t expire_time) { - taskqid_t rc = 0; + taskqid_t rc = TASKQID_INVALID; taskq_ent_t *t; unsigned long irqflags; @@ -667,7 +667,7 @@ taskq_dispatch_ent(taskq_t *tq, task_func_t func, void *arg, uint_t flags, /* Taskq being destroyed and all tasks drained */ if (!(tq->tq_flags & TASKQ_ACTIVE)) { - t->tqent_id = 0; + t->tqent_id = TASKQID_INVALID; goto out; } @@ -941,7 +941,7 @@ taskq_thread(void *args) taskq_thread_spawn(tq)) seq_tasks = 0; - tqt->tqt_id = 0; + tqt->tqt_id = TASKQID_INVALID; tqt->tqt_flags = 0; wake_up_all(&tq->tq_wait_waitq); } else { @@ -975,7 +975,7 @@ taskq_thread_create(taskq_t *tq) INIT_LIST_HEAD(&tqt->tqt_thread_list); INIT_LIST_HEAD(&tqt->tqt_active_list); tqt->tqt_tq = tq; - tqt->tqt_id = 0; + tqt->tqt_id = TASKQID_INVALID; tqt->tqt_thread = spl_kthread_create(taskq_thread, tqt, "%s", tq->tq_name); @@ -1037,8 +1037,8 @@ taskq_create(const char *name, int nthreads, pri_t pri, tq->tq_maxalloc = maxalloc; tq->tq_nalloc = 0; tq->tq_flags = (flags | TASKQ_ACTIVE); - tq->tq_next_id = 1; - tq->tq_lowest_id = 1; + tq->tq_next_id = TASKQID_INITIAL; + tq->tq_lowest_id = TASKQID_INITIAL; INIT_LIST_HEAD(&tq->tq_free_list); INIT_LIST_HEAD(&tq->tq_pend_list); INIT_LIST_HEAD(&tq->tq_prio_list); diff --git a/module/splat/splat-mutex.c b/module/splat/splat-mutex.c index 86bef8ee3..d39551354 100644 --- a/module/splat/splat-mutex.c +++ b/module/splat/splat-mutex.c @@ -81,7 +81,8 @@ splat_mutex_test1(struct file *file, void *arg) { mutex_priv_t *mp; taskq_t *tq; - int id, rc = 0; + taskqid_t id; + int rc = 0; mp = (mutex_priv_t *)kmalloc(sizeof(*mp), GFP_KERNEL); if (mp == NULL) @@ -105,8 +106,8 @@ splat_mutex_test1(struct file *file, void *arg) * function will indicate this status in the passed private data. */ mp->mp_rc = -EINVAL; - id = taskq_dispatch(tq, splat_mutex_test1_func, mp, TQ_SLEEP); - if (id == 0) { + id = taskq_dispatch(tq, splat_mutex_test1_func, mp, TQ_SLEEP); + if (id == TASKQID_INVALID) { mutex_exit(&mp->mp_mtx); splat_vprint(file, SPLAT_MUTEX_TEST1_NAME, "%s", "taskq_dispatch() failed\n"); @@ -120,8 +121,8 @@ splat_mutex_test1(struct file *file, void *arg) /* Task function successfully acquired mutex, very bad! */ if (mp->mp_rc != -EBUSY) { splat_vprint(file, SPLAT_MUTEX_TEST1_NAME, - "mutex_trylock() incorrectly succeeded when " - "the mutex was held, %d/%d\n", id, mp->mp_rc); + "mutex_trylock() incorrectly succeeded when " + "the mutex was held, %d/%d\n", (int)id, mp->mp_rc); rc = -EINVAL; goto out; } else { @@ -136,8 +137,8 @@ splat_mutex_test1(struct file *file, void *arg) * can be verified by checking the private data. */ mp->mp_rc = -EINVAL; - id = taskq_dispatch(tq, splat_mutex_test1_func, mp, TQ_SLEEP); - if (id == 0) { + id = taskq_dispatch(tq, splat_mutex_test1_func, mp, TQ_SLEEP); + if (id == TASKQID_INVALID) { splat_vprint(file, SPLAT_MUTEX_TEST1_NAME, "%s", "taskq_dispatch() failed\n"); rc = -EINVAL; @@ -149,8 +150,8 @@ splat_mutex_test1(struct file *file, void *arg) /* Task function failed to acquire mutex, very bad! */ if (mp->mp_rc != 0) { splat_vprint(file, SPLAT_MUTEX_TEST1_NAME, - "mutex_trylock() incorrectly failed when " - "the mutex was not held, %d/%d\n", id, mp->mp_rc); + "mutex_trylock() incorrectly failed when the mutex " + "was not held, %d/%d\n", (int)id, mp->mp_rc); rc = -EINVAL; } else { splat_vprint(file, SPLAT_MUTEX_TEST1_NAME, "%s", @@ -188,6 +189,7 @@ splat_mutex_test2(struct file *file, void *arg) { mutex_priv_t *mp; taskq_t *tq; + taskqid_t id; int i, rc = 0; mp = (mutex_priv_t *)kmalloc(sizeof(*mp), GFP_KERNEL); @@ -218,7 +220,8 @@ splat_mutex_test2(struct file *file, void *arg) * mutex is implemented right this will never happy, that's a pass. */ for (i = 0; i < SPLAT_MUTEX_TEST_COUNT; i++) { - if (!taskq_dispatch(tq, splat_mutex_test2_func, mp, TQ_SLEEP)) { + id = taskq_dispatch(tq, splat_mutex_test2_func, mp, TQ_SLEEP); + if (id == TASKQID_INVALID) { splat_vprint(file, SPLAT_MUTEX_TEST2_NAME, "Failed to queue task %d\n", i); rc = -EINVAL; @@ -260,6 +263,7 @@ splat_mutex_test3(struct file *file, void *arg) { mutex_priv_t mp; taskq_t *tq; + taskqid_t id; int rc = 0; mp.mp_magic = SPLAT_MUTEX_TEST_MAGIC; @@ -283,7 +287,8 @@ splat_mutex_test3(struct file *file, void *arg) goto out_exit; } - if (taskq_dispatch(tq, splat_mutex_owned, &mp, TQ_SLEEP) == 0) { + id = taskq_dispatch(tq, splat_mutex_owned, &mp, TQ_SLEEP); + if (id == TASKQID_INVALID) { splat_vprint(file, SPLAT_MUTEX_TEST3_NAME, "Failed to " "dispatch function '%s' to taskq\n", sym2str(splat_mutex_owned)); @@ -310,7 +315,8 @@ splat_mutex_test3(struct file *file, void *arg) goto out; } - if (taskq_dispatch(tq, splat_mutex_owned, &mp, TQ_SLEEP) == 0) { + id = taskq_dispatch(tq, splat_mutex_owned, &mp, TQ_SLEEP); + if (id == TASKQID_INVALID) { splat_vprint(file, SPLAT_MUTEX_TEST3_NAME, "Failed to " "dispatch function '%s' to taskq\n", sym2str(splat_mutex_owned)); diff --git a/module/splat/splat-rwlock.c b/module/splat/splat-rwlock.c index 4576f20c7..87bc0c1c0 100644 --- a/module/splat/splat-rwlock.c +++ b/module/splat/splat-rwlock.c @@ -348,7 +348,8 @@ splat_rwlock_test2(struct file *file, void *arg) * rwlock is implemented right this will never happy, that's a pass. */ for (i = 0; i < tq_count; i++) { - if (!taskq_dispatch(tq,splat_rwlock_test2_func,rwp,TQ_SLEEP)) { + if (taskq_dispatch(tq, splat_rwlock_test2_func, rwp, + TQ_SLEEP) == TASKQID_INVALID) { splat_vprint(file, SPLAT_RWLOCK_TEST2_NAME, "Failed to queue task %d\n", i); rc = -EINVAL; @@ -469,7 +470,7 @@ splat_rwlock_test4_type(taskq_t *tq, rw_priv_t *rwp, int expected_rc, rw_enter(&rwp->rw_rwlock, holder_type); id = taskq_dispatch(tq, splat_rwlock_test4_func, rwp, TQ_SLEEP); - if (id == 0) { + if (id == TASKQID_INVALID) { splat_vprint(rwp->rw_file, SPLAT_RWLOCK_TEST4_NAME, "%s", "taskq_dispatch() failed\n"); rc = -EINVAL; diff --git a/module/splat/splat-taskq.c b/module/splat/splat-taskq.c index f26f828d9..665126bdd 100644 --- a/module/splat/splat-taskq.c +++ b/module/splat/splat-taskq.c @@ -160,7 +160,7 @@ splat_taskq_test1_impl(struct file *file, void *arg, boolean_t prealloc) &tq_arg, TQ_SLEEP); } - if (id == 0) { + if (id == TASKQID_INVALID) { splat_vprint(file, SPLAT_TASKQ_TEST1_NAME, "Taskq '%s' function '%s' dispatch failed\n", tq_arg.name, sym2str(splat_taskq_test13_func)); @@ -296,7 +296,7 @@ splat_taskq_test2_impl(struct file *file, void *arg, boolean_t prealloc) { tq_args[i], TQ_SLEEP); } - if (id == 0) { + if (id == TASKQID_INVALID) { splat_vprint(file, SPLAT_TASKQ_TEST2_NAME, "Taskq '%s/%d' function '%s' dispatch " "failed\n", tq_args[i]->name, tq_args[i]->id, @@ -318,7 +318,7 @@ splat_taskq_test2_impl(struct file *file, void *arg, boolean_t prealloc) { tq_args[i], TQ_SLEEP); } - if (id == 0) { + if (id == TASKQID_INVALID) { splat_vprint(file, SPLAT_TASKQ_TEST2_NAME, "Taskq " "'%s/%d' function '%s' dispatch failed\n", tq_args[i]->name, tq_args[i]->id, @@ -420,7 +420,7 @@ splat_taskq_test3_impl(struct file *file, void *arg, boolean_t prealloc) tq_arg, TQ_SLEEP); } - if (id == 0) { + if (id == TASKQID_INVALID) { splat_vprint(file, SPLAT_TASKQ_TEST3_NAME, "Taskq '%s' function '%s' dispatch failed\n", tq_arg->name, sym2str(splat_taskq_test13_func)); @@ -525,7 +525,7 @@ splat_taskq_test4_common(struct file *file, void *arg, int minalloc, &tq_arg, TQ_SLEEP); } - if (id == 0) { + if (id == TASKQID_INVALID) { splat_vprint(file, SPLAT_TASKQ_TEST4_NAME, "Taskq '%s' function '%s' dispatch " "%d failed\n", tq_arg.name, @@ -741,7 +741,7 @@ splat_taskq_test5_impl(struct file *file, void *arg, boolean_t prealloc) &tq_id[i], TQ_SLEEP); } - if (id == 0) { + if (id == TASKQID_INVALID) { splat_vprint(file, SPLAT_TASKQ_TEST5_NAME, "Taskq '%s' function '%s' dispatch failed\n", tq_arg.name, sym2str(splat_taskq_test5_func)); @@ -905,7 +905,7 @@ splat_taskq_test6_impl(struct file *file, void *arg, boolean_t prealloc) &tq_id[i], tflags); } - if (id == 0) { + if (id == TASKQID_INVALID) { splat_vprint(file, SPLAT_TASKQ_TEST6_NAME, "Taskq '%s' function '%s' dispatch failed\n", tq_arg.name, sym2str(splat_taskq_test6_func)); @@ -983,7 +983,7 @@ splat_taskq_test7_func(void *arg) tq_arg, TQ_SLEEP); } - if (id == 0) { + if (id == TASKQID_INVALID) { splat_vprint(tq_arg->file, SPLAT_TASKQ_TEST7_NAME, "Taskq '%s' function '%s' dispatch failed " "(depth = %u)\n", tq_arg->name, @@ -1121,7 +1121,7 @@ splat_taskq_throughput(struct file *file, void *arg, const char *name, &tq_arg, TQ_SLEEP, tqes[i]); id = tqes[i]->tqent_id; - if (id == 0) { + if (id == TASKQID_INVALID) { splat_vprint(file, name, "Taskq '%s' function '%s' " "dispatch %d failed\n", tq_arg.name, sym2str(splat_taskq_throughput_func), i); @@ -1235,7 +1235,7 @@ splat_taskq_test9(struct file *file, void *arg) id = taskq_dispatch_delay(tq, splat_taskq_test9_func, tq_arg, TQ_SLEEP, ddi_get_lbolt() + rnd); - if (id == 0) { + if (id == TASKQID_INVALID) { splat_vprint(file, SPLAT_TASKQ_TEST9_NAME, "Taskq '%s' delay dispatch failed\n", SPLAT_TASKQ_TEST9_NAME); @@ -1344,7 +1344,7 @@ splat_taskq_test10(struct file *file, void *arg) tq_arg, TQ_SLEEP, ddi_get_lbolt() + rnd); } - if (tq_arg->id == 0) { + if (tq_arg->id == TASKQID_INVALID) { splat_vprint(file, SPLAT_TASKQ_TEST10_NAME, "Taskq '%s' dispatch failed\n", SPLAT_TASKQ_TEST10_NAME); @@ -1473,8 +1473,8 @@ splat_taskq_test11(struct file *file, void *arg) dynamic.tv_sec, dynamic.tv_nsec); /* A 10x increase in runtime is used to indicate a core problem. */ - if ((dynamic.tv_sec * NANOSEC + dynamic.tv_nsec) > - ((normal.tv_sec * NANOSEC + normal.tv_nsec) * 10)) + if (((int64_t)dynamic.tv_sec * NANOSEC + (int64_t)dynamic.tv_nsec) > + (((int64_t)normal.tv_sec * NANOSEC + (int64_t)normal.tv_nsec) * 10)) error = -ETIME; return (error); -- cgit v1.2.3 From f200b836734550ba258a0d7e05381dc8cebf80f4 Mon Sep 17 00:00:00 2001 From: Chunwei Chen Date: Thu, 8 Dec 2016 13:00:20 -0800 Subject: Add system_delay_taskq for long delay 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 Signed-off-by: Chunwei Chen Closes #588 --- include/sys/taskq.h | 2 ++ module/spl/spl-taskq.c | 14 ++++++++++++++ 2 files changed, 16 insertions(+) (limited to 'module/spl/spl-taskq.c') diff --git a/include/sys/taskq.h b/include/sys/taskq.h index 1eecda4d2..5adda8827 100644 --- a/include/sys/taskq.h +++ b/include/sys/taskq.h @@ -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; diff --git a/module/spl/spl-taskq.c b/module/spl/spl-taskq.c index b362bef54..83f483ea9 100644 --- a/module/spl/spl-taskq.c +++ b/module/spl/spl-taskq.c @@ -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; -- cgit v1.2.3 From cce83ba0ecacc45c79709e8b3def8dc8a046fffe Mon Sep 17 00:00:00 2001 From: Chunwei Chen Date: Fri, 4 Aug 2017 09:57:58 -0700 Subject: Fix use-after-free in taskq_seq_show_impl taskq_seq_show_impl walks the tq_active_list to show the tqent_func and tqent_arg. However for taskq_dispatch_ent, it's very likely that the task entry will be freed during the function call, and causes a use-after-free bug. To fix this, we duplicate the task entry to an on-stack struct, and assign it instead to tqt_task. This way, the tq_lock alone will guarantee its safety. Reviewed-by: Tim Chase Reviewed-by: Brian Behlendorf Signed-off-by: Chunwei Chen Closes #638 Closes #640 --- module/spl/spl-taskq.c | 55 ++++++++++++++++++++++++++------------------------ 1 file changed, 29 insertions(+), 26 deletions(-) (limited to 'module/spl/spl-taskq.c') diff --git a/module/spl/spl-taskq.c b/module/spl/spl-taskq.c index 83f483ea9..4298b3c86 100644 --- a/module/spl/spl-taskq.c +++ b/module/spl/spl-taskq.c @@ -337,19 +337,18 @@ taskq_find_list(taskq_t *tq, struct list_head *lh, taskqid_t id) /* * Find an already dispatched task given the task id regardless of what - * state it is in. If a task is still pending or executing it will be - * returned and 'active' set appropriately. If the task has already - * been run then NULL is returned. + * state it is in. If a task is still pending it will be returned. + * If a task is executing, then -EBUSY will be returned instead. + * If the task has already been run then NULL is returned. */ static taskq_ent_t * -taskq_find(taskq_t *tq, taskqid_t id, int *active) +taskq_find(taskq_t *tq, taskqid_t id) { taskq_thread_t *tqt; struct list_head *l; taskq_ent_t *t; ASSERT(spin_is_locked(&tq->tq_lock)); - *active = 0; t = taskq_find_list(tq, &tq->tq_delay_list, id); if (t) @@ -366,9 +365,12 @@ taskq_find(taskq_t *tq, taskqid_t id, int *active) list_for_each(l, &tq->tq_active_list) { tqt = list_entry(l, taskq_thread_t, tqt_active_list); if (tqt->tqt_id == id) { - t = tqt->tqt_task; - *active = 1; - return (t); + /* + * Instead of returning tqt_task, we just return a non + * NULL value to prevent misuse, since tqt_task only + * has two valid fields. + */ + return (ERR_PTR(-EBUSY)); } } @@ -405,12 +407,11 @@ taskq_find(taskq_t *tq, taskqid_t id, int *active) static int taskq_wait_id_check(taskq_t *tq, taskqid_t id) { - int active = 0; int rc; unsigned long flags; spin_lock_irqsave_nested(&tq->tq_lock, flags, tq->tq_lock_class); - rc = (taskq_find(tq, id, &active) == NULL); + rc = (taskq_find(tq, id) == NULL); spin_unlock_irqrestore(&tq->tq_lock, flags); return (rc); @@ -497,15 +498,14 @@ int taskq_cancel_id(taskq_t *tq, taskqid_t id) { taskq_ent_t *t; - int active = 0; int rc = ENOENT; unsigned long flags; ASSERT(tq); spin_lock_irqsave_nested(&tq->tq_lock, flags, tq->tq_lock_class); - t = taskq_find(tq, id, &active); - if (t && !active) { + t = taskq_find(tq, id); + if (t && t != ERR_PTR(-EBUSY)) { list_del_init(&t->tqent_list); t->tqent_flags |= TQENT_FLAG_CANCEL; @@ -536,7 +536,7 @@ taskq_cancel_id(taskq_t *tq, taskqid_t id) } spin_unlock_irqrestore(&tq->tq_lock, flags); - if (active) { + if (t == ERR_PTR(-EBUSY)) { taskq_wait_id(tq, id); rc = EBUSY; } @@ -838,6 +838,7 @@ taskq_thread(void *args) taskq_ent_t *t; int seq_tasks = 0; unsigned long flags; + taskq_ent_t dup_task = {}; ASSERT(tqt); ASSERT(tqt->tqt_tq); @@ -897,22 +898,24 @@ taskq_thread(void *args) list_del_init(&t->tqent_list); /* - * In order to support recursively dispatching a - * preallocated taskq_ent_t, tqent_id must be - * stored prior to executing tqent_func. + * A TQENT_FLAG_PREALLOC task may be reused or freed + * during the task function call. Store tqent_id and + * tqent_flags here. + * + * Also use an on stack taskq_ent_t for tqt_task + * assignment in this case. We only populate the two + * fields used by the only user in taskq proc file. */ tqt->tqt_id = t->tqent_id; - tqt->tqt_task = t; - - /* - * We must store a copy of the flags prior to - * servicing the task (servicing a prealloc'd task - * returns the ownership of the tqent back to - * the caller of taskq_dispatch). Thus, - * tqent_flags _may_ change within the call. - */ tqt->tqt_flags = t->tqent_flags; + if (t->tqent_flags & TQENT_FLAG_PREALLOC) { + dup_task.tqent_func = t->tqent_func; + dup_task.tqent_arg = t->tqent_arg; + t = &dup_task; + } + tqt->tqt_task = t; + taskq_insert_in_order(tq, tqt); tq->tq_nactive++; spin_unlock_irqrestore(&tq->tq_lock, flags); -- cgit v1.2.3 From 9243b0fb4784803720a0a5336cc3ded969a779e6 Mon Sep 17 00:00:00 2001 From: Boris Protopopov Date: Tue, 8 Aug 2017 11:31:52 -0400 Subject: Add assert under lock to detect cases of dispach of a preallocated taskq work item to more than one queue concurrently. Also, please see discussion in zfsonlinux/zfs#3840. Reviewed-by: Brian Behlendorf Signed-off-by: Boris Protopopov Closes #609 --- module/spl/spl-taskq.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'module/spl/spl-taskq.c') diff --git a/module/spl/spl-taskq.c b/module/spl/spl-taskq.c index 4298b3c86..7cad9f76b 100644 --- a/module/spl/spl-taskq.c +++ b/module/spl/spl-taskq.c @@ -683,6 +683,12 @@ taskq_dispatch_ent(taskq_t *tq, task_func_t func, void *arg, uint_t flags, spin_lock(&t->tqent_lock); + /* + * Make sure the entry is not on some other taskq; it is important to + * ASSERT() under lock + */ + ASSERT(taskq_empty_ent(t)); + /* * Mark it as a prealloc'd task. This is important * to ensure that we don't free it later. -- cgit v1.2.3 From 35a44fcb8d6e346f51be82dfe57562c2ea0c6a9c Mon Sep 17 00:00:00 2001 From: James Cowgill Date: Mon, 30 Oct 2017 18:16:56 +0000 Subject: Remove all spin_is_locked calls On systems with CONFIG_SMP turned off, spin_is_locked always returns false causing these assertions to fail. Remove them as suggested in zfsonlinux/zfs#6558. Reviewed-by: George Melikov Reviewed-by: Brian Behlendorf Signed-off-by: James Cowgill Closes #665 --- module/spl/spl-kmem-cache.c | 4 ---- module/spl/spl-taskq.c | 13 ------------- module/spl/spl-tsd.c | 1 - module/spl/spl-vnode.c | 2 -- 4 files changed, 20 deletions(-) (limited to 'module/spl/spl-taskq.c') diff --git a/module/spl/spl-kmem-cache.c b/module/spl/spl-kmem-cache.c index 45576b976..36686692b 100644 --- a/module/spl/spl-kmem-cache.c +++ b/module/spl/spl-kmem-cache.c @@ -382,7 +382,6 @@ spl_slab_free(spl_kmem_slab_t *sks, skc = sks->sks_cache; ASSERT(skc->skc_magic == SKC_MAGIC); - ASSERT(spin_is_locked(&skc->skc_lock)); /* * Update slab/objects counters in the cache, then remove the @@ -583,7 +582,6 @@ __spl_cache_flush(spl_kmem_cache_t *skc, spl_kmem_magazine_t *skm, int flush) ASSERT(skc->skc_magic == SKC_MAGIC); ASSERT(skm->skm_magic == SKM_MAGIC); - ASSERT(spin_is_locked(&skc->skc_lock)); for (i = 0; i < count; i++) spl_cache_shrink(skc, skm->skm_objs[i]); @@ -1125,7 +1123,6 @@ spl_cache_obj(spl_kmem_cache_t *skc, spl_kmem_slab_t *sks) ASSERT(skc->skc_magic == SKC_MAGIC); ASSERT(sks->sks_magic == SKS_MAGIC); - ASSERT(spin_is_locked(&skc->skc_lock)); sko = list_entry(sks->sks_free_list.next, spl_kmem_obj_t, sko_list); ASSERT(sko->sko_magic == SKO_MAGIC); @@ -1396,7 +1393,6 @@ spl_cache_shrink(spl_kmem_cache_t *skc, void *obj) spl_kmem_obj_t *sko = NULL; ASSERT(skc->skc_magic == SKC_MAGIC); - ASSERT(spin_is_locked(&skc->skc_lock)); sko = spl_sko_from_obj(skc, obj); ASSERT(sko->sko_magic == SKO_MAGIC); diff --git a/module/spl/spl-taskq.c b/module/spl/spl-taskq.c index 7cad9f76b..50f6f520f 100644 --- a/module/spl/spl-taskq.c +++ b/module/spl/spl-taskq.c @@ -103,7 +103,6 @@ task_alloc(taskq_t *tq, uint_t flags, unsigned long *irqflags) int count = 0; ASSERT(tq); - ASSERT(spin_is_locked(&tq->tq_lock)); retry: /* Acquire taskq_ent_t's from free list if available */ if (!list_empty(&tq->tq_free_list) && !(flags & TQ_NEW)) { @@ -168,7 +167,6 @@ task_free(taskq_t *tq, taskq_ent_t *t) { ASSERT(tq); ASSERT(t); - ASSERT(spin_is_locked(&tq->tq_lock)); ASSERT(list_empty(&t->tqent_list)); ASSERT(!timer_pending(&t->tqent_timer)); @@ -185,7 +183,6 @@ task_done(taskq_t *tq, taskq_ent_t *t) { ASSERT(tq); ASSERT(t); - ASSERT(spin_is_locked(&tq->tq_lock)); /* Wake tasks blocked in taskq_wait_id() */ wake_up_all(&t->tqent_waitq); @@ -259,7 +256,6 @@ taskq_lowest_id(taskq_t *tq) taskq_thread_t *tqt; ASSERT(tq); - ASSERT(spin_is_locked(&tq->tq_lock)); if (!list_empty(&tq->tq_pend_list)) { t = list_entry(tq->tq_pend_list.next, taskq_ent_t, tqent_list); @@ -297,7 +293,6 @@ taskq_insert_in_order(taskq_t *tq, taskq_thread_t *tqt) ASSERT(tq); ASSERT(tqt); - ASSERT(spin_is_locked(&tq->tq_lock)); list_for_each_prev(l, &tq->tq_active_list) { w = list_entry(l, taskq_thread_t, tqt_active_list); @@ -320,8 +315,6 @@ taskq_find_list(taskq_t *tq, struct list_head *lh, taskqid_t id) struct list_head *l; taskq_ent_t *t; - ASSERT(spin_is_locked(&tq->tq_lock)); - list_for_each(l, lh) { t = list_entry(l, taskq_ent_t, tqent_list); @@ -348,8 +341,6 @@ taskq_find(taskq_t *tq, taskqid_t id) struct list_head *l; taskq_ent_t *t; - ASSERT(spin_is_locked(&tq->tq_lock)); - t = taskq_find_list(tq, &tq->tq_delay_list, id); if (t) return (t); @@ -751,8 +742,6 @@ taskq_next_ent(taskq_t *tq) { struct list_head *list; - ASSERT(spin_is_locked(&tq->tq_lock)); - if (!list_empty(&tq->tq_prio_list)) list = &tq->tq_prio_list; else if (!list_empty(&tq->tq_pend_list)) @@ -817,8 +806,6 @@ taskq_thread_spawn(taskq_t *tq) static int taskq_thread_should_stop(taskq_t *tq, taskq_thread_t *tqt) { - ASSERT(spin_is_locked(&tq->tq_lock)); - if (!(tq->tq_flags & TASKQ_DYNAMIC)) return (0); diff --git a/module/spl/spl-tsd.c b/module/spl/spl-tsd.c index bf8235063..4c800292a 100644 --- a/module/spl/spl-tsd.c +++ b/module/spl/spl-tsd.c @@ -315,7 +315,6 @@ tsd_hash_add_pid(tsd_hash_table_t *table, pid_t pid) static void tsd_hash_del(tsd_hash_table_t *table, tsd_hash_entry_t *entry) { - ASSERT(spin_is_locked(&table->ht_lock)); hlist_del(&entry->he_list); list_del_init(&entry->he_key_list); list_del_init(&entry->he_pid_list); diff --git a/module/spl/spl-vnode.c b/module/spl/spl-vnode.c index 38f64a478..0e4c386a3 100644 --- a/module/spl/spl-vnode.c +++ b/module/spl/spl-vnode.c @@ -427,8 +427,6 @@ file_find(int fd, struct task_struct *task) { file_t *fp; - ASSERT(spin_is_locked(&vn_file_lock)); - list_for_each_entry(fp, &vn_file_list, f_list) { if (fd == fp->f_fd && fp->f_task == task) { ASSERT(atomic_read(&fp->f_ref) != 0); -- cgit v1.2.3 From c9821f1ccc647dfbd506f381b736c664d862d126 Mon Sep 17 00:00:00 2001 From: Tony Hutter Date: Thu, 21 Dec 2017 10:56:32 -0800 Subject: Linux 4.15 compat: timer updates Use timer_setup() macro and new timeout function definition. Reviewed-by: Brian Behlendorf Signed-off-by: Tony Hutter Closes #670 Closes #671 --- config/spl-build.m4 | 34 ++++++++++++++++++++++++++++++++++ module/spl/spl-taskq.c | 27 +++++++++++++++++++++++++-- 2 files changed, 59 insertions(+), 2 deletions(-) (limited to 'module/spl/spl-taskq.c') diff --git a/config/spl-build.m4 b/config/spl-build.m4 index 7b66f2c86..926abd5c8 100644 --- a/config/spl-build.m4 +++ b/config/spl-build.m4 @@ -54,6 +54,7 @@ AC_DEFUN([SPL_AC_CONFIG_KERNEL], [ SPL_AC_WAIT_QUEUE_HEAD_ENTRY SPL_AC_KERNEL_WRITE SPL_AC_KERNEL_READ + SPL_AC_KERNEL_TIMER_FUNCTION_TIMER_LIST ]) AC_DEFUN([SPL_AC_MODULE_SYMVERS], [ @@ -1654,3 +1655,36 @@ AC_DEFUN([SPL_AC_KERNEL_READ], [ ]) EXTRA_KCFLAGS="$tmp_flags" ]) + +dnl # +dnl # 4.15 API change +dnl # https://lkml.org/lkml/2017/11/25/90 +dnl # Check if timer_list.func get passed a timer_list or an unsigned long +dnl # (older kernels). Also sanity check the from_timer() and timer_setup() +dnl # macros are available as well, since they will be used in the same newer +dnl # kernels that support the new timer_list.func signature. +dnl # +AC_DEFUN([SPL_AC_KERNEL_TIMER_FUNCTION_TIMER_LIST], [ + AC_MSG_CHECKING([whether timer_list.function gets a timer_list]) + tmp_flags="$EXTRA_KCFLAGS" + EXTRA_KCFLAGS="-Werror" + SPL_LINUX_TRY_COMPILE([ + #include + void task_expire(struct timer_list *tl) {} + ],[ + #ifndef from_timer + #error "No from_timer() macro" + #endif + + struct timer_list timer; + timer.function = task_expire; + timer_setup(&timer, NULL, 0); + ],[ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_KERNEL_TIMER_FUNCTION_TIMER_LIST, 1, + [timer_list.function gets a timer_list]) + ],[ + AC_MSG_RESULT(no) + ]) + EXTRA_KCFLAGS="$tmp_flags" +]) diff --git a/module/spl/spl-taskq.c b/module/spl/spl-taskq.c index 50f6f520f..ae26bdb2e 100644 --- a/module/spl/spl-taskq.c +++ b/module/spl/spl-taskq.c @@ -206,9 +206,9 @@ task_done(taskq_t *tq, taskq_ent_t *t) * add it to the priority list in order for immediate processing. */ static void -task_expire(unsigned long data) +task_expire_impl(taskq_ent_t *t) { - taskq_ent_t *w, *t = (taskq_ent_t *)data; + taskq_ent_t *w; taskq_t *tq = t->tqent_taskq; struct list_head *l; unsigned long flags; @@ -242,6 +242,21 @@ task_expire(unsigned long data) wake_up(&tq->tq_work_waitq); } +#ifdef HAVE_KERNEL_TIMER_FUNCTION_TIMER_LIST +static void +task_expire(struct timer_list *tl) +{ + taskq_ent_t *t = from_timer(t, tl, tqent_timer); + task_expire_impl(t); +} +#else +static void +task_expire(unsigned long data) +{ + task_expire_impl((taskq_ent_t *)data); +} +#endif + /* * Returns the lowest incomplete taskqid_t. The taskqid_t may * be queued on the pending list, on the priority list, on the @@ -581,7 +596,9 @@ taskq_dispatch(taskq_t *tq, task_func_t func, void *arg, uint_t flags) t->tqent_func = func; t->tqent_arg = arg; t->tqent_taskq = tq; +#ifndef HAVE_KERNEL_TIMER_FUNCTION_TIMER_LIST t->tqent_timer.data = 0; +#endif t->tqent_timer.function = NULL; t->tqent_timer.expires = 0; t->tqent_birth = jiffies; @@ -631,7 +648,9 @@ taskq_dispatch_delay(taskq_t *tq, task_func_t func, void *arg, t->tqent_func = func; t->tqent_arg = arg; t->tqent_taskq = tq; +#ifndef HAVE_KERNEL_TIMER_FUNCTION_TIMER_LIST t->tqent_timer.data = (unsigned long)t; +#endif t->tqent_timer.function = task_expire; t->tqent_timer.expires = (unsigned long)expire_time; add_timer(&t->tqent_timer); @@ -723,7 +742,11 @@ taskq_init_ent(taskq_ent_t *t) { spin_lock_init(&t->tqent_lock); init_waitqueue_head(&t->tqent_waitq); +#ifdef HAVE_KERNEL_TIMER_FUNCTION_TIMER_LIST + timer_setup(&t->tqent_timer, NULL, 0); +#else init_timer(&t->tqent_timer); +#endif INIT_LIST_HEAD(&t->tqent_list); t->tqent_id = 0; t->tqent_func = NULL; -- cgit v1.2.3 From 5461eefe50427a8f8caf0b92f0195c754bed8ec6 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Wed, 7 Feb 2018 11:49:38 -0800 Subject: Fix cstyle warnings This patch contains no functional changes. It is solely intended to resolve cstyle warnings in order to facilitate moving the spl source code in to the zfs repository. Signed-off-by: Brian Behlendorf Closes #681 --- include/fs/fs_subr.h | 2 +- include/linux/math64_compat.h | 1 + include/rpc/types.h | 2 +- include/rpc/xdr.h | 48 ++-- include/sharefs/share.h | 2 +- include/spl-ctl.h | 22 +- include/splat-ctl.h | 60 ++-- include/strings.h | 2 +- include/sys/acl.h | 138 +++++----- include/sys/acl_impl.h | 2 +- include/sys/atomic.h | 80 +++--- include/sys/attr.h | 2 +- include/sys/bitmap.h | 2 +- include/sys/bootconf.h | 2 +- include/sys/bootprops.h | 2 +- include/sys/buf.h | 2 +- include/sys/byteorder.h | 32 ++- include/sys/callb.h | 21 +- include/sys/callo.h | 10 +- include/sys/cmn_err.h | 14 +- include/sys/compress.h | 2 +- include/sys/conf.h | 2 +- include/sys/console.h | 10 +- include/sys/cpupart.h | 2 +- include/sys/cpuvar.h | 2 +- include/sys/crc32.h | 2 +- include/sys/cred.h | 4 +- include/sys/ctype.h | 2 +- include/sys/ddi.h | 2 +- include/sys/debug.h | 6 +- include/sys/dirent.h | 2 +- include/sys/disp.h | 2 +- include/sys/dkioc_free_util.h | 2 +- include/sys/dnlc.h | 2 +- include/sys/dumphdr.h | 2 +- include/sys/efi_partition.h | 2 +- include/sys/errno.h | 2 +- include/sys/fcntl.h | 4 +- include/sys/file.h | 2 +- include/sys/fs/swapnode.h | 2 +- include/sys/idmap.h | 4 +- include/sys/int_limits.h | 2 +- include/sys/int_types.h | 2 +- include/sys/inttypes.h | 2 +- include/sys/isa_defs.h | 64 ++--- include/sys/kidmap.h | 2 +- include/sys/kobj.h | 2 +- include/sys/kstat.h | 244 ++++++++-------- include/sys/list.h | 36 +-- include/sys/mkdev.h | 2 +- include/sys/mntent.h | 2 +- include/sys/modctl.h | 2 +- include/sys/mode.h | 8 +- include/sys/mount.h | 2 +- include/sys/mutex.h | 10 +- include/sys/note.h | 2 +- include/sys/open.h | 2 +- include/sys/param.h | 8 +- include/sys/pathname.h | 2 +- include/sys/policy.h | 20 +- include/sys/pool.h | 2 +- include/sys/priv_impl.h | 2 +- include/sys/proc.h | 2 +- include/sys/processor.h | 2 +- include/sys/pset.h | 14 +- include/sys/random.h | 4 +- include/sys/refstr.h | 2 +- include/sys/resource.h | 2 +- include/sys/rwlock.h | 34 +-- include/sys/sdt.h | 4 +- include/sys/sid.h | 12 +- include/sys/signal.h | 7 +- include/sys/stat.h | 2 +- include/sys/stropts.h | 2 +- include/sys/sunddi.h | 8 +- include/sys/sunldi.h | 4 +- include/sys/sysdc.h | 2 +- include/sys/sysmacros.h | 196 ++++++------- include/sys/systeminfo.h | 8 +- include/sys/systm.h | 2 +- include/sys/t_lock.h | 2 +- include/sys/taskq.h | 2 +- include/sys/thread.h | 36 +-- include/sys/timer.h | 37 ++- include/sys/tsd.h | 10 +- include/sys/types.h | 6 +- include/sys/u8_textprep.h | 2 +- include/sys/uio.h | 20 +- include/sys/unistd.h | 2 +- include/sys/user.h | 4 +- include/sys/va_list.h | 2 +- include/sys/varargs.h | 4 +- include/sys/vfs.h | 4 +- include/sys/vfs_opreg.h | 2 +- include/sys/vmsystm.h | 14 +- include/sys/vnode.h | 100 +++---- include/sys/zmod.h | 5 +- include/sys/zone.h | 2 +- include/unistd.h | 2 +- include/util/qsort.h | 4 +- include/util/sscanf.h | 2 +- include/vm/anon.h | 2 +- include/vm/pvn.h | 2 +- include/vm/seg_kmem.h | 2 +- module/spl/spl-atomic.c | 8 +- module/spl/spl-condvar.c | 8 +- module/spl/spl-cred.c | 38 ++- module/spl/spl-err.c | 5 +- module/spl/spl-generic.c | 84 +++--- module/spl/spl-kmem-cache.c | 22 +- module/spl/spl-kmem.c | 2 +- module/spl/spl-kobj.c | 12 +- module/spl/spl-kstat.c | 521 +++++++++++++++++------------------ module/spl/spl-mutex.c | 8 +- module/spl/spl-proc.c | 628 +++++++++++++++++++++--------------------- module/spl/spl-rwlock.c | 10 +- module/spl/spl-taskq.c | 22 +- module/spl/spl-thread.c | 29 +- module/spl/spl-vnode.c | 164 ++++++----- module/spl/spl-xdr.c | 157 ++++++----- module/spl/spl-zlib.c | 37 +-- 121 files changed, 1633 insertions(+), 1621 deletions(-) (limited to 'module/spl/spl-taskq.c') diff --git a/include/fs/fs_subr.h b/include/fs/fs_subr.h index 802aa7336..71f074205 100644 --- a/include/fs/fs_subr.h +++ b/include/fs/fs_subr.h @@ -23,6 +23,6 @@ */ #ifndef _SPL_FS_FS_SUBR_H -#define _SPL_FS_FS_SUBR_H +#define _SPL_FS_FS_SUBR_H #endif /* SPL_FS_FS_SUBR_H */ diff --git a/include/linux/math64_compat.h b/include/linux/math64_compat.h index e45015bea..c02f58479 100644 --- a/include/linux/math64_compat.h +++ b/include/linux/math64_compat.h @@ -26,6 +26,7 @@ #define _SPL_MATH64_COMPAT_H #ifndef abs64 +/* CSTYLED */ #define abs64(x) ({ uint64_t t = (x) >> 63; ((x) ^ t) - t; }) #endif diff --git a/include/rpc/types.h b/include/rpc/types.h index 57afbc52a..4fb5415ab 100644 --- a/include/rpc/types.h +++ b/include/rpc/types.h @@ -23,7 +23,7 @@ */ #ifndef _SPL_RPC_TYPES_H -#define _SPL_RPC_TYPES_H +#define _SPL_RPC_TYPES_H typedef int bool_t; diff --git a/include/rpc/xdr.h b/include/rpc/xdr.h index 4f19f655b..e349757d5 100644 --- a/include/rpc/xdr.h +++ b/include/rpc/xdr.h @@ -20,7 +20,7 @@ */ #ifndef _SPL_RPC_XDR_H -#define _SPL_RPC_XDR_H +#define _SPL_RPC_XDR_H #include #include @@ -36,11 +36,10 @@ enum xdr_op { struct xdr_ops; typedef struct { - struct xdr_ops *x_ops; /* Also used to let caller know if - xdrmem_create() succeeds (sigh..) */ - caddr_t x_addr; /* Current buffer addr */ - caddr_t x_addr_end; /* End of the buffer */ - enum xdr_op x_op; /* Stream direction */ + struct xdr_ops *x_ops; /* Let caller know xdrmem_create() succeeds */ + caddr_t x_addr; /* Current buffer addr */ + caddr_t x_addr_end; /* End of the buffer */ + enum xdr_op x_op; /* Stream direction */ } XDR; typedef bool_t (*xdrproc_t)(XDR *xdrs, void *ptr); @@ -56,13 +55,13 @@ struct xdr_ops { bool_t (*xdr_opaque)(XDR *, caddr_t, const uint_t); bool_t (*xdr_string)(XDR *, char **, const uint_t); bool_t (*xdr_array)(XDR *, caddr_t *, uint_t *, const uint_t, - const uint_t, const xdrproc_t); + const uint_t, const xdrproc_t); }; /* * XDR control operator. */ -#define XDR_GET_BYTES_AVAIL 1 +#define XDR_GET_BYTES_AVAIL 1 struct xdr_bytesrec { bool_t xc_is_last_record; @@ -74,11 +73,12 @@ struct xdr_bytesrec { */ void xdrmem_create(XDR *xdrs, const caddr_t addr, const uint_t size, const enum xdr_op op); -#define xdr_destroy(xdrs) ((void) 0) /* Currently not needed. If needed later, - we'll add it to struct xdr_ops */ -#define xdr_control(xdrs, req, info) (xdrs)->x_ops->xdr_control((xdrs), \ - (req), (info)) +/* Currently not needed. If needed later, we'll add it to struct xdr_ops */ +#define xdr_destroy(xdrs) ((void) 0) + +#define xdr_control(xdrs, req, info) \ + (xdrs)->x_ops->xdr_control((xdrs), (req), (info)) /* * For precaution, the following are defined as static inlines instead of macros @@ -89,40 +89,40 @@ void xdrmem_create(XDR *xdrs, const caddr_t addr, const uint_t size, */ static inline bool_t xdr_char(XDR *xdrs, char *cp) { - return xdrs->x_ops->xdr_char(xdrs, cp); + return (xdrs->x_ops->xdr_char(xdrs, cp)); } static inline bool_t xdr_u_short(XDR *xdrs, unsigned short *usp) { - return xdrs->x_ops->xdr_u_short(xdrs, usp); + return (xdrs->x_ops->xdr_u_short(xdrs, usp)); } static inline bool_t xdr_short(XDR *xdrs, short *sp) { - BUILD_BUG_ON(sizeof(short) != 2); - return xdrs->x_ops->xdr_u_short(xdrs, (unsigned short *) sp); + BUILD_BUG_ON(sizeof (short) != 2); + return (xdrs->x_ops->xdr_u_short(xdrs, (unsigned short *) sp)); } static inline bool_t xdr_u_int(XDR *xdrs, unsigned *up) { - return xdrs->x_ops->xdr_u_int(xdrs, up); + return (xdrs->x_ops->xdr_u_int(xdrs, up)); } static inline bool_t xdr_int(XDR *xdrs, int *ip) { - BUILD_BUG_ON(sizeof(int) != 4); - return xdrs->x_ops->xdr_u_int(xdrs, (unsigned *) ip); + BUILD_BUG_ON(sizeof (int) != 4); + return (xdrs->x_ops->xdr_u_int(xdrs, (unsigned *)ip)); } static inline bool_t xdr_u_longlong_t(XDR *xdrs, u_longlong_t *ullp) { - return xdrs->x_ops->xdr_u_longlong_t(xdrs, ullp); + return (xdrs->x_ops->xdr_u_longlong_t(xdrs, ullp)); } static inline bool_t xdr_longlong_t(XDR *xdrs, longlong_t *llp) { - BUILD_BUG_ON(sizeof(longlong_t) != 8); - return xdrs->x_ops->xdr_u_longlong_t(xdrs, (u_longlong_t *) llp); + BUILD_BUG_ON(sizeof (longlong_t) != 8); + return (xdrs->x_ops->xdr_u_longlong_t(xdrs, (u_longlong_t *)llp)); } /* @@ -130,7 +130,7 @@ static inline bool_t xdr_longlong_t(XDR *xdrs, longlong_t *llp) */ static inline bool_t xdr_opaque(XDR *xdrs, caddr_t cp, const uint_t cnt) { - return xdrs->x_ops->xdr_opaque(xdrs, cp, cnt); + return (xdrs->x_ops->xdr_opaque(xdrs, cp, cnt)); } /* @@ -139,7 +139,7 @@ static inline bool_t xdr_opaque(XDR *xdrs, caddr_t cp, const uint_t cnt) */ static inline bool_t xdr_string(XDR *xdrs, char **sp, const uint_t maxsize) { - return xdrs->x_ops->xdr_string(xdrs, sp, maxsize); + return (xdrs->x_ops->xdr_string(xdrs, sp, maxsize)); } /* diff --git a/include/sharefs/share.h b/include/sharefs/share.h index 6c140d0b8..a5bf0e2e1 100644 --- a/include/sharefs/share.h +++ b/include/sharefs/share.h @@ -23,6 +23,6 @@ */ #ifndef _SPL_SHARE_H -#define _SPL_SHARE_H +#define _SPL_SHARE_H #endif /* SPL_SHARE_H */ diff --git a/include/spl-ctl.h b/include/spl-ctl.h index 21b1c1c05..571887d1d 100644 --- a/include/spl-ctl.h +++ b/include/spl-ctl.h @@ -23,23 +23,23 @@ */ #ifndef _DEBUG_CTL_H -#define _DEBUG_CTL_H +#define _DEBUG_CTL_H /* * Contains shared definitions which both the user space * and kernel space portions of splat must agree on. */ typedef struct spl_debug_header { - int ph_len; - int ph_flags; - int ph_subsys; - int ph_mask; - int ph_cpu_id; - int ph_sec; - long ph_usec; - int ph_stack; - int ph_pid; - int ph_line_num; + int ph_len; + int ph_flags; + int ph_subsys; + int ph_mask; + int ph_cpu_id; + int ph_sec; + long ph_usec; + int ph_stack; + int ph_pid; + int ph_line_num; } spl_debug_header_t; #endif /* _DEBUG_CTL_H */ diff --git a/include/splat-ctl.h b/include/splat-ctl.h index dab3b299f..0f020dc24 100644 --- a/include/splat-ctl.h +++ b/include/splat-ctl.h @@ -23,7 +23,7 @@ */ #ifndef _SPLAT_CTL_H -#define _SPLAT_CTL_H +#define _SPLAT_CTL_H #include @@ -32,11 +32,11 @@ * ensure 32-bit/64-bit interoperability over ioctl()'s only types with * fixed sizes can be used. */ -#define SPLAT_NAME "splatctl" -#define SPLAT_DEV "/dev/splatctl" +#define SPLAT_NAME "splatctl" +#define SPLAT_DEV "/dev/splatctl" -#define SPLAT_NAME_SIZE 20 -#define SPLAT_DESC_SIZE 60 +#define SPLAT_NAME_SIZE 20 +#define SPLAT_DESC_SIZE 60 typedef struct splat_user { char name[SPLAT_NAME_SIZE]; /* Short name */ @@ -72,38 +72,38 @@ typedef struct splat_cmd { } splat_cmd_t; /* Valid ioctls */ -#define SPLAT_CFG _IOWR('f', 101, splat_cfg_t) -#define SPLAT_CMD _IOWR('f', 102, splat_cmd_t) +#define SPLAT_CFG _IOWR('f', 101, splat_cfg_t) +#define SPLAT_CMD _IOWR('f', 102, splat_cmd_t) /* Valid configuration commands */ -#define SPLAT_CFG_BUFFER_CLEAR 0x001 /* Clear text buffer */ -#define SPLAT_CFG_BUFFER_SIZE 0x002 /* Resize text buffer */ -#define SPLAT_CFG_SUBSYSTEM_COUNT 0x101 /* Number of subsystem */ -#define SPLAT_CFG_SUBSYSTEM_LIST 0x102 /* List of N subsystems */ -#define SPLAT_CFG_TEST_COUNT 0x201 /* Number of tests */ -#define SPLAT_CFG_TEST_LIST 0x202 /* List of N tests */ +#define SPLAT_CFG_BUFFER_CLEAR 0x001 /* Clear text buffer */ +#define SPLAT_CFG_BUFFER_SIZE 0x002 /* Resize text buffer */ +#define SPLAT_CFG_SUBSYSTEM_COUNT 0x101 /* Number of subsystem */ +#define SPLAT_CFG_SUBSYSTEM_LIST 0x102 /* List of N subsystems */ +#define SPLAT_CFG_TEST_COUNT 0x201 /* Number of tests */ +#define SPLAT_CFG_TEST_LIST 0x202 /* List of N tests */ /* * Valid subsystem and test commands are defined in each subsystem as * SPLAT_SUBSYSTEM_*. We do need to be careful to avoid collisions, the * currently defined subsystems are as follows: */ -#define SPLAT_SUBSYSTEM_KMEM 0x0100 -#define SPLAT_SUBSYSTEM_TASKQ 0x0200 -#define SPLAT_SUBSYSTEM_KRNG 0x0300 -#define SPLAT_SUBSYSTEM_MUTEX 0x0400 -#define SPLAT_SUBSYSTEM_CONDVAR 0x0500 -#define SPLAT_SUBSYSTEM_THREAD 0x0600 -#define SPLAT_SUBSYSTEM_RWLOCK 0x0700 -#define SPLAT_SUBSYSTEM_TIME 0x0800 -#define SPLAT_SUBSYSTEM_VNODE 0x0900 -#define SPLAT_SUBSYSTEM_KOBJ 0x0a00 -#define SPLAT_SUBSYSTEM_ATOMIC 0x0b00 -#define SPLAT_SUBSYSTEM_LIST 0x0c00 -#define SPLAT_SUBSYSTEM_GENERIC 0x0d00 -#define SPLAT_SUBSYSTEM_CRED 0x0e00 -#define SPLAT_SUBSYSTEM_ZLIB 0x0f00 -#define SPLAT_SUBSYSTEM_LINUX 0x1000 -#define SPLAT_SUBSYSTEM_UNKNOWN 0xff00 +#define SPLAT_SUBSYSTEM_KMEM 0x0100 +#define SPLAT_SUBSYSTEM_TASKQ 0x0200 +#define SPLAT_SUBSYSTEM_KRNG 0x0300 +#define SPLAT_SUBSYSTEM_MUTEX 0x0400 +#define SPLAT_SUBSYSTEM_CONDVAR 0x0500 +#define SPLAT_SUBSYSTEM_THREAD 0x0600 +#define SPLAT_SUBSYSTEM_RWLOCK 0x0700 +#define SPLAT_SUBSYSTEM_TIME 0x0800 +#define SPLAT_SUBSYSTEM_VNODE 0x0900 +#define SPLAT_SUBSYSTEM_KOBJ 0x0a00 +#define SPLAT_SUBSYSTEM_ATOMIC 0x0b00 +#define SPLAT_SUBSYSTEM_LIST 0x0c00 +#define SPLAT_SUBSYSTEM_GENERIC 0x0d00 +#define SPLAT_SUBSYSTEM_CRED 0x0e00 +#define SPLAT_SUBSYSTEM_ZLIB 0x0f00 +#define SPLAT_SUBSYSTEM_LINUX 0x1000 +#define SPLAT_SUBSYSTEM_UNKNOWN 0xff00 #endif /* _SPLAT_CTL_H */ diff --git a/include/strings.h b/include/strings.h index c3b5741de..18179c79e 100644 --- a/include/strings.h +++ b/include/strings.h @@ -23,6 +23,6 @@ */ #ifndef _SPL_STRINGS_H -#define _SPL_STRINGS_H +#define _SPL_STRINGS_H #endif /* SPL_STRINGS_H */ diff --git a/include/sys/acl.h b/include/sys/acl.h index 4c301b2a8..9fc79c025 100644 --- a/include/sys/acl.h +++ b/include/sys/acl.h @@ -23,95 +23,97 @@ */ #ifndef _SPL_ACL_H -#define _SPL_ACL_H +#define _SPL_ACL_H #include typedef struct ace { - uid_t a_who; - uint32_t a_access_mask; - uint16_t a_flags; - uint16_t a_type; + uid_t a_who; + uint32_t a_access_mask; + uint16_t a_flags; + uint16_t a_type; } ace_t; typedef struct ace_object { - uid_t a_who; /* uid or gid */ - uint32_t a_access_mask; /* read,write,... */ - uint16_t a_flags; /* see below */ - uint16_t a_type; /* allow or deny */ - uint8_t a_obj_type[16]; /* obj type */ - uint8_t a_inherit_obj_type[16]; /* inherit obj */ + uid_t a_who; /* uid or gid */ + uint32_t a_access_mask; /* read,write,... */ + uint16_t a_flags; /* see below */ + uint16_t a_type; /* allow or deny */ + uint8_t a_obj_type[16]; /* obj type */ + uint8_t a_inherit_obj_type[16]; /* inherit obj */ } ace_object_t; -#define MAX_ACL_ENTRIES 1024 +#define MAX_ACL_ENTRIES 1024 -#define ACE_READ_DATA 0x00000001 -#define ACE_LIST_DIRECTORY 0x00000001 -#define ACE_WRITE_DATA 0x00000002 -#define ACE_ADD_FILE 0x00000002 -#define ACE_APPEND_DATA 0x00000004 -#define ACE_ADD_SUBDIRECTORY 0x00000004 -#define ACE_READ_NAMED_ATTRS 0x00000008 -#define ACE_WRITE_NAMED_ATTRS 0x00000010 -#define ACE_EXECUTE 0x00000020 -#define ACE_DELETE_CHILD 0x00000040 -#define ACE_READ_ATTRIBUTES 0x00000080 -#define ACE_WRITE_ATTRIBUTES 0x00000100 -#define ACE_DELETE 0x00010000 -#define ACE_READ_ACL 0x00020000 -#define ACE_WRITE_ACL 0x00040000 -#define ACE_WRITE_OWNER 0x00080000 -#define ACE_SYNCHRONIZE 0x00100000 +#define ACE_READ_DATA 0x00000001 +#define ACE_LIST_DIRECTORY 0x00000001 +#define ACE_WRITE_DATA 0x00000002 +#define ACE_ADD_FILE 0x00000002 +#define ACE_APPEND_DATA 0x00000004 +#define ACE_ADD_SUBDIRECTORY 0x00000004 +#define ACE_READ_NAMED_ATTRS 0x00000008 +#define ACE_WRITE_NAMED_ATTRS 0x00000010 +#define ACE_EXECUTE 0x00000020 +#define ACE_DELETE_CHILD 0x00000040 +#define ACE_READ_ATTRIBUTES 0x00000080 +#define ACE_WRITE_ATTRIBUTES 0x00000100 +#define ACE_DELETE 0x00010000 +#define ACE_READ_ACL 0x00020000 +#define ACE_WRITE_ACL 0x00040000 +#define ACE_WRITE_OWNER 0x00080000 +#define ACE_SYNCHRONIZE 0x00100000 -#define ACE_FILE_INHERIT_ACE 0x0001 -#define ACE_DIRECTORY_INHERIT_ACE 0x0002 -#define ACE_NO_PROPAGATE_INHERIT_ACE 0x0004 -#define ACE_INHERIT_ONLY_ACE 0x0008 -#define ACE_SUCCESSFUL_ACCESS_ACE_FLAG 0x0010 -#define ACE_FAILED_ACCESS_ACE_FLAG 0x0020 -#define ACE_IDENTIFIER_GROUP 0x0040 -#define ACE_INHERITED_ACE 0x0080 -#define ACE_OWNER 0x1000 -#define ACE_GROUP 0x2000 -#define ACE_EVERYONE 0x4000 +#define ACE_FILE_INHERIT_ACE 0x0001 +#define ACE_DIRECTORY_INHERIT_ACE 0x0002 +#define ACE_NO_PROPAGATE_INHERIT_ACE 0x0004 +#define ACE_INHERIT_ONLY_ACE 0x0008 +#define ACE_SUCCESSFUL_ACCESS_ACE_FLAG 0x0010 +#define ACE_FAILED_ACCESS_ACE_FLAG 0x0020 +#define ACE_IDENTIFIER_GROUP 0x0040 +#define ACE_INHERITED_ACE 0x0080 +#define ACE_OWNER 0x1000 +#define ACE_GROUP 0x2000 +#define ACE_EVERYONE 0x4000 -#define ACE_ACCESS_ALLOWED_ACE_TYPE 0x0000 -#define ACE_ACCESS_DENIED_ACE_TYPE 0x0001 -#define ACE_SYSTEM_AUDIT_ACE_TYPE 0x0002 -#define ACE_SYSTEM_ALARM_ACE_TYPE 0x0003 +#define ACE_ACCESS_ALLOWED_ACE_TYPE 0x0000 +#define ACE_ACCESS_DENIED_ACE_TYPE 0x0001 +#define ACE_SYSTEM_AUDIT_ACE_TYPE 0x0002 +#define ACE_SYSTEM_ALARM_ACE_TYPE 0x0003 -#define ACL_AUTO_INHERIT 0x0001 -#define ACL_PROTECTED 0x0002 -#define ACL_DEFAULTED 0x0004 -#define ACL_FLAGS_ALL (ACL_AUTO_INHERIT|ACL_PROTECTED|ACL_DEFAULTED) +#define ACL_AUTO_INHERIT 0x0001 +#define ACL_PROTECTED 0x0002 +#define ACL_DEFAULTED 0x0004 +#define ACL_FLAGS_ALL (ACL_AUTO_INHERIT|ACL_PROTECTED|ACL_DEFAULTED) -#define ACE_ACCESS_ALLOWED_COMPOUND_ACE_TYPE 0x04 -#define ACE_ACCESS_ALLOWED_OBJECT_ACE_TYPE 0x05 -#define ACE_ACCESS_DENIED_OBJECT_ACE_TYPE 0x06 -#define ACE_SYSTEM_AUDIT_OBJECT_ACE_TYPE 0x07 -#define ACE_SYSTEM_ALARM_OBJECT_ACE_TYPE 0x08 -#define ACE_ACCESS_ALLOWED_CALLBACK_ACE_TYPE 0x09 -#define ACE_ACCESS_DENIED_CALLBACK_ACE_TYPE 0x0A -#define ACE_ACCESS_ALLOWED_CALLBACK_OBJECT_ACE_TYPE 0x0B -#define ACE_ACCESS_DENIED_CALLBACK_OBJECT_ACE_TYPE 0x0C -#define ACE_SYSTEM_AUDIT_CALLBACK_ACE_TYPE 0x0D -#define ACE_SYSTEM_ALARM_CALLBACK_ACE_TYPE 0x0E -#define ACE_SYSTEM_AUDIT_CALLBACK_OBJECT_ACE_TYPE 0x0F -#define ACE_SYSTEM_ALARM_CALLBACK_OBJECT_ACE_TYPE 0x10 +#define ACE_ACCESS_ALLOWED_COMPOUND_ACE_TYPE 0x04 +#define ACE_ACCESS_ALLOWED_OBJECT_ACE_TYPE 0x05 +#define ACE_ACCESS_DENIED_OBJECT_ACE_TYPE 0x06 +#define ACE_SYSTEM_AUDIT_OBJECT_ACE_TYPE 0x07 +#define ACE_SYSTEM_ALARM_OBJECT_ACE_TYPE 0x08 +#define ACE_ACCESS_ALLOWED_CALLBACK_ACE_TYPE 0x09 +#define ACE_ACCESS_DENIED_CALLBACK_ACE_TYPE 0x0A +#define ACE_ACCESS_ALLOWED_CALLBACK_OBJECT_ACE_TYPE 0x0B +#define ACE_ACCESS_DENIED_CALLBACK_OBJECT_ACE_TYPE 0x0C +#define ACE_SYSTEM_AUDIT_CALLBACK_ACE_TYPE 0x0D +#define ACE_SYSTEM_ALARM_CALLBACK_ACE_TYPE 0x0E +#define ACE_SYSTEM_AUDIT_CALLBACK_OBJECT_ACE_TYPE 0x0F +#define ACE_SYSTEM_ALARM_CALLBACK_OBJECT_ACE_TYPE 0x10 -#define ACE_ALL_TYPES 0x001F +#define ACE_ALL_TYPES 0x001F -#define ACE_TYPE_FLAGS (ACE_OWNER|ACE_GROUP|ACE_EVERYONE|ACE_IDENTIFIER_GROUP) +#define ACE_TYPE_FLAGS (ACE_OWNER|ACE_GROUP|ACE_EVERYONE|ACE_IDENTIFIER_GROUP) -#define ACE_ALL_PERMS (ACE_READ_DATA|ACE_LIST_DIRECTORY|ACE_WRITE_DATA| \ +/* BEGIN CSTYLED */ +#define ACE_ALL_PERMS (ACE_READ_DATA|ACE_LIST_DIRECTORY|ACE_WRITE_DATA| \ ACE_ADD_FILE|ACE_APPEND_DATA|ACE_ADD_SUBDIRECTORY|ACE_READ_NAMED_ATTRS| \ ACE_WRITE_NAMED_ATTRS|ACE_EXECUTE|ACE_DELETE_CHILD|ACE_READ_ATTRIBUTES| \ ACE_WRITE_ATTRIBUTES|ACE_DELETE|ACE_READ_ACL|ACE_WRITE_ACL| \ ACE_WRITE_OWNER|ACE_SYNCHRONIZE) +/* END CSTYLED */ -#define VSA_ACE 0x0010 -#define VSA_ACECNT 0x0020 -#define VSA_ACE_ALLTYPES 0x0040 -#define VSA_ACE_ACLFLAGS 0x0080 +#define VSA_ACE 0x0010 +#define VSA_ACECNT 0x0020 +#define VSA_ACE_ALLTYPES 0x0040 +#define VSA_ACE_ACLFLAGS 0x0080 #endif /* _SPL_ACL_H */ diff --git a/include/sys/acl_impl.h b/include/sys/acl_impl.h index 45a4561dc..9cb21124b 100644 --- a/include/sys/acl_impl.h +++ b/include/sys/acl_impl.h @@ -23,6 +23,6 @@ */ #ifndef _SPL_ACL_IMPL_H -#define _SPL_ACL_IMPL_H +#define _SPL_ACL_IMPL_H #endif /* _SPL_ACL_IMPL_H */ diff --git a/include/sys/atomic.h b/include/sys/atomic.h index d0229fb88..e992fdce3 100644 --- a/include/sys/atomic.h +++ b/include/sys/atomic.h @@ -23,7 +23,7 @@ */ #ifndef _SPL_ATOMIC_H -#define _SPL_ATOMIC_H +#define _SPL_ATOMIC_H #include #include @@ -91,7 +91,7 @@ atomic_inc_32_nv(volatile uint32_t *target) nv = ++(*target); spin_unlock(&atomic32_lock); - return nv; + return (nv); } static __inline__ uint32_t @@ -103,7 +103,7 @@ atomic_dec_32_nv(volatile uint32_t *target) nv = --(*target); spin_unlock(&atomic32_lock); - return nv; + return (nv); } static __inline__ uint32_t @@ -116,7 +116,7 @@ atomic_add_32_nv(volatile uint32_t *target, uint32_t delta) nv = *target; spin_unlock(&atomic32_lock); - return nv; + return (nv); } static __inline__ uint32_t @@ -129,12 +129,11 @@ atomic_sub_32_nv(volatile uint32_t *target, uint32_t delta) nv = *target; spin_unlock(&atomic32_lock); - return nv; + return (nv); } static __inline__ uint32_t -atomic_cas_32(volatile uint32_t *target, uint32_t cmp, - uint32_t newval) +atomic_cas_32(volatile uint32_t *target, uint32_t cmp, uint32_t newval) { uint32_t rc; @@ -145,7 +144,7 @@ atomic_cas_32(volatile uint32_t *target, uint32_t cmp, spin_unlock(&atomic32_lock); - return rc; + return (rc); } static __inline__ uint32_t @@ -158,7 +157,7 @@ atomic_swap_32(volatile uint32_t *target, uint32_t newval) *target = newval; spin_unlock(&atomic32_lock); - return rc; + return (rc); } static __inline__ void @@ -202,7 +201,7 @@ atomic_inc_64_nv(volatile uint64_t *target) nv = ++(*target); spin_unlock(&atomic64_lock); - return nv; + return (nv); } static __inline__ uint64_t @@ -214,7 +213,7 @@ atomic_dec_64_nv(volatile uint64_t *target) nv = --(*target); spin_unlock(&atomic64_lock); - return nv; + return (nv); } static __inline__ uint64_t @@ -227,7 +226,7 @@ atomic_add_64_nv(volatile uint64_t *target, uint64_t delta) nv = *target; spin_unlock(&atomic64_lock); - return nv; + return (nv); } static __inline__ uint64_t @@ -240,12 +239,11 @@ atomic_sub_64_nv(volatile uint64_t *target, uint64_t delta) nv = *target; spin_unlock(&atomic64_lock); - return nv; + return (nv); } static __inline__ uint64_t -atomic_cas_64(volatile uint64_t *target, uint64_t cmp, - uint64_t newval) +atomic_cas_64(volatile uint64_t *target, uint64_t cmp, uint64_t newval) { uint64_t rc; @@ -255,7 +253,7 @@ atomic_cas_64(volatile uint64_t *target, uint64_t cmp, *target = newval; spin_unlock(&atomic64_lock); - return rc; + return (rc); } static __inline__ uint64_t @@ -268,31 +266,31 @@ atomic_swap_64(volatile uint64_t *target, uint64_t newval) *target = newval; spin_unlock(&atomic64_lock); - return rc; + return (rc); } #else /* ATOMIC_SPINLOCK */ -#define atomic_inc_32(v) atomic_inc((atomic_t *)(v)) -#define atomic_dec_32(v) atomic_dec((atomic_t *)(v)) -#define atomic_add_32(v, i) atomic_add((i), (atomic_t *)(v)) -#define atomic_sub_32(v, i) atomic_sub((i), (atomic_t *)(v)) -#define atomic_inc_32_nv(v) atomic_inc_return((atomic_t *)(v)) -#define atomic_dec_32_nv(v) atomic_dec_return((atomic_t *)(v)) -#define atomic_add_32_nv(v, i) atomic_add_return((i), (atomic_t *)(v)) -#define atomic_sub_32_nv(v, i) atomic_sub_return((i), (atomic_t *)(v)) -#define atomic_cas_32(v, x, y) atomic_cmpxchg((atomic_t *)(v), x, y) -#define atomic_swap_32(v, x) atomic_xchg((atomic_t *)(v), x) -#define atomic_inc_64(v) atomic64_inc((atomic64_t *)(v)) -#define atomic_dec_64(v) atomic64_dec((atomic64_t *)(v)) -#define atomic_add_64(v, i) atomic64_add((i), (atomic64_t *)(v)) -#define atomic_sub_64(v, i) atomic64_sub((i), (atomic64_t *)(v)) -#define atomic_inc_64_nv(v) atomic64_inc_return((atomic64_t *)(v)) -#define atomic_dec_64_nv(v) atomic64_dec_return((atomic64_t *)(v)) -#define atomic_add_64_nv(v, i) atomic64_add_return((i), (atomic64_t *)(v)) -#define atomic_sub_64_nv(v, i) atomic64_sub_return((i), (atomic64_t *)(v)) -#define atomic_cas_64(v, x, y) atomic64_cmpxchg((atomic64_t *)(v), x, y) -#define atomic_swap_64(v, x) atomic64_xchg((atomic64_t *)(v), x) +#define atomic_inc_32(v) atomic_inc((atomic_t *)(v)) +#define atomic_dec_32(v) atomic_dec((atomic_t *)(v)) +#define atomic_add_32(v, i) atomic_add((i), (atomic_t *)(v)) +#define atomic_sub_32(v, i) atomic_sub((i), (atomic_t *)(v)) +#define atomic_inc_32_nv(v) atomic_inc_return((atomic_t *)(v)) +#define atomic_dec_32_nv(v) atomic_dec_return((atomic_t *)(v)) +#define atomic_add_32_nv(v, i) atomic_add_return((i), (atomic_t *)(v)) +#define atomic_sub_32_nv(v, i) atomic_sub_return((i), (atomic_t *)(v)) +#define atomic_cas_32(v, x, y) atomic_cmpxchg((atomic_t *)(v), x, y) +#define atomic_swap_32(v, x) atomic_xchg((atomic_t *)(v), x) +#define atomic_inc_64(v) atomic64_inc((atomic64_t *)(v)) +#define atomic_dec_64(v) atomic64_dec((atomic64_t *)(v)) +#define atomic_add_64(v, i) atomic64_add((i), (atomic64_t *)(v)) +#define atomic_sub_64(v, i) atomic64_sub((i), (atomic64_t *)(v)) +#define atomic_inc_64_nv(v) atomic64_inc_return((atomic64_t *)(v)) +#define atomic_dec_64_nv(v) atomic64_dec_return((atomic64_t *)(v)) +#define atomic_add_64_nv(v, i) atomic64_add_return((i), (atomic64_t *)(v)) +#define atomic_sub_64_nv(v, i) atomic64_sub_return((i), (atomic64_t *)(v)) +#define atomic_cas_64(v, x, y) atomic64_cmpxchg((atomic64_t *)(v), x, y) +#define atomic_swap_64(v, x) atomic64_xchg((atomic64_t *)(v), x) #endif /* ATOMIC_SPINLOCK */ @@ -300,15 +298,15 @@ atomic_swap_64(volatile uint64_t *target, uint64_t newval) static __inline__ void * atomic_cas_ptr(volatile void *target, void *cmp, void *newval) { - return (void *)atomic_cas_64((volatile uint64_t *)target, - (uint64_t)cmp, (uint64_t)newval); + return ((void *)atomic_cas_64((volatile uint64_t *)target, + (uint64_t)cmp, (uint64_t)newval)); } #else /* _LP64 */ static __inline__ void * atomic_cas_ptr(volatile void *target, void *cmp, void *newval) { - return (void *)atomic_cas_32((volatile uint32_t *)target, - (uint32_t)cmp, (uint32_t)newval); + return ((void *)atomic_cas_32((volatile uint32_t *)target, + (uint32_t)cmp, (uint32_t)newval)); } #endif /* _LP64 */ diff --git a/include/sys/attr.h b/include/sys/attr.h index 549807f25..7941acbec 100644 --- a/include/sys/attr.h +++ b/include/sys/attr.h @@ -23,6 +23,6 @@ */ #ifndef _SPL_ATTR_H -#define _SPL_ATTR_H +#define _SPL_ATTR_H #endif /* SPL_ATTR_H */ diff --git a/include/sys/bitmap.h b/include/sys/bitmap.h index 5bbf15f4b..3e7d910c0 100644 --- a/include/sys/bitmap.h +++ b/include/sys/bitmap.h @@ -23,6 +23,6 @@ */ #ifndef _SPL_BITMAP_H -#define _SPL_BITMAP_H +#define _SPL_BITMAP_H #endif /* SPL_BITMAP_H */ diff --git a/include/sys/bootconf.h b/include/sys/bootconf.h index 883b9ec76..62730ba5d 100644 --- a/include/sys/bootconf.h +++ b/include/sys/bootconf.h @@ -23,6 +23,6 @@ */ #ifndef _SPL_BOOTCONF_H -#define _SPL_BOOTCONF_H +#define _SPL_BOOTCONF_H #endif /* SPL_BOOTCONF_H */ diff --git a/include/sys/bootprops.h b/include/sys/bootprops.h index bd1c3182b..50150eda9 100644 --- a/include/sys/bootprops.h +++ b/include/sys/bootprops.h @@ -23,6 +23,6 @@ */ #ifndef _SPL_BOOTPROPS_H -#define _SPL_BOOTPROPS_H +#define _SPL_BOOTPROPS_H #endif /* SPL_BOOTPROPS_H */ diff --git a/include/sys/buf.h b/include/sys/buf.h index 60b1c621d..fa453e478 100644 --- a/include/sys/buf.h +++ b/include/sys/buf.h @@ -23,6 +23,6 @@ */ #ifndef _SPL_BUF_H -#define _SPL_BUF_H +#define _SPL_BUF_H #endif /* SPL_BUF_H */ diff --git a/include/sys/byteorder.h b/include/sys/byteorder.h index ffd7ec4c4..a0ff424f8 100644 --- a/include/sys/byteorder.h +++ b/include/sys/byteorder.h @@ -23,45 +23,49 @@ */ #ifndef _SPL_BYTEORDER_H -#define _SPL_BYTEORDER_H +#define _SPL_BYTEORDER_H #include #include -#define LE_16(x) cpu_to_le16(x) -#define LE_32(x) cpu_to_le32(x) -#define LE_64(x) cpu_to_le64(x) -#define BE_16(x) cpu_to_be16(x) -#define BE_32(x) cpu_to_be32(x) -#define BE_64(x) cpu_to_be64(x) +#define LE_16(x) cpu_to_le16(x) +#define LE_32(x) cpu_to_le32(x) +#define LE_64(x) cpu_to_le64(x) +#define BE_16(x) cpu_to_be16(x) +#define BE_32(x) cpu_to_be32(x) +#define BE_64(x) cpu_to_be64(x) -#define BE_IN8(xa) \ +#define BE_IN8(xa) \ *((uint8_t *)(xa)) -#define BE_IN16(xa) \ +#define BE_IN16(xa) \ (((uint16_t)BE_IN8(xa) << 8) | BE_IN8((uint8_t *)(xa)+1)) -#define BE_IN32(xa) \ +#define BE_IN32(xa) \ (((uint32_t)BE_IN16(xa) << 16) | BE_IN16((uint8_t *)(xa)+2)) #ifdef _BIG_ENDIAN static __inline__ uint64_t -htonll(uint64_t n) { +htonll(uint64_t n) +{ return (n); } static __inline__ uint64_t -ntohll(uint64_t n) { +ntohll(uint64_t n) +{ return (n); } #else static __inline__ uint64_t -htonll(uint64_t n) { +htonll(uint64_t n) +{ return ((((uint64_t)htonl(n)) << 32) + htonl(n >> 32)); } static __inline__ uint64_t -ntohll(uint64_t n) { +ntohll(uint64_t n) +{ return ((((uint64_t)ntohl(n)) << 32) + ntohl(n >> 32)); } #endif diff --git a/include/sys/callb.h b/include/sys/callb.h index 0b33bc0f3..f1826bfd3 100644 --- a/include/sys/callb.h +++ b/include/sys/callb.h @@ -23,33 +23,32 @@ */ #ifndef _SPL_CALLB_H -#define _SPL_CALLB_H +#define _SPL_CALLB_H #include #include -#define CALLB_CPR_ASSERT(cp) ASSERT(MUTEX_HELD((cp)->cc_lockp)); +#define CALLB_CPR_ASSERT(cp) ASSERT(MUTEX_HELD((cp)->cc_lockp)); typedef struct callb_cpr { - kmutex_t *cc_lockp; + kmutex_t *cc_lockp; } callb_cpr_t; -#define CALLB_CPR_INIT(cp, lockp, func, name) { \ - (cp)->cc_lockp = lockp; \ +#define CALLB_CPR_INIT(cp, lockp, func, name) { \ + (cp)->cc_lockp = lockp; \ } -#define CALLB_CPR_SAFE_BEGIN(cp) { \ +#define CALLB_CPR_SAFE_BEGIN(cp) { \ CALLB_CPR_ASSERT(cp); \ } -#define CALLB_CPR_SAFE_END(cp, lockp) { \ +#define CALLB_CPR_SAFE_END(cp, lockp) { \ CALLB_CPR_ASSERT(cp); \ } -#define CALLB_CPR_EXIT(cp) { \ - ASSERT(MUTEX_HELD((cp)->cc_lockp)); \ - mutex_exit((cp)->cc_lockp); \ +#define CALLB_CPR_EXIT(cp) { \ + ASSERT(MUTEX_HELD((cp)->cc_lockp)); \ + mutex_exit((cp)->cc_lockp); \ } #endif /* _SPL_CALLB_H */ - diff --git a/include/sys/callo.h b/include/sys/callo.h index 1e1516392..c43ac92e7 100644 --- a/include/sys/callo.h +++ b/include/sys/callo.h @@ -22,7 +22,7 @@ */ #ifndef _SPL_CALLO_H -#define _SPL_CALLO_H +#define _SPL_CALLO_H /* * Callout flags: @@ -44,9 +44,9 @@ * Legacy interfaces timeout() and realtime_timeout() pass this flag * to timeout_generic() to indicate that a 32-bit ID should be allocated. */ -#define CALLOUT_FLAG_ROUNDUP 0x1 -#define CALLOUT_FLAG_ABSOLUTE 0x2 -#define CALLOUT_FLAG_HRESTIME 0x4 -#define CALLOUT_FLAG_32BIT 0x8 +#define CALLOUT_FLAG_ROUNDUP 0x1 +#define CALLOUT_FLAG_ABSOLUTE 0x2 +#define CALLOUT_FLAG_HRESTIME 0x4 +#define CALLOUT_FLAG_32BIT 0x8 #endif /* _SPL_CALLB_H */ diff --git a/include/sys/cmn_err.h b/include/sys/cmn_err.h index 0e8e41841..594a76333 100644 --- a/include/sys/cmn_err.h +++ b/include/sys/cmn_err.h @@ -23,20 +23,20 @@ */ #ifndef _SPL_CMN_ERR_H -#define _SPL_CMN_ERR_H +#define _SPL_CMN_ERR_H #include -#define CE_CONT 0 /* continuation */ -#define CE_NOTE 1 /* notice */ -#define CE_WARN 2 /* warning */ -#define CE_PANIC 3 /* panic */ -#define CE_IGNORE 4 /* print nothing */ +#define CE_CONT 0 /* continuation */ +#define CE_NOTE 1 /* notice */ +#define CE_WARN 2 /* warning */ +#define CE_PANIC 3 /* panic */ +#define CE_IGNORE 4 /* print nothing */ extern void cmn_err(int, const char *, ...); extern void vcmn_err(int, const char *, __va_list); extern void vpanic(const char *, __va_list); -#define fm_panic panic +#define fm_panic panic #endif /* SPL_CMN_ERR_H */ diff --git a/include/sys/compress.h b/include/sys/compress.h index 719d87c4e..e46ab0df2 100644 --- a/include/sys/compress.h +++ b/include/sys/compress.h @@ -23,6 +23,6 @@ */ #ifndef _SPL_COMPRESS_H -#define _SPL_COMPRESS_H +#define _SPL_COMPRESS_H #endif /* SPL_COMPRESS_H */ diff --git a/include/sys/conf.h b/include/sys/conf.h index eeaecb6f0..68f4095dd 100644 --- a/include/sys/conf.h +++ b/include/sys/conf.h @@ -23,6 +23,6 @@ */ #ifndef _SPL_CONF_H -#define _SPL_CONF_H +#define _SPL_CONF_H #endif /* SPL_CONF_H */ diff --git a/include/sys/console.h b/include/sys/console.h index 2c327fb8f..3469cb762 100644 --- a/include/sys/console.h +++ b/include/sys/console.h @@ -28,17 +28,17 @@ void console_vprintf(const char *fmt, va_list args) { - vprintk(fmt, args); + vprintk(fmt, args); } void console_printf(const char *fmt, ...) { - va_list args; + va_list args; - va_start(args, fmt); - console_vprintf(fmt, args); - va_end(args); + va_start(args, fmt); + console_vprintf(fmt, args); + va_end(args); } #endif /* _SPL_CONSOLE_H */ diff --git a/include/sys/cpupart.h b/include/sys/cpupart.h index 1c3eb00f1..ba57c19e8 100644 --- a/include/sys/cpupart.h +++ b/include/sys/cpupart.h @@ -23,6 +23,6 @@ */ #ifndef _SPL_CPUPART_H -#define _SPL_CPUPART_H +#define _SPL_CPUPART_H #endif /* SPL_CPUPART_H */ diff --git a/include/sys/cpuvar.h b/include/sys/cpuvar.h index d2e48063e..075c06047 100644 --- a/include/sys/cpuvar.h +++ b/include/sys/cpuvar.h @@ -23,6 +23,6 @@ */ #ifndef _SPL_CPUVAR_H -#define _SPL_CPUVAR_H +#define _SPL_CPUVAR_H #endif /* SPL_CPUVAR_H */ diff --git a/include/sys/crc32.h b/include/sys/crc32.h index d974418c8..eb021b1ff 100644 --- a/include/sys/crc32.h +++ b/include/sys/crc32.h @@ -23,6 +23,6 @@ */ #ifndef _SPL_CRC32_H -#define _SPL_CRC32_H +#define _SPL_CRC32_H #endif /* SPL_CRC32_H */ diff --git a/include/sys/cred.h b/include/sys/cred.h index f966ac453..e4b18b665 100644 --- a/include/sys/cred.h +++ b/include/sys/cred.h @@ -23,7 +23,7 @@ */ #ifndef _SPL_CRED_H -#define _SPL_CRED_H +#define _SPL_CRED_H #include #include @@ -68,7 +68,7 @@ extern gid_t crgetrgid(const cred_t *cr); extern gid_t crgetsgid(const cred_t *cr); extern gid_t crgetfsgid(const cred_t *cr); extern int crgetngroups(const cred_t *cr); -extern gid_t * crgetgroups(const cred_t *cr); +extern gid_t *crgetgroups(const cred_t *cr); extern int groupmember(gid_t gid, const cred_t *cr); #endif /* _SPL_CRED_H */ diff --git a/include/sys/ctype.h b/include/sys/ctype.h index 0a7ee4a8f..18beb1daa 100644 --- a/include/sys/ctype.h +++ b/include/sys/ctype.h @@ -23,7 +23,7 @@ */ #ifndef _SPL_CTYPE_H -#define _SPL_CTYPE_H +#define _SPL_CTYPE_H #include diff --git a/include/sys/ddi.h b/include/sys/ddi.h index 458c13ec8..af2806ee7 100644 --- a/include/sys/ddi.h +++ b/include/sys/ddi.h @@ -23,6 +23,6 @@ */ #ifndef _SPL_DDI_H -#define _SPL_DDI_H +#define _SPL_DDI_H #endif /* SPL_DDI_H */ diff --git a/include/sys/debug.h b/include/sys/debug.h index 5fecaa869..cd78171df 100644 --- a/include/sys/debug.h +++ b/include/sys/debug.h @@ -54,16 +54,17 @@ int spl_panic(const char *file, const char *func, int line, const char *fmt, ...); void spl_dumpstack(void); +/* BEGIN CSTYLED */ #define PANIC(fmt, a...) \ spl_panic(__FILE__, __FUNCTION__, __LINE__, fmt, ## a) #define VERIFY(cond) \ - (void)(unlikely(!(cond)) && \ + (void) (unlikely(!(cond)) && \ spl_panic(__FILE__, __FUNCTION__, __LINE__, \ "%s", "VERIFY(" #cond ") failed\n")) #define VERIFY3_IMPL(LEFT, OP, RIGHT, TYPE, FMT, CAST) \ - (void)((!((TYPE)(LEFT) OP (TYPE)(RIGHT))) && \ + (void) ((!((TYPE)(LEFT) OP (TYPE)(RIGHT))) && \ spl_panic(__FILE__, __FUNCTION__, __LINE__, \ "VERIFY3(" #LEFT " " #OP " " #RIGHT ") " \ "failed (" FMT " " #OP " " FMT ")\n", \ @@ -120,6 +121,7 @@ void spl_dumpstack(void); ((void)((!!(A) == !!(B)) || \ spl_panic(__FILE__, __FUNCTION__, __LINE__, \ "(" #A ") is equivalent to (" #B ")"))) +/* END CSTYLED */ #endif /* NDEBUG */ diff --git a/include/sys/dirent.h b/include/sys/dirent.h index 3069628da..8237d0dd9 100644 --- a/include/sys/dirent.h +++ b/include/sys/dirent.h @@ -23,6 +23,6 @@ */ #ifndef _SPL_DIRENT_H -#define _SPL_DIRENT_H +#define _SPL_DIRENT_H #endif /* SPL_DIRENT_H */ diff --git a/include/sys/disp.h b/include/sys/disp.h index 1994d53ed..413b623c8 100644 --- a/include/sys/disp.h +++ b/include/sys/disp.h @@ -23,7 +23,7 @@ */ #ifndef _SPL_DISP_H -#define _SPL_DISP_H +#define _SPL_DISP_H #include diff --git a/include/sys/dkioc_free_util.h b/include/sys/dkioc_free_util.h index 579bf503f..d519b2f8e 100644 --- a/include/sys/dkioc_free_util.h +++ b/include/sys/dkioc_free_util.h @@ -52,7 +52,7 @@ static inline void dfl_free(dkioc_free_list_t *dfl) { } static inline dkioc_free_list_t *dfl_alloc(uint64_t dfl_num_exts, int flags) { - return vmem_zalloc(DFL_SZ(dfl_num_exts), flags); + return (vmem_zalloc(DFL_SZ(dfl_num_exts), flags)); } #endif /* _SPL_DKIOC_UTIL_H */ diff --git a/include/sys/dnlc.h b/include/sys/dnlc.h index 20850c82e..cda112c18 100644 --- a/include/sys/dnlc.h +++ b/include/sys/dnlc.h @@ -23,6 +23,6 @@ */ #ifndef _SPL_DNLC_H -#define _SPL_DNLC_H +#define _SPL_DNLC_H #endif /* SPL_DNLC_H */ diff --git a/include/sys/dumphdr.h b/include/sys/dumphdr.h index dfb0585d1..a452fe35d 100644 --- a/include/sys/dumphdr.h +++ b/include/sys/dumphdr.h @@ -23,6 +23,6 @@ */ #ifndef _SPL_DUMPHDR_H -#define _SPL_DUMPHDR_H +#define _SPL_DUMPHDR_H #endif /* SPL_DUMPHDR_H */ diff --git a/include/sys/efi_partition.h b/include/sys/efi_partition.h index 6c4bb201e..d0c9c2005 100644 --- a/include/sys/efi_partition.h +++ b/include/sys/efi_partition.h @@ -23,6 +23,6 @@ */ #ifndef _SPL_EFI_PARTITION_H -#define _SPL_EFI_PARTITION_H +#define _SPL_EFI_PARTITION_H #endif /* SPL_EFI_PARTITION_H */ diff --git a/include/sys/errno.h b/include/sys/errno.h index 92b2cde6c..2dd378bc8 100644 --- a/include/sys/errno.h +++ b/include/sys/errno.h @@ -23,6 +23,6 @@ */ #ifndef _SPL_ERRNO_H -#define _SPL_ERRNO_H +#define _SPL_ERRNO_H #endif /* SPL_ERRNO_H */ diff --git a/include/sys/fcntl.h b/include/sys/fcntl.h index bf5bf0323..3faa5dad7 100644 --- a/include/sys/fcntl.h +++ b/include/sys/fcntl.h @@ -22,11 +22,11 @@ */ #ifndef _SPL_FCNTL_H -#define _SPL_FCNTL_H +#define _SPL_FCNTL_H #include -#define F_FREESP 11 +#define F_FREESP 11 #ifdef CONFIG_64BIT typedef struct flock flock64_t; diff --git a/include/sys/file.h b/include/sys/file.h index 4990e0505..b6c40aff2 100644 --- a/include/sys/file.h +++ b/include/sys/file.h @@ -23,7 +23,7 @@ */ #ifndef _SPL_FILE_H -#define _SPL_FILE_H +#define _SPL_FILE_H #define FIGNORECASE 0x00080000 #define FKIOCTL 0x80000000 diff --git a/include/sys/fs/swapnode.h b/include/sys/fs/swapnode.h index dd18f3343..1fa5fdc83 100644 --- a/include/sys/fs/swapnode.h +++ b/include/sys/fs/swapnode.h @@ -23,6 +23,6 @@ */ #ifndef _SPL_SWAPNODE_H -#define _SPL_SWAPNODE_H +#define _SPL_SWAPNODE_H #endif /* SPL_SWAPNODE_H */ diff --git a/include/sys/idmap.h b/include/sys/idmap.h index aad96439f..abbfcbed1 100644 --- a/include/sys/idmap.h +++ b/include/sys/idmap.h @@ -22,8 +22,8 @@ */ #ifndef _SPL_IDMAP_H -#define _SPL_IDMAP_H +#define _SPL_IDMAP_H -#define IDMAP_WK_CREATOR_OWNER_UID 2147483648U +#define IDMAP_WK_CREATOR_OWNER_UID 2147483648U #endif /* SPL_IDMAP_H */ diff --git a/include/sys/int_limits.h b/include/sys/int_limits.h index d9e775973..5d7e9be89 100644 --- a/include/sys/int_limits.h +++ b/include/sys/int_limits.h @@ -23,6 +23,6 @@ */ #ifndef _SPL_INT_LIMITS_H -#define _SPL_INT_LIMITS_H +#define _SPL_INT_LIMITS_H #endif /* SPL_INT_LIMITS_H */ diff --git a/include/sys/int_types.h b/include/sys/int_types.h index 2345205ea..7e3b7329f 100644 --- a/include/sys/int_types.h +++ b/include/sys/int_types.h @@ -23,7 +23,7 @@ */ #ifndef _SPL_INT_TYPES_H -#define _SPL_INT_TYPES_H +#define _SPL_INT_TYPES_H #include diff --git a/include/sys/inttypes.h b/include/sys/inttypes.h index 98e25110e..92e76206b 100644 --- a/include/sys/inttypes.h +++ b/include/sys/inttypes.h @@ -23,6 +23,6 @@ */ #ifndef _SPL_INTTYPES_H -#define _SPL_INTTYPES_H +#define _SPL_INTTYPES_H #endif /* SPL_INTTYPES_H */ diff --git a/include/sys/isa_defs.h b/include/sys/isa_defs.h index 6aa78e84c..089ae0f85 100644 --- a/include/sys/isa_defs.h +++ b/include/sys/isa_defs.h @@ -29,59 +29,59 @@ #if defined(__x86_64) || defined(__x86_64__) #if !defined(__x86_64) -#define __x86_64 +#define __x86_64 #endif #if !defined(__amd64) -#define __amd64 +#define __amd64 #endif #if !defined(__x86) -#define __x86 +#define __x86 #endif #if !defined(_LP64) -#define _LP64 +#define _LP64 #endif -#define _ALIGNMENT_REQUIRED 1 +#define _ALIGNMENT_REQUIRED 1 /* i386 arch specific defines */ #elif defined(__i386) || defined(__i386__) #if !defined(__i386) -#define __i386 +#define __i386 #endif #if !defined(__x86) -#define __x86 +#define __x86 #endif #if !defined(_ILP32) -#define _ILP32 +#define _ILP32 #endif -#define _ALIGNMENT_REQUIRED 0 +#define _ALIGNMENT_REQUIRED 0 /* powerpc (ppc64) arch specific defines */ #elif defined(__powerpc) || defined(__powerpc__) || defined(__powerpc64__) #if !defined(__powerpc) -#define __powerpc +#define __powerpc #endif #if !defined(__powerpc__) -#define __powerpc__ +#define __powerpc__ #endif #if defined(__powerpc64__) #if !defined(_LP64) -#define _LP64 +#define _LP64 #endif #else #if !defined(_ILP32) -#define _ILP32 +#define _ILP32 #endif #endif @@ -89,65 +89,65 @@ * Illumos doesn't define _ALIGNMENT_REQUIRED for PPC, so default to 1 * out of paranoia. */ -#define _ALIGNMENT_REQUIRED 1 +#define _ALIGNMENT_REQUIRED 1 /* arm arch specific defines */ #elif defined(__arm) || defined(__arm__) || defined(__aarch64__) #if !defined(__arm) -#define __arm +#define __arm #endif #if !defined(__arm__) -#define __arm__ +#define __arm__ #endif #if defined(__aarch64__) #if !defined(_LP64) -#define _LP64 +#define _LP64 #endif #else #if !defined(_ILP32) -#define _ILP32 +#define _ILP32 #endif #endif #if defined(__ARMEL__) || defined(__AARCH64EL__) -#define _LITTLE_ENDIAN +#define _LITTLE_ENDIAN #else -#define _BIG_ENDIAN +#define _BIG_ENDIAN #endif /* * Illumos doesn't define _ALIGNMENT_REQUIRED for ARM, so default to 1 * out of paranoia. */ -#define _ALIGNMENT_REQUIRED 1 +#define _ALIGNMENT_REQUIRED 1 /* sparc arch specific defines */ #elif defined(__sparc) || defined(__sparc__) #if !defined(__sparc) -#define __sparc +#define __sparc #endif #if !defined(__sparc__) -#define __sparc__ +#define __sparc__ #endif #if defined(__arch64__) #if !defined(_LP64) -#define _LP64 +#define _LP64 #endif #else #if !defined(_ILP32) -#define _ILP32 +#define _ILP32 #endif #endif -#define _BIG_ENDIAN -#define _SUNOS_VTOC_16 -#define _ALIGNMENT_REQUIRED 1 +#define _BIG_ENDIAN +#define _SUNOS_VTOC_16 +#define _ALIGNMENT_REQUIRED 1 /* s390 arch specific defines */ #elif defined(__s390__) @@ -167,7 +167,7 @@ * Illumos doesn't define _ALIGNMENT_REQUIRED for s390, so default to 1 * out of paranoia. */ -#define _ALIGNMENT_REQUIRED 1 +#define _ALIGNMENT_REQUIRED 1 /* MIPS arch specific defines */ #elif defined(__mips__) @@ -190,7 +190,7 @@ * Illumos doesn't define _ALIGNMENT_REQUIRED for MIPS, so default to 1 * out of paranoia. */ -#define _ALIGNMENT_REQUIRED 1 +#define _ALIGNMENT_REQUIRED 1 #else /* @@ -211,11 +211,11 @@ #include #if defined(__LITTLE_ENDIAN) && !defined(_LITTLE_ENDIAN) -#define _LITTLE_ENDIAN __LITTLE_ENDIAN +#define _LITTLE_ENDIAN __LITTLE_ENDIAN #endif #if defined(__BIG_ENDIAN) && !defined(_BIG_ENDIAN) -#define _BIG_ENDIAN __BIG_ENDIAN +#define _BIG_ENDIAN __BIG_ENDIAN #endif #if defined(_LITTLE_ENDIAN) && defined(_BIG_ENDIAN) diff --git a/include/sys/kidmap.h b/include/sys/kidmap.h index 21e5e8f99..a5e6375c3 100644 --- a/include/sys/kidmap.h +++ b/include/sys/kidmap.h @@ -23,7 +23,7 @@ */ #ifndef _SPL_KIDMAP_H -#define _SPL_KIDMAP_H +#define _SPL_KIDMAP_H #include diff --git a/include/sys/kobj.h b/include/sys/kobj.h index d133091e1..558ec39a8 100644 --- a/include/sys/kobj.h +++ b/include/sys/kobj.h @@ -23,7 +23,7 @@ */ #ifndef _SPL_KOBJ_H -#define _SPL_KOBJ_H +#define _SPL_KOBJ_H #include diff --git a/include/sys/kstat.h b/include/sys/kstat.h index 85909fc1f..e9aff7386 100644 --- a/include/sys/kstat.h +++ b/include/sys/kstat.h @@ -23,7 +23,7 @@ */ #ifndef _SPL_KSTAT_H -#define _SPL_KSTAT_H +#define _SPL_KSTAT_H #include #include @@ -32,63 +32,65 @@ #include #include -#define KSTAT_STRLEN 255 -#define KSTAT_RAW_MAX (128*1024) +#define KSTAT_STRLEN 255 +#define KSTAT_RAW_MAX (128*1024) -/* For reference valid classes are: +/* + * For reference valid classes are: * disk, tape, net, controller, vm, kvm, hat, streams, kstat, misc */ -#define KSTAT_TYPE_RAW 0 /* can be anything; ks_ndata >= 1 */ -#define KSTAT_TYPE_NAMED 1 /* name/value pair; ks_ndata >= 1 */ -#define KSTAT_TYPE_INTR 2 /* interrupt stats; ks_ndata == 1 */ -#define KSTAT_TYPE_IO 3 /* I/O stats; ks_ndata == 1 */ -#define KSTAT_TYPE_TIMER 4 /* event timer; ks_ndata >= 1 */ -#define KSTAT_NUM_TYPES 5 - -#define KSTAT_DATA_CHAR 0 -#define KSTAT_DATA_INT32 1 -#define KSTAT_DATA_UINT32 2 -#define KSTAT_DATA_INT64 3 -#define KSTAT_DATA_UINT64 4 -#define KSTAT_DATA_LONG 5 -#define KSTAT_DATA_ULONG 6 -#define KSTAT_DATA_STRING 7 -#define KSTAT_NUM_DATAS 8 - -#define KSTAT_INTR_HARD 0 -#define KSTAT_INTR_SOFT 1 -#define KSTAT_INTR_WATCHDOG 2 -#define KSTAT_INTR_SPURIOUS 3 -#define KSTAT_INTR_MULTSVC 4 -#define KSTAT_NUM_INTRS 5 - -#define KSTAT_FLAG_VIRTUAL 0x01 -#define KSTAT_FLAG_VAR_SIZE 0x02 -#define KSTAT_FLAG_WRITABLE 0x04 -#define KSTAT_FLAG_PERSISTENT 0x08 -#define KSTAT_FLAG_DORMANT 0x10 -#define KSTAT_FLAG_UNSUPPORTED (KSTAT_FLAG_VAR_SIZE | KSTAT_FLAG_WRITABLE | \ - KSTAT_FLAG_PERSISTENT | KSTAT_FLAG_DORMANT) - - -#define KS_MAGIC 0x9d9d9d9d +#define KSTAT_TYPE_RAW 0 /* can be anything; ks_ndata >= 1 */ +#define KSTAT_TYPE_NAMED 1 /* name/value pair; ks_ndata >= 1 */ +#define KSTAT_TYPE_INTR 2 /* interrupt stats; ks_ndata == 1 */ +#define KSTAT_TYPE_IO 3 /* I/O stats; ks_ndata == 1 */ +#define KSTAT_TYPE_TIMER 4 /* event timer; ks_ndata >= 1 */ +#define KSTAT_NUM_TYPES 5 + +#define KSTAT_DATA_CHAR 0 +#define KSTAT_DATA_INT32 1 +#define KSTAT_DATA_UINT32 2 +#define KSTAT_DATA_INT64 3 +#define KSTAT_DATA_UINT64 4 +#define KSTAT_DATA_LONG 5 +#define KSTAT_DATA_ULONG 6 +#define KSTAT_DATA_STRING 7 +#define KSTAT_NUM_DATAS 8 + +#define KSTAT_INTR_HARD 0 +#define KSTAT_INTR_SOFT 1 +#define KSTAT_INTR_WATCHDOG 2 +#define KSTAT_INTR_SPURIOUS 3 +#define KSTAT_INTR_MULTSVC 4 +#define KSTAT_NUM_INTRS 5 + +#define KSTAT_FLAG_VIRTUAL 0x01 +#define KSTAT_FLAG_VAR_SIZE 0x02 +#define KSTAT_FLAG_WRITABLE 0x04 +#define KSTAT_FLAG_PERSISTENT 0x08 +#define KSTAT_FLAG_DORMANT 0x10 +#define KSTAT_FLAG_UNSUPPORTED \ + (KSTAT_FLAG_VAR_SIZE | KSTAT_FLAG_WRITABLE | \ + KSTAT_FLAG_PERSISTENT | KSTAT_FLAG_DORMANT) + + +#define KS_MAGIC 0x9d9d9d9d /* Dynamic updates */ -#define KSTAT_READ 0 -#define KSTAT_WRITE 1 +#define KSTAT_READ 0 +#define KSTAT_WRITE 1 struct kstat_s; typedef struct kstat_s kstat_t; -typedef int kid_t; /* unique kstat id */ -typedef int kstat_update_t(struct kstat_s *, int); /* dynamic update cb */ +typedef int kid_t; /* unique kstat id */ +typedef int kstat_update_t(struct kstat_s *, int); /* dynamic update cb */ typedef struct kstat_module { - char ksm_name[KSTAT_STRLEN+1]; /* module name */ - struct list_head ksm_module_list; /* module linkage */ - struct list_head ksm_kstat_list; /* list of kstat entries */ - struct proc_dir_entry *ksm_proc; /* proc entry */ + char ksm_name[KSTAT_STRLEN+1]; /* module name */ + struct list_head ksm_module_list; /* module linkage */ + struct list_head ksm_kstat_list; /* list of kstat entries */ + struct proc_dir_entry *ksm_proc; /* proc entry */ } kstat_module_t; typedef struct kstat_raw_ops { @@ -98,95 +100,96 @@ typedef struct kstat_raw_ops { } kstat_raw_ops_t; struct kstat_s { - int ks_magic; /* magic value */ - kid_t ks_kid; /* unique kstat ID */ - hrtime_t ks_crtime; /* creation time */ - hrtime_t ks_snaptime; /* last access time */ - char ks_module[KSTAT_STRLEN+1]; /* provider module name */ - int ks_instance; /* provider module instance */ - char ks_name[KSTAT_STRLEN+1]; /* kstat name */ - char ks_class[KSTAT_STRLEN+1]; /* kstat class */ - uchar_t ks_type; /* kstat data type */ - uchar_t ks_flags; /* kstat flags */ - void *ks_data; /* kstat type-specific data */ - uint_t ks_ndata; /* # of type-specific data records */ - size_t ks_data_size; /* size of kstat data section */ - struct proc_dir_entry *ks_proc; /* proc linkage */ - kstat_update_t *ks_update; /* dynamic updates */ - void *ks_private; /* private data */ - kmutex_t ks_private_lock; /* kstat private data lock */ - kmutex_t *ks_lock; /* kstat data lock */ - struct list_head ks_list; /* kstat linkage */ - kstat_module_t *ks_owner; /* kstat module linkage */ - kstat_raw_ops_t ks_raw_ops; /* ops table for raw type */ - char *ks_raw_buf; /* buf used for raw ops */ - size_t ks_raw_bufsize; /* size of raw ops buffer */ + int ks_magic; /* magic value */ + kid_t ks_kid; /* unique kstat ID */ + hrtime_t ks_crtime; /* creation time */ + hrtime_t ks_snaptime; /* last access time */ + char ks_module[KSTAT_STRLEN+1]; /* provider module name */ + int ks_instance; /* provider module instance */ + char ks_name[KSTAT_STRLEN+1]; /* kstat name */ + char ks_class[KSTAT_STRLEN+1]; /* kstat class */ + uchar_t ks_type; /* kstat data type */ + uchar_t ks_flags; /* kstat flags */ + void *ks_data; /* kstat type-specific data */ + uint_t ks_ndata; /* # of data records */ + size_t ks_data_size; /* size of kstat data section */ + struct proc_dir_entry *ks_proc; /* proc linkage */ + kstat_update_t *ks_update; /* dynamic updates */ + void *ks_private; /* private data */ + kmutex_t ks_private_lock; /* kstat private data lock */ + kmutex_t *ks_lock; /* kstat data lock */ + struct list_head ks_list; /* kstat linkage */ + kstat_module_t *ks_owner; /* kstat module linkage */ + kstat_raw_ops_t ks_raw_ops; /* ops table for raw type */ + char *ks_raw_buf; /* buf used for raw ops */ + size_t ks_raw_bufsize; /* size of raw ops buffer */ }; typedef struct kstat_named_s { - char name[KSTAT_STRLEN]; /* name of counter */ - uchar_t data_type; /* data type */ - union { - char c[16]; /* 128-bit int */ - int32_t i32; /* 32-bit signed int */ - uint32_t ui32; /* 32-bit unsigned int */ - int64_t i64; /* 64-bit signed int */ - uint64_t ui64; /* 64-bit unsigned int */ - long l; /* native signed long */ - ulong_t ul; /* native unsigned long */ - struct { - union { - char *ptr; /* NULL-term string */ - char __pad[8]; /* 64-bit padding */ - } addr; - uint32_t len; /* # bytes for strlen + '\0' */ - } string; - } value; + char name[KSTAT_STRLEN]; /* name of counter */ + uchar_t data_type; /* data type */ + union { + char c[16]; /* 128-bit int */ + int32_t i32; /* 32-bit signed int */ + uint32_t ui32; /* 32-bit unsigned int */ + int64_t i64; /* 64-bit signed int */ + uint64_t ui64; /* 64-bit unsigned int */ + long l; /* native signed long */ + ulong_t ul; /* native unsigned long */ + struct { + union { + char *ptr; /* NULL-term string */ + char __pad[8]; /* 64-bit padding */ + } addr; + uint32_t len; /* # bytes for strlen + '\0' */ + } string; + } value; } kstat_named_t; -#define KSTAT_NAMED_STR_PTR(knptr) ((knptr)->value.string.addr.ptr) -#define KSTAT_NAMED_STR_BUFLEN(knptr) ((knptr)->value.string.len) +#define KSTAT_NAMED_STR_PTR(knptr) ((knptr)->value.string.addr.ptr) +#define KSTAT_NAMED_STR_BUFLEN(knptr) ((knptr)->value.string.len) typedef struct kstat_intr { - uint_t intrs[KSTAT_NUM_INTRS]; + uint_t intrs[KSTAT_NUM_INTRS]; } kstat_intr_t; typedef struct kstat_io { - u_longlong_t nread; /* number of bytes read */ - u_longlong_t nwritten; /* number of bytes written */ - uint_t reads; /* number of read operations */ - uint_t writes; /* number of write operations */ - hrtime_t wtime; /* cumulative wait (pre-service) time */ - hrtime_t wlentime; /* cumulative wait length*time product*/ - hrtime_t wlastupdate; /* last time wait queue changed */ - hrtime_t rtime; /* cumulative run (service) time */ - hrtime_t rlentime; /* cumulative run length*time product */ - hrtime_t rlastupdate; /* last time run queue changed */ - uint_t wcnt; /* count of elements in wait state */ - uint_t rcnt; /* count of elements in run state */ + u_longlong_t nread; /* number of bytes read */ + u_longlong_t nwritten; /* number of bytes written */ + uint_t reads; /* number of read operations */ + uint_t writes; /* number of write operations */ + hrtime_t wtime; /* cumulative wait (pre-service) time */ + hrtime_t wlentime; /* cumulative wait len*time product */ + hrtime_t wlastupdate; /* last time wait queue changed */ + hrtime_t rtime; /* cumulative run (service) time */ + hrtime_t rlentime; /* cumulative run length*time product */ + hrtime_t rlastupdate; /* last time run queue changed */ + uint_t wcnt; /* count of elements in wait state */ + uint_t rcnt; /* count of elements in run state */ } kstat_io_t; typedef struct kstat_timer { - char name[KSTAT_STRLEN+1]; /* event name */ - u_longlong_t num_events; /* number of events */ - hrtime_t elapsed_time; /* cumulative elapsed time */ - hrtime_t min_time; /* shortest event duration */ - hrtime_t max_time; /* longest event duration */ - hrtime_t start_time; /* previous event start time */ - hrtime_t stop_time; /* previous event stop time */ + char name[KSTAT_STRLEN+1]; /* event name */ + u_longlong_t num_events; /* number of events */ + hrtime_t elapsed_time; /* cumulative elapsed time */ + hrtime_t min_time; /* shortest event duration */ + hrtime_t max_time; /* longest event duration */ + hrtime_t start_time; /* previous event start time */ + hrtime_t stop_time; /* previous event stop time */ } kstat_timer_t; int spl_kstat_init(void); void spl_kstat_fini(void); extern void __kstat_set_raw_ops(kstat_t *ksp, - int (*headers)(char *buf, size_t size), - int (*data)(char *buf, size_t size, void *data), - void* (*addr)(kstat_t *ksp, loff_t index)); + int (*headers)(char *buf, size_t size), + int (*data)(char *buf, size_t size, void *data), + void* (*addr)(kstat_t *ksp, loff_t index)); + extern kstat_t *__kstat_create(const char *ks_module, int ks_instance, - const char *ks_name, const char *ks_class, - uchar_t ks_type, uint_t ks_ndata, - uchar_t ks_flags); + const char *ks_name, const char *ks_class, uchar_t ks_type, + uint_t ks_ndata, uchar_t ks_flags); + extern void __kstat_install(kstat_t *ksp); extern void __kstat_delete(kstat_t *ksp); extern void kstat_waitq_enter(kstat_io_t *); @@ -194,9 +197,12 @@ extern void kstat_waitq_exit(kstat_io_t *); extern void kstat_runq_enter(kstat_io_t *); extern void kstat_runq_exit(kstat_io_t *); -#define kstat_set_raw_ops(k,h,d,a) __kstat_set_raw_ops(k,h,d,a) -#define kstat_create(m,i,n,c,t,s,f) __kstat_create(m,i,n,c,t,s,f) -#define kstat_install(k) __kstat_install(k) -#define kstat_delete(k) __kstat_delete(k) +#define kstat_set_raw_ops(k, h, d, a) \ + __kstat_set_raw_ops(k, h, d, a) +#define kstat_create(m, i, n, c, t, s, f) \ + __kstat_create(m, i, n, c, t, s, f) + +#define kstat_install(k) __kstat_install(k) +#define kstat_delete(k) __kstat_delete(k) #endif /* _SPL_KSTAT_H */ diff --git a/include/sys/list.h b/include/sys/list.h index 319e1f890..d80c8474e 100644 --- a/include/sys/list.h +++ b/include/sys/list.h @@ -23,7 +23,7 @@ */ #ifndef _SPL_LIST_H -#define _SPL_LIST_H +#define _SPL_LIST_H #include #include @@ -53,13 +53,13 @@ typedef struct list { list_node_t list_head; } list_t; -#define list_d2l(a, obj) ((list_node_t *)(((char *)obj) + (a)->list_offset)) -#define list_object(a, node) ((void *)(((char *)node) - (a)->list_offset)) +#define list_d2l(a, obj) ((list_node_t *)(((char *)obj) + (a)->list_offset)) +#define list_object(a, node) ((void *)(((char *)node) - (a)->list_offset)) static inline int list_is_empty(list_t *list) { - return list_empty(&list->list_head); + return (list_empty(&list->list_head)); } static inline void @@ -74,7 +74,7 @@ list_create(list_t *list, size_t size, size_t offset) { ASSERT(list); ASSERT(size > 0); - ASSERT(size >= offset + sizeof(list_node_t)); + ASSERT(size >= offset + sizeof (list_node_t)); list->list_size = size; list->list_offset = offset; @@ -132,10 +132,10 @@ list_remove_head(list_t *list) { list_node_t *head = list->list_head.next; if (head == &list->list_head) - return NULL; + return (NULL); list_del(head); - return list_object(list, head); + return (list_object(list, head)); } static inline void * @@ -143,28 +143,28 @@ list_remove_tail(list_t *list) { list_node_t *tail = list->list_head.prev; if (tail == &list->list_head) - return NULL; + return (NULL); list_del(tail); - return list_object(list, tail); + return (list_object(list, tail)); } static inline void * list_head(list_t *list) { if (list_is_empty(list)) - return NULL; + return (NULL); - return list_object(list, list->list_head.next); + return (list_object(list, list->list_head.next)); } static inline void * list_tail(list_t *list) { if (list_is_empty(list)) - return NULL; + return (NULL); - return list_object(list, list->list_head.prev); + return (list_object(list, list->list_head.prev)); } static inline void * @@ -173,9 +173,9 @@ list_next(list_t *list, void *object) list_node_t *node = list_d2l(list, object); if (node->next != &list->list_head) - return list_object(list, node->next); + return (list_object(list, node->next)); - return NULL; + return (NULL); } static inline void * @@ -184,9 +184,9 @@ list_prev(list_t *list, void *object) list_node_t *node = list_d2l(list, object); if (node->prev != &list->list_head) - return list_object(list, node->prev); + return (list_object(list, node->prev)); - return NULL; + return (NULL); } static inline int @@ -201,7 +201,7 @@ spl_list_move_tail(list_t *dst, list_t *src) list_splice_init(&src->list_head, dst->list_head.prev); } -#define list_move_tail(dst, src) spl_list_move_tail(dst, src) +#define list_move_tail(dst, src) spl_list_move_tail(dst, src) static inline void list_link_replace(list_node_t *old_node, list_node_t *new_node) diff --git a/include/sys/mkdev.h b/include/sys/mkdev.h index e63d09f7c..7dff2d22d 100644 --- a/include/sys/mkdev.h +++ b/include/sys/mkdev.h @@ -23,6 +23,6 @@ */ #ifndef _SPL_MKDEV_H -#define _SPL_MKDEV_H +#define _SPL_MKDEV_H #endif /* SPL_MKDEV_H */ diff --git a/include/sys/mntent.h b/include/sys/mntent.h index 4ca1b346a..cac28c530 100644 --- a/include/sys/mntent.h +++ b/include/sys/mntent.h @@ -23,6 +23,6 @@ */ #ifndef _SPL_MNTENT_H -#define _SPL_MNTENT_H +#define _SPL_MNTENT_H #endif /* SPL_MNTENT_H */ diff --git a/include/sys/modctl.h b/include/sys/modctl.h index f234c45ed..8f9ae496d 100644 --- a/include/sys/modctl.h +++ b/include/sys/modctl.h @@ -23,6 +23,6 @@ */ #ifndef _SPL_MODCTL_H -#define _SPL_MODCTL_H +#define _SPL_MODCTL_H #endif /* SPL_MODCTL_H */ diff --git a/include/sys/mode.h b/include/sys/mode.h index a9cf0da59..02802d0d4 100644 --- a/include/sys/mode.h +++ b/include/sys/mode.h @@ -23,10 +23,10 @@ */ #ifndef _SPL_MODE_H -#define _SPL_MODE_H +#define _SPL_MODE_H -#define IFTOVT(mode) vn_mode_to_vtype(mode) -#define VTTOIF(vtype) vn_vtype_to_mode(vtype) -#define MAKEIMODE(T, M) (VTTOIF(T) | ((M) & ~S_IFMT)) +#define IFTOVT(mode) vn_mode_to_vtype(mode) +#define VTTOIF(vtype) vn_vtype_to_mode(vtype) +#define MAKEIMODE(T, M) (VTTOIF(T) | ((M) & ~S_IFMT)) #endif /* SPL_MODE_H */ diff --git a/include/sys/mount.h b/include/sys/mount.h index 17eb1af57..fdd1c6678 100644 --- a/include/sys/mount.h +++ b/include/sys/mount.h @@ -23,6 +23,6 @@ */ #ifndef _SPL_MOUNT_H -#define _SPL_MOUNT_H +#define _SPL_MOUNT_H #endif /* SPL_MOUNT_H */ diff --git a/include/sys/mutex.h b/include/sys/mutex.h index 8cbab7c47..c7084b3c3 100644 --- a/include/sys/mutex.h +++ b/include/sys/mutex.h @@ -84,13 +84,13 @@ spl_mutex_lockdep_on_maybe(kmutex_t *mp) \ lockdep_on(); \ } #else /* CONFIG_LOCKDEP */ -#define spl_mutex_set_type(mp, type) -#define spl_mutex_lockdep_off_maybe(mp) -#define spl_mutex_lockdep_on_maybe(mp) +#define spl_mutex_set_type(mp, type) +#define spl_mutex_lockdep_off_maybe(mp) +#define spl_mutex_lockdep_on_maybe(mp) #endif /* CONFIG_LOCKDEP */ /* - * The following functions must be a #define and not static inline. + * The following functions must be a #define and not static inline. * This ensures that the native linux mutex functions (lock/unlock) * will be correctly located in the users code which is important * for the built in kernel lock analysis tools @@ -113,6 +113,7 @@ spl_mutex_lockdep_on_maybe(kmutex_t *mp) \ VERIFY3P(mutex_owner(mp), ==, NULL); \ } +/* BEGIN CSTYLED */ #define mutex_tryenter(mp) \ ({ \ int _rc_; \ @@ -124,6 +125,7 @@ spl_mutex_lockdep_on_maybe(kmutex_t *mp) \ \ _rc_; \ }) +/* END CSTYLED */ #ifdef CONFIG_DEBUG_LOCK_ALLOC #define mutex_enter_nested(mp, subclass) \ diff --git a/include/sys/note.h b/include/sys/note.h index 0c3386912..f7f9b70ef 100644 --- a/include/sys/note.h +++ b/include/sys/note.h @@ -23,6 +23,6 @@ */ #ifndef _SPL_NOTE_H -#define _SPL_NOTE_H +#define _SPL_NOTE_H #endif /* SPL_NOTE_H */ diff --git a/include/sys/open.h b/include/sys/open.h index 201bbeb56..7c9e0cb7a 100644 --- a/include/sys/open.h +++ b/include/sys/open.h @@ -23,6 +23,6 @@ */ #ifndef _SPL_OPEN_H -#define _SPL_OPEN_H +#define _SPL_OPEN_H #endif /* SPL_OPEN_H */ diff --git a/include/sys/param.h b/include/sys/param.h index 10bf96588..4ef929151 100644 --- a/include/sys/param.h +++ b/include/sys/param.h @@ -23,14 +23,14 @@ */ #ifndef _SPL_PARAM_H -#define _SPL_PARAM_H +#define _SPL_PARAM_H #include /* Pages to bytes and back */ -#define ptob(pages) ((pages) << PAGE_SHIFT) -#define btop(bytes) ((bytes) >> PAGE_SHIFT) +#define ptob(pages) ((pages) << PAGE_SHIFT) +#define btop(bytes) ((bytes) >> PAGE_SHIFT) -#define MAXUID UINT32_MAX +#define MAXUID UINT32_MAX #endif /* SPL_PARAM_H */ diff --git a/include/sys/pathname.h b/include/sys/pathname.h index 2806ce38b..fde1b3c1e 100644 --- a/include/sys/pathname.h +++ b/include/sys/pathname.h @@ -23,7 +23,7 @@ */ #ifndef _SPL_PATHNAME_H -#define _SPL_PATHNAME_H +#define _SPL_PATHNAME_H typedef struct pathname { char *pn_buf; /* underlying storage */ diff --git a/include/sys/policy.h b/include/sys/policy.h index 6f40a0175..e4333cfcf 100644 --- a/include/sys/policy.h +++ b/include/sys/policy.h @@ -23,25 +23,25 @@ */ #ifndef _SPL_POLICY_H -#define _SPL_POLICY_H +#define _SPL_POLICY_H -#define secpolicy_fs_unmount(c,vfs) (0) +#define secpolicy_fs_unmount(c, vfs) (0) #define secpolicy_nfs(c) (0) -#define secpolicy_sys_config(c,co) (0) +#define secpolicy_sys_config(c, co) (0) #define secpolicy_zfs(c) (0) #define secpolicy_zinject(c) (0) -#define secpolicy_vnode_setids_setgids(c,id) (0) +#define secpolicy_vnode_setids_setgids(c, id) (0) #define secpolicy_vnode_setid_retain(c, sr) (0) #define secpolicy_setid_clear(v, c) (0) -#define secpolicy_vnode_any_access(c,vp,o) (0) -#define secpolicy_vnode_access2(c,cp,o,m1,m2) (0) -#define secpolicy_vnode_chown(c,o) (0) -#define secpolicy_vnode_setdac(c,o) (0) +#define secpolicy_vnode_any_access(c, vp, o) (0) +#define secpolicy_vnode_access2(c, cp, o, m1, m2) (0) +#define secpolicy_vnode_chown(c, o) (0) +#define secpolicy_vnode_setdac(c, o) (0) #define secpolicy_vnode_remove(c) (0) -#define secpolicy_vnode_setattr(c,v,a,o,f,func,n) (0) +#define secpolicy_vnode_setattr(c, v, a, o, f, func, n) (0) #define secpolicy_xvattr(x, o, c, t) (0) #define secpolicy_vnode_stky_modify(c) (0) -#define secpolicy_setid_setsticky_clear(v,a,o,c) (0) +#define secpolicy_setid_setsticky_clear(v, a, o, c) (0) #define secpolicy_basic_link(c) (0) #endif /* SPL_POLICY_H */ diff --git a/include/sys/pool.h b/include/sys/pool.h index 9addd2c53..392c14b5e 100644 --- a/include/sys/pool.h +++ b/include/sys/pool.h @@ -23,7 +23,7 @@ */ #ifndef _SPL_POOL_H -#define _SPL_POOL_H +#define _SPL_POOL_H #include diff --git a/include/sys/priv_impl.h b/include/sys/priv_impl.h index 4d6640c8d..822c2dec1 100644 --- a/include/sys/priv_impl.h +++ b/include/sys/priv_impl.h @@ -23,6 +23,6 @@ */ #ifndef _SPL_PRIV_IMPL_H -#define _SPL_PRIV_IMPL_H +#define _SPL_PRIV_IMPL_H #endif /* _SPL_PRIV_IMPL_H */ diff --git a/include/sys/proc.h b/include/sys/proc.h index 5e2989610..95fc8cc5f 100644 --- a/include/sys/proc.h +++ b/include/sys/proc.h @@ -23,6 +23,6 @@ */ #ifndef _SPL_PROC_H -#define _SPL_PROC_H +#define _SPL_PROC_H #endif /* SPL_PROC_H */ diff --git a/include/sys/processor.h b/include/sys/processor.h index de0395e5a..a70101fa2 100644 --- a/include/sys/processor.h +++ b/include/sys/processor.h @@ -25,7 +25,7 @@ #ifndef _SPL_PROCESSOR_H #define _SPL_PROCESSOR_H -#define getcpuid() smp_processor_id() +#define getcpuid() smp_processor_id() typedef int processorid_t; diff --git a/include/sys/pset.h b/include/sys/pset.h index 58841e77d..a6a9d343b 100644 --- a/include/sys/pset.h +++ b/include/sys/pset.h @@ -23,16 +23,16 @@ */ #ifndef _SPL_PSET_H -#define _SPL_PSET_H +#define _SPL_PSET_H typedef int psetid_t; /* special processor set id's */ -#define PS_NONE -1 -#define PS_QUERY -2 -#define PS_MYID -3 -#define PS_SOFT -4 -#define PS_HARD -5 -#define PS_QUERY_TYPE -6 +#define PS_NONE -1 +#define PS_QUERY -2 +#define PS_MYID -3 +#define PS_SOFT -4 +#define PS_HARD -5 +#define PS_QUERY_TYPE -6 #endif /* SPL_PSET_H */ diff --git a/include/sys/random.h b/include/sys/random.h index a3f2933e1..93e244f56 100644 --- a/include/sys/random.h +++ b/include/sys/random.h @@ -31,8 +31,8 @@ static __inline__ int random_get_bytes(uint8_t *ptr, size_t len) { - get_random_bytes((void *)ptr,(int)len); - return 0; + get_random_bytes((void *)ptr, (int)len); + return (0); } extern int random_get_pseudo_bytes(uint8_t *ptr, size_t len); diff --git a/include/sys/refstr.h b/include/sys/refstr.h index 7fe8a0360..1b54dab45 100644 --- a/include/sys/refstr.h +++ b/include/sys/refstr.h @@ -23,6 +23,6 @@ */ #ifndef _SPL_REFSTR_H -#define _SPL_REFSTR_H +#define _SPL_REFSTR_H #endif /* SPL_REFSTR_H */ diff --git a/include/sys/resource.h b/include/sys/resource.h index dfc6e28f4..d1ffb6c2d 100644 --- a/include/sys/resource.h +++ b/include/sys/resource.h @@ -23,7 +23,7 @@ */ #ifndef _SPL_RESOURCE_H -#define _SPL_RESOURCE_H +#define _SPL_RESOURCE_H #include diff --git a/include/sys/rwlock.h b/include/sys/rwlock.h index e806bdc9d..bb8b785e8 100644 --- a/include/sys/rwlock.h +++ b/include/sys/rwlock.h @@ -23,7 +23,7 @@ */ #ifndef _SPL_RWLOCK_H -#define _SPL_RWLOCK_H +#define _SPL_RWLOCK_H #include #include @@ -55,7 +55,7 @@ typedef struct { #endif /* CONFIG_LOCKDEP */ } krwlock_t; -#define SEM(rwp) (&(rwp)->rw_rwlock) +#define SEM(rwp) (&(rwp)->rw_rwlock) static inline void spl_rw_set_owner(krwlock_t *rwp) @@ -81,9 +81,9 @@ static inline kthread_t * rw_owner(krwlock_t *rwp) { #ifdef CONFIG_RWSEM_SPIN_ON_OWNER - return SEM(rwp)->owner; + return (SEM(rwp)->owner); #else - return rwp->rw_owner; + return (rwp->rw_owner); #endif } @@ -106,9 +106,9 @@ spl_rw_lockdep_on_maybe(krwlock_t *rwp) \ lockdep_on(); \ } #else /* CONFIG_LOCKDEP */ -#define spl_rw_set_type(rwp, type) -#define spl_rw_lockdep_off_maybe(rwp) -#define spl_rw_lockdep_on_maybe(rwp) +#define spl_rw_set_type(rwp, type) +#define spl_rw_lockdep_off_maybe(rwp) +#define spl_rw_lockdep_on_maybe(rwp) #endif /* CONFIG_LOCKDEP */ static inline int @@ -131,16 +131,17 @@ RW_WRITE_HELD(krwlock_t *rwp) static inline int RW_LOCK_HELD(krwlock_t *rwp) { - return spl_rwsem_is_locked(SEM(rwp)); + return (spl_rwsem_is_locked(SEM(rwp))); } /* - * The following functions must be a #define and not static inline. + * The following functions must be a #define and not static inline. * This ensures that the native linux semaphore functions (down/up) * will be correctly located in the users code which is important * for the built in kernel lock analysis tools */ -#define rw_init(rwp, name, type, arg) \ +/* BEGIN CSTYLED */ +#define rw_init(rwp, name, type, arg) \ ({ \ static struct lock_class_key __key; \ ASSERT(type == RW_DEFAULT || type == RW_NOLOCKDEP); \ @@ -150,12 +151,12 @@ RW_LOCK_HELD(krwlock_t *rwp) spl_rw_set_type(rwp, type); \ }) -#define rw_destroy(rwp) \ +#define rw_destroy(rwp) \ ({ \ VERIFY(!RW_LOCK_HELD(rwp)); \ }) -#define rw_tryenter(rwp, rw) \ +#define rw_tryenter(rwp, rw) \ ({ \ int _rc_ = 0; \ \ @@ -175,7 +176,7 @@ RW_LOCK_HELD(krwlock_t *rwp) _rc_; \ }) -#define rw_enter(rwp, rw) \ +#define rw_enter(rwp, rw) \ ({ \ spl_rw_lockdep_off_maybe(rwp); \ switch (rw) { \ @@ -192,7 +193,7 @@ RW_LOCK_HELD(krwlock_t *rwp) spl_rw_lockdep_on_maybe(rwp); \ }) -#define rw_exit(rwp) \ +#define rw_exit(rwp) \ ({ \ spl_rw_lockdep_off_maybe(rwp); \ if (RW_WRITE_HELD(rwp)) { \ @@ -205,7 +206,7 @@ RW_LOCK_HELD(krwlock_t *rwp) spl_rw_lockdep_on_maybe(rwp); \ }) -#define rw_downgrade(rwp) \ +#define rw_downgrade(rwp) \ ({ \ spl_rw_lockdep_off_maybe(rwp); \ spl_rw_clear_owner(rwp); \ @@ -213,7 +214,7 @@ RW_LOCK_HELD(krwlock_t *rwp) spl_rw_lockdep_on_maybe(rwp); \ }) -#define rw_tryupgrade(rwp) \ +#define rw_tryupgrade(rwp) \ ({ \ int _rc_ = 0; \ \ @@ -227,6 +228,7 @@ RW_LOCK_HELD(krwlock_t *rwp) } \ _rc_; \ }) +/* END CSTYLED */ int spl_rw_init(void); void spl_rw_fini(void); diff --git a/include/sys/sdt.h b/include/sys/sdt.h index 80fb4c32a..2d4679d65 100644 --- a/include/sys/sdt.h +++ b/include/sys/sdt.h @@ -23,8 +23,8 @@ */ #ifndef _SPL_SDT_H -#define _SPL_SDT_H +#define _SPL_SDT_H -#define SET_ERROR(x) (x) +#define SET_ERROR(x) (x) #endif /* SPL_SDT_H */ diff --git a/include/sys/sid.h b/include/sys/sid.h index c5988a6f9..731b62c47 100644 --- a/include/sys/sid.h +++ b/include/sys/sid.h @@ -23,7 +23,7 @@ */ #ifndef _SPL_SID_H -#define _SPL_SID_H +#define _SPL_SID_H typedef struct ksiddomain { char *kd_name; @@ -41,21 +41,21 @@ typedef int ksid_t; static inline ksiddomain_t * ksid_lookupdomain(const char *dom) { - ksiddomain_t *kd; + ksiddomain_t *kd; int len = strlen(dom); - kd = kmem_zalloc(sizeof(ksiddomain_t), KM_SLEEP); - kd->kd_name = kmem_zalloc(len + 1, KM_SLEEP); + kd = kmem_zalloc(sizeof (ksiddomain_t), KM_SLEEP); + kd->kd_name = kmem_zalloc(len + 1, KM_SLEEP); memcpy(kd->kd_name, dom, len); - return (kd); + return (kd); } static inline void ksiddomain_rele(ksiddomain_t *ksid) { kmem_free(ksid->kd_name, strlen(ksid->kd_name) + 1); - kmem_free(ksid, sizeof(ksiddomain_t)); + kmem_free(ksid, sizeof (ksiddomain_t)); } #endif /* _SPL_SID_H */ diff --git a/include/sys/signal.h b/include/sys/signal.h index 0c7236390..36b8b5d98 100644 --- a/include/sys/signal.h +++ b/include/sys/signal.h @@ -23,7 +23,7 @@ */ #ifndef _SPL_SIGNAL_H -#define _SPL_SIGNAL_H +#define _SPL_SIGNAL_H #include @@ -34,7 +34,8 @@ #define FORREAL 0 /* Usual side-effects */ #define JUSTLOOKING 1 /* Don't stop the process */ -/* The "why" argument indicates the allowable side-effects of the call: +/* + * The "why" argument indicates the allowable side-effects of the call: * * FORREAL: Extract the next pending signal from p_sig into p_cursig; * stop the process if a stop has been requested or if a traced signal @@ -48,7 +49,7 @@ issig(int why) { ASSERT(why == FORREAL || why == JUSTLOOKING); - return signal_pending(current); + return (signal_pending(current)); } #endif /* SPL_SIGNAL_H */ diff --git a/include/sys/stat.h b/include/sys/stat.h index c6ee57ed7..83018e894 100644 --- a/include/sys/stat.h +++ b/include/sys/stat.h @@ -23,7 +23,7 @@ */ #ifndef _SPL_STAT_H -#define _SPL_STAT_H +#define _SPL_STAT_H #include diff --git a/include/sys/stropts.h b/include/sys/stropts.h index 68c4a0d14..746141fe8 100644 --- a/include/sys/stropts.h +++ b/include/sys/stropts.h @@ -23,6 +23,6 @@ */ #ifndef _SPL_STROPTS_H -#define _SPL_STROPTS_H +#define _SPL_STROPTS_H #endif /* SPL_STROPTS_H */ diff --git a/include/sys/sunddi.h b/include/sys/sunddi.h index 74ca4228f..1bae594c8 100644 --- a/include/sys/sunddi.h +++ b/include/sys/sunddi.h @@ -23,7 +23,7 @@ */ #ifndef _SPL_SUNDDI_H -#define _SPL_SUNDDI_H +#define _SPL_SUNDDI_H #include #include @@ -44,9 +44,9 @@ typedef int ddi_devid_t; #define DDI_SUCCESS 0 #define DDI_FAILURE -1 -#define ddi_prop_lookup_string(x1,x2,x3,x4,x5) (*x5 = NULL) -#define ddi_prop_free(x) (void)0 -#define ddi_root_node() (void)0 +#define ddi_prop_lookup_string(x1, x2, x3, x4, x5) (*x5 = NULL) +#define ddi_prop_free(x) (void)0 +#define ddi_root_node() (void)0 extern int ddi_strtoul(const char *, char **, int, unsigned long *); extern int ddi_strtol(const char *, char **, int, long *); diff --git a/include/sys/sunldi.h b/include/sys/sunldi.h index 0831904d6..43462efad 100644 --- a/include/sys/sunldi.h +++ b/include/sys/sunldi.h @@ -23,7 +23,7 @@ */ #ifndef _SPL_SUNLDI_H -#define _SPL_SUNLDI_H +#define _SPL_SUNLDI_H #include #include @@ -32,6 +32,6 @@ #include #include -#define SECTOR_SIZE 512 +#define SECTOR_SIZE 512 #endif /* SPL_SUNLDI_H */ diff --git a/include/sys/sysdc.h b/include/sys/sysdc.h index a563c87af..d963774ac 100644 --- a/include/sys/sysdc.h +++ b/include/sys/sysdc.h @@ -23,6 +23,6 @@ */ #ifndef _SPL_SYSDC_H -#define _SPL_SYSDC_H +#define _SPL_SYSDC_H #endif /* SPL_SYSDC_H */ diff --git a/include/sys/sysmacros.h b/include/sys/sysmacros.h index 03468d7d0..d083cebda 100644 --- a/include/sys/sysmacros.h +++ b/include/sys/sysmacros.h @@ -23,7 +23,7 @@ */ #ifndef _SPL_SYSMACROS_H -#define _SPL_SYSMACROS_H +#define _SPL_SYSMACROS_H #include #include @@ -39,120 +39,122 @@ #endif #ifndef _KERNEL -#define _KERNEL __KERNEL__ +#define _KERNEL __KERNEL__ #endif -#define FALSE 0 -#define TRUE 1 - -#define INT8_MAX (127) -#define INT8_MIN (-128) -#define UINT8_MAX (255) -#define UINT8_MIN (0) - -#define INT16_MAX (32767) -#define INT16_MIN (-32768) -#define UINT16_MAX (65535) -#define UINT16_MIN (0) - -#define INT32_MAX INT_MAX -#define INT32_MIN INT_MIN -#define UINT32_MAX UINT_MAX -#define UINT32_MIN UINT_MIN - -#define INT64_MAX LLONG_MAX -#define INT64_MIN LLONG_MIN -#define UINT64_MAX ULLONG_MAX -#define UINT64_MIN ULLONG_MIN - -#define NBBY 8 -#define ENOTSUP EOPNOTSUPP - -#define MAXMSGLEN 256 -#define MAXNAMELEN 256 -#define MAXPATHLEN PATH_MAX -#define MAXOFFSET_T LLONG_MAX -#define MAXBSIZE 8192 -#define DEV_BSIZE 512 -#define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */ - -#define proc_pageout NULL -#define curproc current -#define max_ncpus num_possible_cpus() -#define boot_ncpus num_online_cpus() -#define CPU_SEQID smp_processor_id() -#define _NOTE(x) -#define is_system_labeled() 0 +#define FALSE 0 +#define TRUE 1 + +#define INT8_MAX (127) +#define INT8_MIN (-128) +#define UINT8_MAX (255) +#define UINT8_MIN (0) + +#define INT16_MAX (32767) +#define INT16_MIN (-32768) +#define UINT16_MAX (65535) +#define UINT16_MIN (0) + +#define INT32_MAX INT_MAX +#define INT32_MIN INT_MIN +#define UINT32_MAX UINT_MAX +#define UINT32_MIN UINT_MIN + +#define INT64_MAX LLONG_MAX +#define INT64_MIN LLONG_MIN +#define UINT64_MAX ULLONG_MAX +#define UINT64_MIN ULLONG_MIN + +#define NBBY 8 +#define ENOTSUP EOPNOTSUPP + +#define MAXMSGLEN 256 +#define MAXNAMELEN 256 +#define MAXPATHLEN PATH_MAX +#define MAXOFFSET_T LLONG_MAX +#define MAXBSIZE 8192 +#define DEV_BSIZE 512 +#define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */ + +#define proc_pageout NULL +#define curproc current +#define max_ncpus num_possible_cpus() +#define boot_ncpus num_online_cpus() +#define CPU_SEQID smp_processor_id() +#define _NOTE(x) +#define is_system_labeled() 0 #ifndef RLIM64_INFINITY -#define RLIM64_INFINITY (~0ULL) +#define RLIM64_INFINITY (~0ULL) #endif -/* 0..MAX_PRIO-1: Process priority +/* + * 0..MAX_PRIO-1: Process priority * 0..MAX_RT_PRIO-1: RT priority tasks * MAX_RT_PRIO..MAX_PRIO-1: SCHED_NORMAL tasks * * Treat shim tasks as SCHED_NORMAL tasks */ -#define minclsyspri (MAX_PRIO-1) -#define maxclsyspri (MAX_RT_PRIO) -#define defclsyspri (DEFAULT_PRIO) +#define minclsyspri (MAX_PRIO-1) +#define maxclsyspri (MAX_RT_PRIO) +#define defclsyspri (DEFAULT_PRIO) #ifndef NICE_TO_PRIO -#define NICE_TO_PRIO(nice) (MAX_RT_PRIO + (nice) + 20) +#define NICE_TO_PRIO(nice) (MAX_RT_PRIO + (nice) + 20) #endif #ifndef PRIO_TO_NICE -#define PRIO_TO_NICE(prio) ((prio) - MAX_RT_PRIO - 20) +#define PRIO_TO_NICE(prio) ((prio) - MAX_RT_PRIO - 20) #endif /* * Missing macros */ #ifndef PAGESIZE -#define PAGESIZE PAGE_SIZE +#define PAGESIZE PAGE_SIZE #endif #ifndef PAGESHIFT -#define PAGESHIFT PAGE_SHIFT +#define PAGESHIFT PAGE_SHIFT #endif /* from Solaris sys/byteorder.h */ -#define BSWAP_8(x) ((x) & 0xff) -#define BSWAP_16(x) ((BSWAP_8(x) << 8) | BSWAP_8((x) >> 8)) -#define BSWAP_32(x) ((BSWAP_16(x) << 16) | BSWAP_16((x) >> 16)) -#define BSWAP_64(x) ((BSWAP_32(x) << 32) | BSWAP_32((x) >> 32)) +#define BSWAP_8(x) ((x) & 0xff) +#define BSWAP_16(x) ((BSWAP_8(x) << 8) | BSWAP_8((x) >> 8)) +#define BSWAP_32(x) ((BSWAP_16(x) << 16) | BSWAP_16((x) >> 16)) +#define BSWAP_64(x) ((BSWAP_32(x) << 32) | BSWAP_32((x) >> 32)) -/* Map some simple functions. +/* + * Map some simple functions. */ -#define bzero(ptr,size) memset(ptr,0,size) -#define bcopy(src,dest,size) memmove(dest,src,size) -#define bcmp(src,dest,size) memcmp((src), (dest), (size_t)(size)) +#define bzero(ptr, size) memset(ptr, 0, size) +#define bcopy(src, dest, size) memmove(dest, src, size) +#define bcmp(src, dest, size) memcmp((src), (dest), (size_t)(size)) /* Dtrace probes do not exist in the linux kernel */ #ifdef DTRACE_PROBE #undef DTRACE_PROBE #endif /* DTRACE_PROBE */ -#define DTRACE_PROBE(a) ((void)0) +#define DTRACE_PROBE(a) ((void)0) #ifdef DTRACE_PROBE1 #undef DTRACE_PROBE1 #endif /* DTRACE_PROBE1 */ -#define DTRACE_PROBE1(a, b, c) ((void)0) +#define DTRACE_PROBE1(a, b, c) ((void)0) #ifdef DTRACE_PROBE2 #undef DTRACE_PROBE2 #endif /* DTRACE_PROBE2 */ -#define DTRACE_PROBE2(a, b, c, d, e) ((void)0) +#define DTRACE_PROBE2(a, b, c, d, e) ((void)0) #ifdef DTRACE_PROBE3 #undef DTRACE_PROBE3 #endif /* DTRACE_PROBE3 */ -#define DTRACE_PROBE3(a, b, c, d, e, f, g) ((void)0) +#define DTRACE_PROBE3(a, b, c, d, e, f, g) ((void)0) #ifdef DTRACE_PROBE4 #undef DTRACE_PROBE4 #endif /* DTRACE_PROBE4 */ -#define DTRACE_PROBE4(a, b, c, d, e, f, g, h, i) ((void)0) +#define DTRACE_PROBE4(a, b, c, d, e, f, g, h, i) ((void)0) /* Missing globals */ extern char spl_version[32]; @@ -167,39 +169,39 @@ extern void spl_cleanup(void); #define lowbit(x) __ffs(x) #define highbit64(x) fls64(x) -#define makedevice(maj,min) makedev(maj,min) +#define makedevice(maj, min) makedev(maj, min) /* common macros */ #ifndef MIN -#define MIN(a, b) ((a) < (b) ? (a) : (b)) +#define MIN(a, b) ((a) < (b) ? (a) : (b)) #endif #ifndef MAX -#define MAX(a, b) ((a) < (b) ? (b) : (a)) +#define MAX(a, b) ((a) < (b) ? (b) : (a)) #endif #ifndef ABS -#define ABS(a) ((a) < 0 ? -(a) : (a)) +#define ABS(a) ((a) < 0 ? -(a) : (a)) #endif #ifndef DIV_ROUND_UP -#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d)) +#define DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d)) #endif #ifndef roundup -#define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y)) +#define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y)) #endif #ifndef howmany -#define howmany(x, y) (((x) + ((y) - 1)) / (y)) +#define howmany(x, y) (((x) + ((y) - 1)) / (y)) #endif /* * Compatibility macros/typedefs needed for Solaris -> Linux port */ -#define P2ALIGN(x, align) ((x) & -(align)) -#define P2CROSS(x, y, align) (((x) ^ (y)) > (align) - 1) -#define P2ROUNDUP(x, align) ((((x) - 1) | ((align) - 1)) + 1) -#define P2PHASE(x, align) ((x) & ((align) - 1)) -#define P2NPHASE(x, align) (-(x) & ((align) - 1)) -#define ISP2(x) (((x) & ((x) - 1)) == 0) -#define IS_P2ALIGNED(v, a) ((((uintptr_t)(v)) & ((uintptr_t)(a) - 1))==0) -#define P2BOUNDARY(off, len, align) \ +#define P2ALIGN(x, align) ((x) & -(align)) +#define P2CROSS(x, y, align) (((x) ^ (y)) > (align) - 1) +#define P2ROUNDUP(x, align) ((((x) - 1) | ((align) - 1)) + 1) +#define P2PHASE(x, align) ((x) & ((align) - 1)) +#define P2NPHASE(x, align) (-(x) & ((align) - 1)) +#define ISP2(x) (((x) & ((x) - 1)) == 0) +#define IS_P2ALIGNED(v, a) ((((uintptr_t)(v)) & ((uintptr_t)(a) - 1)) == 0) +#define P2BOUNDARY(off, len, align) \ (((off) ^ ((off) + (len) - 1)) > (align) - 1) /* @@ -214,28 +216,28 @@ extern void spl_cleanup(void); * or * P2ROUNDUP_TYPED(x, PAGESIZE, uint64_t) */ -#define P2ALIGN_TYPED(x, align, type) \ - ((type)(x) & -(type)(align)) -#define P2PHASE_TYPED(x, align, type) \ - ((type)(x) & ((type)(align) - 1)) -#define P2NPHASE_TYPED(x, align, type) \ - (-(type)(x) & ((type)(align) - 1)) -#define P2ROUNDUP_TYPED(x, align, type) \ - ((((type)(x) - 1) | ((type)(align) - 1)) + 1) -#define P2END_TYPED(x, align, type) \ - (-(~(type)(x) & -(type)(align))) -#define P2PHASEUP_TYPED(x, align, phase, type) \ - ((type)(phase) - (((type)(phase) - (type)(x)) & -(type)(align))) -#define P2CROSS_TYPED(x, y, align, type) \ - (((type)(x) ^ (type)(y)) > (type)(align) - 1) -#define P2SAMEHIGHBIT_TYPED(x, y, type) \ - (((type)(x) ^ (type)(y)) < ((type)(x) & (type)(y))) +#define P2ALIGN_TYPED(x, align, type) \ + ((type)(x) & -(type)(align)) +#define P2PHASE_TYPED(x, align, type) \ + ((type)(x) & ((type)(align) - 1)) +#define P2NPHASE_TYPED(x, align, type) \ + (-(type)(x) & ((type)(align) - 1)) +#define P2ROUNDUP_TYPED(x, align, type) \ + ((((type)(x) - 1) | ((type)(align) - 1)) + 1) +#define P2END_TYPED(x, align, type) \ + (-(~(type)(x) & -(type)(align))) +#define P2PHASEUP_TYPED(x, align, phase, type) \ + ((type)(phase) - (((type)(phase) - (type)(x)) & -(type)(align))) +#define P2CROSS_TYPED(x, y, align, type) \ + (((type)(x) ^ (type)(y)) > (type)(align) - 1) +#define P2SAMEHIGHBIT_TYPED(x, y, type) \ + (((type)(x) ^ (type)(y)) < ((type)(x) & (type)(y))) #if defined(_KERNEL) && !defined(_KMEMUSER) && !defined(offsetof) /* avoid any possibility of clashing with version */ -#define offsetof(s, m) ((size_t)(&(((s *)0)->m))) +#define offsetof(s, m) ((size_t)(&(((s *)0)->m))) #endif #endif /* _SPL_SYSMACROS_H */ diff --git a/include/sys/systeminfo.h b/include/sys/systeminfo.h index bc5337fa5..225569158 100644 --- a/include/sys/systeminfo.h +++ b/include/sys/systeminfo.h @@ -23,14 +23,14 @@ */ #ifndef _SPL_SYSTEMINFO_H -#define _SPL_SYSTEMINFO_H +#define _SPL_SYSTEMINFO_H -#define HW_HOSTID_LEN 11 /* minimum buffer size needed */ +#define HW_HOSTID_LEN 11 /* minimum buffer size needed */ /* to hold a decimal or hex */ /* hostid string */ /* Supplemental definitions for Linux. */ -#define HW_HOSTID_PATH "/etc/hostid" /* binary configuration file */ -#define HW_HOSTID_MASK 0xFFFFFFFF /* significant hostid bits */ +#define HW_HOSTID_PATH "/etc/hostid" /* binary configuration file */ +#define HW_HOSTID_MASK 0xFFFFFFFF /* significant hostid bits */ #endif /* SPL_SYSTEMINFO_H */ diff --git a/include/sys/systm.h b/include/sys/systm.h index cd49e14be..2420e7e9d 100644 --- a/include/sys/systm.h +++ b/include/sys/systm.h @@ -23,7 +23,7 @@ */ #ifndef _SPL_SYSTM_H -#define _SPL_SYSTM_H +#define _SPL_SYSTM_H #include diff --git a/include/sys/t_lock.h b/include/sys/t_lock.h index f1de9616b..dcdfaeec5 100644 --- a/include/sys/t_lock.h +++ b/include/sys/t_lock.h @@ -23,7 +23,7 @@ */ #ifndef _SPL_T_LOCK_H -#define _SPL_T_LOCK_H +#define _SPL_T_LOCK_H #include #include diff --git a/include/sys/taskq.h b/include/sys/taskq.h index c5ccec715..4d90a3563 100644 --- a/include/sys/taskq.h +++ b/include/sys/taskq.h @@ -94,7 +94,7 @@ typedef struct taskq { taskqid_t tq_lowest_id; /* lowest pend/work id */ struct list_head tq_free_list; /* free taskq_ent_t's */ struct list_head tq_pend_list; /* pending taskq_ent_t's */ - struct list_head tq_prio_list; /* priority pending taskq_ent_t's */ + struct list_head tq_prio_list; /* priority taskq_ent_t's */ struct list_head tq_delay_list; /* delayed taskq_ent_t's */ struct list_head tq_taskqs; /* all taskq_t's */ spl_wait_queue_head_t tq_work_waitq; /* new work waitq */ diff --git a/include/sys/thread.h b/include/sys/thread.h index ae2188d84..80cf49914 100644 --- a/include/sys/thread.h +++ b/include/sys/thread.h @@ -23,7 +23,7 @@ */ #ifndef _SPL_THREAD_H -#define _SPL_THREAD_H +#define _SPL_THREAD_H #include #include @@ -36,28 +36,30 @@ /* * Thread interfaces */ -#define TP_MAGIC 0x53535353 +#define TP_MAGIC 0x53535353 -#define TS_SLEEP TASK_INTERRUPTIBLE -#define TS_RUN TASK_RUNNING -#define TS_ZOMB EXIT_ZOMBIE -#define TS_STOPPED TASK_STOPPED +#define TS_SLEEP TASK_INTERRUPTIBLE +#define TS_RUN TASK_RUNNING +#define TS_ZOMB EXIT_ZOMBIE +#define TS_STOPPED TASK_STOPPED typedef void (*thread_func_t)(void *); -#define thread_create(stk, stksize, func, arg, len, pp, state, pri) \ - __thread_create(stk, stksize, (thread_func_t)func, \ - #func, arg, len, pp, state, pri) -#define thread_exit() __thread_exit() -#define thread_join(t) VERIFY(0) -#define curthread current -#define getcomm() current->comm -#define getpid() current->pid +/* BEGIN CSTYLED */ +#define thread_create(stk, stksize, func, arg, len, pp, state, pri) \ + __thread_create(stk, stksize, (thread_func_t)func, \ + #func, arg, len, pp, state, pri) +/* END CSTYLED */ + +#define thread_exit() __thread_exit() +#define thread_join(t) VERIFY(0) +#define curthread current +#define getcomm() current->comm +#define getpid() current->pid extern kthread_t *__thread_create(caddr_t stk, size_t stksize, - thread_func_t func, const char *name, - void *args, size_t len, proc_t *pp, - int state, pri_t pri); + thread_func_t func, const char *name, void *args, size_t len, proc_t *pp, + int state, pri_t pri); extern void __thread_exit(void); extern struct task_struct *spl_kthread_create(int (*func)(void *), void *data, const char namefmt[], ...); diff --git a/include/sys/timer.h b/include/sys/timer.h index 71190d287..821590e3a 100644 --- a/include/sys/timer.h +++ b/include/sys/timer.h @@ -23,38 +23,37 @@ */ #ifndef _SPL_TIMER_H -#define _SPL_TIMER_H +#define _SPL_TIMER_H #include #include #include -#define lbolt ((clock_t)jiffies) -#define lbolt64 ((int64_t)get_jiffies_64()) +#define lbolt ((clock_t)jiffies) +#define lbolt64 ((int64_t)get_jiffies_64()) -#define ddi_get_lbolt() ((clock_t)jiffies) -#define ddi_get_lbolt64() ((int64_t)get_jiffies_64()) +#define ddi_get_lbolt() ((clock_t)jiffies) +#define ddi_get_lbolt64() ((int64_t)get_jiffies_64()) -#define ddi_time_before(a, b) (typecheck(clock_t, a) && \ +#define ddi_time_before(a, b) (typecheck(clock_t, a) && \ typecheck(clock_t, b) && \ ((a) - (b) < 0)) -#define ddi_time_after(a, b) ddi_time_before(b, a) -#define ddi_time_before_eq(a, b) (!ddi_time_after(a, b)) -#define ddi_time_after_eq(a, b) ddi_time_before_eq(b, a) +#define ddi_time_after(a, b) ddi_time_before(b, a) +#define ddi_time_before_eq(a, b) (!ddi_time_after(a, b)) +#define ddi_time_after_eq(a, b) ddi_time_before_eq(b, a) -#define ddi_time_before64(a, b) (typecheck(int64_t, a) && \ +#define ddi_time_before64(a, b) (typecheck(int64_t, a) && \ typecheck(int64_t, b) && \ ((a) - (b) < 0)) -#define ddi_time_after64(a, b) ddi_time_before64(b, a) -#define ddi_time_before_eq64(a, b) (!ddi_time_after64(a, b)) -#define ddi_time_after_eq64(a, b) ddi_time_before_eq64(b, a) +#define ddi_time_after64(a, b) ddi_time_before64(b, a) +#define ddi_time_before_eq64(a, b) (!ddi_time_after64(a, b)) +#define ddi_time_after_eq64(a, b) ddi_time_before_eq64(b, a) -#define delay(ticks) schedule_timeout_uninterruptible(ticks) +#define delay(ticks) schedule_timeout_uninterruptible(ticks) -#define SEC_TO_TICK(sec) ((sec) * HZ) -#define MSEC_TO_TICK(ms) msecs_to_jiffies(ms) -#define USEC_TO_TICK(us) usecs_to_jiffies(us) -#define NSEC_TO_TICK(ns) usecs_to_jiffies(ns / NSEC_PER_USEC) +#define SEC_TO_TICK(sec) ((sec) * HZ) +#define MSEC_TO_TICK(ms) msecs_to_jiffies(ms) +#define USEC_TO_TICK(us) usecs_to_jiffies(us) +#define NSEC_TO_TICK(ns) usecs_to_jiffies(ns / NSEC_PER_USEC) #endif /* _SPL_TIMER_H */ - diff --git a/include/sys/tsd.h b/include/sys/tsd.h index 4ddaea444..39a291bf3 100644 --- a/include/sys/tsd.h +++ b/include/sys/tsd.h @@ -22,14 +22,14 @@ */ #ifndef _SPL_TSD_H -#define _SPL_TSD_H +#define _SPL_TSD_H #include -#define TSD_HASH_TABLE_BITS_DEFAULT 9 -#define TSD_KEYS_MAX 32768 -#define DTOR_PID (PID_MAX_LIMIT+1) -#define PID_KEY (TSD_KEYS_MAX+1) +#define TSD_HASH_TABLE_BITS_DEFAULT 9 +#define TSD_KEYS_MAX 32768 +#define DTOR_PID (PID_MAX_LIMIT+1) +#define PID_KEY (TSD_KEYS_MAX+1) typedef void (*dtor_func_t)(void *); diff --git a/include/sys/types.h b/include/sys/types.h index b5359c7e8..e159dda21 100644 --- a/include/sys/types.h +++ b/include/sys/types.h @@ -29,14 +29,14 @@ #include #ifndef ULLONG_MAX -#define ULLONG_MAX (~0ULL) +#define ULLONG_MAX (~0ULL) #endif #ifndef LLONG_MAX -#define LLONG_MAX ((long long)(~0ULL>>1)) +#define LLONG_MAX ((long long)(~0ULL>>1)) #endif -typedef enum { B_FALSE=0, B_TRUE=1 } boolean_t; +typedef enum { B_FALSE = 0, B_TRUE = 1 } boolean_t; typedef unsigned long intptr_t; typedef unsigned long ulong_t; typedef unsigned int uint_t; diff --git a/include/sys/u8_textprep.h b/include/sys/u8_textprep.h index f25cf1b2b..6e76651d5 100644 --- a/include/sys/u8_textprep.h +++ b/include/sys/u8_textprep.h @@ -23,6 +23,6 @@ */ #ifndef _SPL_U8_TEXTPREP_H -#define _SPL_U8_TEXTPREP_H +#define _SPL_U8_TEXTPREP_H #endif /* SPL_U8_TEXTPREP_H */ diff --git a/include/sys/uio.h b/include/sys/uio.h index b34741523..64c452b8d 100644 --- a/include/sys/uio.h +++ b/include/sys/uio.h @@ -24,7 +24,7 @@ */ #ifndef _SPL_UIO_H -#define _SPL_UIO_H +#define _SPL_UIO_H #include #include @@ -34,15 +34,15 @@ typedef struct iovec iovec_t; typedef enum uio_rw { - UIO_READ = 0, - UIO_WRITE = 1, + UIO_READ = 0, + UIO_WRITE = 1, } uio_rw_t; typedef enum uio_seg { - UIO_USERSPACE = 0, - UIO_SYSSPACE = 1, - UIO_USERISPACE= 2, - UIO_BVEC = 3, + UIO_USERSPACE = 0, + UIO_SYSSPACE = 1, + UIO_USERISPACE = 2, + UIO_BVEC = 3, } uio_seg_t; typedef struct uio { @@ -71,7 +71,7 @@ typedef enum xuio_type { } xuio_type_t; -#define UIOA_IOV_MAX 16 +#define UIOA_IOV_MAX 16 typedef struct uioa_page_s { int uioa_pfncnt; @@ -100,7 +100,7 @@ typedef struct xuio { } xu_ext; } xuio_t; -#define XUIO_XUZC_PRIV(xuio) xuio->xu_ext.xu_zc.xu_zc_priv -#define XUIO_XUZC_RW(xuio) xuio->xu_ext.xu_zc.xu_zc_rw +#define XUIO_XUZC_PRIV(xuio) xuio->xu_ext.xu_zc.xu_zc_priv +#define XUIO_XUZC_RW(xuio) xuio->xu_ext.xu_zc.xu_zc_rw #endif /* SPL_UIO_H */ diff --git a/include/sys/unistd.h b/include/sys/unistd.h index 24eab763c..d86de891c 100644 --- a/include/sys/unistd.h +++ b/include/sys/unistd.h @@ -23,6 +23,6 @@ */ #ifndef _SPL_UNISTD_H -#define _SPL_UNISTD_H +#define _SPL_UNISTD_H #endif /* SPL_UNISTD_H */ diff --git a/include/sys/user.h b/include/sys/user.h index 2dc3ed0c5..b12cb240e 100644 --- a/include/sys/user.h +++ b/include/sys/user.h @@ -21,7 +21,7 @@ */ #ifndef _SPL_USER_H -#define _SPL_USER_H +#define _SPL_USER_H /* * We have uf_info_t for areleasef(). We implement areleasef() using a global @@ -37,6 +37,6 @@ struct uf_info; typedef struct uf_info uf_info_t; -#define P_FINFO(x) ((uf_info_t *)x) +#define P_FINFO(x) ((uf_info_t *)x) #endif /* SPL_USER_H */ diff --git a/include/sys/va_list.h b/include/sys/va_list.h index 4468d9e89..62d18b9ae 100644 --- a/include/sys/va_list.h +++ b/include/sys/va_list.h @@ -23,6 +23,6 @@ */ #ifndef _SPL_VA_LIST_H -#define _SPL_VA_LIST_H +#define _SPL_VA_LIST_H #endif /* SPL_VA_LIST_H */ diff --git a/include/sys/varargs.h b/include/sys/varargs.h index b992e8430..cdb73fbbd 100644 --- a/include/sys/varargs.h +++ b/include/sys/varargs.h @@ -23,8 +23,8 @@ */ #ifndef _SPL_VARARGS_H -#define _SPL_VARARGS_H +#define _SPL_VARARGS_H -#define __va_list va_list +#define __va_list va_list #endif /* SPL_VARARGS_H */ diff --git a/include/sys/vfs.h b/include/sys/vfs.h index 30fcfb476..0d5e1d51d 100644 --- a/include/sys/vfs.h +++ b/include/sys/vfs.h @@ -23,7 +23,7 @@ */ #ifndef _SPL_ZFS_H -#define _SPL_ZFS_H +#define _SPL_ZFS_H #include #include @@ -40,7 +40,7 @@ typedef struct spl_fid { long fid_pad; struct { ushort_t len; /* length of data in bytes */ - char data[MAXFIDSZ];/* data (variable len) */ + char data[MAXFIDSZ]; /* data (variable len) */ } _fid; } un; } fid_t; diff --git a/include/sys/vfs_opreg.h b/include/sys/vfs_opreg.h index 1d20997ed..1d48f2d5a 100644 --- a/include/sys/vfs_opreg.h +++ b/include/sys/vfs_opreg.h @@ -23,6 +23,6 @@ */ #ifndef _SPL_OPREG_H -#define _SPL_OPREG_H +#define _SPL_OPREG_H #endif /* SPL_OPREG_H */ diff --git a/include/sys/vmsystm.h b/include/sys/vmsystm.h index f048c318c..2b48fe0e3 100644 --- a/include/sys/vmsystm.h +++ b/include/sys/vmsystm.h @@ -23,7 +23,7 @@ */ #ifndef _SPL_VMSYSTM_H -#define _SPL_VMSYSTM_H +#define _SPL_VMSYSTM_H #include #include @@ -48,9 +48,9 @@ copyin(const void *from, void *to, size_t len) { /* On error copyin routine returns -1 */ if (xcopyin(from, to, len)) - return -1; + return (-1); - return 0; + return (0); } static __inline__ int @@ -58,9 +58,9 @@ copyout(const void *from, void *to, size_t len) { /* On error copyout routine returns -1 */ if (xcopyout(from, to, len)) - return -1; + return (-1); - return 0; + return (0); } static __inline__ int @@ -69,7 +69,7 @@ copyinstr(const void *from, void *to, size_t len, size_t *done) size_t rc; if (len == 0) - return -ENAMETOOLONG; + return (-ENAMETOOLONG); /* XXX: Should return ENAMETOOLONG if 'strlen(from) > len' */ @@ -78,7 +78,7 @@ copyinstr(const void *from, void *to, size_t len, size_t *done) if (done != NULL) *done = rc; - return 0; + return (0); } #endif /* SPL_VMSYSTM_H */ diff --git a/include/sys/vnode.h b/include/sys/vnode.h index 9ae48c7f0..946654b7b 100644 --- a/include/sys/vnode.h +++ b/include/sys/vnode.h @@ -23,7 +23,7 @@ */ #ifndef _SPL_VNODE_H -#define _SPL_VNODE_H +#define _SPL_VNODE_H #include #include @@ -49,25 +49,25 @@ * was properly split in to O_SYNC and O_DSYNC respectively. */ #ifndef O_DSYNC -#define O_DSYNC O_SYNC +#define O_DSYNC O_SYNC #endif -#define FREAD 1 -#define FWRITE 2 -#define FCREAT O_CREAT -#define FTRUNC O_TRUNC -#define FOFFMAX O_LARGEFILE -#define FSYNC O_SYNC -#define FDSYNC O_DSYNC -#define FRSYNC O_SYNC -#define FEXCL O_EXCL -#define FDIRECT O_DIRECT -#define FAPPEND O_APPEND +#define FREAD 1 +#define FWRITE 2 +#define FCREAT O_CREAT +#define FTRUNC O_TRUNC +#define FOFFMAX O_LARGEFILE +#define FSYNC O_SYNC +#define FDSYNC O_DSYNC +#define FRSYNC O_SYNC +#define FEXCL O_EXCL +#define FDIRECT O_DIRECT +#define FAPPEND O_APPEND -#define FNODSYNC 0x10000 /* fsync pseudo flag */ -#define FNOFOLLOW 0x20000 /* don't follow symlinks */ +#define FNODSYNC 0x10000 /* fsync pseudo flag */ +#define FNOFOLLOW 0x20000 /* don't follow symlinks */ -#define F_FREESP 11 /* Free file space */ +#define F_FREESP 11 /* Free file space */ /* @@ -79,30 +79,30 @@ #undef AT_UID #undef AT_GID -#define AT_MODE ATTR_MODE -#define AT_UID ATTR_UID -#define AT_GID ATTR_GID -#define AT_SIZE ATTR_SIZE -#define AT_ATIME ATTR_ATIME -#define AT_MTIME ATTR_MTIME -#define AT_CTIME ATTR_CTIME +#define AT_MODE ATTR_MODE +#define AT_UID ATTR_UID +#define AT_GID ATTR_GID +#define AT_SIZE ATTR_SIZE +#define AT_ATIME ATTR_ATIME +#define AT_MTIME ATTR_MTIME +#define AT_CTIME ATTR_CTIME -#define ATTR_XVATTR (1 << 31) -#define AT_XVATTR ATTR_XVATTR +#define ATTR_XVATTR (1 << 31) +#define AT_XVATTR ATTR_XVATTR -#define ATTR_IATTR_MASK (ATTR_MODE | ATTR_UID | ATTR_GID | ATTR_SIZE | \ +#define ATTR_IATTR_MASK (ATTR_MODE | ATTR_UID | ATTR_GID | ATTR_SIZE | \ ATTR_ATIME | ATTR_MTIME | ATTR_CTIME | ATTR_FILE) -#define CRCREAT 0x01 -#define RMFILE 0x02 +#define CRCREAT 0x01 +#define RMFILE 0x02 -#define B_INVAL 0x01 -#define B_TRUNC 0x02 +#define B_INVAL 0x01 +#define B_TRUNC 0x02 -#define LOOKUP_DIR 0x01 -#define LOOKUP_XATTR 0x02 -#define CREATE_XATTR_DIR 0x04 -#define ATTR_NOACLCHECK 0x20 +#define LOOKUP_DIR 0x01 +#define LOOKUP_XATTR 0x02 +#define CREATE_XATTR_DIR 0x04 +#define ATTR_NOACLCHECK 0x20 typedef enum vtype { VNON = 0, @@ -121,8 +121,8 @@ typedef enum vtype { typedef struct vattr { enum vtype va_type; /* vnode type */ - u_int va_mask; /* attribute bit-mask */ - u_short va_mode; /* acc mode */ + uint_t va_mask; /* attribute bit-mask */ + ushort_t va_mode; /* acc mode */ uid_t va_uid; /* owner uid */ gid_t va_gid; /* owner gid */ long va_fsid; /* fs id */ @@ -168,12 +168,12 @@ void vn_free(vnode_t *vp); extern vtype_t vn_mode_to_vtype(mode_t); extern mode_t vn_vtype_to_mode(vtype_t); extern int vn_open(const char *path, uio_seg_t seg, int flags, int mode, - vnode_t **vpp, int x1, void *x2); + vnode_t **vpp, int x1, void *x2); extern int vn_openat(const char *path, uio_seg_t seg, int flags, int mode, - vnode_t **vpp, int x1, void *x2, vnode_t *vp, int fd); + vnode_t **vpp, int x1, void *x2, vnode_t *vp, int fd); extern int vn_rdwr(uio_rw_t uio, vnode_t *vp, void *addr, ssize_t len, - offset_t off, uio_seg_t seg, int x1, rlim64_t x2, - void *x3, ssize_t *residp); + offset_t off, uio_seg_t seg, int x1, rlim64_t x2, + void *x3, ssize_t *residp); extern int vn_close(vnode_t *vp, int flags, int x1, int x2, void *x3, void *x4); extern int vn_seek(vnode_t *vp, offset_t o, offset_t *op, void *ct); @@ -189,16 +189,16 @@ extern int vn_set_pwd(const char *filename); int spl_vn_init(void); void spl_vn_fini(void); -#define VOP_CLOSE vn_close -#define VOP_SEEK vn_seek -#define VOP_GETATTR vn_getattr -#define VOP_FSYNC vn_fsync -#define VOP_SPACE vn_space -#define VOP_PUTPAGE(vp, o, s, f, x1, x2) ((void)0) -#define vn_is_readonly(vp) 0 -#define getf vn_getf -#define releasef vn_releasef -#define areleasef vn_areleasef +#define VOP_CLOSE vn_close +#define VOP_SEEK vn_seek +#define VOP_GETATTR vn_getattr +#define VOP_FSYNC vn_fsync +#define VOP_SPACE vn_space +#define VOP_PUTPAGE(vp, o, s, f, x1, x2) ((void)0) +#define vn_is_readonly(vp) 0 +#define getf vn_getf +#define releasef vn_releasef +#define areleasef vn_areleasef extern vnode_t *rootdir; diff --git a/include/sys/zmod.h b/include/sys/zmod.h index d708c6612..5380bd6fd 100644 --- a/include/sys/zmod.h +++ b/include/sys/zmod.h @@ -20,7 +20,8 @@ * * You should have received a copy of the GNU General Public License along * with the SPL. If not, see . - ***************************************************************************** + * + * * z_compress_level/z_uncompress are nearly identical copies of the * compress2/uncompress functions provided by the official zlib package * available at http://zlib.net/. The only changes made we to slightly @@ -53,7 +54,7 @@ */ #ifndef _SPL_ZMOD_H -#define _SPL_ZMOD_H +#define _SPL_ZMOD_H #include #include diff --git a/include/sys/zone.h b/include/sys/zone.h index 4ed2a836f..b2efd13b8 100644 --- a/include/sys/zone.h +++ b/include/sys/zone.h @@ -23,7 +23,7 @@ */ #ifndef _SPL_ZONE_H -#define _SPL_ZONE_H +#define _SPL_ZONE_H #include diff --git a/include/unistd.h b/include/unistd.h index 24eab763c..d86de891c 100644 --- a/include/unistd.h +++ b/include/unistd.h @@ -23,6 +23,6 @@ */ #ifndef _SPL_UNISTD_H -#define _SPL_UNISTD_H +#define _SPL_UNISTD_H #endif /* SPL_UNISTD_H */ diff --git a/include/util/qsort.h b/include/util/qsort.h index 5dc0b446b..90ae6e4c2 100644 --- a/include/util/qsort.h +++ b/include/util/qsort.h @@ -23,10 +23,10 @@ */ #ifndef _SPL_QSORT_H -#define _SPL_QSORT_H +#define _SPL_QSORT_H #include -#define qsort(base, num, size, cmp) sort(base, num, size, cmp, NULL) +#define qsort(base, num, size, cmp) sort(base, num, size, cmp, NULL) #endif /* SPL_QSORT_H */ diff --git a/include/util/sscanf.h b/include/util/sscanf.h index 561918d65..9788234bb 100644 --- a/include/util/sscanf.h +++ b/include/util/sscanf.h @@ -23,6 +23,6 @@ */ #ifndef _SPL_UTIL_SSCANF_H -#define _SPL_UTIL_SSCANF_H +#define _SPL_UTIL_SSCANF_H #endif /* SPL_UTIL_SSCAN_H */ diff --git a/include/vm/anon.h b/include/vm/anon.h index a09f47c9f..706734ff3 100644 --- a/include/vm/anon.h +++ b/include/vm/anon.h @@ -23,6 +23,6 @@ */ #ifndef _SPL_VM_ANON_H -#define _SPL_VM_ANON_H +#define _SPL_VM_ANON_H #endif /* SPL_VM_ANON_H */ diff --git a/include/vm/pvn.h b/include/vm/pvn.h index df916e68f..1011e6cd8 100644 --- a/include/vm/pvn.h +++ b/include/vm/pvn.h @@ -23,6 +23,6 @@ */ #ifndef _SPL_VM_PVN_H -#define _SPL_VM_PVN_H +#define _SPL_VM_PVN_H #endif /* SPL_VM_PVN_H */ diff --git a/include/vm/seg_kmem.h b/include/vm/seg_kmem.h index 64b9688bd..a0ab7fce6 100644 --- a/include/vm/seg_kmem.h +++ b/include/vm/seg_kmem.h @@ -23,7 +23,7 @@ */ #ifndef _SPL_SEG_KMEM_H -#define _SPL_SEG_KMEM_H +#define _SPL_SEG_KMEM_H #include diff --git a/module/spl/spl-atomic.c b/module/spl/spl-atomic.c index 4c48684ba..47ed1886e 100644 --- a/module/spl/spl-atomic.c +++ b/module/spl/spl-atomic.c @@ -20,18 +20,12 @@ * * You should have received a copy of the GNU General Public License along * with the SPL. If not, see . - ***************************************************************************** + * * Solaris Porting Layer (SPL) Atomic Implementation. */ #include -#ifdef DEBUG_SUBSYSTEM -#undef DEBUG_SUBSYSTEM -#endif - -#define DEBUG_SUBSYSTEM S_ATOMIC - #ifdef ATOMIC_SPINLOCK /* Global atomic lock declarations */ DEFINE_SPINLOCK(atomic32_lock); diff --git a/module/spl/spl-condvar.c b/module/spl/spl-condvar.c index 4778fb256..f0060bbdc 100644 --- a/module/spl/spl-condvar.c +++ b/module/spl/spl-condvar.c @@ -335,8 +335,8 @@ __cv_timedwait_hires(kcondvar_t *cvp, kmutex_t *mp, hrtime_t expire_time, * Compatibility wrapper for the cv_timedwait_hires() Illumos interface. */ static clock_t -cv_timedwait_hires_common(kcondvar_t *cvp, kmutex_t *mp, hrtime_t tim, hrtime_t res, - int flag, int state) +cv_timedwait_hires_common(kcondvar_t *cvp, kmutex_t *mp, hrtime_t tim, + hrtime_t res, int flag, int state) { if (res > 1) { /* @@ -363,8 +363,8 @@ cv_timedwait_hires(kcondvar_t *cvp, kmutex_t *mp, hrtime_t tim, hrtime_t res, EXPORT_SYMBOL(cv_timedwait_hires); clock_t -cv_timedwait_sig_hires(kcondvar_t *cvp, kmutex_t *mp, hrtime_t tim, hrtime_t res, - int flag) +cv_timedwait_sig_hires(kcondvar_t *cvp, kmutex_t *mp, hrtime_t tim, + hrtime_t res, int flag) { return (cv_timedwait_hires_common(cvp, mp, tim, res, flag, TASK_INTERRUPTIBLE)); diff --git a/module/spl/spl-cred.c b/module/spl/spl-cred.c index f4431db7f..ea3e903f9 100644 --- a/module/spl/spl-cred.c +++ b/module/spl/spl-cred.c @@ -20,18 +20,12 @@ * * You should have received a copy of the GNU General Public License along * with the SPL. If not, see . - ***************************************************************************** + * * Solaris Porting Layer (SPL) Credential Implementation. */ #include -#ifdef DEBUG_SUBSYSTEM -#undef DEBUG_SUBSYSTEM -#endif - -#define DEBUG_SUBSYSTEM S_CRED - static int #ifdef HAVE_KUIDGID_T cr_groups_search(const struct group_info *group_info, kgid_t grp) @@ -43,7 +37,7 @@ cr_groups_search(const struct group_info *group_info, gid_t grp) int cmp; if (!group_info) - return 0; + return (0); left = 0; right = group_info->ngroups; @@ -57,16 +51,16 @@ cr_groups_search(const struct group_info *group_info, gid_t grp) else if (cmp < 0) right = mid; else - return 1; + return (1); } - return 0; + return (0); } /* Hold a reference on the credential */ void crhold(cred_t *cr) { - (void)get_cred((const cred_t *)cr); + (void) get_cred((const cred_t *)cr); } /* Free a reference on the credential */ @@ -96,7 +90,7 @@ crgetngroups(const cred_t *cr) rc = NGROUPS_PER_BLOCK; } #endif - return rc; + return (rc); } /* @@ -119,7 +113,7 @@ crgetgroups(const cred_t *cr) if (gi->nblocks > 0) gids = KGIDP_TO_SGIDP(gi->blocks[0]); #endif - return gids; + return (gids); } /* Check if the passed gid is available in supplied credential. */ @@ -132,63 +126,63 @@ groupmember(gid_t gid, const cred_t *cr) gi = cr->group_info; rc = cr_groups_search(gi, SGID_TO_KGID(gid)); - return rc; + return (rc); } /* Return the effective user id */ uid_t crgetuid(const cred_t *cr) { - return KUID_TO_SUID(cr->euid); + return (KUID_TO_SUID(cr->euid)); } /* Return the real user id */ uid_t crgetruid(const cred_t *cr) { - return KUID_TO_SUID(cr->uid); + return (KUID_TO_SUID(cr->uid)); } /* Return the saved user id */ uid_t crgetsuid(const cred_t *cr) { - return KUID_TO_SUID(cr->suid); + return (KUID_TO_SUID(cr->suid)); } /* Return the filesystem user id */ uid_t crgetfsuid(const cred_t *cr) { - return KUID_TO_SUID(cr->fsuid); + return (KUID_TO_SUID(cr->fsuid)); } /* Return the effective group id */ gid_t crgetgid(const cred_t *cr) { - return KGID_TO_SGID(cr->egid); + return (KGID_TO_SGID(cr->egid)); } /* Return the real group id */ gid_t crgetrgid(const cred_t *cr) { - return KGID_TO_SGID(cr->gid); + return (KGID_TO_SGID(cr->gid)); } /* Return the saved group id */ gid_t crgetsgid(const cred_t *cr) { - return KGID_TO_SGID(cr->sgid); + return (KGID_TO_SGID(cr->sgid)); } /* Return the filesystem group id */ gid_t crgetfsgid(const cred_t *cr) { - return KGID_TO_SGID(cr->fsgid); + return (KGID_TO_SGID(cr->fsgid)); } EXPORT_SYMBOL(crhold); diff --git a/module/spl/spl-err.c b/module/spl/spl-err.c index 28c5258ef..33a8df898 100644 --- a/module/spl/spl-err.c +++ b/module/spl/spl-err.c @@ -20,7 +20,7 @@ * * You should have received a copy of the GNU General Public License along * with the SPL. If not, see . - ***************************************************************************** + * * Solaris Porting Layer (SPL) Error Implementation. */ @@ -36,8 +36,7 @@ */ unsigned int spl_panic_halt; module_param(spl_panic_halt, uint, 0644); -MODULE_PARM_DESC(spl_panic_halt, - "Cause kernel panic on assertion failures"); +MODULE_PARM_DESC(spl_panic_halt, "Cause kernel panic on assertion failures"); /* * Limit the number of stack traces dumped to not more than 5 every diff --git a/module/spl/spl-generic.c b/module/spl/spl-generic.c index b5c9a9aef..efd901094 100644 --- a/module/spl/spl-generic.c +++ b/module/spl/spl-generic.c @@ -20,7 +20,7 @@ * * You should have received a copy of the GNU General Public License along * with the SPL. If not, see . - ***************************************************************************** + * * Solaris Porting Layer (SPL) Generic Implementation. */ @@ -109,13 +109,14 @@ spl_rand_next(uint64_t *s) { static inline void spl_rand_jump(uint64_t *s) { - static const uint64_t JUMP[] = { 0x8a5cd789635d2dff, 0x121fd2155c472f96 }; + static const uint64_t JUMP[] = + { 0x8a5cd789635d2dff, 0x121fd2155c472f96 }; uint64_t s0 = 0; uint64_t s1 = 0; int i, b; - for(i = 0; i < sizeof JUMP / sizeof *JUMP; i++) - for(b = 0; b < 64; b++) { + for (i = 0; i < sizeof (JUMP) / sizeof (*JUMP); i++) + for (b = 0; b < 64; b++) { if (JUMP[i] & 1ULL << b) { s0 ^= s[0]; s1 ^= s[1]; @@ -187,16 +188,16 @@ nlz64(uint64_t x) { register int n = 0; if (x == 0) - return 64; + return (64); - if (x <= 0x00000000FFFFFFFFULL) {n = n + 32; x = x << 32;} - if (x <= 0x0000FFFFFFFFFFFFULL) {n = n + 16; x = x << 16;} - if (x <= 0x00FFFFFFFFFFFFFFULL) {n = n + 8; x = x << 8;} - if (x <= 0x0FFFFFFFFFFFFFFFULL) {n = n + 4; x = x << 4;} - if (x <= 0x3FFFFFFFFFFFFFFFULL) {n = n + 2; x = x << 2;} - if (x <= 0x7FFFFFFFFFFFFFFFULL) {n = n + 1;} + if (x <= 0x00000000FFFFFFFFULL) { n = n + 32; x = x << 32; } + if (x <= 0x0000FFFFFFFFFFFFULL) { n = n + 16; x = x << 16; } + if (x <= 0x00FFFFFFFFFFFFFFULL) { n = n + 8; x = x << 8; } + if (x <= 0x0FFFFFFFFFFFFFFFULL) { n = n + 4; x = x << 4; } + if (x <= 0x3FFFFFFFFFFFFFFFULL) { n = n + 2; x = x << 2; } + if (x <= 0x7FFFFFFFFFFFFFFFULL) { n = n + 1; } - return n; + return (n); } /* @@ -207,7 +208,7 @@ static inline uint64_t __div_u64(uint64_t u, uint32_t v) { (void) do_div(u, v); - return u; + return (u); } /* @@ -227,7 +228,7 @@ __udivdi3(uint64_t u, uint64_t v) if (v >> 32 == 0) { // If v < 2**32: if (u >> 32 < v) { // If u/v cannot overflow, - return __div_u64(u, v); // just do one division. + return (__div_u64(u, v)); // just do one division. } else { // If u/v would overflow: u1 = u >> 32; // Break u into two halves. u0 = u & 0xFFFFFFFF; @@ -235,7 +236,7 @@ __udivdi3(uint64_t u, uint64_t v) k = u1 - q1 * v; // First remainder, < v. u0 += (k << 32); q0 = __div_u64(u0, v); // Seconds quotient digit. - return (q1 << 32) + q0; + return ((q1 << 32) + q0); } } else { // If v >= 2**32: n = nlz64(v); // 0 <= n <= 31. @@ -249,7 +250,7 @@ __udivdi3(uint64_t u, uint64_t v) if ((u - q0 * v) >= v) q0 = q0 + 1; // Now q0 is correct. - return q0; + return (q0); } } EXPORT_SYMBOL(__udivdi3); @@ -263,7 +264,7 @@ __divdi3(int64_t u, int64_t v) int64_t q, t; q = __udivdi3(abs64(u), abs64(v)); t = (u ^ v) >> 63; // If u, v have different - return (q ^ t) - t; // signs, negate q. + return ((q ^ t) - t); // signs, negate q. } EXPORT_SYMBOL(__divdi3); @@ -344,9 +345,11 @@ __aeabi_uldivmod(uint64_t u, uint64_t v) register uint32_t r2 asm("r2") = (mod & 0xFFFFFFFF); register uint32_t r3 asm("r3") = (mod >> 32); + /* BEGIN CSTYLED */ asm volatile("" : "+r"(r0), "+r"(r1), "+r"(r2),"+r"(r3) /* output */ : "r"(r0), "r"(r1), "r"(r2), "r"(r3)); /* input */ + /* END CSTYLED */ return; /* r0; */ } @@ -367,9 +370,11 @@ __aeabi_ldivmod(int64_t u, int64_t v) register uint32_t r2 asm("r2") = (mod & 0xFFFFFFFF); register uint32_t r3 asm("r3") = (mod >> 32); + /* BEGIN CSTYLED */ asm volatile("" : "+r"(r0), "+r"(r1), "+r"(r2),"+r"(r3) /* output */ : "r"(r0), "r"(r1), "r"(r2), "r"(r3)); /* input */ + /* END CSTYLED */ return; /* r0; */ } @@ -378,7 +383,8 @@ EXPORT_SYMBOL(__aeabi_ldivmod); #endif /* __arm || __arm__ */ #endif /* BITS_PER_LONG */ -/* NOTE: The strtoxx behavior is solely based on my reading of the Solaris +/* + * NOTE: The strtoxx behavior is solely based on my reading of the Solaris * ddi_strtol(9F) man page. I have not verified the behavior of these * functions against their Solaris counterparts. It is possible that I * may have misinterpreted the man page or the man page is incorrect. @@ -388,28 +394,28 @@ int ddi_strtol(const char *, char **, int, long *); int ddi_strtoull(const char *, char **, int, unsigned long long *); int ddi_strtoll(const char *, char **, int, long long *); -#define define_ddi_strtoux(type, valtype) \ +#define define_ddi_strtoux(type, valtype) \ int ddi_strtou##type(const char *str, char **endptr, \ - int base, valtype *result) \ + int base, valtype *result) \ { \ valtype last_value, value = 0; \ char *ptr = (char *)str; \ int flag = 1, digit; \ \ if (strlen(ptr) == 0) \ - return EINVAL; \ + return (EINVAL); \ \ /* Auto-detect base based on prefix */ \ if (!base) { \ if (str[0] == '0') { \ - if (tolower(str[1])=='x' && isxdigit(str[2])) { \ + if (tolower(str[1]) == 'x' && isxdigit(str[2])) { \ base = 16; /* hex */ \ ptr += 2; \ } else if (str[1] >= '0' && str[1] < 8) { \ base = 8; /* octal */ \ ptr += 1; \ } else { \ - return EINVAL; \ + return (EINVAL); \ } \ } else { \ base = 10; /* decimal */ \ @@ -430,7 +436,7 @@ int ddi_strtou##type(const char *str, char **endptr, \ last_value = value; \ value = value * base + digit; \ if (last_value > value) /* Overflow */ \ - return ERANGE; \ + return (ERANGE); \ \ flag = 1; \ ptr++; \ @@ -442,12 +448,12 @@ int ddi_strtou##type(const char *str, char **endptr, \ if (endptr) \ *endptr = (char *)(flag ? ptr : str); \ \ - return 0; \ + return (0); \ } \ -#define define_ddi_strtox(type, valtype) \ +#define define_ddi_strtox(type, valtype) \ int ddi_strto##type(const char *str, char **endptr, \ - int base, valtype *result) \ + int base, valtype *result) \ { \ int rc; \ \ @@ -463,7 +469,7 @@ int ddi_strto##type(const char *str, char **endptr, \ rc = ddi_strtou##type(str, endptr, base, result); \ } \ \ - return rc; \ + return (rc); \ } define_ddi_strtoux(l, unsigned long) @@ -482,10 +488,10 @@ ddi_copyin(const void *from, void *to, size_t len, int flags) /* Fake ioctl() issued by kernel, 'from' is a kernel address */ if (flags & FKIOCTL) { memcpy(to, from, len); - return 0; + return (0); } - return copyin(from, to, len); + return (copyin(from, to, len)); } EXPORT_SYMBOL(ddi_copyin); @@ -495,10 +501,10 @@ ddi_copyout(const void *from, void *to, size_t len, int flags) /* Fake ioctl() issued by kernel, 'from' is a kernel address */ if (flags & FKIOCTL) { memcpy(to, from, len); - return 0; + return (0); } - return copyout(from, to, len); + return (copyout(from, to, len)); } EXPORT_SYMBOL(ddi_copyout); @@ -559,7 +565,7 @@ hostid_read(uint32_t *hostid) return (error); } - if (size < sizeof(HW_HOSTID_MASK)) { + if (size < sizeof (HW_HOSTID_MASK)) { kobj_close_file(file); return (EINVAL); } @@ -568,7 +574,7 @@ hostid_read(uint32_t *hostid) * Read directly into the variable like eglibc does. * Short reads are okay; native behavior is preserved. */ - error = kobj_read_file(file, (char *)&value, sizeof(value), 0); + error = kobj_read_file(file, (char *)&value, sizeof (value), 0); if (error < 0) { kobj_close_file(file); return (EIO); @@ -578,7 +584,7 @@ hostid_read(uint32_t *hostid) *hostid = (value & HW_HOSTID_MASK); kobj_close_file(file); - return 0; + return (0); } /* @@ -704,7 +710,7 @@ spl_init(void) goto out10; printk(KERN_NOTICE "SPL: Loaded module v%s-%s%s\n", SPL_META_VERSION, - SPL_META_RELEASE, SPL_DEBUG_STR); + SPL_META_RELEASE, SPL_DEBUG_STR); return (rc); out10: @@ -727,8 +733,8 @@ out2: spl_kvmem_fini(); out1: printk(KERN_NOTICE "SPL: Failed to Load Solaris Porting Layer " - "v%s-%s%s, rc = %d\n", SPL_META_VERSION, SPL_META_RELEASE, - SPL_DEBUG_STR, rc); + "v%s-%s%s, rc = %d\n", SPL_META_VERSION, SPL_META_RELEASE, + SPL_DEBUG_STR, rc); return (rc); } @@ -737,7 +743,7 @@ static void __exit spl_fini(void) { printk(KERN_NOTICE "SPL: Unloaded module v%s-%s%s\n", - SPL_META_VERSION, SPL_META_RELEASE, SPL_DEBUG_STR); + SPL_META_VERSION, SPL_META_RELEASE, SPL_DEBUG_STR); spl_zlib_fini(); spl_kstat_fini(); spl_proc_fini(); diff --git a/module/spl/spl-kmem-cache.c b/module/spl/spl-kmem-cache.c index 36686692b..e4bcdd825 100644 --- a/module/spl/spl-kmem-cache.c +++ b/module/spl/spl-kmem-cache.c @@ -134,8 +134,8 @@ MODULE_PARM_DESC(spl_kmem_cache_slab_limit, * have been deemed costly by the kernel. */ unsigned int spl_kmem_cache_kmem_limit = - ((1 << (PAGE_ALLOC_COSTLY_ORDER - 1)) * PAGE_SIZE) / - SPL_KMEM_CACHE_OBJ_PER_SLAB; + ((1 << (PAGE_ALLOC_COSTLY_ORDER - 1)) * PAGE_SIZE) / + SPL_KMEM_CACHE_OBJ_PER_SLAB; module_param(spl_kmem_cache_kmem_limit, uint, 0644); MODULE_PARM_DESC(spl_kmem_cache_kmem_limit, "Objects less than N bytes use the kmalloc"); @@ -1000,15 +1000,15 @@ spl_kmem_cache_create(char *name, size_t size, size_t align, #endif #if defined(HAVE_KMEM_CACHE_CREATE_USERCOPY) - /* - * Newer grsec patchset uses kmem_cache_create_usercopy() - * instead of SLAB_USERCOPY flag - */ - skc->skc_linux_cache = kmem_cache_create_usercopy( - skc->skc_name, size, align, slabflags, 0, size, NULL); + /* + * Newer grsec patchset uses kmem_cache_create_usercopy() + * instead of SLAB_USERCOPY flag + */ + skc->skc_linux_cache = kmem_cache_create_usercopy( + skc->skc_name, size, align, slabflags, 0, size, NULL); #else - skc->skc_linux_cache = kmem_cache_create( - skc->skc_name, size, align, slabflags, NULL); + skc->skc_linux_cache = kmem_cache_create( + skc->skc_name, size, align, slabflags, NULL); #endif if (skc->skc_linux_cache == NULL) { rc = ENOMEM; @@ -1186,7 +1186,7 @@ spl_cache_grow_work(void *data) spl_kmem_alloc_t *ska = (spl_kmem_alloc_t *)data; spl_kmem_cache_t *skc = ska->ska_cache; - (void)__spl_cache_grow(skc, ska->ska_flags); + (void) __spl_cache_grow(skc, ska->ska_flags); atomic_dec(&skc->skc_ref); smp_mb__before_atomic(); diff --git a/module/spl/spl-kmem.c b/module/spl/spl-kmem.c index 41bec75d2..bf9c6b179 100644 --- a/module/spl/spl-kmem.c +++ b/module/spl/spl-kmem.c @@ -383,7 +383,7 @@ spl_kmem_free_track(const void *ptr, size_t size) { kmem_debug_t *dptr; - /* Ignore NULL pointer since we haven't tracked it at all*/ + /* Ignore NULL pointer since we haven't tracked it at all */ if (ptr == NULL) return; diff --git a/module/spl/spl-kobj.c b/module/spl/spl-kobj.c index 6191163a8..7019369bd 100644 --- a/module/spl/spl-kobj.c +++ b/module/spl/spl-kobj.c @@ -20,7 +20,7 @@ * * You should have received a copy of the GNU General Public License along * with the SPL. If not, see . - ***************************************************************************** + * * Solaris Porting Layer (SPL) Kobj Implementation. */ @@ -33,7 +33,7 @@ kobj_open_file(const char *name) vnode_t *vp; int rc; - file = kmalloc(sizeof(_buf_t), kmem_flags_convert(KM_SLEEP)); + file = kmalloc(sizeof (_buf_t), kmem_flags_convert(KM_SLEEP)); if (file == NULL) return ((_buf_t *)-1UL); @@ -52,7 +52,7 @@ void kobj_close_file(struct _buf *file) { VOP_CLOSE(file->vp, 0, 0, 0, 0, 0); - kfree(file); + kfree(file); } /* kobj_close_file() */ EXPORT_SYMBOL(kobj_close_file); @@ -72,15 +72,15 @@ EXPORT_SYMBOL(kobj_read_file); int kobj_get_filesize(struct _buf *file, uint64_t *size) { - vattr_t vap; + vattr_t vap; int rc; rc = VOP_GETATTR(file->vp, &vap, 0, 0, NULL); if (rc) return (rc); - *size = vap.va_size; + *size = vap.va_size; - return (rc); + return (rc); } /* kobj_get_filesize() */ EXPORT_SYMBOL(kobj_get_filesize); diff --git a/module/spl/spl-kstat.c b/module/spl/spl-kstat.c index 4517824e7..70c0c98f8 100644 --- a/module/spl/spl-kstat.c +++ b/module/spl/spl-kstat.c @@ -20,7 +20,7 @@ * * You should have received a copy of the GNU General Public License along * with the SPL. If not, see . - ***************************************************************************** + * * Solaris Porting Layer (SPL) Kstat Implementation. */ @@ -30,7 +30,7 @@ #include #ifndef HAVE_PDE_DATA -#define PDE_DATA(x) (PDE(x)->data) +#define PDE_DATA(x) (PDE(x)->data) #endif static kmutex_t kstat_module_lock; @@ -41,13 +41,13 @@ static int kstat_resize_raw(kstat_t *ksp) { if (ksp->ks_raw_bufsize == KSTAT_RAW_MAX) - return ENOMEM; + return (ENOMEM); vmem_free(ksp->ks_raw_buf, ksp->ks_raw_bufsize); ksp->ks_raw_bufsize = MIN(ksp->ks_raw_bufsize * 2, KSTAT_RAW_MAX); ksp->ks_raw_buf = vmem_alloc(ksp->ks_raw_bufsize, KM_SLEEP); - return 0; + return (0); } void @@ -119,210 +119,212 @@ EXPORT_SYMBOL(kstat_runq_exit); static int kstat_seq_show_headers(struct seq_file *f) { - kstat_t *ksp = (kstat_t *)f->private; + kstat_t *ksp = (kstat_t *)f->private; int rc = 0; - ASSERT(ksp->ks_magic == KS_MAGIC); + ASSERT(ksp->ks_magic == KS_MAGIC); - seq_printf(f, "%d %d 0x%02x %d %d %lld %lld\n", - ksp->ks_kid, ksp->ks_type, ksp->ks_flags, - ksp->ks_ndata, (int)ksp->ks_data_size, - ksp->ks_crtime, ksp->ks_snaptime); + seq_printf(f, "%d %d 0x%02x %d %d %lld %lld\n", + ksp->ks_kid, ksp->ks_type, ksp->ks_flags, + ksp->ks_ndata, (int)ksp->ks_data_size, + ksp->ks_crtime, ksp->ks_snaptime); switch (ksp->ks_type) { - case KSTAT_TYPE_RAW: + case KSTAT_TYPE_RAW: restart: - if (ksp->ks_raw_ops.headers) { - rc = ksp->ks_raw_ops.headers( - ksp->ks_raw_buf, ksp->ks_raw_bufsize); + if (ksp->ks_raw_ops.headers) { + rc = ksp->ks_raw_ops.headers( + ksp->ks_raw_buf, ksp->ks_raw_bufsize); if (rc == ENOMEM && !kstat_resize_raw(ksp)) goto restart; if (!rc) - seq_puts(f, ksp->ks_raw_buf); - } else { - seq_printf(f, "raw data\n"); - } - break; - case KSTAT_TYPE_NAMED: - seq_printf(f, "%-31s %-4s %s\n", - "name", "type", "data"); - break; - case KSTAT_TYPE_INTR: - seq_printf(f, "%-8s %-8s %-8s %-8s %-8s\n", - "hard", "soft", "watchdog", - "spurious", "multsvc"); - break; - case KSTAT_TYPE_IO: - seq_printf(f, - "%-8s %-8s %-8s %-8s %-8s %-8s " - "%-8s %-8s %-8s %-8s %-8s %-8s\n", - "nread", "nwritten", "reads", "writes", - "wtime", "wlentime", "wupdate", - "rtime", "rlentime", "rupdate", - "wcnt", "rcnt"); - break; - case KSTAT_TYPE_TIMER: - seq_printf(f, - "%-31s %-8s " - "%-8s %-8s %-8s %-8s %-8s\n", - "name", "events", "elapsed", - "min", "max", "start", "stop"); - break; - default: - PANIC("Undefined kstat type %d\n", ksp->ks_type); - } - - return -rc; + seq_puts(f, ksp->ks_raw_buf); + } else { + seq_printf(f, "raw data\n"); + } + break; + case KSTAT_TYPE_NAMED: + seq_printf(f, "%-31s %-4s %s\n", + "name", "type", "data"); + break; + case KSTAT_TYPE_INTR: + seq_printf(f, "%-8s %-8s %-8s %-8s %-8s\n", + "hard", "soft", "watchdog", + "spurious", "multsvc"); + break; + case KSTAT_TYPE_IO: + seq_printf(f, + "%-8s %-8s %-8s %-8s %-8s %-8s " + "%-8s %-8s %-8s %-8s %-8s %-8s\n", + "nread", "nwritten", "reads", "writes", + "wtime", "wlentime", "wupdate", + "rtime", "rlentime", "rupdate", + "wcnt", "rcnt"); + break; + case KSTAT_TYPE_TIMER: + seq_printf(f, + "%-31s %-8s " + "%-8s %-8s %-8s %-8s %-8s\n", + "name", "events", "elapsed", + "min", "max", "start", "stop"); + break; + default: + PANIC("Undefined kstat type %d\n", ksp->ks_type); + } + + return (-rc); } static int kstat_seq_show_raw(struct seq_file *f, unsigned char *p, int l) { - int i, j; + int i, j; - for (i = 0; ; i++) { - seq_printf(f, "%03x:", i); + for (i = 0; ; i++) { + seq_printf(f, "%03x:", i); - for (j = 0; j < 16; j++) { - if (i * 16 + j >= l) { - seq_printf(f, "\n"); - goto out; - } + for (j = 0; j < 16; j++) { + if (i * 16 + j >= l) { + seq_printf(f, "\n"); + goto out; + } - seq_printf(f, " %02x", (unsigned char)p[i * 16 + j]); - } - seq_printf(f, "\n"); - } + seq_printf(f, " %02x", (unsigned char)p[i * 16 + j]); + } + seq_printf(f, "\n"); + } out: - return 0; + return (0); } static int kstat_seq_show_named(struct seq_file *f, kstat_named_t *knp) { - seq_printf(f, "%-31s %-4d ", knp->name, knp->data_type); - - switch (knp->data_type) { - case KSTAT_DATA_CHAR: - knp->value.c[15] = '\0'; /* NULL terminate */ - seq_printf(f, "%-16s", knp->value.c); - break; - /* XXX - We need to be more careful able what tokens are - * used for each arch, for now this is correct for x86_64. - */ - case KSTAT_DATA_INT32: - seq_printf(f, "%d", knp->value.i32); - break; - case KSTAT_DATA_UINT32: - seq_printf(f, "%u", knp->value.ui32); - break; - case KSTAT_DATA_INT64: - seq_printf(f, "%lld", (signed long long)knp->value.i64); - break; - case KSTAT_DATA_UINT64: - seq_printf(f, "%llu", (unsigned long long)knp->value.ui64); - break; - case KSTAT_DATA_LONG: - seq_printf(f, "%ld", knp->value.l); - break; - case KSTAT_DATA_ULONG: - seq_printf(f, "%lu", knp->value.ul); - break; - case KSTAT_DATA_STRING: - KSTAT_NAMED_STR_PTR(knp) - [KSTAT_NAMED_STR_BUFLEN(knp)-1] = '\0'; - seq_printf(f, "%s", KSTAT_NAMED_STR_PTR(knp)); - break; - default: - PANIC("Undefined kstat data type %d\n", knp->data_type); - } - - seq_printf(f, "\n"); - - return 0; + seq_printf(f, "%-31s %-4d ", knp->name, knp->data_type); + + switch (knp->data_type) { + case KSTAT_DATA_CHAR: + knp->value.c[15] = '\0'; /* NULL terminate */ + seq_printf(f, "%-16s", knp->value.c); + break; + /* + * NOTE - We need to be more careful able what tokens are + * used for each arch, for now this is correct for x86_64. + */ + case KSTAT_DATA_INT32: + seq_printf(f, "%d", knp->value.i32); + break; + case KSTAT_DATA_UINT32: + seq_printf(f, "%u", knp->value.ui32); + break; + case KSTAT_DATA_INT64: + seq_printf(f, "%lld", (signed long long)knp->value.i64); + break; + case KSTAT_DATA_UINT64: + seq_printf(f, "%llu", + (unsigned long long)knp->value.ui64); + break; + case KSTAT_DATA_LONG: + seq_printf(f, "%ld", knp->value.l); + break; + case KSTAT_DATA_ULONG: + seq_printf(f, "%lu", knp->value.ul); + break; + case KSTAT_DATA_STRING: + KSTAT_NAMED_STR_PTR(knp) + [KSTAT_NAMED_STR_BUFLEN(knp)-1] = '\0'; + seq_printf(f, "%s", KSTAT_NAMED_STR_PTR(knp)); + break; + default: + PANIC("Undefined kstat data type %d\n", knp->data_type); + } + + seq_printf(f, "\n"); + + return (0); } static int kstat_seq_show_intr(struct seq_file *f, kstat_intr_t *kip) { - seq_printf(f, "%-8u %-8u %-8u %-8u %-8u\n", - kip->intrs[KSTAT_INTR_HARD], - kip->intrs[KSTAT_INTR_SOFT], - kip->intrs[KSTAT_INTR_WATCHDOG], - kip->intrs[KSTAT_INTR_SPURIOUS], - kip->intrs[KSTAT_INTR_MULTSVC]); - - return 0; + seq_printf(f, "%-8u %-8u %-8u %-8u %-8u\n", + kip->intrs[KSTAT_INTR_HARD], + kip->intrs[KSTAT_INTR_SOFT], + kip->intrs[KSTAT_INTR_WATCHDOG], + kip->intrs[KSTAT_INTR_SPURIOUS], + kip->intrs[KSTAT_INTR_MULTSVC]); + + return (0); } static int kstat_seq_show_io(struct seq_file *f, kstat_io_t *kip) { - seq_printf(f, - "%-8llu %-8llu %-8u %-8u %-8lld %-8lld " - "%-8lld %-8lld %-8lld %-8lld %-8u %-8u\n", - kip->nread, kip->nwritten, - kip->reads, kip->writes, - kip->wtime, kip->wlentime, kip->wlastupdate, - kip->rtime, kip->rlentime, kip->rlastupdate, - kip->wcnt, kip->rcnt); - - return 0; + seq_printf(f, + "%-8llu %-8llu %-8u %-8u %-8lld %-8lld " + "%-8lld %-8lld %-8lld %-8lld %-8u %-8u\n", + kip->nread, kip->nwritten, + kip->reads, kip->writes, + kip->wtime, kip->wlentime, kip->wlastupdate, + kip->rtime, kip->rlentime, kip->rlastupdate, + kip->wcnt, kip->rcnt); + + return (0); } static int kstat_seq_show_timer(struct seq_file *f, kstat_timer_t *ktp) { - seq_printf(f, - "%-31s %-8llu %-8lld %-8lld %-8lld %-8lld %-8lld\n", - ktp->name, ktp->num_events, ktp->elapsed_time, - ktp->min_time, ktp->max_time, - ktp->start_time, ktp->stop_time); + seq_printf(f, + "%-31s %-8llu %-8lld %-8lld %-8lld %-8lld %-8lld\n", + ktp->name, ktp->num_events, ktp->elapsed_time, + ktp->min_time, ktp->max_time, + ktp->start_time, ktp->stop_time); - return 0; + return (0); } static int kstat_seq_show(struct seq_file *f, void *p) { - kstat_t *ksp = (kstat_t *)f->private; - int rc = 0; + kstat_t *ksp = (kstat_t *)f->private; + int rc = 0; - ASSERT(ksp->ks_magic == KS_MAGIC); + ASSERT(ksp->ks_magic == KS_MAGIC); switch (ksp->ks_type) { - case KSTAT_TYPE_RAW: + case KSTAT_TYPE_RAW: restart: - if (ksp->ks_raw_ops.data) { - rc = ksp->ks_raw_ops.data( + if (ksp->ks_raw_ops.data) { + rc = ksp->ks_raw_ops.data( ksp->ks_raw_buf, ksp->ks_raw_bufsize, p); if (rc == ENOMEM && !kstat_resize_raw(ksp)) goto restart; if (!rc) - seq_puts(f, ksp->ks_raw_buf); - } else { - ASSERT(ksp->ks_ndata == 1); - rc = kstat_seq_show_raw(f, ksp->ks_data, - ksp->ks_data_size); - } - break; - case KSTAT_TYPE_NAMED: - rc = kstat_seq_show_named(f, (kstat_named_t *)p); - break; - case KSTAT_TYPE_INTR: - rc = kstat_seq_show_intr(f, (kstat_intr_t *)p); - break; - case KSTAT_TYPE_IO: - rc = kstat_seq_show_io(f, (kstat_io_t *)p); - break; - case KSTAT_TYPE_TIMER: - rc = kstat_seq_show_timer(f, (kstat_timer_t *)p); - break; - default: - PANIC("Undefined kstat type %d\n", ksp->ks_type); - } - - return -rc; + seq_puts(f, ksp->ks_raw_buf); + } else { + ASSERT(ksp->ks_ndata == 1); + rc = kstat_seq_show_raw(f, ksp->ks_data, + ksp->ks_data_size); + } + break; + case KSTAT_TYPE_NAMED: + rc = kstat_seq_show_named(f, (kstat_named_t *)p); + break; + case KSTAT_TYPE_INTR: + rc = kstat_seq_show_intr(f, (kstat_intr_t *)p); + break; + case KSTAT_TYPE_IO: + rc = kstat_seq_show_io(f, (kstat_io_t *)p); + break; + case KSTAT_TYPE_TIMER: + rc = kstat_seq_show_timer(f, (kstat_timer_t *)p); + break; + default: + PANIC("Undefined kstat type %d\n", ksp->ks_type); + } + + return (-rc); } int @@ -333,79 +335,79 @@ kstat_default_update(kstat_t *ksp, int rw) if (rw == KSTAT_WRITE) return (EACCES); - return 0; + return (0); } static void * kstat_seq_data_addr(kstat_t *ksp, loff_t n) { - void *rc = NULL; + void *rc = NULL; switch (ksp->ks_type) { - case KSTAT_TYPE_RAW: - if (ksp->ks_raw_ops.addr) - rc = ksp->ks_raw_ops.addr(ksp, n); - else - rc = ksp->ks_data; - break; - case KSTAT_TYPE_NAMED: - rc = ksp->ks_data + n * sizeof(kstat_named_t); - break; - case KSTAT_TYPE_INTR: - rc = ksp->ks_data + n * sizeof(kstat_intr_t); - break; - case KSTAT_TYPE_IO: - rc = ksp->ks_data + n * sizeof(kstat_io_t); - break; - case KSTAT_TYPE_TIMER: - rc = ksp->ks_data + n * sizeof(kstat_timer_t); - break; - default: - PANIC("Undefined kstat type %d\n", ksp->ks_type); - } - - return (rc); + case KSTAT_TYPE_RAW: + if (ksp->ks_raw_ops.addr) + rc = ksp->ks_raw_ops.addr(ksp, n); + else + rc = ksp->ks_data; + break; + case KSTAT_TYPE_NAMED: + rc = ksp->ks_data + n * sizeof (kstat_named_t); + break; + case KSTAT_TYPE_INTR: + rc = ksp->ks_data + n * sizeof (kstat_intr_t); + break; + case KSTAT_TYPE_IO: + rc = ksp->ks_data + n * sizeof (kstat_io_t); + break; + case KSTAT_TYPE_TIMER: + rc = ksp->ks_data + n * sizeof (kstat_timer_t); + break; + default: + PANIC("Undefined kstat type %d\n", ksp->ks_type); + } + + return (rc); } static void * kstat_seq_start(struct seq_file *f, loff_t *pos) { - loff_t n = *pos; - kstat_t *ksp = (kstat_t *)f->private; - ASSERT(ksp->ks_magic == KS_MAGIC); + loff_t n = *pos; + kstat_t *ksp = (kstat_t *)f->private; + ASSERT(ksp->ks_magic == KS_MAGIC); mutex_enter(ksp->ks_lock); - if (ksp->ks_type == KSTAT_TYPE_RAW) { - ksp->ks_raw_bufsize = PAGE_SIZE; - ksp->ks_raw_buf = vmem_alloc(ksp->ks_raw_bufsize, KM_SLEEP); - } + if (ksp->ks_type == KSTAT_TYPE_RAW) { + ksp->ks_raw_bufsize = PAGE_SIZE; + ksp->ks_raw_buf = vmem_alloc(ksp->ks_raw_bufsize, KM_SLEEP); + } - /* Dynamically update kstat, on error existing kstats are used */ - (void) ksp->ks_update(ksp, KSTAT_READ); + /* Dynamically update kstat, on error existing kstats are used */ + (void) ksp->ks_update(ksp, KSTAT_READ); ksp->ks_snaptime = gethrtime(); - if (!n && kstat_seq_show_headers(f)) + if (!n && kstat_seq_show_headers(f)) return (NULL); - if (n >= ksp->ks_ndata) - return (NULL); + if (n >= ksp->ks_ndata) + return (NULL); - return (kstat_seq_data_addr(ksp, n)); + return (kstat_seq_data_addr(ksp, n)); } static void * kstat_seq_next(struct seq_file *f, void *p, loff_t *pos) { - kstat_t *ksp = (kstat_t *)f->private; - ASSERT(ksp->ks_magic == KS_MAGIC); + kstat_t *ksp = (kstat_t *)f->private; + ASSERT(ksp->ks_magic == KS_MAGIC); - ++*pos; - if (*pos >= ksp->ks_ndata) - return (NULL); + ++*pos; + if (*pos >= ksp->ks_ndata) + return (NULL); - return (kstat_seq_data_addr(ksp, *pos)); + return (kstat_seq_data_addr(ksp, *pos)); } static void @@ -421,10 +423,10 @@ kstat_seq_stop(struct seq_file *f, void *v) } static struct seq_operations kstat_seq_ops = { - .show = kstat_seq_show, - .start = kstat_seq_start, - .next = kstat_seq_next, - .stop = kstat_seq_stop, + .show = kstat_seq_show, + .start = kstat_seq_start, + .next = kstat_seq_next, + .stop = kstat_seq_stop, }; static kstat_module_t * @@ -465,28 +467,28 @@ kstat_delete_module(kstat_module_t *module) ASSERT(list_empty(&module->ksm_kstat_list)); remove_proc_entry(module->ksm_name, proc_spl_kstat); list_del(&module->ksm_module_list); - kmem_free(module, sizeof(kstat_module_t)); + kmem_free(module, sizeof (kstat_module_t)); } static int proc_kstat_open(struct inode *inode, struct file *filp) { - struct seq_file *f; - int rc; + struct seq_file *f; + int rc; - rc = seq_open(filp, &kstat_seq_ops); - if (rc) - return rc; + rc = seq_open(filp, &kstat_seq_ops); + if (rc) + return (rc); - f = filp->private_data; - f->private = PDE_DATA(inode); + f = filp->private_data; + f->private = PDE_DATA(inode); - return rc; + return (rc); } static ssize_t -proc_kstat_write(struct file *filp, const char __user *buf, - size_t len, loff_t *ppos) +proc_kstat_write(struct file *filp, const char __user *buf, size_t len, + loff_t *ppos) { struct seq_file *f = filp->private_data; kstat_t *ksp = f->private; @@ -527,8 +529,8 @@ EXPORT_SYMBOL(__kstat_set_raw_ops); kstat_t * __kstat_create(const char *ks_module, int ks_instance, const char *ks_name, - const char *ks_class, uchar_t ks_type, uint_t ks_ndata, - uchar_t ks_flags) + const char *ks_class, uchar_t ks_type, uint_t ks_ndata, + uchar_t ks_flags) { kstat_t *ksp; @@ -538,24 +540,24 @@ __kstat_create(const char *ks_module, int ks_instance, const char *ks_name, ASSERT(!(ks_flags & KSTAT_FLAG_UNSUPPORTED)); if ((ks_type == KSTAT_TYPE_INTR) || (ks_type == KSTAT_TYPE_IO)) - ASSERT(ks_ndata == 1); + ASSERT(ks_ndata == 1); - ksp = kmem_zalloc(sizeof(*ksp), KM_SLEEP); + ksp = kmem_zalloc(sizeof (*ksp), KM_SLEEP); if (ksp == NULL) - return ksp; + return (ksp); mutex_enter(&kstat_module_lock); ksp->ks_kid = kstat_id; - kstat_id++; + kstat_id++; mutex_exit(&kstat_module_lock); - ksp->ks_magic = KS_MAGIC; + ksp->ks_magic = KS_MAGIC; mutex_init(&ksp->ks_private_lock, NULL, MUTEX_DEFAULT, NULL); ksp->ks_lock = &ksp->ks_private_lock; INIT_LIST_HEAD(&ksp->ks_list); ksp->ks_crtime = gethrtime(); - ksp->ks_snaptime = ksp->ks_crtime; + ksp->ks_snaptime = ksp->ks_crtime; strncpy(ksp->ks_module, ks_module, KSTAT_STRLEN); ksp->ks_instance = ks_instance; strncpy(ksp->ks_name, ks_name, KSTAT_STRLEN); @@ -571,41 +573,41 @@ __kstat_create(const char *ks_module, int ks_instance, const char *ks_name, ksp->ks_raw_bufsize = 0; switch (ksp->ks_type) { - case KSTAT_TYPE_RAW: - ksp->ks_ndata = 1; - ksp->ks_data_size = ks_ndata; - break; - case KSTAT_TYPE_NAMED: - ksp->ks_ndata = ks_ndata; - ksp->ks_data_size = ks_ndata * sizeof(kstat_named_t); - break; - case KSTAT_TYPE_INTR: - ksp->ks_ndata = ks_ndata; - ksp->ks_data_size = ks_ndata * sizeof(kstat_intr_t); - break; - case KSTAT_TYPE_IO: - ksp->ks_ndata = ks_ndata; - ksp->ks_data_size = ks_ndata * sizeof(kstat_io_t); - break; - case KSTAT_TYPE_TIMER: - ksp->ks_ndata = ks_ndata; - ksp->ks_data_size = ks_ndata * sizeof(kstat_timer_t); - break; - default: - PANIC("Undefined kstat type %d\n", ksp->ks_type); - } + case KSTAT_TYPE_RAW: + ksp->ks_ndata = 1; + ksp->ks_data_size = ks_ndata; + break; + case KSTAT_TYPE_NAMED: + ksp->ks_ndata = ks_ndata; + ksp->ks_data_size = ks_ndata * sizeof (kstat_named_t); + break; + case KSTAT_TYPE_INTR: + ksp->ks_ndata = ks_ndata; + ksp->ks_data_size = ks_ndata * sizeof (kstat_intr_t); + break; + case KSTAT_TYPE_IO: + ksp->ks_ndata = ks_ndata; + ksp->ks_data_size = ks_ndata * sizeof (kstat_io_t); + break; + case KSTAT_TYPE_TIMER: + ksp->ks_ndata = ks_ndata; + ksp->ks_data_size = ks_ndata * sizeof (kstat_timer_t); + break; + default: + PANIC("Undefined kstat type %d\n", ksp->ks_type); + } if (ksp->ks_flags & KSTAT_FLAG_VIRTUAL) { - ksp->ks_data = NULL; - } else { - ksp->ks_data = kmem_zalloc(ksp->ks_data_size, KM_SLEEP); - if (ksp->ks_data == NULL) { - kmem_free(ksp, sizeof(*ksp)); - ksp = NULL; - } - } - - return ksp; + ksp->ks_data = NULL; + } else { + ksp->ks_data = kmem_zalloc(ksp->ks_data_size, KM_SLEEP); + if (ksp->ks_data == NULL) { + kmem_free(ksp, sizeof (*ksp)); + ksp = NULL; + } + } + + return (ksp); } EXPORT_SYMBOL(__kstat_create); @@ -706,9 +708,7 @@ __kstat_delete(kstat_t *ksp) ksp->ks_lock = NULL; mutex_destroy(&ksp->ks_private_lock); - kmem_free(ksp, sizeof(*ksp)); - - return; + kmem_free(ksp, sizeof (*ksp)); } EXPORT_SYMBOL(__kstat_delete); @@ -717,7 +717,7 @@ spl_kstat_init(void) { mutex_init(&kstat_module_lock, NULL, MUTEX_DEFAULT, NULL); INIT_LIST_HEAD(&kstat_module_list); - kstat_id = 0; + kstat_id = 0; return (0); } @@ -727,4 +727,3 @@ spl_kstat_fini(void) ASSERT(list_empty(&kstat_module_list)); mutex_destroy(&kstat_module_lock); } - diff --git a/module/spl/spl-mutex.c b/module/spl/spl-mutex.c index 9e1e103db..ba818862b 100644 --- a/module/spl/spl-mutex.c +++ b/module/spl/spl-mutex.c @@ -20,17 +20,11 @@ * * You should have received a copy of the GNU General Public License along * with the SPL. If not, see . - ***************************************************************************** + * * Solaris Porting Layer (SPL) Mutex Implementation. */ #include -#ifdef DEBUG_SUBSYSTEM -#undef DEBUG_SUBSYSTEM -#endif - -#define DEBUG_SUBSYSTEM S_MUTEX - int spl_mutex_init(void) { return 0; } void spl_mutex_fini(void) { } diff --git a/module/spl/spl-proc.c b/module/spl/spl-proc.c index 848eebffe..f5998a06e 100644 --- a/module/spl/spl-proc.c +++ b/module/spl/spl-proc.c @@ -20,7 +20,7 @@ * * You should have received a copy of the GNU General Public License along * with the SPL. If not, see . - ***************************************************************************** + * * Solaris Porting Layer (SPL) Proc Implementation. */ @@ -37,7 +37,7 @@ #include #include -#if defined(CONSTIFY_PLUGIN) && LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) +#if defined(CONSTIFY_PLUGIN) && LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) typedef struct ctl_table __no_const spl_ctl_table; #else typedef struct ctl_table spl_ctl_table; @@ -55,56 +55,57 @@ static struct proc_dir_entry *proc_spl_taskq = NULL; struct proc_dir_entry *proc_spl_kstat = NULL; static int -proc_copyin_string(char *kbuffer, int kbuffer_size, - const char *ubuffer, int ubuffer_size) +proc_copyin_string(char *kbuffer, int kbuffer_size, const char *ubuffer, + int ubuffer_size) { - int size; + int size; - if (ubuffer_size > kbuffer_size) - return -EOVERFLOW; + if (ubuffer_size > kbuffer_size) + return (-EOVERFLOW); - if (copy_from_user((void *)kbuffer, (void *)ubuffer, ubuffer_size)) - return -EFAULT; + if (copy_from_user((void *)kbuffer, (void *)ubuffer, ubuffer_size)) + return (-EFAULT); - /* strip trailing whitespace */ - size = strnlen(kbuffer, ubuffer_size); - while (size-- >= 0) - if (!isspace(kbuffer[size])) - break; + /* strip trailing whitespace */ + size = strnlen(kbuffer, ubuffer_size); + while (size-- >= 0) + if (!isspace(kbuffer[size])) + break; - /* empty string */ - if (size < 0) - return -EINVAL; + /* empty string */ + if (size < 0) + return (-EINVAL); - /* no space to terminate */ - if (size == kbuffer_size) - return -EOVERFLOW; + /* no space to terminate */ + if (size == kbuffer_size) + return (-EOVERFLOW); - kbuffer[size + 1] = 0; - return 0; + kbuffer[size + 1] = 0; + return (0); } static int proc_copyout_string(char *ubuffer, int ubuffer_size, - const char *kbuffer, char *append) + const char *kbuffer, char *append) { - /* NB if 'append' != NULL, it's a single character to append to the - * copied out string - usually "\n", for /proc entries and - * (i.e. a terminating zero byte) for sysctl entries - */ - int size = MIN(strlen(kbuffer), ubuffer_size); + /* + * NB if 'append' != NULL, it's a single character to append to the + * copied out string - usually "\n", for /proc entries and + * (i.e. a terminating zero byte) for sysctl entries + */ + int size = MIN(strlen(kbuffer), ubuffer_size); - if (copy_to_user(ubuffer, kbuffer, size)) - return -EFAULT; + if (copy_to_user(ubuffer, kbuffer, size)) + return (-EFAULT); - if (append != NULL && size < ubuffer_size) { - if (copy_to_user(ubuffer + size, append, 1)) - return -EFAULT; + if (append != NULL && size < ubuffer_size) { + if (copy_to_user(ubuffer + size, append, 1)) + return (-EFAULT); - size++; - } + size++; + } - return size; + return (size); } #ifdef DEBUG_KMEM @@ -112,27 +113,27 @@ static int proc_domemused(struct ctl_table *table, int write, void __user *buffer, size_t *lenp, loff_t *ppos) { - int rc = 0; - unsigned long min = 0, max = ~0, val; - spl_ctl_table dummy = *table; - - dummy.data = &val; - dummy.proc_handler = &proc_dointvec; - dummy.extra1 = &min; - dummy.extra2 = &max; - - if (write) { - *ppos += *lenp; - } else { -# ifdef HAVE_ATOMIC64_T - val = atomic64_read((atomic64_t *)table->data); -# else - val = atomic_read((atomic_t *)table->data); -# endif /* HAVE_ATOMIC64_T */ - rc = proc_doulongvec_minmax(&dummy, write, buffer, lenp, ppos); - } - - return (rc); + int rc = 0; + unsigned long min = 0, max = ~0, val; + spl_ctl_table dummy = *table; + + dummy.data = &val; + dummy.proc_handler = &proc_dointvec; + dummy.extra1 = &min; + dummy.extra2 = &max; + + if (write) { + *ppos += *lenp; + } else { +#ifdef HAVE_ATOMIC64_T + val = atomic64_read((atomic64_t *)table->data); +#else + val = atomic_read((atomic_t *)table->data); +#endif /* HAVE_ATOMIC64_T */ + rc = proc_doulongvec_minmax(&dummy, write, buffer, lenp, ppos); + } + + return (rc); } #endif /* DEBUG_KMEM */ @@ -140,23 +141,23 @@ static int proc_doslab(struct ctl_table *table, int write, void __user *buffer, size_t *lenp, loff_t *ppos) { - int rc = 0; - unsigned long min = 0, max = ~0, val = 0, mask; - spl_ctl_table dummy = *table; - spl_kmem_cache_t *skc; + int rc = 0; + unsigned long min = 0, max = ~0, val = 0, mask; + spl_ctl_table dummy = *table; + spl_kmem_cache_t *skc; - dummy.data = &val; - dummy.proc_handler = &proc_dointvec; - dummy.extra1 = &min; - dummy.extra2 = &max; + dummy.data = &val; + dummy.proc_handler = &proc_dointvec; + dummy.extra1 = &min; + dummy.extra2 = &max; - if (write) { - *ppos += *lenp; - } else { - down_read(&spl_kmem_cache_sem); - mask = (unsigned long)table->data; + if (write) { + *ppos += *lenp; + } else { + down_read(&spl_kmem_cache_sem); + mask = (unsigned long)table->data; - list_for_each_entry(skc, &spl_kmem_cache_list, skc_list) { + list_for_each_entry(skc, &spl_kmem_cache_list, skc_list) { /* Only use slabs of the correct kmem/vmem type */ if (!(skc->skc_flags & mask)) @@ -165,58 +166,61 @@ proc_doslab(struct ctl_table *table, int write, /* Sum the specified field for selected slabs */ switch (mask & (KMC_TOTAL | KMC_ALLOC | KMC_MAX)) { case KMC_TOTAL: - val += skc->skc_slab_size * skc->skc_slab_total; + val += skc->skc_slab_size * skc->skc_slab_total; break; case KMC_ALLOC: - val += skc->skc_obj_size * skc->skc_obj_alloc; + val += skc->skc_obj_size * skc->skc_obj_alloc; break; case KMC_MAX: - val += skc->skc_obj_size * skc->skc_obj_max; + val += skc->skc_obj_size * skc->skc_obj_max; break; } - } + } - up_read(&spl_kmem_cache_sem); - rc = proc_doulongvec_minmax(&dummy, write, buffer, lenp, ppos); - } + up_read(&spl_kmem_cache_sem); + rc = proc_doulongvec_minmax(&dummy, write, buffer, lenp, ppos); + } - return (rc); + return (rc); } static int proc_dohostid(struct ctl_table *table, int write, void __user *buffer, size_t *lenp, loff_t *ppos) { - int len, rc = 0; - char *end, str[32]; - - if (write) { - /* We can't use proc_doulongvec_minmax() in the write - * case here because hostid while a hex value has no - * leading 0x which confuses the helper function. */ - rc = proc_copyin_string(str, sizeof(str), buffer, *lenp); - if (rc < 0) - return (rc); - - spl_hostid = simple_strtoul(str, &end, 16); - if (str == end) - return (-EINVAL); - - } else { - len = snprintf(str, sizeof(str), "%lx", + int len, rc = 0; + char *end, str[32]; + + if (write) { + /* + * We can't use proc_doulongvec_minmax() in the write + * case here because hostid while a hex value has no + * leading 0x which confuses the helper function. + */ + rc = proc_copyin_string(str, sizeof (str), buffer, *lenp); + if (rc < 0) + return (rc); + + spl_hostid = simple_strtoul(str, &end, 16); + if (str == end) + return (-EINVAL); + + } else { + len = snprintf(str, sizeof (str), "%lx", (unsigned long) zone_get_hostid(NULL)); - if (*ppos >= len) - rc = 0; - else - rc = proc_copyout_string(buffer,*lenp,str+*ppos,"\n"); - - if (rc >= 0) { - *lenp = rc; - *ppos += rc; - } - } - - return (rc); + if (*ppos >= len) + rc = 0; + else + rc = proc_copyout_string(buffer, + *lenp, str + *ppos, "\n"); + + if (rc >= 0) { + *lenp = rc; + *ppos += rc; + } + } + + return (rc); } static void @@ -229,11 +233,11 @@ taskq_seq_show_headers(struct seq_file *f) /* indices into the lheads array below */ #define LHEAD_PEND 0 -#define LHEAD_PRIO 1 -#define LHEAD_DELAY 2 -#define LHEAD_WAIT 3 -#define LHEAD_ACTIVE 4 -#define LHEAD_SIZE 5 +#define LHEAD_PRIO 1 +#define LHEAD_DELAY 2 +#define LHEAD_WAIT 3 +#define LHEAD_ACTIVE 4 +#define LHEAD_SIZE 5 static unsigned int spl_max_show_tasks = 512; module_param(spl_max_show_tasks, uint, 0644); @@ -287,7 +291,7 @@ taskq_seq_show_impl(struct seq_file *f, void *p, boolean_t allflag) spin_unlock_irqrestore(&tq->tq_wait_waitq.lock, wflags); /* show the base taskq contents */ - snprintf(name, sizeof(name), "%s/%d", tq->tq_name, tq->tq_instance); + snprintf(name, sizeof (name), "%s/%d", tq->tq_name, tq->tq_instance); seq_printf(f, "%-25s ", name); seq_printf(f, "%5d %5d %5d %5d %5d %5d %12d %5d %10x\n", tq->tq_nactive, tq->tq_nthreads, tq->tq_nspawn, @@ -299,7 +303,8 @@ taskq_seq_show_impl(struct seq_file *f, void *p, boolean_t allflag) j = 0; list_for_each_entry(tqt, &tq->tq_active_list, tqt_active_list) { if (j == 0) - seq_printf(f, "\t%s:", list_names[LHEAD_ACTIVE]); + seq_printf(f, "\t%s:", + list_names[LHEAD_ACTIVE]); else if (j == 2) { seq_printf(f, "\n\t "); j = 0; @@ -403,32 +408,32 @@ taskq_seq_next(struct seq_file *f, void *p, loff_t *pos) ++*pos; return ((tq->tq_taskqs.next == &tq_list) ? - NULL : list_entry(tq->tq_taskqs.next, taskq_t, tq_taskqs)); + NULL : list_entry(tq->tq_taskqs.next, taskq_t, tq_taskqs)); } static void slab_seq_show_headers(struct seq_file *f) { - seq_printf(f, - "--------------------- cache ----------" - "--------------------------------------------- " - "----- slab ------ " - "---- object ----- " - "--- emergency ---\n"); - seq_printf(f, - "name " - " flags size alloc slabsize objsize " - "total alloc max " - "total alloc max " - "dlock alloc max\n"); + seq_printf(f, + "--------------------- cache ----------" + "--------------------------------------------- " + "----- slab ------ " + "---- object ----- " + "--- emergency ---\n"); + seq_printf(f, + "name " + " flags size alloc slabsize objsize " + "total alloc max " + "total alloc max " + "dlock alloc max\n"); } static int slab_seq_show(struct seq_file *f, void *p) { - spl_kmem_cache_t *skc = p; + spl_kmem_cache_t *skc = p; - ASSERT(skc->skc_magic == SKC_MAGIC); + ASSERT(skc->skc_magic == SKC_MAGIC); /* * Backed by Linux slab see /proc/slabinfo. @@ -436,48 +441,48 @@ slab_seq_show(struct seq_file *f, void *p) if (skc->skc_flags & KMC_SLAB) return (0); - spin_lock(&skc->skc_lock); - seq_printf(f, "%-36s ", skc->skc_name); - seq_printf(f, "0x%05lx %9lu %9lu %8u %8u " - "%5lu %5lu %5lu %5lu %5lu %5lu %5lu %5lu %5lu\n", - (long unsigned)skc->skc_flags, - (long unsigned)(skc->skc_slab_size * skc->skc_slab_total), - (long unsigned)(skc->skc_obj_size * skc->skc_obj_alloc), - (unsigned)skc->skc_slab_size, - (unsigned)skc->skc_obj_size, - (long unsigned)skc->skc_slab_total, - (long unsigned)skc->skc_slab_alloc, - (long unsigned)skc->skc_slab_max, - (long unsigned)skc->skc_obj_total, - (long unsigned)skc->skc_obj_alloc, - (long unsigned)skc->skc_obj_max, - (long unsigned)skc->skc_obj_deadlock, - (long unsigned)skc->skc_obj_emergency, - (long unsigned)skc->skc_obj_emergency_max); - - spin_unlock(&skc->skc_lock); - - return 0; + spin_lock(&skc->skc_lock); + seq_printf(f, "%-36s ", skc->skc_name); + seq_printf(f, "0x%05lx %9lu %9lu %8u %8u " + "%5lu %5lu %5lu %5lu %5lu %5lu %5lu %5lu %5lu\n", + (long unsigned)skc->skc_flags, + (long unsigned)(skc->skc_slab_size * skc->skc_slab_total), + (long unsigned)(skc->skc_obj_size * skc->skc_obj_alloc), + (unsigned)skc->skc_slab_size, + (unsigned)skc->skc_obj_size, + (long unsigned)skc->skc_slab_total, + (long unsigned)skc->skc_slab_alloc, + (long unsigned)skc->skc_slab_max, + (long unsigned)skc->skc_obj_total, + (long unsigned)skc->skc_obj_alloc, + (long unsigned)skc->skc_obj_max, + (long unsigned)skc->skc_obj_deadlock, + (long unsigned)skc->skc_obj_emergency, + (long unsigned)skc->skc_obj_emergency_max); + + spin_unlock(&skc->skc_lock); + + return (0); } static void * slab_seq_start(struct seq_file *f, loff_t *pos) { - struct list_head *p; - loff_t n = *pos; + struct list_head *p; + loff_t n = *pos; down_read(&spl_kmem_cache_sem); - if (!n) - slab_seq_show_headers(f); + if (!n) + slab_seq_show_headers(f); - p = spl_kmem_cache_list.next; - while (n--) { - p = p->next; - if (p == &spl_kmem_cache_list) - return (NULL); - } + p = spl_kmem_cache_list.next; + while (n--) { + p = p->next; + if (p == &spl_kmem_cache_list) + return (NULL); + } - return (list_entry(p, spl_kmem_cache_t, skc_list)); + return (list_entry(p, spl_kmem_cache_t, skc_list)); } static void * @@ -485,9 +490,9 @@ slab_seq_next(struct seq_file *f, void *p, loff_t *pos) { spl_kmem_cache_t *skc = p; - ++*pos; - return ((skc->skc_list.next == &spl_kmem_cache_list) ? - NULL : list_entry(skc->skc_list.next,spl_kmem_cache_t,skc_list)); + ++*pos; + return ((skc->skc_list.next == &spl_kmem_cache_list) ? + NULL : list_entry(skc->skc_list.next, spl_kmem_cache_t, skc_list)); } static void @@ -497,23 +502,23 @@ slab_seq_stop(struct seq_file *f, void *v) } static struct seq_operations slab_seq_ops = { - .show = slab_seq_show, - .start = slab_seq_start, - .next = slab_seq_next, - .stop = slab_seq_stop, + .show = slab_seq_show, + .start = slab_seq_start, + .next = slab_seq_next, + .stop = slab_seq_stop, }; static int proc_slab_open(struct inode *inode, struct file *filp) { - return seq_open(filp, &slab_seq_ops); + return (seq_open(filp, &slab_seq_ops)); } static struct file_operations proc_slab_operations = { - .open = proc_slab_open, - .read = seq_read, - .llseek = seq_lseek, - .release = seq_release, + .open = proc_slab_open, + .read = seq_read, + .llseek = seq_lseek, + .release = seq_release, }; static void @@ -523,122 +528,122 @@ taskq_seq_stop(struct seq_file *f, void *v) } static struct seq_operations taskq_all_seq_ops = { - .show = taskq_all_seq_show, - .start = taskq_seq_start, - .next = taskq_seq_next, - .stop = taskq_seq_stop, + .show = taskq_all_seq_show, + .start = taskq_seq_start, + .next = taskq_seq_next, + .stop = taskq_seq_stop, }; static struct seq_operations taskq_seq_ops = { - .show = taskq_seq_show, - .start = taskq_seq_start, - .next = taskq_seq_next, - .stop = taskq_seq_stop, + .show = taskq_seq_show, + .start = taskq_seq_start, + .next = taskq_seq_next, + .stop = taskq_seq_stop, }; static int proc_taskq_all_open(struct inode *inode, struct file *filp) { - return seq_open(filp, &taskq_all_seq_ops); + return (seq_open(filp, &taskq_all_seq_ops)); } static int proc_taskq_open(struct inode *inode, struct file *filp) { - return seq_open(filp, &taskq_seq_ops); + return (seq_open(filp, &taskq_seq_ops)); } static struct file_operations proc_taskq_all_operations = { - .open = proc_taskq_all_open, - .read = seq_read, - .llseek = seq_lseek, - .release = seq_release, + .open = proc_taskq_all_open, + .read = seq_read, + .llseek = seq_lseek, + .release = seq_release, }; static struct file_operations proc_taskq_operations = { - .open = proc_taskq_open, - .read = seq_read, - .llseek = seq_lseek, - .release = seq_release, + .open = proc_taskq_open, + .read = seq_read, + .llseek = seq_lseek, + .release = seq_release, }; static struct ctl_table spl_kmem_table[] = { #ifdef DEBUG_KMEM - { - .procname = "kmem_used", - .data = &kmem_alloc_used, -# ifdef HAVE_ATOMIC64_T - .maxlen = sizeof(atomic64_t), -# else - .maxlen = sizeof(atomic_t), -# endif /* HAVE_ATOMIC64_T */ - .mode = 0444, - .proc_handler = &proc_domemused, - }, - { - .procname = "kmem_max", - .data = &kmem_alloc_max, - .maxlen = sizeof(unsigned long), - .extra1 = &table_min, - .extra2 = &table_max, - .mode = 0444, - .proc_handler = &proc_doulongvec_minmax, - }, + { + .procname = "kmem_used", + .data = &kmem_alloc_used, +#ifdef HAVE_ATOMIC64_T + .maxlen = sizeof (atomic64_t), +#else + .maxlen = sizeof (atomic_t), +#endif /* HAVE_ATOMIC64_T */ + .mode = 0444, + .proc_handler = &proc_domemused, + }, + { + .procname = "kmem_max", + .data = &kmem_alloc_max, + .maxlen = sizeof (unsigned long), + .extra1 = &table_min, + .extra2 = &table_max, + .mode = 0444, + .proc_handler = &proc_doulongvec_minmax, + }, #endif /* DEBUG_KMEM */ - { - .procname = "slab_kmem_total", - .data = (void *)(KMC_KMEM | KMC_TOTAL), - .maxlen = sizeof(unsigned long), - .extra1 = &table_min, - .extra2 = &table_max, - .mode = 0444, - .proc_handler = &proc_doslab, - }, - { - .procname = "slab_kmem_alloc", - .data = (void *)(KMC_KMEM | KMC_ALLOC), - .maxlen = sizeof(unsigned long), - .extra1 = &table_min, - .extra2 = &table_max, - .mode = 0444, - .proc_handler = &proc_doslab, - }, - { - .procname = "slab_kmem_max", - .data = (void *)(KMC_KMEM | KMC_MAX), - .maxlen = sizeof(unsigned long), - .extra1 = &table_min, - .extra2 = &table_max, - .mode = 0444, - .proc_handler = &proc_doslab, - }, - { - .procname = "slab_vmem_total", - .data = (void *)(KMC_VMEM | KMC_TOTAL), - .maxlen = sizeof(unsigned long), - .extra1 = &table_min, - .extra2 = &table_max, - .mode = 0444, - .proc_handler = &proc_doslab, - }, - { - .procname = "slab_vmem_alloc", - .data = (void *)(KMC_VMEM | KMC_ALLOC), - .maxlen = sizeof(unsigned long), - .extra1 = &table_min, - .extra2 = &table_max, - .mode = 0444, - .proc_handler = &proc_doslab, - }, - { - .procname = "slab_vmem_max", - .data = (void *)(KMC_VMEM | KMC_MAX), - .maxlen = sizeof(unsigned long), - .extra1 = &table_min, - .extra2 = &table_max, - .mode = 0444, - .proc_handler = &proc_doslab, - }, + { + .procname = "slab_kmem_total", + .data = (void *)(KMC_KMEM | KMC_TOTAL), + .maxlen = sizeof (unsigned long), + .extra1 = &table_min, + .extra2 = &table_max, + .mode = 0444, + .proc_handler = &proc_doslab, + }, + { + .procname = "slab_kmem_alloc", + .data = (void *)(KMC_KMEM | KMC_ALLOC), + .maxlen = sizeof (unsigned long), + .extra1 = &table_min, + .extra2 = &table_max, + .mode = 0444, + .proc_handler = &proc_doslab, + }, + { + .procname = "slab_kmem_max", + .data = (void *)(KMC_KMEM | KMC_MAX), + .maxlen = sizeof (unsigned long), + .extra1 = &table_min, + .extra2 = &table_max, + .mode = 0444, + .proc_handler = &proc_doslab, + }, + { + .procname = "slab_vmem_total", + .data = (void *)(KMC_VMEM | KMC_TOTAL), + .maxlen = sizeof (unsigned long), + .extra1 = &table_min, + .extra2 = &table_max, + .mode = 0444, + .proc_handler = &proc_doslab, + }, + { + .procname = "slab_vmem_alloc", + .data = (void *)(KMC_VMEM | KMC_ALLOC), + .maxlen = sizeof (unsigned long), + .extra1 = &table_min, + .extra2 = &table_max, + .mode = 0444, + .proc_handler = &proc_doslab, + }, + { + .procname = "slab_vmem_max", + .data = (void *)(KMC_VMEM | KMC_MAX), + .maxlen = sizeof (unsigned long), + .extra1 = &table_min, + .extra2 = &table_max, + .mode = 0444, + .proc_handler = &proc_doslab, + }, {}, }; @@ -647,43 +652,44 @@ static struct ctl_table spl_kstat_table[] = { }; static struct ctl_table spl_table[] = { - /* NB No .strategy entries have been provided since - * sysctl(8) prefers to go via /proc for portability. - */ - { - .procname = "version", - .data = spl_version, - .maxlen = sizeof(spl_version), - .mode = 0444, - .proc_handler = &proc_dostring, - }, - { - .procname = "hostid", - .data = &spl_hostid, - .maxlen = sizeof(unsigned long), - .mode = 0644, - .proc_handler = &proc_dohostid, - }, + /* + * NB No .strategy entries have been provided since + * sysctl(8) prefers to go via /proc for portability. + */ + { + .procname = "version", + .data = spl_version, + .maxlen = sizeof (spl_version), + .mode = 0444, + .proc_handler = &proc_dostring, + }, + { + .procname = "hostid", + .data = &spl_hostid, + .maxlen = sizeof (unsigned long), + .mode = 0644, + .proc_handler = &proc_dohostid, + }, { - .procname = "kmem", - .mode = 0555, - .child = spl_kmem_table, + .procname = "kmem", + .mode = 0555, + .child = spl_kmem_table, }, { - .procname = "kstat", - .mode = 0555, - .child = spl_kstat_table, + .procname = "kstat", + .mode = 0555, + .child = spl_kstat_table, }, - {}, + {}, }; static struct ctl_table spl_dir[] = { - { - .procname = "spl", - .mode = 0555, - .child = spl_table, - }, - {} + { + .procname = "spl", + .mode = 0555, + .child = spl_table, + }, + {} }; static struct ctl_table spl_root[] = { @@ -703,7 +709,7 @@ spl_proc_init(void) { int rc = 0; - spl_header = register_sysctl_table(spl_root); + spl_header = register_sysctl_table(spl_root); if (spl_header == NULL) return (-EUNATCH); @@ -727,48 +733,48 @@ spl_proc_init(void) goto out; } - proc_spl_kmem = proc_mkdir("kmem", proc_spl); - if (proc_spl_kmem == NULL) { - rc = -EUNATCH; + proc_spl_kmem = proc_mkdir("kmem", proc_spl); + if (proc_spl_kmem == NULL) { + rc = -EUNATCH; goto out; } proc_spl_kmem_slab = proc_create_data("slab", 0444, proc_spl_kmem, &proc_slab_operations, NULL); - if (proc_spl_kmem_slab == NULL) { + if (proc_spl_kmem_slab == NULL) { rc = -EUNATCH; goto out; } - proc_spl_kstat = proc_mkdir("kstat", proc_spl); - if (proc_spl_kstat == NULL) { - rc = -EUNATCH; + proc_spl_kstat = proc_mkdir("kstat", proc_spl); + if (proc_spl_kstat == NULL) { + rc = -EUNATCH; goto out; } out: if (rc) { remove_proc_entry("kstat", proc_spl); - remove_proc_entry("slab", proc_spl_kmem); + remove_proc_entry("slab", proc_spl_kmem); remove_proc_entry("kmem", proc_spl); remove_proc_entry("taskq-all", proc_spl); remove_proc_entry("taskq", proc_spl); remove_proc_entry("spl", NULL); - unregister_sysctl_table(spl_header); + unregister_sysctl_table(spl_header); } - return (rc); + return (rc); } void spl_proc_fini(void) { remove_proc_entry("kstat", proc_spl); - remove_proc_entry("slab", proc_spl_kmem); + remove_proc_entry("slab", proc_spl_kmem); remove_proc_entry("kmem", proc_spl); remove_proc_entry("taskq-all", proc_spl); remove_proc_entry("taskq", proc_spl); remove_proc_entry("spl", NULL); - ASSERT(spl_header != NULL); - unregister_sysctl_table(spl_header); + ASSERT(spl_header != NULL); + unregister_sysctl_table(spl_header); } diff --git a/module/spl/spl-rwlock.c b/module/spl/spl-rwlock.c index e497775e6..9a992cc3a 100644 --- a/module/spl/spl-rwlock.c +++ b/module/spl/spl-rwlock.c @@ -20,18 +20,12 @@ * * You should have received a copy of the GNU General Public License along * with the SPL. If not, see . - ***************************************************************************** + * * Solaris Porting Layer (SPL) Reader/Writer Lock Implementation. */ #include -#ifdef DEBUG_SUBSYSTEM -#undef DEBUG_SUBSYSTEM -#endif - -#define DEBUG_SUBSYSTEM S_RWLOCK - #if defined(CONFIG_PREEMPT_RT_FULL) #include @@ -94,7 +88,7 @@ __rwsem_tryupgrade(struct rw_semaphore *rwsem) static int __rwsem_tryupgrade(struct rw_semaphore *rwsem) { - typeof (rwsem->count) val; + typeof(rwsem->count) val; val = cmpxchg(&rwsem->count, SPL_RWSEM_SINGLE_READER_VALUE, SPL_RWSEM_SINGLE_WRITER_VALUE); return (val == SPL_RWSEM_SINGLE_READER_VALUE); diff --git a/module/spl/spl-taskq.c b/module/spl/spl-taskq.c index ae26bdb2e..2919a942a 100644 --- a/module/spl/spl-taskq.c +++ b/module/spl/spl-taskq.c @@ -87,7 +87,7 @@ taskq_find_by_name(const char *name) list_for_each_prev(tql, &tq_list) { tq = list_entry(tql, taskq_t, tq_taskqs); if (strcmp(name, tq->tq_name) == 0) - return tq->tq_instance; + return (tq->tq_instance); } return (-1); } @@ -573,7 +573,8 @@ taskq_dispatch(taskq_t *tq, task_func_t func, void *arg, uint_t flags) ASSERT(tq->tq_nactive <= tq->tq_nthreads); if ((flags & TQ_NOQUEUE) && (tq->tq_nactive == tq->tq_nthreads)) { /* Dynamic taskq may be able to spawn another thread */ - if (!(tq->tq_flags & TASKQ_DYNAMIC) || taskq_thread_spawn(tq) == 0) + if (!(tq->tq_flags & TASKQ_DYNAMIC) || + taskq_thread_spawn(tq) == 0) goto out; } @@ -686,7 +687,8 @@ taskq_dispatch_ent(taskq_t *tq, task_func_t func, void *arg, uint_t flags, if ((flags & TQ_NOQUEUE) && (tq->tq_nactive == tq->tq_nthreads)) { /* Dynamic taskq may be able to spawn another thread */ - if (!(tq->tq_flags & TASKQ_DYNAMIC) || taskq_thread_spawn(tq) == 0) + if (!(tq->tq_flags & TASKQ_DYNAMIC) || + taskq_thread_spawn(tq) == 0) goto out2; flags |= TQ_FRONT; } @@ -786,7 +788,8 @@ taskq_thread_spawn_task(void *arg) if (taskq_thread_create(tq) == NULL) { /* restore spawning count if failed */ - spin_lock_irqsave_nested(&tq->tq_lock, flags, tq->tq_lock_class); + spin_lock_irqsave_nested(&tq->tq_lock, flags, + tq->tq_lock_class); tq->tq_nspawn--; spin_unlock_irqrestore(&tq->tq_lock, flags); } @@ -1146,7 +1149,8 @@ taskq_destroy(taskq_t *tq) while (tq->tq_nspawn) { spin_unlock_irqrestore(&tq->tq_lock, flags); schedule_timeout_interruptible(1); - spin_lock_irqsave_nested(&tq->tq_lock, flags, tq->tq_lock_class); + spin_lock_irqsave_nested(&tq->tq_lock, flags, + tq->tq_lock_class); } /* @@ -1239,16 +1243,16 @@ param_set_taskq_kick(const char *val, struct kernel_param *kp) #ifdef module_param_cb static const struct kernel_param_ops param_ops_taskq_kick = { - .set = param_set_taskq_kick, - .get = param_get_uint, + .set = param_set_taskq_kick, + .get = param_get_uint, }; module_param_cb(spl_taskq_kick, ¶m_ops_taskq_kick, &spl_taskq_kick, 0644); #else module_param_call(spl_taskq_kick, param_set_taskq_kick, param_get_uint, - &spl_taskq_kick, 0644); + &spl_taskq_kick, 0644); #endif MODULE_PARM_DESC(spl_taskq_kick, - "Write nonzero to kick stuck taskqs to spawn more threads"); + "Write nonzero to kick stuck taskqs to spawn more threads"); int spl_taskq_init(void) diff --git a/module/spl/spl-thread.c b/module/spl/spl-thread.c index 92eba42ba..9ad044161 100644 --- a/module/spl/spl-thread.c +++ b/module/spl/spl-thread.c @@ -20,7 +20,7 @@ * * You should have received a copy of the GNU General Public License along * with the SPL. If not, see . - ***************************************************************************** + * * Solaris Porting Layer (SPL) Thread Implementation. */ @@ -33,8 +33,8 @@ */ typedef struct thread_priv_s { unsigned long tp_magic; /* Magic */ - int tp_name_size; /* Name size */ - char *tp_name; /* Name (without _thread suffix) */ + int tp_name_size; /* Name size */ + char *tp_name; /* Name (without _thread suffix) */ void (*tp_func)(void *); /* Registered function */ void *tp_args; /* Args to be passed to function */ size_t tp_len; /* Len to be passed to function */ @@ -55,12 +55,12 @@ thread_generic_wrapper(void *arg) set_current_state(tp->tp_state); set_user_nice((kthread_t *)current, PRIO_TO_NICE(tp->tp_pri)); kmem_free(tp->tp_name, tp->tp_name_size); - kmem_free(tp, sizeof(thread_priv_t)); + kmem_free(tp, sizeof (thread_priv_t)); if (func) func(args); - return 0; + return (0); } void @@ -72,9 +72,11 @@ __thread_exit(void) } EXPORT_SYMBOL(__thread_exit); -/* thread_create() may block forever if it cannot create a thread or +/* + * thread_create() may block forever if it cannot create a thread or * allocate memory. This is preferable to returning a NULL which Solaris - * style callers likely never check for... since it can't fail. */ + * style callers likely never check for... since it can't fail. + */ kthread_t * __thread_create(caddr_t stk, size_t stksize, thread_func_t func, const char *name, void *args, size_t len, proc_t *pp, @@ -88,7 +90,7 @@ __thread_create(caddr_t stk, size_t stksize, thread_func_t func, /* Variable stack size unsupported */ ASSERT(stk == NULL); - tp = kmem_alloc(sizeof(thread_priv_t), KM_PUSHPAGE); + tp = kmem_alloc(sizeof (thread_priv_t), KM_PUSHPAGE); if (tp == NULL) return (NULL); @@ -96,14 +98,15 @@ __thread_create(caddr_t stk, size_t stksize, thread_func_t func, tp->tp_name_size = strlen(name) + 1; tp->tp_name = kmem_alloc(tp->tp_name_size, KM_PUSHPAGE); - if (tp->tp_name == NULL) { - kmem_free(tp, sizeof(thread_priv_t)); + if (tp->tp_name == NULL) { + kmem_free(tp, sizeof (thread_priv_t)); return (NULL); } strncpy(tp->tp_name, name, tp->tp_name_size); - /* Strip trailing "_thread" from passed name which will be the func + /* + * Strip trailing "_thread" from passed name which will be the func * name since the exposed API has no parameter for passing a name. */ p = strstr(tp->tp_name, "_thread"); @@ -117,7 +120,7 @@ __thread_create(caddr_t stk, size_t stksize, thread_func_t func, tp->tp_pri = pri; tsk = spl_kthread_create(thread_generic_wrapper, (void *)tp, - "%s", tp->tp_name); + "%s", tp->tp_name); if (IS_ERR(tsk)) return (NULL); @@ -139,7 +142,7 @@ spl_kthread_create(int (*func)(void *), void *data, const char namefmt[], ...) char name[TASK_COMM_LEN]; va_start(args, namefmt); - vsnprintf(name, sizeof(name), namefmt, args); + vsnprintf(name, sizeof (name), namefmt, args); va_end(args); do { tsk = kthread_create(func, data, "%s", name); diff --git a/module/spl/spl-vnode.c b/module/spl/spl-vnode.c index 19b3b76cd..f019a0877 100644 --- a/module/spl/spl-vnode.c +++ b/module/spl/spl-vnode.c @@ -20,7 +20,7 @@ * * You should have received a copy of the GNU General Public License along * with the SPL. If not, see . - ***************************************************************************** + * * Solaris Porting Layer (SPL) Vnode Implementation. */ @@ -43,27 +43,27 @@ vtype_t vn_mode_to_vtype(mode_t mode) { if (S_ISREG(mode)) - return VREG; + return (VREG); if (S_ISDIR(mode)) - return VDIR; + return (VDIR); if (S_ISCHR(mode)) - return VCHR; + return (VCHR); if (S_ISBLK(mode)) - return VBLK; + return (VBLK); if (S_ISFIFO(mode)) - return VFIFO; + return (VFIFO); if (S_ISLNK(mode)) - return VLNK; + return (VLNK); if (S_ISSOCK(mode)) - return VSOCK; + return (VSOCK); - return VNON; + return (VNON); } /* vn_mode_to_vtype() */ EXPORT_SYMBOL(vn_mode_to_vtype); @@ -71,27 +71,27 @@ mode_t vn_vtype_to_mode(vtype_t vtype) { if (vtype == VREG) - return S_IFREG; + return (S_IFREG); if (vtype == VDIR) - return S_IFDIR; + return (S_IFDIR); if (vtype == VCHR) - return S_IFCHR; + return (S_IFCHR); if (vtype == VBLK) - return S_IFBLK; + return (S_IFBLK); if (vtype == VFIFO) - return S_IFIFO; + return (S_IFIFO); if (vtype == VLNK) - return S_IFLNK; + return (S_IFLNK); if (vtype == VSOCK) - return S_IFSOCK; + return (S_IFSOCK); - return VNON; + return (VNON); } /* vn_vtype_to_mode() */ EXPORT_SYMBOL(vn_vtype_to_mode); @@ -135,7 +135,8 @@ vn_open(const char *path, uio_seg_t seg, int flags, int mode, if (!(flags & FCREAT) && (flags & FWRITE)) flags |= FEXCL; - /* Note for filp_open() the two low bits must be remapped to mean: + /* + * Note for filp_open() the two low bits must be remapped to mean: * 01 - read-only -> 00 read-only * 10 - write-only -> 01 write-only * 11 - read-write -> 10 read-write @@ -148,7 +149,7 @@ vn_open(const char *path, uio_seg_t seg, int flags, int mode, fp = filp_open(path, flags, mode); if (flags & FCREAT) - (void)xchg(¤t->fs->umask, saved_umask); + (void) xchg(¤t->fs->umask, saved_umask); if (IS_ERR(fp)) return (-PTR_ERR(fp)); @@ -187,7 +188,7 @@ EXPORT_SYMBOL(vn_open); int vn_openat(const char *path, uio_seg_t seg, int flags, int mode, - vnode_t **vpp, int x1, void *x2, vnode_t *vp, int fd) + vnode_t **vpp, int x1, void *x2, vnode_t *vp, int fd) { char *realpath; int len, rc; @@ -199,7 +200,7 @@ vn_openat(const char *path, uio_seg_t seg, int flags, int mode, if (!realpath) return (ENOMEM); - (void)snprintf(realpath, len, "/%s", path); + (void) snprintf(realpath, len, "/%s", path); rc = vn_open(realpath, seg, flags, mode, vpp, x1, x2); kfree(realpath); @@ -259,9 +260,11 @@ vn_close(vnode_t *vp, int flags, int x1, int x2, void *x3, void *x4) } /* vn_close() */ EXPORT_SYMBOL(vn_close); -/* vn_seek() does not actually seek it only performs bounds checking on the +/* + * vn_seek() does not actually seek it only performs bounds checking on the * proposed seek. We perform minimal checking and allow vn_rdwr() to catch - * anything more serious. */ + * anything more serious. + */ int vn_seek(vnode_t *vp, offset_t ooff, offset_t *noffp, void *ct) { @@ -293,26 +296,27 @@ vn_getattr(vnode_t *vp, vattr_t *vap, int flags, void *x3, void *x4) if (rc) return (-rc); - vap->va_type = vn_mode_to_vtype(stat.mode); - vap->va_mode = stat.mode; - vap->va_uid = KUID_TO_SUID(stat.uid); - vap->va_gid = KGID_TO_SGID(stat.gid); - vap->va_fsid = 0; - vap->va_nodeid = stat.ino; - vap->va_nlink = stat.nlink; - vap->va_size = stat.size; - vap->va_blksize = stat.blksize; - vap->va_atime = stat.atime; - vap->va_mtime = stat.mtime; - vap->va_ctime = stat.ctime; - vap->va_rdev = stat.rdev; - vap->va_nblocks = stat.blocks; + vap->va_type = vn_mode_to_vtype(stat.mode); + vap->va_mode = stat.mode; + vap->va_uid = KUID_TO_SUID(stat.uid); + vap->va_gid = KGID_TO_SGID(stat.gid); + vap->va_fsid = 0; + vap->va_nodeid = stat.ino; + vap->va_nlink = stat.nlink; + vap->va_size = stat.size; + vap->va_blksize = stat.blksize; + vap->va_atime = stat.atime; + vap->va_mtime = stat.mtime; + vap->va_ctime = stat.ctime; + vap->va_rdev = stat.rdev; + vap->va_nblocks = stat.blocks; return (0); } EXPORT_SYMBOL(vn_getattr); -int vn_fsync(vnode_t *vp, int flags, void *x3, void *x4) +int +vn_fsync(vnode_t *vp, int flags, void *x3, void *x4) { int datasync = 0; int error; @@ -412,22 +416,22 @@ EXPORT_SYMBOL(vn_space); static file_t * file_find(int fd, struct task_struct *task) { - file_t *fp; + file_t *fp; - list_for_each_entry(fp, &vn_file_list, f_list) { + list_for_each_entry(fp, &vn_file_list, f_list) { if (fd == fp->f_fd && fp->f_task == task) { ASSERT(atomic_read(&fp->f_ref) != 0); - return fp; + return (fp); } } - return NULL; + return (NULL); } /* file_find() */ file_t * vn_getf(int fd) { - struct kstat stat; + struct kstat stat; struct file *lfp; file_t *fp; vnode_t *vp; @@ -482,13 +486,14 @@ vn_getf(int fd) goto out_fget; #if defined(HAVE_4ARGS_VFS_GETATTR) - rc = vfs_getattr(&lfp->f_path, &stat, STATX_TYPE, AT_STATX_SYNC_AS_STAT); + rc = vfs_getattr(&lfp->f_path, &stat, STATX_TYPE, + AT_STATX_SYNC_AS_STAT); #elif defined(HAVE_2ARGS_VFS_GETATTR) rc = vfs_getattr(&lfp->f_path, &stat); #else rc = vfs_getattr(lfp->f_path.mnt, lfp->f_dentry, &stat); #endif - if (rc) + if (rc) goto out_vnode; mutex_enter(&vp->v_lock); @@ -515,7 +520,7 @@ out_mutex: mutex_exit(&fp->f_lock); kmem_cache_free(vn_file_cache, fp); out: - return (NULL); + return (NULL); } /* getf() */ EXPORT_SYMBOL(getf); @@ -556,12 +561,10 @@ vn_areleasef(int fd, uf_info_t *fip) return; } - list_del(&fp->f_list); + list_del(&fp->f_list); releasef_locked(fp); } spin_unlock(&vn_file_lock); - - return; } /* releasef() */ EXPORT_SYMBOL(areleasef); @@ -596,34 +599,34 @@ vn_set_fs_pwd(struct fs_struct *fs, struct path *path) int vn_set_pwd(const char *filename) { - struct path path; - mm_segment_t saved_fs; - int rc; - - /* - * user_path_dir() and __user_walk() both expect 'filename' to be - * a user space address so we must briefly increase the data segment - * size to ensure strncpy_from_user() does not fail with -EFAULT. - */ - saved_fs = get_fs(); - set_fs(get_ds()); - - rc = user_path_dir(filename, &path); - if (rc) + struct path path; + mm_segment_t saved_fs; + int rc; + + /* + * user_path_dir() and __user_walk() both expect 'filename' to be + * a user space address so we must briefly increase the data segment + * size to ensure strncpy_from_user() does not fail with -EFAULT. + */ + saved_fs = get_fs(); + set_fs(get_ds()); + + rc = user_path_dir(filename, &path); + if (rc) goto out; - rc = inode_permission(path.dentry->d_inode, MAY_EXEC | MAY_ACCESS); - if (rc) + rc = inode_permission(path.dentry->d_inode, MAY_EXEC | MAY_ACCESS); + if (rc) goto dput_and_out; - vn_set_fs_pwd(current->fs, &path); + vn_set_fs_pwd(current->fs, &path); dput_and_out: - path_put(&path); + path_put(&path); out: set_fs(saved_fs); - return (-rc); + return (-rc); } /* vn_set_pwd() */ EXPORT_SYMBOL(vn_set_pwd); @@ -651,10 +654,10 @@ vn_file_cache_constructor(void *buf, void *cdrarg, int kmflags) file_t *fp = buf; atomic_set(&fp->f_ref, 0); - mutex_init(&fp->f_lock, NULL, MUTEX_DEFAULT, NULL); + mutex_init(&fp->f_lock, NULL, MUTEX_DEFAULT, NULL); INIT_LIST_HEAD(&fp->f_list); - return (0); + return (0); } /* file_cache_constructor() */ static void @@ -669,29 +672,26 @@ int spl_vn_init(void) { vn_cache = kmem_cache_create("spl_vn_cache", - sizeof(struct vnode), 64, - vn_cache_constructor, - vn_cache_destructor, - NULL, NULL, NULL, 0); + sizeof (struct vnode), 64, vn_cache_constructor, + vn_cache_destructor, NULL, NULL, NULL, 0); vn_file_cache = kmem_cache_create("spl_vn_file_cache", - sizeof(file_t), 64, - vn_file_cache_constructor, - vn_file_cache_destructor, - NULL, NULL, NULL, 0); + sizeof (file_t), 64, vn_file_cache_constructor, + vn_file_cache_destructor, NULL, NULL, NULL, 0); + return (0); } /* vn_init() */ void spl_vn_fini(void) { - file_t *fp, *next_fp; + file_t *fp, *next_fp; int leaked = 0; spin_lock(&vn_file_lock); - list_for_each_entry_safe(fp, next_fp, &vn_file_list, f_list) { - list_del(&fp->f_list); + list_for_each_entry_safe(fp, next_fp, &vn_file_list, f_list) { + list_del(&fp->f_list); releasef_locked(fp); leaked++; } @@ -703,6 +703,4 @@ spl_vn_fini(void) kmem_cache_destroy(vn_file_cache); kmem_cache_destroy(vn_cache); - - return; } /* vn_fini() */ diff --git a/module/spl/spl-xdr.c b/module/spl/spl-xdr.c index 04a337c2b..c582913f1 100644 --- a/module/spl/spl-xdr.c +++ b/module/spl/spl-xdr.c @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License along * with the SPL. If not, see . - ***************************************************************************** + * * Solaris Porting Layer (SPL) XDR Implementation. */ @@ -163,12 +163,12 @@ xdrmem_control(XDR *xdrs, int req, void *info) struct xdr_bytesrec *rec = (struct xdr_bytesrec *) info; if (req != XDR_GET_BYTES_AVAIL) - return FALSE; + return (FALSE); rec->xc_is_last_record = TRUE; /* always TRUE in xdrmem streams */ rec->xc_num_avail = xdrs->x_addr_end - xdrs->x_addr; - return TRUE; + return (TRUE); } static bool_t @@ -178,13 +178,13 @@ xdrmem_enc_bytes(XDR *xdrs, caddr_t cp, const uint_t cnt) uint_t pad; if (size < cnt) - return FALSE; /* Integer overflow */ + return (FALSE); /* Integer overflow */ if (xdrs->x_addr > xdrs->x_addr_end) - return FALSE; + return (FALSE); if (xdrs->x_addr_end - xdrs->x_addr < size) - return FALSE; + return (FALSE); memcpy(xdrs->x_addr, cp, cnt); @@ -196,7 +196,7 @@ xdrmem_enc_bytes(XDR *xdrs, caddr_t cp, const uint_t cnt) xdrs->x_addr += pad; } - return TRUE; + return (TRUE); } static bool_t @@ -207,13 +207,13 @@ xdrmem_dec_bytes(XDR *xdrs, caddr_t cp, const uint_t cnt) uint_t pad; if (size < cnt) - return FALSE; /* Integer overflow */ + return (FALSE); /* Integer overflow */ if (xdrs->x_addr > xdrs->x_addr_end) - return FALSE; + return (FALSE); if (xdrs->x_addr_end - xdrs->x_addr < size) - return FALSE; + return (FALSE); memcpy(cp, xdrs->x_addr, cnt); xdrs->x_addr += cnt; @@ -222,38 +222,38 @@ xdrmem_dec_bytes(XDR *xdrs, caddr_t cp, const uint_t cnt) if (pad > 0) { /* An inverted memchr() would be useful here... */ if (memcmp(&zero, xdrs->x_addr, pad) != 0) - return FALSE; + return (FALSE); xdrs->x_addr += pad; } - return TRUE; + return (TRUE); } static bool_t xdrmem_enc_uint32(XDR *xdrs, uint32_t val) { - if (xdrs->x_addr + sizeof(uint32_t) > xdrs->x_addr_end) - return FALSE; + if (xdrs->x_addr + sizeof (uint32_t) > xdrs->x_addr_end) + return (FALSE); *((uint32_t *) xdrs->x_addr) = cpu_to_be32(val); - xdrs->x_addr += sizeof(uint32_t); + xdrs->x_addr += sizeof (uint32_t); - return TRUE; + return (TRUE); } static bool_t xdrmem_dec_uint32(XDR *xdrs, uint32_t *val) { - if (xdrs->x_addr + sizeof(uint32_t) > xdrs->x_addr_end) - return FALSE; + if (xdrs->x_addr + sizeof (uint32_t) > xdrs->x_addr_end) + return (FALSE); *val = be32_to_cpu(*((uint32_t *) xdrs->x_addr)); - xdrs->x_addr += sizeof(uint32_t); + xdrs->x_addr += sizeof (uint32_t); - return TRUE; + return (TRUE); } static bool_t @@ -261,10 +261,10 @@ xdrmem_enc_char(XDR *xdrs, char *cp) { uint32_t val; - BUILD_BUG_ON(sizeof(char) != 1); + BUILD_BUG_ON(sizeof (char) != 1); val = *((unsigned char *) cp); - return xdrmem_enc_uint32(xdrs, val); + return (xdrmem_enc_uint32(xdrs, val)); } static bool_t @@ -272,10 +272,10 @@ xdrmem_dec_char(XDR *xdrs, char *cp) { uint32_t val; - BUILD_BUG_ON(sizeof(char) != 1); + BUILD_BUG_ON(sizeof (char) != 1); if (!xdrmem_dec_uint32(xdrs, &val)) - return FALSE; + return (FALSE); /* * If any of the 3 other bytes are non-zero then val will be greater @@ -283,19 +283,19 @@ xdrmem_dec_char(XDR *xdrs, char *cp) * not have a char encoded in it. */ if (val > 0xff) - return FALSE; + return (FALSE); *((unsigned char *) cp) = val; - return TRUE; + return (TRUE); } static bool_t xdrmem_enc_ushort(XDR *xdrs, unsigned short *usp) { - BUILD_BUG_ON(sizeof(unsigned short) != 2); + BUILD_BUG_ON(sizeof (unsigned short) != 2); - return xdrmem_enc_uint32(xdrs, *usp); + return (xdrmem_enc_uint32(xdrs, *usp)); } static bool_t @@ -303,48 +303,48 @@ xdrmem_dec_ushort(XDR *xdrs, unsigned short *usp) { uint32_t val; - BUILD_BUG_ON(sizeof(unsigned short) != 2); + BUILD_BUG_ON(sizeof (unsigned short) != 2); if (!xdrmem_dec_uint32(xdrs, &val)) - return FALSE; + return (FALSE); /* * Short ints are not in the RFC, but we assume similar logic as in * xdrmem_dec_char(). */ if (val > 0xffff) - return FALSE; + return (FALSE); *usp = val; - return TRUE; + return (TRUE); } static bool_t xdrmem_enc_uint(XDR *xdrs, unsigned *up) { - BUILD_BUG_ON(sizeof(unsigned) != 4); + BUILD_BUG_ON(sizeof (unsigned) != 4); - return xdrmem_enc_uint32(xdrs, *up); + return (xdrmem_enc_uint32(xdrs, *up)); } static bool_t xdrmem_dec_uint(XDR *xdrs, unsigned *up) { - BUILD_BUG_ON(sizeof(unsigned) != 4); + BUILD_BUG_ON(sizeof (unsigned) != 4); - return xdrmem_dec_uint32(xdrs, (uint32_t *) up); + return (xdrmem_dec_uint32(xdrs, (uint32_t *) up)); } static bool_t xdrmem_enc_ulonglong(XDR *xdrs, u_longlong_t *ullp) { - BUILD_BUG_ON(sizeof(u_longlong_t) != 8); + BUILD_BUG_ON(sizeof (u_longlong_t) != 8); if (!xdrmem_enc_uint32(xdrs, *ullp >> 32)) - return FALSE; + return (FALSE); - return xdrmem_enc_uint32(xdrs, *ullp & 0xffffffff); + return (xdrmem_enc_uint32(xdrs, *ullp & 0xffffffff)); } static bool_t @@ -352,16 +352,16 @@ xdrmem_dec_ulonglong(XDR *xdrs, u_longlong_t *ullp) { uint32_t low, high; - BUILD_BUG_ON(sizeof(u_longlong_t) != 8); + BUILD_BUG_ON(sizeof (u_longlong_t) != 8); if (!xdrmem_dec_uint32(xdrs, &high)) - return FALSE; + return (FALSE); if (!xdrmem_dec_uint32(xdrs, &low)) - return FALSE; + return (FALSE); *ullp = ((u_longlong_t) high << 32) | low; - return TRUE; + return (TRUE); } static bool_t @@ -372,18 +372,18 @@ xdr_enc_array(XDR *xdrs, caddr_t *arrp, uint_t *sizep, const uint_t maxsize, caddr_t addr = *arrp; if (*sizep > maxsize || *sizep > UINT_MAX / elsize) - return FALSE; + return (FALSE); if (!xdrmem_enc_uint(xdrs, sizep)) - return FALSE; + return (FALSE); for (i = 0; i < *sizep; i++) { if (!elproc(xdrs, addr)) - return FALSE; + return (FALSE); addr += elsize; } - return TRUE; + return (TRUE); } static bool_t @@ -395,23 +395,23 @@ xdr_dec_array(XDR *xdrs, caddr_t *arrp, uint_t *sizep, const uint_t maxsize, caddr_t addr; if (!xdrmem_dec_uint(xdrs, sizep)) - return FALSE; + return (FALSE); size = *sizep; if (size > maxsize || size > UINT_MAX / elsize) - return FALSE; + return (FALSE); /* * The Solaris man page says: "If *arrp is NULL when decoding, * xdr_array() allocates memory and *arrp points to it". */ if (*arrp == NULL) { - BUILD_BUG_ON(sizeof(uint_t) > sizeof(size_t)); + BUILD_BUG_ON(sizeof (uint_t) > sizeof (size_t)); *arrp = kmem_alloc(size * elsize, KM_NOSLEEP); if (*arrp == NULL) - return FALSE; + return (FALSE); alloc = TRUE; } @@ -422,12 +422,12 @@ xdr_dec_array(XDR *xdrs, caddr_t *arrp, uint_t *sizep, const uint_t maxsize, if (!elproc(xdrs, addr)) { if (alloc) kmem_free(*arrp, size * elsize); - return FALSE; + return (FALSE); } addr += elsize; } - return TRUE; + return (TRUE); } static bool_t @@ -437,14 +437,14 @@ xdr_enc_string(XDR *xdrs, char **sp, const uint_t maxsize) uint_t len; if (slen > maxsize) - return FALSE; + return (FALSE); len = slen; if (!xdrmem_enc_uint(xdrs, &len)) - return FALSE; + return (FALSE); - return xdrmem_enc_bytes(xdrs, *sp, len); + return (xdrmem_enc_bytes(xdrs, *sp, len)); } static bool_t @@ -454,21 +454,21 @@ xdr_dec_string(XDR *xdrs, char **sp, const uint_t maxsize) bool_t alloc = FALSE; if (!xdrmem_dec_uint(xdrs, &size)) - return FALSE; + return (FALSE); if (size > maxsize || size > UINT_MAX - 1) - return FALSE; + return (FALSE); /* * Solaris man page: "If *sp is NULL when decoding, xdr_string() * allocates memory and *sp points to it". */ if (*sp == NULL) { - BUILD_BUG_ON(sizeof(uint_t) > sizeof(size_t)); + BUILD_BUG_ON(sizeof (uint_t) > sizeof (size_t)); *sp = kmem_alloc(size + 1, KM_NOSLEEP); if (*sp == NULL) - return FALSE; + return (FALSE); alloc = TRUE; } @@ -481,34 +481,33 @@ xdr_dec_string(XDR *xdrs, char **sp, const uint_t maxsize) (*sp)[size] = '\0'; - return TRUE; + return (TRUE); fail: if (alloc) kmem_free(*sp, size + 1); - return FALSE; + return (FALSE); } static struct xdr_ops xdrmem_encode_ops = { - .xdr_control = xdrmem_control, - .xdr_char = xdrmem_enc_char, - .xdr_u_short = xdrmem_enc_ushort, - .xdr_u_int = xdrmem_enc_uint, - .xdr_u_longlong_t = xdrmem_enc_ulonglong, - .xdr_opaque = xdrmem_enc_bytes, - .xdr_string = xdr_enc_string, - .xdr_array = xdr_enc_array + .xdr_control = xdrmem_control, + .xdr_char = xdrmem_enc_char, + .xdr_u_short = xdrmem_enc_ushort, + .xdr_u_int = xdrmem_enc_uint, + .xdr_u_longlong_t = xdrmem_enc_ulonglong, + .xdr_opaque = xdrmem_enc_bytes, + .xdr_string = xdr_enc_string, + .xdr_array = xdr_enc_array }; static struct xdr_ops xdrmem_decode_ops = { - .xdr_control = xdrmem_control, - .xdr_char = xdrmem_dec_char, - .xdr_u_short = xdrmem_dec_ushort, - .xdr_u_int = xdrmem_dec_uint, - .xdr_u_longlong_t = xdrmem_dec_ulonglong, - .xdr_opaque = xdrmem_dec_bytes, - .xdr_string = xdr_dec_string, - .xdr_array = xdr_dec_array + .xdr_control = xdrmem_control, + .xdr_char = xdrmem_dec_char, + .xdr_u_short = xdrmem_dec_ushort, + .xdr_u_int = xdrmem_dec_uint, + .xdr_u_longlong_t = xdrmem_dec_ulonglong, + .xdr_opaque = xdrmem_dec_bytes, + .xdr_string = xdr_dec_string, + .xdr_array = xdr_dec_array }; - diff --git a/module/spl/spl-zlib.c b/module/spl/spl-zlib.c index 609bf5048..177a626df 100644 --- a/module/spl/spl-zlib.c +++ b/module/spl/spl-zlib.c @@ -20,7 +20,8 @@ * * You should have received a copy of the GNU General Public License along * with the SPL. If not, see . - ***************************************************************************** + * + * * z_compress_level/z_uncompress are nearly identical copies of the * compress2/uncompress functions provided by the official zlib package * available at http://zlib.net/. The only changes made we to slightly @@ -72,7 +73,7 @@ static spl_kmem_cache_t *zlib_workspace_cache; static void * zlib_workspace_alloc(int flags) { - return kmem_cache_alloc(zlib_workspace_cache, flags & ~(__GFP_FS)); + return (kmem_cache_alloc(zlib_workspace_cache, flags & ~(__GFP_FS))); } static void @@ -94,7 +95,7 @@ zlib_workspace_free(void *workspace) */ int z_compress_level(void *dest, size_t *destLen, const void *source, - size_t sourceLen, int level) + size_t sourceLen, int level) { z_stream stream; int err; @@ -105,30 +106,30 @@ z_compress_level(void *dest, size_t *destLen, const void *source, stream.avail_out = (uInt)*destLen; if ((size_t)stream.avail_out != *destLen) - return Z_BUF_ERROR; + return (Z_BUF_ERROR); stream.workspace = zlib_workspace_alloc(KM_SLEEP); if (!stream.workspace) - return Z_MEM_ERROR; + return (Z_MEM_ERROR); err = zlib_deflateInit(&stream, level); if (err != Z_OK) { zlib_workspace_free(stream.workspace); - return err; + return (err); } err = zlib_deflate(&stream, Z_FINISH); if (err != Z_STREAM_END) { zlib_deflateEnd(&stream); zlib_workspace_free(stream.workspace); - return err == Z_OK ? Z_BUF_ERROR : err; + return (err == Z_OK ? Z_BUF_ERROR : err); } *destLen = stream.total_out; err = zlib_deflateEnd(&stream); zlib_workspace_free(stream.workspace); - return err; + return (err); } EXPORT_SYMBOL(z_compress_level); @@ -159,16 +160,16 @@ z_uncompress(void *dest, size_t *destLen, const void *source, size_t sourceLen) stream.avail_out = (uInt)*destLen; if ((size_t)stream.avail_out != *destLen) - return Z_BUF_ERROR; + return (Z_BUF_ERROR); stream.workspace = zlib_workspace_alloc(KM_SLEEP); if (!stream.workspace) - return Z_MEM_ERROR; + return (Z_MEM_ERROR); err = zlib_inflateInit(&stream); if (err != Z_OK) { zlib_workspace_free(stream.workspace); - return err; + return (err); } err = zlib_inflate(&stream, Z_FINISH); @@ -177,17 +178,17 @@ z_uncompress(void *dest, size_t *destLen, const void *source, size_t sourceLen) zlib_workspace_free(stream.workspace); if (err == Z_NEED_DICT || - (err == Z_BUF_ERROR && stream.avail_in == 0)) - return Z_DATA_ERROR; + (err == Z_BUF_ERROR && stream.avail_in == 0)) + return (Z_DATA_ERROR); - return err; + return (err); } *destLen = stream.total_out; err = zlib_inflateEnd(&stream); zlib_workspace_free(stream.workspace); - return err; + return (err); } EXPORT_SYMBOL(z_uncompress); @@ -203,15 +204,15 @@ spl_zlib_init(void) "spl_zlib_workspace_cache", size, 0, NULL, NULL, NULL, NULL, NULL, KMC_VMEM | KMC_NOEMERGENCY); - if (!zlib_workspace_cache) + if (!zlib_workspace_cache) return (1); - return (0); + return (0); } void spl_zlib_fini(void) { kmem_cache_destroy(zlib_workspace_cache); - zlib_workspace_cache = NULL; + zlib_workspace_cache = NULL; } -- cgit v1.2.3