summaryrefslogtreecommitdiff
path: root/fs/9p/vfs_file.c
diff options
context:
space:
mode:
authorEric Van Hensbergen <ericvh@ericvh-desktop.austin.ibm.com>2007-07-13 13:01:27 -0500
committerEric Van Hensbergen <ericvh@ericvh-desktop.austin.ibm.com>2007-07-14 15:14:08 -0500
commit9523a841b109765f8779236d28be6458ee3a6824 (patch)
tree3701f26715eae8dcfb7610984051720a6f588019 /fs/9p/vfs_file.c
parent1d6b5602381524c339af2c2fdfe42ad0a01464a4 (diff)
downloadlinux-exynos-9523a841b109765f8779236d28be6458ee3a6824.tar.gz
linux-exynos-9523a841b109765f8779236d28be6458ee3a6824.tar.bz2
linux-exynos-9523a841b109765f8779236d28be6458ee3a6824.zip
9p: cache meta-data when cache=loose
This patch expands the impact of the loose cache mode to allow for cached metadata increasing the performance of directory listings and other metadata read operations. Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
Diffstat (limited to 'fs/9p/vfs_file.c')
-rw-r--r--fs/9p/vfs_file.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c
index c1f7c027cfeb..2a40c2946d0a 100644
--- a/fs/9p/vfs_file.c
+++ b/fs/9p/vfs_file.c
@@ -67,10 +67,14 @@ int v9fs_file_open(struct inode *inode, struct file *file)
return PTR_ERR(fid);
err = p9_client_open(fid, omode);
- if (err < 0) {
+ if (err < 0) {
p9_client_clunk(fid);
return err;
}
+ if (omode & P9_OTRUNC) {
+ inode->i_size = 0;
+ inode->i_blocks = 0;
+ }
}
file->private_data = fid;
@@ -151,6 +155,7 @@ v9fs_file_write(struct file *filp, const char __user * data,
{
int ret;
struct p9_fid *fid;
+ struct inode *inode = filp->f_path.dentry->d_inode;
P9_DPRINTK(P9_DEBUG_VFS, "data %p count %d offset %x\n", data,
(int)count, (int)*offset);
@@ -160,7 +165,12 @@ v9fs_file_write(struct file *filp, const char __user * data,
if (ret > 0)
*offset += ret;
- invalidate_inode_pages2(filp->f_path.dentry->d_inode->i_mapping);
+ if (*offset > inode->i_size) {
+ inode->i_size = *offset;
+ inode->i_blocks = (inode->i_size + 512 - 1) >> 9;
+ }
+
+ invalidate_inode_pages2(inode->i_mapping);
return ret;
}