aboutsummaryrefslogtreecommitdiffstats
path: root/fs/9p
diff options
context:
space:
mode:
Diffstat (limited to 'fs/9p')
-rw-r--r--fs/9p/vfs_file.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c
index de7690eec4d8..cafaa46434ba 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/inet.h> 33#include <linux/inet.h>
34#include <linux/list.h> 34#include <linux/list.h>
35#include <linux/pagemap.h>
35#include <asm/uaccess.h> 36#include <asm/uaccess.h>
36#include <linux/idr.h> 37#include <linux/idr.h>
37#include <net/9p/9p.h> 38#include <net/9p/9p.h>
@@ -210,6 +211,7 @@ v9fs_file_write(struct file *filp, const char __user * data,
210 struct p9_client *clnt; 211 struct p9_client *clnt;
211 struct inode *inode = filp->f_path.dentry->d_inode; 212 struct inode *inode = filp->f_path.dentry->d_inode;
212 int origin = *offset; 213 int origin = *offset;
214 unsigned long pg_start, pg_end;
213 215
214 P9_DPRINTK(P9_DEBUG_VFS, "data %p count %d offset %x\n", data, 216 P9_DPRINTK(P9_DEBUG_VFS, "data %p count %d offset %x\n", data,
215 (int)count, (int)*offset); 217 (int)count, (int)*offset);
@@ -225,7 +227,7 @@ v9fs_file_write(struct file *filp, const char __user * data,
225 if (count < rsize) 227 if (count < rsize)
226 rsize = count; 228 rsize = count;
227 229
228 n = p9_client_write(fid, NULL, data+total, *offset+total, 230 n = p9_client_write(fid, NULL, data+total, origin+total,
229 rsize); 231 rsize);
230 if (n <= 0) 232 if (n <= 0)
231 break; 233 break;
@@ -234,13 +236,12 @@ v9fs_file_write(struct file *filp, const char __user * data,
234 } while (count > 0); 236 } while (count > 0);
235 237
236 if (total > 0) { 238 if (total > 0) {
237 invalidate_inode_pages2_range(inode->i_mapping, origin, 239 pg_start = origin >> PAGE_CACHE_SHIFT;
238 origin+total); 240 pg_end = (origin + total - 1) >> PAGE_CACHE_SHIFT;
241 invalidate_inode_pages2_range(inode->i_mapping, pg_start,
242 pg_end);
239 *offset += total; 243 *offset += total;
240 } 244 i_size_write(inode, i_size_read(inode) + total);
241
242 if (*offset > i_size_read(inode)) {
243 i_size_write(inode, *offset);
244 inode->i_blocks = (i_size_read(inode) + 512 - 1) >> 9; 245 inode->i_blocks = (i_size_read(inode) + 512 - 1) >> 9;
245 } 246 }
246 247