summaryrefslogtreecommitdiffstats
path: root/fs/nfs/file.c
diff options
context:
space:
mode:
authorTrond Myklebust2005-06-22 19:16:30 +0200
committerTrond Myklebust2005-06-22 22:07:37 +0200
commit7d52e86274e09fce8ac8f963e3605a84d0a305a7 (patch)
treeb9ecc05bbdff94aa344f39b53756bfddbd9db123 /fs/nfs/file.c
parent[PATCH] NFS: Fix the file size revalidation (diff)
downloadkernel-qcow2-linux-7d52e86274e09fce8ac8f963e3605a84d0a305a7.tar.gz
kernel-qcow2-linux-7d52e86274e09fce8ac8f963e3605a84d0a305a7.tar.xz
kernel-qcow2-linux-7d52e86274e09fce8ac8f963e3605a84d0a305a7.zip
[PATCH] NFS: Cleanup of caching code, and slight optimization of writes.
Unless we're doing O_APPEND writes, we really don't care about revalidating the file length. Just make sure that we catch any page cache invalidations. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/file.c')
-rw-r--r--fs/nfs/file.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/fs/nfs/file.c b/fs/nfs/file.c
index a606708264ed..40436857ed42 100644
--- a/fs/nfs/file.c
+++ b/fs/nfs/file.c
@@ -333,9 +333,15 @@ nfs_file_write(struct kiocb *iocb, const char __user *buf, size_t count, loff_t
result = -EBUSY;
if (IS_SWAPFILE(inode))
goto out_swapfile;
- result = nfs_revalidate_inode(NFS_SERVER(inode), inode);
- if (result)
- goto out;
+ /*
+ * O_APPEND implies that we must revalidate the file length.
+ */
+ if (iocb->ki_filp->f_flags & O_APPEND) {
+ result = nfs_revalidate_file_size(inode, iocb->ki_filp);
+ if (result)
+ goto out;
+ } else
+ nfs_revalidate_mapping(inode, iocb->ki_filp->f_mapping);
result = count;
if (!count)