[PATCH] NFS: Cleanup of caching code, and slight optimization of writes.
[pandora-kernel.git] / fs / nfs / file.c
index 55c9075..4043685 100644 (file)
@@ -71,6 +71,18 @@ struct inode_operations nfs_file_inode_operations = {
        .setattr        = nfs_setattr,
 };
 
+#ifdef CONFIG_NFS_V3
+struct inode_operations nfs3_file_inode_operations = {
+       .permission     = nfs_permission,
+       .getattr        = nfs_getattr,
+       .setattr        = nfs_setattr,
+       .listxattr      = nfs3_listxattr,
+       .getxattr       = nfs3_getxattr,
+       .setxattr       = nfs3_setxattr,
+       .removexattr    = nfs3_removexattr,
+};
+#endif  /* CONFIG_NFS_v3 */
+
 /* Hack for future NFS swap support */
 #ifndef IS_SWAPFILE
 # define IS_SWAPFILE(inode)    (0)
@@ -321,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)