diff options
author | Latchesar Ionkov <lucho@ionkov.net> | 2006-01-08 04:05:00 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-08 23:14:06 -0500 |
commit | 531b1094b74365dcc55fa464d28a9a2497ae825d (patch) | |
tree | a0384dabe3be1c844166d028b3ef7c21c3dfe5fc /fs/9p/9p.h | |
parent | d8da097afb765654c866062148fd98b11db9003e (diff) |
[PATCH] v9fs: zero copy implementation
Performance enhancement reducing the number of copies in the data and
stat paths.
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.h')
-rw-r--r-- | fs/9p/9p.h | 75 |
1 files changed, 54 insertions, 21 deletions
diff --git a/fs/9p/9p.h b/fs/9p/9p.h index 6355392786e2..007ff639777d 100644 --- a/fs/9p/9p.h +++ b/fs/9p/9p.h | |||
@@ -3,6 +3,7 @@ | |||
3 | * | 3 | * |
4 | * 9P protocol definitions. | 4 | * 9P protocol definitions. |
5 | * | 5 | * |
6 | * Copyright (C) 2005 by Latchesar Ionkov <lucho@ionkov.net> | ||
6 | * Copyright (C) 2004 by Eric Van Hensbergen <ericvh@gmail.com> | 7 | * Copyright (C) 2004 by Eric Van Hensbergen <ericvh@gmail.com> |
7 | * Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov> | 8 | * Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov> |
8 | * | 9 | * |
@@ -102,10 +103,16 @@ enum { | |||
102 | 103 | ||
103 | #define V9FS_NOTAG (u16)(~0) | 104 | #define V9FS_NOTAG (u16)(~0) |
104 | #define V9FS_NOFID (u32)(~0) | 105 | #define V9FS_NOFID (u32)(~0) |
106 | #define V9FS_MAXWELEM 16 | ||
105 | 107 | ||
106 | /* ample room for Twrite/Rread header (iounit) */ | 108 | /* ample room for Twrite/Rread header (iounit) */ |
107 | #define V9FS_IOHDRSZ 24 | 109 | #define V9FS_IOHDRSZ 24 |
108 | 110 | ||
111 | struct v9fs_str { | ||
112 | u16 len; | ||
113 | char *str; | ||
114 | }; | ||
115 | |||
109 | /* qids are the unique ID for a file (like an inode */ | 116 | /* qids are the unique ID for a file (like an inode */ |
110 | struct v9fs_qid { | 117 | struct v9fs_qid { |
111 | u8 type; | 118 | u8 type; |
@@ -123,6 +130,29 @@ struct v9fs_stat { | |||
123 | u32 atime; | 130 | u32 atime; |
124 | u32 mtime; | 131 | u32 mtime; |
125 | u64 length; | 132 | u64 length; |
133 | struct v9fs_str name; | ||
134 | struct v9fs_str uid; | ||
135 | struct v9fs_str gid; | ||
136 | struct v9fs_str muid; | ||
137 | struct v9fs_str extension; /* 9p2000.u extensions */ | ||
138 | u32 n_uid; /* 9p2000.u extensions */ | ||
139 | u32 n_gid; /* 9p2000.u extensions */ | ||
140 | u32 n_muid; /* 9p2000.u extensions */ | ||
141 | }; | ||
142 | |||
143 | /* file metadata (stat) structure used to create Twstat message | ||
144 | The is similar to v9fs_stat, but the strings don't point to | ||
145 | the same memory block and should be freed separately | ||
146 | */ | ||
147 | struct v9fs_wstat { | ||
148 | u16 size; | ||
149 | u16 type; | ||
150 | u32 dev; | ||
151 | struct v9fs_qid qid; | ||
152 | u32 mode; | ||
153 | u32 atime; | ||
154 | u32 mtime; | ||
155 | u64 length; | ||
126 | char *name; | 156 | char *name; |
127 | char *uid; | 157 | char *uid; |
128 | char *gid; | 158 | char *gid; |
@@ -131,25 +161,24 @@ struct v9fs_stat { | |||
131 | u32 n_uid; /* 9p2000.u extensions */ | 161 | u32 n_uid; /* 9p2000.u extensions */ |
132 | u32 n_gid; /* 9p2000.u extensions */ | 162 | u32 n_gid; /* 9p2000.u extensions */ |
133 | u32 n_muid; /* 9p2000.u extensions */ | 163 | u32 n_muid; /* 9p2000.u extensions */ |
134 | char data[0]; | ||
135 | }; | 164 | }; |
136 | 165 | ||
137 | /* Structures for Protocol Operations */ | 166 | /* Structures for Protocol Operations */ |
138 | 167 | ||
139 | struct Tversion { | 168 | struct Tversion { |
140 | u32 msize; | 169 | u32 msize; |
141 | char *version; | 170 | struct v9fs_str version; |
142 | }; | 171 | }; |
143 | 172 | ||
144 | struct Rversion { | 173 | struct Rversion { |
145 | u32 msize; | 174 | u32 msize; |
146 | char *version; | 175 | struct v9fs_str version; |
147 | }; | 176 | }; |
148 | 177 | ||
149 | struct Tauth { | 178 | struct Tauth { |
150 | u32 afid; | 179 | u32 afid; |
151 | char *uname; | 180 | struct v9fs_str uname; |
152 | char *aname; | 181 | struct v9fs_str aname; |
153 | }; | 182 | }; |
154 | 183 | ||
155 | struct Rauth { | 184 | struct Rauth { |
@@ -157,12 +186,12 @@ struct Rauth { | |||
157 | }; | 186 | }; |
158 | 187 | ||
159 | struct Rerror { | 188 | struct Rerror { |
160 | char *error; | 189 | struct v9fs_str error; |
161 | u32 errno; /* 9p2000.u extension */ | 190 | u32 errno; /* 9p2000.u extension */ |
162 | }; | 191 | }; |
163 | 192 | ||
164 | struct Tflush { | 193 | struct Tflush { |
165 | u32 oldtag; | 194 | u16 oldtag; |
166 | }; | 195 | }; |
167 | 196 | ||
168 | struct Rflush { | 197 | struct Rflush { |
@@ -171,8 +200,8 @@ struct Rflush { | |||
171 | struct Tattach { | 200 | struct Tattach { |
172 | u32 fid; | 201 | u32 fid; |
173 | u32 afid; | 202 | u32 afid; |
174 | char *uname; | 203 | struct v9fs_str uname; |
175 | char *aname; | 204 | struct v9fs_str aname; |
176 | }; | 205 | }; |
177 | 206 | ||
178 | struct Rattach { | 207 | struct Rattach { |
@@ -182,13 +211,13 @@ struct Rattach { | |||
182 | struct Twalk { | 211 | struct Twalk { |
183 | u32 fid; | 212 | u32 fid; |
184 | u32 newfid; | 213 | u32 newfid; |
185 | u32 nwname; | 214 | u16 nwname; |
186 | char **wnames; | 215 | struct v9fs_str wnames[16]; |
187 | }; | 216 | }; |
188 | 217 | ||
189 | struct Rwalk { | 218 | struct Rwalk { |
190 | u32 nwqid; | 219 | u16 nwqid; |
191 | struct v9fs_qid *wqids; | 220 | struct v9fs_qid wqids[16]; |
192 | }; | 221 | }; |
193 | 222 | ||
194 | struct Topen { | 223 | struct Topen { |
@@ -203,7 +232,7 @@ struct Ropen { | |||
203 | 232 | ||
204 | struct Tcreate { | 233 | struct Tcreate { |
205 | u32 fid; | 234 | u32 fid; |
206 | char *name; | 235 | struct v9fs_str name; |
207 | u32 perm; | 236 | u32 perm; |
208 | u8 mode; | 237 | u8 mode; |
209 | }; | 238 | }; |
@@ -254,12 +283,12 @@ struct Tstat { | |||
254 | }; | 283 | }; |
255 | 284 | ||
256 | struct Rstat { | 285 | struct Rstat { |
257 | struct v9fs_stat *stat; | 286 | struct v9fs_stat stat; |
258 | }; | 287 | }; |
259 | 288 | ||
260 | struct Twstat { | 289 | struct Twstat { |
261 | u32 fid; | 290 | u32 fid; |
262 | struct v9fs_stat *stat; | 291 | struct v9fs_stat stat; |
263 | }; | 292 | }; |
264 | 293 | ||
265 | struct Rwstat { | 294 | struct Rwstat { |
@@ -274,6 +303,7 @@ struct v9fs_fcall { | |||
274 | u32 size; | 303 | u32 size; |
275 | u8 id; | 304 | u8 id; |
276 | u16 tag; | 305 | u16 tag; |
306 | void *sdata; | ||
277 | 307 | ||
278 | union { | 308 | union { |
279 | struct Tversion tversion; | 309 | struct Tversion tversion; |
@@ -306,10 +336,12 @@ struct v9fs_fcall { | |||
306 | } params; | 336 | } params; |
307 | }; | 337 | }; |
308 | 338 | ||
309 | #define V9FS_FCALLHDRSZ (sizeof(struct v9fs_fcall) + \ | 339 | #define PRINT_FCALL_ERROR(s, fcall) dprintk(DEBUG_ERROR, "%s: %.*s\n", s, \ |
310 | sizeof(struct v9fs_stat) + 16*sizeof(struct v9fs_qid) + 16) | 340 | fcall?fcall->params.rerror.error.len:0, \ |
341 | fcall?fcall->params.rerror.error.str:""); | ||
311 | 342 | ||
312 | #define FCALL_ERROR(fcall) (fcall ? fcall->params.rerror.error : "") | 343 | char *v9fs_str_copy(char *buf, int buflen, struct v9fs_str *str); |
344 | int v9fs_str_compare(char *buf, struct v9fs_str *str); | ||
313 | 345 | ||
314 | int v9fs_t_version(struct v9fs_session_info *v9ses, u32 msize, | 346 | int v9fs_t_version(struct v9fs_session_info *v9ses, u32 msize, |
315 | char *version, struct v9fs_fcall **rcall); | 347 | char *version, struct v9fs_fcall **rcall); |
@@ -325,7 +357,7 @@ int v9fs_t_stat(struct v9fs_session_info *v9ses, u32 fid, | |||
325 | struct v9fs_fcall **rcall); | 357 | struct v9fs_fcall **rcall); |
326 | 358 | ||
327 | int v9fs_t_wstat(struct v9fs_session_info *v9ses, u32 fid, | 359 | int v9fs_t_wstat(struct v9fs_session_info *v9ses, u32 fid, |
328 | struct v9fs_stat *stat, struct v9fs_fcall **rcall); | 360 | struct v9fs_wstat *wstat, struct v9fs_fcall **rcall); |
329 | 361 | ||
330 | int v9fs_t_walk(struct v9fs_session_info *v9ses, u32 fid, u32 newfid, | 362 | int v9fs_t_walk(struct v9fs_session_info *v9ses, u32 fid, u32 newfid, |
331 | char *name, struct v9fs_fcall **rcall); | 363 | char *name, struct v9fs_fcall **rcall); |
@@ -343,4 +375,5 @@ int v9fs_t_read(struct v9fs_session_info *v9ses, u32 fid, | |||
343 | u64 offset, u32 count, struct v9fs_fcall **rcall); | 375 | u64 offset, u32 count, struct v9fs_fcall **rcall); |
344 | 376 | ||
345 | int v9fs_t_write(struct v9fs_session_info *v9ses, u32 fid, u64 offset, | 377 | int v9fs_t_write(struct v9fs_session_info *v9ses, u32 fid, u64 offset, |
346 | u32 count, void *data, struct v9fs_fcall **rcall); | 378 | u32 count, const char __user * data, |
379 | struct v9fs_fcall **rcall); | ||