diff options
| author | Anton Altaparmakov <aia21@cantab.net> | 2006-01-19 11:39:33 -0500 |
|---|---|---|
| committer | Anton Altaparmakov <aia21@cantab.net> | 2006-01-19 11:39:33 -0500 |
| commit | 944d79559d154c12becde0dab327016cf438f46c (patch) | |
| tree | 50c101806f4d3b6585222dda060559eb4f3e005a /fs/9p/vfs_file.c | |
| parent | d087e4bdd24ebe3ae3d0b265b6573ec901af4b4b (diff) | |
| parent | 0f36b018b2e314d45af86449f1a97facb1fbe300 (diff) | |
Merge branch 'master' of /usr/src/ntfs-2.6/
Diffstat (limited to 'fs/9p/vfs_file.c')
| -rw-r--r-- | fs/9p/vfs_file.c | 32 |
1 files changed, 9 insertions, 23 deletions
diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c index 89c849da8504..c7e14d917215 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 | } |
| @@ -165,8 +164,7 @@ static int v9fs_file_lock(struct file *filp, int cmd, struct file_lock *fl) | |||
| 165 | return -ENOLCK; | 164 | return -ENOLCK; |
| 166 | 165 | ||
| 167 | if ((IS_SETLK(cmd) || IS_SETLKW(cmd)) && fl->fl_type != F_UNLCK) { | 166 | if ((IS_SETLK(cmd) || IS_SETLKW(cmd)) && fl->fl_type != F_UNLCK) { |
| 168 | filemap_fdatawrite(inode->i_mapping); | 167 | filemap_write_and_wait(inode->i_mapping); |
| 169 | filemap_fdatawait(inode->i_mapping); | ||
| 170 | invalidate_inode_pages(&inode->i_data); | 168 | invalidate_inode_pages(&inode->i_data); |
| 171 | } | 169 | } |
| 172 | 170 | ||
| @@ -257,7 +255,6 @@ v9fs_file_write(struct file *filp, const char __user * data, | |||
| 257 | int result = -EIO; | 255 | int result = -EIO; |
| 258 | int rsize = 0; | 256 | int rsize = 0; |
| 259 | int total = 0; | 257 | int total = 0; |
| 260 | char *buf; | ||
| 261 | 258 | ||
| 262 | 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, |
| 263 | (int)*offset); | 260 | (int)*offset); |
| @@ -265,28 +262,14 @@ v9fs_file_write(struct file *filp, const char __user * data, | |||
| 265 | if (v9fid->iounit != 0 && rsize > v9fid->iounit) | 262 | if (v9fid->iounit != 0 && rsize > v9fid->iounit) |
| 266 | rsize = v9fid->iounit; | 263 | rsize = v9fid->iounit; |
| 267 | 264 | ||
| 268 | buf = kmalloc(v9ses->maxdata - V9FS_IOHDRSZ, GFP_KERNEL); | ||
| 269 | if (!buf) | ||
| 270 | return -ENOMEM; | ||
| 271 | |||
| 272 | do { | 265 | do { |
| 273 | if (count < rsize) | 266 | if (count < rsize) |
| 274 | rsize = count; | 267 | rsize = count; |
| 275 | 268 | ||
| 276 | result = copy_from_user(buf, data, rsize); | 269 | result = v9fs_t_write(v9ses, fid, *offset, rsize, data, &fcall); |
| 277 | if (result) { | ||
| 278 | dprintk(DEBUG_ERROR, "Problem copying from user\n"); | ||
| 279 | kfree(buf); | ||
| 280 | return -EFAULT; | ||
| 281 | } | ||
| 282 | |||
| 283 | dump_data(buf, rsize); | ||
| 284 | result = v9fs_t_write(v9ses, fid, *offset, rsize, buf, &fcall); | ||
| 285 | if (result < 0) { | 270 | if (result < 0) { |
| 286 | eprintk(KERN_ERR, "error while writing: %s(%d)\n", | 271 | PRINT_FCALL_ERROR("error while writing", fcall); |
| 287 | FCALL_ERROR(fcall), result); | ||
| 288 | kfree(fcall); | 272 | kfree(fcall); |
| 289 | kfree(buf); | ||
| 290 | return result; | 273 | return result; |
| 291 | } else | 274 | } else |
| 292 | *offset += result; | 275 | *offset += result; |
| @@ -306,7 +289,9 @@ v9fs_file_write(struct file *filp, const char __user * data, | |||
| 306 | total += result; | 289 | total += result; |
| 307 | } while (count); | 290 | } while (count); |
| 308 | 291 | ||
| 309 | kfree(buf); | 292 | if(inode->i_mapping->nrpages) |
| 293 | invalidate_inode_pages2(inode->i_mapping); | ||
| 294 | |||
| 310 | return total; | 295 | return total; |
| 311 | } | 296 | } |
| 312 | 297 | ||
| @@ -317,4 +302,5 @@ struct file_operations v9fs_file_operations = { | |||
| 317 | .open = v9fs_file_open, | 302 | .open = v9fs_file_open, |
| 318 | .release = v9fs_dir_release, | 303 | .release = v9fs_dir_release, |
| 319 | .lock = v9fs_file_lock, | 304 | .lock = v9fs_file_lock, |
| 305 | .mmap = generic_file_mmap, | ||
| 320 | }; | 306 | }; |
