aboutsummaryrefslogtreecommitdiffstats
path: root/fs/9p/9p.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/9p.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/9p.c')
-rw-r--r--fs/9p/9p.c68
1 files changed, 49 insertions, 19 deletions
diff --git a/fs/9p/9p.c b/fs/9p/9p.c
index e847f504a47c..a3a1ac610723 100644
--- a/fs/9p/9p.c
+++ b/fs/9p/9p.c
@@ -52,10 +52,11 @@ v9fs_t_version(struct v9fs_session_info *v9ses, u32 msize,
52 52
53 dprintk(DEBUG_9P, "msize: %d version: %s\n", msize, version); 53 dprintk(DEBUG_9P, "msize: %d version: %s\n", msize, version);
54 msg.id = TVERSION; 54 msg.id = TVERSION;
55 msg.tag = ~0;
55 msg.params.tversion.msize = msize; 56 msg.params.tversion.msize = msize;
56 msg.params.tversion.version = version; 57 msg.params.tversion.version = version;
57 58
58 return v9fs_mux_rpc(v9ses, &msg, fcall); 59 return v9fs_mux_rpc(v9ses->mux, &msg, fcall);
59} 60}
60 61
61/** 62/**
@@ -83,7 +84,30 @@ v9fs_t_attach(struct v9fs_session_info *v9ses, char *uname, char *aname,
83 msg.params.tattach.uname = uname; 84 msg.params.tattach.uname = uname;
84 msg.params.tattach.aname = aname; 85 msg.params.tattach.aname = aname;
85 86
86 return v9fs_mux_rpc(v9ses, &msg, fcall); 87 return v9fs_mux_rpc(v9ses->mux, &msg, fcall);
88}
89
90static void v9fs_t_clunk_cb(void *a, struct v9fs_fcall *tc,
91 struct v9fs_fcall *rc, int err)
92{
93 int fid;
94 struct v9fs_session_info *v9ses;
95
96 if (err)
97 return;
98
99 fid = tc->params.tclunk.fid;
100 kfree(tc);
101
102 if (!rc)
103 return;
104
105 dprintk(DEBUG_9P, "tcall id %d rcall id %d\n", tc->id, rc->id);
106 v9ses = a;
107 if (rc->id == RCLUNK)
108 v9fs_put_idpool(fid, &v9ses->fidpool);
109
110 kfree(rc);
87} 111}
88 112
89/** 113/**
@@ -93,18 +117,24 @@ v9fs_t_attach(struct v9fs_session_info *v9ses, char *uname, char *aname,
93 * @fcall: pointer to response fcall pointer 117 * @fcall: pointer to response fcall pointer
94 * 118 *
95 */ 119 */
96
97int 120int
98v9fs_t_clunk(struct v9fs_session_info *v9ses, u32 fid, 121v9fs_t_clunk(struct v9fs_session_info *v9ses, u32 fid)
99 struct v9fs_fcall **fcall)
100{ 122{
101 struct v9fs_fcall msg; 123 int err;
124 struct v9fs_fcall *tc, *rc;
125
126 tc = kmalloc(sizeof(struct v9fs_fcall), GFP_KERNEL);
102 127
103 dprintk(DEBUG_9P, "fid %d\n", fid); 128 dprintk(DEBUG_9P, "fid %d\n", fid);
104 msg.id = TCLUNK; 129 tc->id = TCLUNK;
105 msg.params.tclunk.fid = fid; 130 tc->params.tclunk.fid = fid;
106 131
107 return v9fs_mux_rpc(v9ses, &msg, fcall); 132 err = v9fs_mux_rpc(v9ses->mux, tc, &rc);
133 if (err >= 0) {
134 v9fs_t_clunk_cb(v9ses, tc, rc, 0);
135 }
136
137 return err;
108} 138}
109 139
110/** 140/**
@@ -121,7 +151,7 @@ int v9fs_t_flush(struct v9fs_session_info *v9ses, u16 tag)
121 dprintk(DEBUG_9P, "oldtag %d\n", tag); 151 dprintk(DEBUG_9P, "oldtag %d\n", tag);
122 msg.id = TFLUSH; 152 msg.id = TFLUSH;
123 msg.params.tflush.oldtag = tag; 153 msg.params.tflush.oldtag = tag;
124 return v9fs_mux_rpc(v9ses, &msg, NULL); 154 return v9fs_mux_rpc(v9ses->mux, &msg, NULL);
125} 155}
126 156
127/** 157/**
@@ -143,7 +173,7 @@ v9fs_t_stat(struct v9fs_session_info *v9ses, u32 fid, struct v9fs_fcall **fcall)
143 173
144 msg.id = TSTAT; 174 msg.id = TSTAT;
145 msg.params.tstat.fid = fid; 175 msg.params.tstat.fid = fid;
146 return v9fs_mux_rpc(v9ses, &msg, fcall); 176 return v9fs_mux_rpc(v9ses->mux, &msg, fcall);
147} 177}
148 178
149/** 179/**
@@ -166,7 +196,7 @@ v9fs_t_wstat(struct v9fs_session_info *v9ses, u32 fid,
166 msg.params.twstat.fid = fid; 196 msg.params.twstat.fid = fid;
167 msg.params.twstat.stat = stat; 197 msg.params.twstat.stat = stat;
168 198
169 return v9fs_mux_rpc(v9ses, &msg, fcall); 199 return v9fs_mux_rpc(v9ses->mux, &msg, fcall);
170} 200}
171 201
172/** 202/**
@@ -199,7 +229,7 @@ v9fs_t_walk(struct v9fs_session_info *v9ses, u32 fid, u32 newfid,
199 msg.params.twalk.nwname = 0; 229 msg.params.twalk.nwname = 0;
200 } 230 }
201 231
202 return v9fs_mux_rpc(v9ses, &msg, fcall); 232 return v9fs_mux_rpc(v9ses->mux, &msg, fcall);
203} 233}
204 234
205/** 235/**
@@ -217,14 +247,14 @@ v9fs_t_open(struct v9fs_session_info *v9ses, u32 fid, u8 mode,
217 struct v9fs_fcall **fcall) 247 struct v9fs_fcall **fcall)
218{ 248{
219 struct v9fs_fcall msg; 249 struct v9fs_fcall msg;
220 long errorno = -1; 250 int errorno = -1;
221 251
222 dprintk(DEBUG_9P, "fid %d mode %d\n", fid, mode); 252 dprintk(DEBUG_9P, "fid %d mode %d\n", fid, mode);
223 msg.id = TOPEN; 253 msg.id = TOPEN;
224 msg.params.topen.fid = fid; 254 msg.params.topen.fid = fid;
225 msg.params.topen.mode = mode; 255 msg.params.topen.mode = mode;
226 256
227 errorno = v9fs_mux_rpc(v9ses, &msg, fcall); 257 errorno = v9fs_mux_rpc(v9ses->mux, &msg, fcall);
228 258
229 return errorno; 259 return errorno;
230} 260}
@@ -246,7 +276,7 @@ v9fs_t_remove(struct v9fs_session_info *v9ses, u32 fid,
246 dprintk(DEBUG_9P, "fid %d\n", fid); 276 dprintk(DEBUG_9P, "fid %d\n", fid);
247 msg.id = TREMOVE; 277 msg.id = TREMOVE;
248 msg.params.tremove.fid = fid; 278 msg.params.tremove.fid = fid;
249 return v9fs_mux_rpc(v9ses, &msg, fcall); 279 return v9fs_mux_rpc(v9ses->mux, &msg, fcall);
250} 280}
251 281
252/** 282/**
@@ -275,7 +305,7 @@ v9fs_t_create(struct v9fs_session_info *v9ses, u32 fid, char *name,
275 msg.params.tcreate.perm = perm; 305 msg.params.tcreate.perm = perm;
276 msg.params.tcreate.mode = mode; 306 msg.params.tcreate.mode = mode;
277 307
278 return v9fs_mux_rpc(v9ses, &msg, fcall); 308 return v9fs_mux_rpc(v9ses->mux, &msg, fcall);
279} 309}
280 310
281/** 311/**
@@ -302,7 +332,7 @@ v9fs_t_read(struct v9fs_session_info *v9ses, u32 fid, u64 offset,
302 msg.params.tread.fid = fid; 332 msg.params.tread.fid = fid;
303 msg.params.tread.offset = offset; 333 msg.params.tread.offset = offset;
304 msg.params.tread.count = count; 334 msg.params.tread.count = count;
305 errorno = v9fs_mux_rpc(v9ses, &msg, &rc); 335 errorno = v9fs_mux_rpc(v9ses->mux, &msg, &rc);
306 336
307 if (!errorno) { 337 if (!errorno) {
308 errorno = rc->params.rread.count; 338 errorno = rc->params.rread.count;
@@ -345,7 +375,7 @@ v9fs_t_write(struct v9fs_session_info *v9ses, u32 fid,
345 msg.params.twrite.count = count; 375 msg.params.twrite.count = count;
346 msg.params.twrite.data = data; 376 msg.params.twrite.data = data;
347 377
348 errorno = v9fs_mux_rpc(v9ses, &msg, &rc); 378 errorno = v9fs_mux_rpc(v9ses->mux, &msg, &rc);
349 379
350 if (!errorno) 380 if (!errorno)
351 errorno = rc->params.rwrite.count; 381 errorno = rc->params.rwrite.count;