aboutsummaryrefslogtreecommitdiffstats
path: root/fs/9p/vfs_file.c
diff options
context:
space:
mode:
authorAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>2011-02-28 06:34:04 -0500
committerEric Van Hensbergen <ericvh@gmail.com>2011-03-15 10:57:40 -0400
commitfa6ea16160c72c448e2728dab4b6b0a133fdfc98 (patch)
tree51c9ad37c30aeb02bc34a67ca499a0492b06959e /fs/9p/vfs_file.c
parent6b365604ca8c1b67f0d5a816cf5acf2dc3edc229 (diff)
fs/9p: Fix inode i_size update in file_write
Only update inode i_size when we write towards end of file. Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> Signed-off-by: Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com> Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
Diffstat (limited to 'fs/9p/vfs_file.c')
-rw-r--r--fs/9p/vfs_file.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c
index 98c4307a1f03..3cff25e759ec 100644
--- a/fs/9p/vfs_file.c
+++ b/fs/9p/vfs_file.c
@@ -440,6 +440,7 @@ v9fs_file_write_internal(struct inode *inode, struct p9_fid *fid,
440 loff_t *offset, int invalidate) 440 loff_t *offset, int invalidate)
441{ 441{
442 int n; 442 int n;
443 loff_t i_size;
443 size_t total = 0; 444 size_t total = 0;
444 struct p9_client *clnt; 445 struct p9_client *clnt;
445 loff_t origin = *offset; 446 loff_t origin = *offset;
@@ -464,8 +465,11 @@ v9fs_file_write_internal(struct inode *inode, struct p9_fid *fid,
464 invalidate_inode_pages2_range(inode->i_mapping, 465 invalidate_inode_pages2_range(inode->i_mapping,
465 pg_start, pg_end); 466 pg_start, pg_end);
466 *offset += total; 467 *offset += total;
467 i_size_write(inode, i_size_read(inode) + total); 468 i_size = i_size_read(inode);
468 inode->i_blocks = (i_size_read(inode) + 512 - 1) >> 9; 469 if (*offset > i_size) {
470 inode_add_bytes(inode, *offset - i_size);
471 i_size_write(inode, *offset);
472 }
469 } 473 }
470 if (n < 0) 474 if (n < 0)
471 return n; 475 return n;