diff options
author | Arjan van de Ven <arjan@infradead.org> | 2006-03-21 01:33:17 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2006-03-21 01:33:17 -0500 |
commit | 4a3e2f711a00a1feb72ae12fdc749da10179d185 (patch) | |
tree | 76ced9d3270dea4b864da71fa1d4415d2e3c8b11 /net/sunrpc | |
parent | d4ccd08cdfa8d34f4d25b62041343c52fc79385f (diff) |
[NET] sem2mutex: net/
Semaphore to mutex conversion.
The conversion was generated via scripts, and the result was validated
automatically via a script as well.
Signed-off-by: Arjan van de Ven <arjan@infradead.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sunrpc')
-rw-r--r-- | net/sunrpc/cache.c | 17 | ||||
-rw-r--r-- | net/sunrpc/sched.c | 11 |
2 files changed, 15 insertions, 13 deletions
diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c index dcaa0c4453ff..0acccfeeb284 100644 --- a/net/sunrpc/cache.c +++ b/net/sunrpc/cache.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/proc_fs.h> | 26 | #include <linux/proc_fs.h> |
27 | #include <linux/net.h> | 27 | #include <linux/net.h> |
28 | #include <linux/workqueue.h> | 28 | #include <linux/workqueue.h> |
29 | #include <linux/mutex.h> | ||
29 | #include <asm/ioctls.h> | 30 | #include <asm/ioctls.h> |
30 | #include <linux/sunrpc/types.h> | 31 | #include <linux/sunrpc/types.h> |
31 | #include <linux/sunrpc/cache.h> | 32 | #include <linux/sunrpc/cache.h> |
@@ -532,7 +533,7 @@ void cache_clean_deferred(void *owner) | |||
532 | */ | 533 | */ |
533 | 534 | ||
534 | static DEFINE_SPINLOCK(queue_lock); | 535 | static DEFINE_SPINLOCK(queue_lock); |
535 | static DECLARE_MUTEX(queue_io_sem); | 536 | static DEFINE_MUTEX(queue_io_mutex); |
536 | 537 | ||
537 | struct cache_queue { | 538 | struct cache_queue { |
538 | struct list_head list; | 539 | struct list_head list; |
@@ -561,7 +562,7 @@ cache_read(struct file *filp, char __user *buf, size_t count, loff_t *ppos) | |||
561 | if (count == 0) | 562 | if (count == 0) |
562 | return 0; | 563 | return 0; |
563 | 564 | ||
564 | down(&queue_io_sem); /* protect against multiple concurrent | 565 | mutex_lock(&queue_io_mutex); /* protect against multiple concurrent |
565 | * readers on this file */ | 566 | * readers on this file */ |
566 | again: | 567 | again: |
567 | spin_lock(&queue_lock); | 568 | spin_lock(&queue_lock); |
@@ -574,7 +575,7 @@ cache_read(struct file *filp, char __user *buf, size_t count, loff_t *ppos) | |||
574 | } | 575 | } |
575 | if (rp->q.list.next == &cd->queue) { | 576 | if (rp->q.list.next == &cd->queue) { |
576 | spin_unlock(&queue_lock); | 577 | spin_unlock(&queue_lock); |
577 | up(&queue_io_sem); | 578 | mutex_unlock(&queue_io_mutex); |
578 | BUG_ON(rp->offset); | 579 | BUG_ON(rp->offset); |
579 | return 0; | 580 | return 0; |
580 | } | 581 | } |
@@ -621,11 +622,11 @@ cache_read(struct file *filp, char __user *buf, size_t count, loff_t *ppos) | |||
621 | } | 622 | } |
622 | if (err == -EAGAIN) | 623 | if (err == -EAGAIN) |
623 | goto again; | 624 | goto again; |
624 | up(&queue_io_sem); | 625 | mutex_unlock(&queue_io_mutex); |
625 | return err ? err : count; | 626 | return err ? err : count; |
626 | } | 627 | } |
627 | 628 | ||
628 | static char write_buf[8192]; /* protected by queue_io_sem */ | 629 | static char write_buf[8192]; /* protected by queue_io_mutex */ |
629 | 630 | ||
630 | static ssize_t | 631 | static ssize_t |
631 | cache_write(struct file *filp, const char __user *buf, size_t count, | 632 | cache_write(struct file *filp, const char __user *buf, size_t count, |
@@ -639,10 +640,10 @@ cache_write(struct file *filp, const char __user *buf, size_t count, | |||
639 | if (count >= sizeof(write_buf)) | 640 | if (count >= sizeof(write_buf)) |
640 | return -EINVAL; | 641 | return -EINVAL; |
641 | 642 | ||
642 | down(&queue_io_sem); | 643 | mutex_lock(&queue_io_mutex); |
643 | 644 | ||
644 | if (copy_from_user(write_buf, buf, count)) { | 645 | if (copy_from_user(write_buf, buf, count)) { |
645 | up(&queue_io_sem); | 646 | mutex_unlock(&queue_io_mutex); |
646 | return -EFAULT; | 647 | return -EFAULT; |
647 | } | 648 | } |
648 | write_buf[count] = '\0'; | 649 | write_buf[count] = '\0'; |
@@ -651,7 +652,7 @@ cache_write(struct file *filp, const char __user *buf, size_t count, | |||
651 | else | 652 | else |
652 | err = -EINVAL; | 653 | err = -EINVAL; |
653 | 654 | ||
654 | up(&queue_io_sem); | 655 | mutex_unlock(&queue_io_mutex); |
655 | return err ? err : count; | 656 | return err ? err : count; |
656 | } | 657 | } |
657 | 658 | ||
diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c index e838d042f7f5..dff07795bd16 100644 --- a/net/sunrpc/sched.c +++ b/net/sunrpc/sched.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/smp.h> | 18 | #include <linux/smp.h> |
19 | #include <linux/smp_lock.h> | 19 | #include <linux/smp_lock.h> |
20 | #include <linux/spinlock.h> | 20 | #include <linux/spinlock.h> |
21 | #include <linux/mutex.h> | ||
21 | 22 | ||
22 | #include <linux/sunrpc/clnt.h> | 23 | #include <linux/sunrpc/clnt.h> |
23 | #include <linux/sunrpc/xprt.h> | 24 | #include <linux/sunrpc/xprt.h> |
@@ -62,7 +63,7 @@ static LIST_HEAD(all_tasks); | |||
62 | /* | 63 | /* |
63 | * rpciod-related stuff | 64 | * rpciod-related stuff |
64 | */ | 65 | */ |
65 | static DECLARE_MUTEX(rpciod_sema); | 66 | static DEFINE_MUTEX(rpciod_mutex); |
66 | static unsigned int rpciod_users; | 67 | static unsigned int rpciod_users; |
67 | static struct workqueue_struct *rpciod_workqueue; | 68 | static struct workqueue_struct *rpciod_workqueue; |
68 | 69 | ||
@@ -1047,7 +1048,7 @@ rpciod_up(void) | |||
1047 | struct workqueue_struct *wq; | 1048 | struct workqueue_struct *wq; |
1048 | int error = 0; | 1049 | int error = 0; |
1049 | 1050 | ||
1050 | down(&rpciod_sema); | 1051 | mutex_lock(&rpciod_mutex); |
1051 | dprintk("rpciod_up: users %d\n", rpciod_users); | 1052 | dprintk("rpciod_up: users %d\n", rpciod_users); |
1052 | rpciod_users++; | 1053 | rpciod_users++; |
1053 | if (rpciod_workqueue) | 1054 | if (rpciod_workqueue) |
@@ -1070,14 +1071,14 @@ rpciod_up(void) | |||
1070 | rpciod_workqueue = wq; | 1071 | rpciod_workqueue = wq; |
1071 | error = 0; | 1072 | error = 0; |
1072 | out: | 1073 | out: |
1073 | up(&rpciod_sema); | 1074 | mutex_unlock(&rpciod_mutex); |
1074 | return error; | 1075 | return error; |
1075 | } | 1076 | } |
1076 | 1077 | ||
1077 | void | 1078 | void |
1078 | rpciod_down(void) | 1079 | rpciod_down(void) |
1079 | { | 1080 | { |
1080 | down(&rpciod_sema); | 1081 | mutex_lock(&rpciod_mutex); |
1081 | dprintk("rpciod_down sema %d\n", rpciod_users); | 1082 | dprintk("rpciod_down sema %d\n", rpciod_users); |
1082 | if (rpciod_users) { | 1083 | if (rpciod_users) { |
1083 | if (--rpciod_users) | 1084 | if (--rpciod_users) |
@@ -1094,7 +1095,7 @@ rpciod_down(void) | |||
1094 | destroy_workqueue(rpciod_workqueue); | 1095 | destroy_workqueue(rpciod_workqueue); |
1095 | rpciod_workqueue = NULL; | 1096 | rpciod_workqueue = NULL; |
1096 | out: | 1097 | out: |
1097 | up(&rpciod_sema); | 1098 | mutex_unlock(&rpciod_mutex); |
1098 | } | 1099 | } |
1099 | 1100 | ||
1100 | #ifdef RPC_DEBUG | 1101 | #ifdef RPC_DEBUG |