aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/file.c
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2009-03-19 15:35:50 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2009-03-19 15:35:50 -0400
commit7fe5c398fc2186ed586db11106a6692d871d0d58 (patch)
tree1133bd775a23fb07ca759e4d6c44132c14576b75 /fs/nfs/file.c
parentb1e4adf4ea41bb8b5a7bfc1a7001f137e65495df (diff)
NFS: Optimise NFS close()
Close-to-open cache consistency rules really only require us to flush out writes on calls to close(), and require us to revalidate attributes on the very last close of the file. Currently we appear to be doing a lot of extra attribute revalidation and cache flushes. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/file.c')
-rw-r--r--fs/nfs/file.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/fs/nfs/file.c b/fs/nfs/file.c
index 1eab9c9ad242..d451073c4947 100644
--- a/fs/nfs/file.c
+++ b/fs/nfs/file.c
@@ -137,9 +137,6 @@ nfs_file_release(struct inode *inode, struct file *filp)
137 dentry->d_parent->d_name.name, 137 dentry->d_parent->d_name.name,
138 dentry->d_name.name); 138 dentry->d_name.name);
139 139
140 /* Ensure that dirty pages are flushed out with the right creds */
141 if (filp->f_mode & FMODE_WRITE)
142 nfs_wb_all(dentry->d_inode);
143 nfs_inc_stats(inode, NFSIOS_VFSRELEASE); 140 nfs_inc_stats(inode, NFSIOS_VFSRELEASE);
144 return nfs_release(inode, filp); 141 return nfs_release(inode, filp);
145} 142}
@@ -231,7 +228,6 @@ nfs_file_flush(struct file *file, fl_owner_t id)
231 struct nfs_open_context *ctx = nfs_file_open_context(file); 228 struct nfs_open_context *ctx = nfs_file_open_context(file);
232 struct dentry *dentry = file->f_path.dentry; 229 struct dentry *dentry = file->f_path.dentry;
233 struct inode *inode = dentry->d_inode; 230 struct inode *inode = dentry->d_inode;
234 int status;
235 231
236 dprintk("NFS: flush(%s/%s)\n", 232 dprintk("NFS: flush(%s/%s)\n",
237 dentry->d_parent->d_name.name, 233 dentry->d_parent->d_name.name,
@@ -241,11 +237,8 @@ nfs_file_flush(struct file *file, fl_owner_t id)
241 return 0; 237 return 0;
242 nfs_inc_stats(inode, NFSIOS_VFSFLUSH); 238 nfs_inc_stats(inode, NFSIOS_VFSFLUSH);
243 239
244 /* Ensure that data+attribute caches are up to date after close() */ 240 /* Flush writes to the server and return any errors */
245 status = nfs_do_fsync(ctx, inode); 241 return nfs_do_fsync(ctx, inode);
246 if (!status)
247 nfs_revalidate_inode(NFS_SERVER(inode), inode);
248 return status;
249} 242}
250 243
251static ssize_t 244static ssize_t