diff options
author | Brian Behlendorf <[email protected]> | 2014-09-29 18:00:46 -0400 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2014-10-17 15:07:28 -0700 |
commit | 0cb3dafccdffd00167275416730332cd5570a07a (patch) | |
tree | 8340763830219747f9948a2335e85d57642fc88d /module/splat/splat-atomic.c | |
parent | 62032954383dc6d1200890f07f56bb0ad85451be (diff) |
Update SPLAT to use kmutex_t for portability
For consistency throughout the code update the SPLAT infrastructure
to use the wrapped mutex interfaces.
Signed-off-by: Brian Behlendorf <[email protected]>
Diffstat (limited to 'module/splat/splat-atomic.c')
-rw-r--r-- | module/splat/splat-atomic.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/module/splat/splat-atomic.c b/module/splat/splat-atomic.c index f702196be..7a1bd859d 100644 --- a/module/splat/splat-atomic.c +++ b/module/splat/splat-atomic.c @@ -26,6 +26,7 @@ #include <sys/atomic.h> #include <sys/thread.h> +#include <sys/mutex.h> #include <linux/slab.h> #include "splat-internal.h" @@ -52,7 +53,7 @@ typedef enum { typedef struct atomic_priv { unsigned long ap_magic; struct file *ap_file; - struct mutex ap_lock; + kmutex_t ap_lock; wait_queue_head_t ap_waitq; volatile uint64_t ap_atomic; volatile uint64_t ap_atomic_exited; @@ -70,10 +71,10 @@ splat_atomic_work(void *priv) ap = (atomic_priv_t *)priv; ASSERT(ap->ap_magic == SPLAT_ATOMIC_TEST_MAGIC); - mutex_lock(&ap->ap_lock); + mutex_enter(&ap->ap_lock); op = ap->ap_op; wake_up(&ap->ap_waitq); - mutex_unlock(&ap->ap_lock); + mutex_exit(&ap->ap_lock); splat_vprint(ap->ap_file, SPLAT_ATOMIC_TEST1_NAME, "Thread %d successfully started: %lu/%lu\n", op, @@ -143,13 +144,13 @@ splat_atomic_test1(struct file *file, void *arg) ap.ap_magic = SPLAT_ATOMIC_TEST_MAGIC; ap.ap_file = file; - mutex_init(&ap.ap_lock); + mutex_init(&ap.ap_lock, SPLAT_ATOMIC_TEST1_NAME, NULL, NULL); init_waitqueue_head(&ap.ap_waitq); ap.ap_atomic = SPLAT_ATOMIC_INIT_VALUE; ap.ap_atomic_exited = 0; for (i = 0; i < SPLAT_ATOMIC_COUNT_64; i++) { - mutex_lock(&ap.ap_lock); + mutex_enter(&ap.ap_lock); ap.ap_op = i; thr = (kthread_t *)thread_create(NULL, 0, splat_atomic_work, @@ -157,14 +158,14 @@ splat_atomic_test1(struct file *file, void *arg) minclsyspri); if (thr == NULL) { rc = -ESRCH; - mutex_unlock(&ap.ap_lock); + mutex_exit(&ap.ap_lock); break; } /* Prepare to wait, the new thread will wake us once it * has made a copy of the unique private passed data */ prepare_to_wait(&ap.ap_waitq, &wait, TASK_UNINTERRUPTIBLE); - mutex_unlock(&ap.ap_lock); + mutex_exit(&ap.ap_lock); schedule(); } @@ -187,6 +188,8 @@ splat_atomic_test1(struct file *file, void *arg) "Success initial and final values match, %lu == %lu\n", (long unsigned)ap.ap_atomic, SPLAT_ATOMIC_INIT_VALUE); + mutex_destroy(&ap.ap_lock); + return 0; } |