diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2010-02-19 20:03:26 -0500 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2010-03-05 15:44:55 -0500 |
commit | acdc53b2146c7ee67feb1f02f7bc3020126514b8 (patch) | |
tree | 3d8b087e8526c4caed87229fe12c2a2b261dd0a5 /fs/nfs/inode.c | |
parent | c988950eb6dd6f8e6d98503ca094622729e9aa13 (diff) |
NFS: Replace __nfs_write_mapping with sync_inode()
Now that we have correct COMMIT semantics in writeback_single_inode, we can
reduce and simplify nfs_wb_all(). Also replace nfs_wb_nocommit() with a
call to filemap_write_and_wait(), which doesn't need to hold the
inode->i_mutex.
With that done, we can eliminate nfs_write_mapping() altogether.
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/inode.c')
-rw-r--r-- | fs/nfs/inode.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index aa5a831001ab..443772df9b17 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c | |||
@@ -495,17 +495,11 @@ int nfs_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat) | |||
495 | int need_atime = NFS_I(inode)->cache_validity & NFS_INO_INVALID_ATIME; | 495 | int need_atime = NFS_I(inode)->cache_validity & NFS_INO_INVALID_ATIME; |
496 | int err; | 496 | int err; |
497 | 497 | ||
498 | /* | 498 | /* Flush out writes to the server in order to update c/mtime. */ |
499 | * Flush out writes to the server in order to update c/mtime. | ||
500 | * | ||
501 | * Hold the i_mutex to suspend application writes temporarily; | ||
502 | * this prevents long-running writing applications from blocking | ||
503 | * nfs_wb_nocommit. | ||
504 | */ | ||
505 | if (S_ISREG(inode->i_mode)) { | 499 | if (S_ISREG(inode->i_mode)) { |
506 | mutex_lock(&inode->i_mutex); | 500 | err = filemap_write_and_wait(inode->i_mapping); |
507 | nfs_wb_nocommit(inode); | 501 | if (err) |
508 | mutex_unlock(&inode->i_mutex); | 502 | goto out; |
509 | } | 503 | } |
510 | 504 | ||
511 | /* | 505 | /* |
@@ -529,6 +523,7 @@ int nfs_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat) | |||
529 | generic_fillattr(inode, stat); | 523 | generic_fillattr(inode, stat); |
530 | stat->ino = nfs_compat_user_ino64(NFS_FILEID(inode)); | 524 | stat->ino = nfs_compat_user_ino64(NFS_FILEID(inode)); |
531 | } | 525 | } |
526 | out: | ||
532 | return err; | 527 | return err; |
533 | } | 528 | } |
534 | 529 | ||