diff options
Diffstat (limited to 'fs/9p/mux.c')
-rw-r--r-- | fs/9p/mux.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/fs/9p/mux.c b/fs/9p/mux.c index ea1134eb47c8..e2ae60adda99 100644 --- a/fs/9p/mux.c +++ b/fs/9p/mux.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/poll.h> | 31 | #include <linux/poll.h> |
32 | #include <linux/kthread.h> | 32 | #include <linux/kthread.h> |
33 | #include <linux/idr.h> | 33 | #include <linux/idr.h> |
34 | #include <linux/mutex.h> | ||
34 | 35 | ||
35 | #include "debug.h" | 36 | #include "debug.h" |
36 | #include "v9fs.h" | 37 | #include "v9fs.h" |
@@ -110,7 +111,7 @@ static void v9fs_pollwait(struct file *filp, wait_queue_head_t * wait_address, | |||
110 | static u16 v9fs_mux_get_tag(struct v9fs_mux_data *); | 111 | static u16 v9fs_mux_get_tag(struct v9fs_mux_data *); |
111 | static void v9fs_mux_put_tag(struct v9fs_mux_data *, u16); | 112 | static void v9fs_mux_put_tag(struct v9fs_mux_data *, u16); |
112 | 113 | ||
113 | static DECLARE_MUTEX(v9fs_mux_task_lock); | 114 | static DEFINE_MUTEX(v9fs_mux_task_lock); |
114 | static struct workqueue_struct *v9fs_mux_wq; | 115 | static struct workqueue_struct *v9fs_mux_wq; |
115 | 116 | ||
116 | static int v9fs_mux_num; | 117 | static int v9fs_mux_num; |
@@ -142,7 +143,7 @@ void v9fs_mux_global_exit(void) | |||
142 | * | 143 | * |
143 | * The current implementation returns sqrt of the number of mounts. | 144 | * The current implementation returns sqrt of the number of mounts. |
144 | */ | 145 | */ |
145 | inline int v9fs_mux_calc_poll_procs(int muxnum) | 146 | static int v9fs_mux_calc_poll_procs(int muxnum) |
146 | { | 147 | { |
147 | int n; | 148 | int n; |
148 | 149 | ||
@@ -166,7 +167,7 @@ static int v9fs_mux_poll_start(struct v9fs_mux_data *m) | |||
166 | 167 | ||
167 | dprintk(DEBUG_MUX, "mux %p muxnum %d procnum %d\n", m, v9fs_mux_num, | 168 | dprintk(DEBUG_MUX, "mux %p muxnum %d procnum %d\n", m, v9fs_mux_num, |
168 | v9fs_mux_poll_task_num); | 169 | v9fs_mux_poll_task_num); |
169 | up(&v9fs_mux_task_lock); | 170 | mutex_lock(&v9fs_mux_task_lock); |
170 | 171 | ||
171 | n = v9fs_mux_calc_poll_procs(v9fs_mux_num + 1); | 172 | n = v9fs_mux_calc_poll_procs(v9fs_mux_num + 1); |
172 | if (n > v9fs_mux_poll_task_num) { | 173 | if (n > v9fs_mux_poll_task_num) { |
@@ -225,7 +226,7 @@ static int v9fs_mux_poll_start(struct v9fs_mux_data *m) | |||
225 | } | 226 | } |
226 | 227 | ||
227 | v9fs_mux_num++; | 228 | v9fs_mux_num++; |
228 | down(&v9fs_mux_task_lock); | 229 | mutex_unlock(&v9fs_mux_task_lock); |
229 | 230 | ||
230 | return 0; | 231 | return 0; |
231 | } | 232 | } |
@@ -235,7 +236,7 @@ static void v9fs_mux_poll_stop(struct v9fs_mux_data *m) | |||
235 | int i; | 236 | int i; |
236 | struct v9fs_mux_poll_task *vpt; | 237 | struct v9fs_mux_poll_task *vpt; |
237 | 238 | ||
238 | up(&v9fs_mux_task_lock); | 239 | mutex_lock(&v9fs_mux_task_lock); |
239 | vpt = m->poll_task; | 240 | vpt = m->poll_task; |
240 | list_del(&m->mux_list); | 241 | list_del(&m->mux_list); |
241 | for(i = 0; i < ARRAY_SIZE(m->poll_waddr); i++) { | 242 | for(i = 0; i < ARRAY_SIZE(m->poll_waddr); i++) { |
@@ -252,7 +253,7 @@ static void v9fs_mux_poll_stop(struct v9fs_mux_data *m) | |||
252 | v9fs_mux_poll_task_num--; | 253 | v9fs_mux_poll_task_num--; |
253 | } | 254 | } |
254 | v9fs_mux_num--; | 255 | v9fs_mux_num--; |
255 | down(&v9fs_mux_task_lock); | 256 | mutex_unlock(&v9fs_mux_task_lock); |
256 | } | 257 | } |
257 | 258 | ||
258 | /** | 259 | /** |
@@ -383,7 +384,7 @@ v9fs_pollwait(struct file *filp, wait_queue_head_t * wait_address, | |||
383 | /** | 384 | /** |
384 | * v9fs_poll_mux - polls a mux and schedules read or write works if necessary | 385 | * v9fs_poll_mux - polls a mux and schedules read or write works if necessary |
385 | */ | 386 | */ |
386 | static inline void v9fs_poll_mux(struct v9fs_mux_data *m) | 387 | static void v9fs_poll_mux(struct v9fs_mux_data *m) |
387 | { | 388 | { |
388 | int n; | 389 | int n; |
389 | 390 | ||
@@ -761,9 +762,8 @@ static struct v9fs_req *v9fs_send_request(struct v9fs_mux_data *m, | |||
761 | return req; | 762 | return req; |
762 | } | 763 | } |
763 | 764 | ||
764 | static inline void | 765 | static void v9fs_mux_flush_cb(void *a, struct v9fs_fcall *tc, |
765 | v9fs_mux_flush_cb(void *a, struct v9fs_fcall *tc, struct v9fs_fcall *rc, | 766 | struct v9fs_fcall *rc, int err) |
766 | int err) | ||
767 | { | 767 | { |
768 | v9fs_mux_req_callback cb; | 768 | v9fs_mux_req_callback cb; |
769 | int tag; | 769 | int tag; |
@@ -901,6 +901,7 @@ v9fs_mux_rpc(struct v9fs_mux_data *m, struct v9fs_fcall *tc, | |||
901 | return err; | 901 | return err; |
902 | } | 902 | } |
903 | 903 | ||
904 | #if 0 | ||
904 | /** | 905 | /** |
905 | * v9fs_mux_rpcnb - sends 9P request without waiting for response. | 906 | * v9fs_mux_rpcnb - sends 9P request without waiting for response. |
906 | * @m: mux data | 907 | * @m: mux data |
@@ -924,6 +925,7 @@ int v9fs_mux_rpcnb(struct v9fs_mux_data *m, struct v9fs_fcall *tc, | |||
924 | dprintk(DEBUG_MUX, "mux %p tc %p tag %d\n", m, tc, req->tag); | 925 | dprintk(DEBUG_MUX, "mux %p tc %p tag %d\n", m, tc, req->tag); |
925 | return 0; | 926 | return 0; |
926 | } | 927 | } |
928 | #endif /* 0 */ | ||
927 | 929 | ||
928 | /** | 930 | /** |
929 | * v9fs_mux_cancel - cancel all pending requests with error | 931 | * v9fs_mux_cancel - cancel all pending requests with error |