aboutsummaryrefslogtreecommitdiffstats
path: root/fs/9p/v9fs.c
diff options
context:
space:
mode:
authorLatchesar Ionkov <lucho@ionkov.net>2006-01-08 04:04:58 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-01-08 23:14:05 -0500
commit3cf6429a26da5c4d7b795e6d0f8f56ed2e4fdfc0 (patch)
treea8d856763fd9a0536519634c93ab92da684107fa /fs/9p/v9fs.c
parentf5ef3c105bee3a52486d7b55cef3330fcde9bca6 (diff)
[PATCH] v9fs: new multiplexer implementation
New multiplexer implementation. Decreases the number of kernel threads required. Better handling when the user process receives a signal. Signed-off-by: Latchesar Ionkov <lucho@ionkov.net> Cc: Eric Van Hensbergen <ericvh@ericvh.myip.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/9p/v9fs.c')
-rw-r--r--fs/9p/v9fs.c41
1 files changed, 30 insertions, 11 deletions
diff --git a/fs/9p/v9fs.c b/fs/9p/v9fs.c
index 418c3743fdee..5e0f79355fdf 100644
--- a/fs/9p/v9fs.c
+++ b/fs/9p/v9fs.c
@@ -213,7 +213,8 @@ retry:
213 return -1; 213 return -1;
214 } 214 }
215 215
216 error = idr_get_new(&p->pool, NULL, &i); 216 /* no need to store exactly p, we just need something non-null */
217 error = idr_get_new(&p->pool, p, &i);
217 up(&p->lock); 218 up(&p->lock);
218 219
219 if (error == -EAGAIN) 220 if (error == -EAGAIN)
@@ -243,6 +244,16 @@ void v9fs_put_idpool(int id, struct v9fs_idpool *p)
243} 244}
244 245
245/** 246/**
247 * v9fs_check_idpool - check if the specified id is available
248 * @id - id to check
249 * @p - pool
250 */
251int v9fs_check_idpool(int id, struct v9fs_idpool *p)
252{
253 return idr_find(&p->pool, id) != NULL;
254}
255
256/**
246 * v9fs_session_init - initialize session 257 * v9fs_session_init - initialize session
247 * @v9ses: session information structure 258 * @v9ses: session information structure
248 * @dev_name: device being mounted 259 * @dev_name: device being mounted
@@ -281,9 +292,6 @@ v9fs_session_init(struct v9fs_session_info *v9ses,
281 /* id pools that are session-dependent: FIDs and TIDs */ 292 /* id pools that are session-dependent: FIDs and TIDs */
282 idr_init(&v9ses->fidpool.pool); 293 idr_init(&v9ses->fidpool.pool);
283 init_MUTEX(&v9ses->fidpool.lock); 294 init_MUTEX(&v9ses->fidpool.lock);
284 idr_init(&v9ses->tidpool.pool);
285 init_MUTEX(&v9ses->tidpool.lock);
286
287 295
288 switch (v9ses->proto) { 296 switch (v9ses->proto) {
289 case PROTO_TCP: 297 case PROTO_TCP:
@@ -320,7 +328,12 @@ v9fs_session_init(struct v9fs_session_info *v9ses,
320 v9ses->shutdown = 0; 328 v9ses->shutdown = 0;
321 v9ses->session_hung = 0; 329 v9ses->session_hung = 0;
322 330
323 if ((retval = v9fs_mux_init(v9ses, dev_name)) < 0) { 331 v9ses->mux = v9fs_mux_init(v9ses->transport, v9ses->maxdata + V9FS_IOHDRSZ,
332 &v9ses->extended);
333
334 if (IS_ERR(v9ses->mux)) {
335 retval = PTR_ERR(v9ses->mux);
336 v9ses->mux = NULL;
324 dprintk(DEBUG_ERROR, "problem initializing mux\n"); 337 dprintk(DEBUG_ERROR, "problem initializing mux\n");
325 goto SessCleanUp; 338 goto SessCleanUp;
326 } 339 }
@@ -381,7 +394,7 @@ v9fs_session_init(struct v9fs_session_info *v9ses,
381 } 394 }
382 395
383 if (v9ses->afid != ~0) { 396 if (v9ses->afid != ~0) {
384 if (v9fs_t_clunk(v9ses, v9ses->afid, NULL)) 397 if (v9fs_t_clunk(v9ses, v9ses->afid))
385 dprintk(DEBUG_ERROR, "clunk failed\n"); 398 dprintk(DEBUG_ERROR, "clunk failed\n");
386 } 399 }
387 400
@@ -403,13 +416,16 @@ v9fs_session_init(struct v9fs_session_info *v9ses,
403 416
404void v9fs_session_close(struct v9fs_session_info *v9ses) 417void v9fs_session_close(struct v9fs_session_info *v9ses)
405{ 418{
406 if (v9ses->recvproc) { 419 if (v9ses->mux) {
407 send_sig(SIGKILL, v9ses->recvproc, 1); 420 v9fs_mux_destroy(v9ses->mux);
408 wait_for_completion(&v9ses->proccmpl); 421 v9ses->mux = NULL;
409 } 422 }
410 423
411 if (v9ses->transport) 424 if (v9ses->transport) {
412 v9ses->transport->close(v9ses->transport); 425 v9ses->transport->close(v9ses->transport);
426 kfree(v9ses->transport);
427 v9ses->transport = NULL;
428 }
413 429
414 __putname(v9ses->name); 430 __putname(v9ses->name);
415 __putname(v9ses->remotename); 431 __putname(v9ses->remotename);
@@ -420,8 +436,9 @@ void v9fs_session_close(struct v9fs_session_info *v9ses)
420 * and cancel all pending requests. 436 * and cancel all pending requests.
421 */ 437 */
422void v9fs_session_cancel(struct v9fs_session_info *v9ses) { 438void v9fs_session_cancel(struct v9fs_session_info *v9ses) {
439 dprintk(DEBUG_ERROR, "cancel session %p\n", v9ses);
423 v9ses->transport->status = Disconnected; 440 v9ses->transport->status = Disconnected;
424 v9fs_mux_cancel_requests(v9ses, -EIO); 441 v9fs_mux_cancel(v9ses->mux, -EIO);
425} 442}
426 443
427extern int v9fs_error_init(void); 444extern int v9fs_error_init(void);
@@ -437,6 +454,7 @@ static int __init init_v9fs(void)
437 454
438 printk(KERN_INFO "Installing v9fs 9P2000 file system support\n"); 455 printk(KERN_INFO "Installing v9fs 9P2000 file system support\n");
439 456
457 v9fs_mux_global_init();
440 return register_filesystem(&v9fs_fs_type); 458 return register_filesystem(&v9fs_fs_type);
441} 459}
442 460
@@ -447,6 +465,7 @@ static int __init init_v9fs(void)
447 465
448static void __exit exit_v9fs(void) 466static void __exit exit_v9fs(void)
449{ 467{
468 v9fs_mux_global_exit();
450 unregister_filesystem(&v9fs_fs_type); 469 unregister_filesystem(&v9fs_fs_type);
451} 470}
452 471