aboutsummaryrefslogtreecommitdiffstats
path: root/fs/9p/vfs_file.c
diff options
context:
space:
mode:
authorLatchesar Ionkov <lucho@ionkov.net>2006-01-08 04:05:00 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-01-08 23:14:06 -0500
commit531b1094b74365dcc55fa464d28a9a2497ae825d (patch)
treea0384dabe3be1c844166d028b3ef7c21c3dfe5fc /fs/9p/vfs_file.c
parentd8da097afb765654c866062148fd98b11db9003e (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/vfs_file.c')
-rw-r--r--fs/9p/vfs_file.c25
1 files changed, 4 insertions, 21 deletions
diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c
index e13577da913..6852f0eb96e 100644
--- a/fs/9p/vfs_file.c
+++ b/fs/9p/vfs_file.c
@@ -32,6 +32,7 @@
32#include <linux/string.h> 32#include <linux/string.h>
33#include <linux/smp_lock.h> 33#include <linux/smp_lock.h>
34#include <linux/inet.h> 34#include <linux/inet.h>
35#include <linux/version.h>
35#include <linux/list.h> 36#include <linux/list.h>
36#include <asm/uaccess.h> 37#include <asm/uaccess.h>
37#include <linux/idr.h> 38#include <linux/idr.h>
@@ -117,9 +118,7 @@ int v9fs_file_open(struct inode *inode, struct file *file)
117 118
118 result = v9fs_t_open(v9ses, newfid, open_mode, &fcall); 119 result = v9fs_t_open(v9ses, newfid, open_mode, &fcall);
119 if (result < 0) { 120 if (result < 0) {
120 dprintk(DEBUG_ERROR, 121 PRINT_FCALL_ERROR("open failed", fcall);
121 "open failed, open_mode 0x%x: %s\n", open_mode,
122 FCALL_ERROR(fcall));
123 kfree(fcall); 122 kfree(fcall);
124 return result; 123 return result;
125 } 124 }
@@ -256,7 +255,6 @@ v9fs_file_write(struct file *filp, const char __user * data,
256 int result = -EIO; 255 int result = -EIO;
257 int rsize = 0; 256 int rsize = 0;
258 int total = 0; 257 int total = 0;
259 char *buf;
260 258
261 dprintk(DEBUG_VFS, "data %p count %d offset %x\n", data, (int)count, 259 dprintk(DEBUG_VFS, "data %p count %d offset %x\n", data, (int)count,
262 (int)*offset); 260 (int)*offset);
@@ -264,28 +262,14 @@ v9fs_file_write(struct file *filp, const char __user * data,
264 if (v9fid->iounit != 0 && rsize > v9fid->iounit) 262 if (v9fid->iounit != 0 && rsize > v9fid->iounit)
265 rsize = v9fid->iounit; 263 rsize = v9fid->iounit;
266 264
267 buf = kmalloc(v9ses->maxdata - V9FS_IOHDRSZ, GFP_KERNEL);
268 if (!buf)
269 return -ENOMEM;
270
271 do { 265 do {
272 if (count < rsize) 266 if (count < rsize)
273 rsize = count; 267 rsize = count;
274 268
275 result = copy_from_user(buf, data, rsize); 269 result = v9fs_t_write(v9ses, fid, *offset, rsize, data, &fcall);
276 if (result) {
277 dprintk(DEBUG_ERROR, "Problem copying from user\n");
278 kfree(buf);
279 return -EFAULT;
280 }
281
282 dump_data(buf, rsize);
283 result = v9fs_t_write(v9ses, fid, *offset, rsize, buf, &fcall);
284 if (result < 0) { 270 if (result < 0) {
285 eprintk(KERN_ERR, "error while writing: %s(%d)\n", 271 PRINT_FCALL_ERROR("error while writing", fcall);
286 FCALL_ERROR(fcall), result);
287 kfree(fcall); 272 kfree(fcall);
288 kfree(buf);
289 return result; 273 return result;
290 } else 274 } else
291 *offset += result; 275 *offset += result;
@@ -305,7 +289,6 @@ v9fs_file_write(struct file *filp, const char __user * data,
305 total += result; 289 total += result;
306 } while (count); 290 } while (count);
307 291
308 kfree(buf);
309 return total; 292 return total;
310} 293}
311 294