diff options
author | Christoph Hellwig <hch@lst.de> | 2009-02-04 03:36:19 -0500 |
---|---|---|
committer | Christoph Hellwig <hch@brick.lst.de> | 2009-02-04 03:36:19 -0500 |
commit | d4bb6d0698090c485e2e80e8a13852be5a8bfb04 (patch) | |
tree | bc94a63f218d64976e11d67c6b8d6f0f2859d2c4 /fs/xfs/linux-2.6/xfs_super.c | |
parent | e1486dea0bf4bc75a52a983281076f454a894b66 (diff) |
xfs: merge xfs_inode_flush into xfs_fs_write_inode
Splitting the task for a VFS-induced inode flush into two functions doesn't
make any sense, so merge the two functions dealing with it.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Felix Blyakher <felixb@sgi.com>
Reviewed-by: Dave Chinner <david@fromorbit.com>
Diffstat (limited to 'fs/xfs/linux-2.6/xfs_super.c')
-rw-r--r-- | fs/xfs/linux-2.6/xfs_super.c | 43 |
1 files changed, 37 insertions, 6 deletions
diff --git a/fs/xfs/linux-2.6/xfs_super.c b/fs/xfs/linux-2.6/xfs_super.c index c71e226da7f5..faf3aa3ca154 100644 --- a/fs/xfs/linux-2.6/xfs_super.c +++ b/fs/xfs/linux-2.6/xfs_super.c | |||
@@ -990,26 +990,57 @@ xfs_fs_write_inode( | |||
990 | int sync) | 990 | int sync) |
991 | { | 991 | { |
992 | struct xfs_inode *ip = XFS_I(inode); | 992 | struct xfs_inode *ip = XFS_I(inode); |
993 | struct xfs_mount *mp = ip->i_mount; | ||
993 | int error = 0; | 994 | int error = 0; |
994 | int flags = 0; | ||
995 | 995 | ||
996 | xfs_itrace_entry(ip); | 996 | xfs_itrace_entry(ip); |
997 | |||
998 | if (XFS_FORCED_SHUTDOWN(mp)) | ||
999 | return XFS_ERROR(EIO); | ||
1000 | |||
997 | if (sync) { | 1001 | if (sync) { |
998 | error = xfs_wait_on_pages(ip, 0, -1); | 1002 | error = xfs_wait_on_pages(ip, 0, -1); |
999 | if (error) | 1003 | if (error) |
1000 | goto out_error; | 1004 | goto out; |
1001 | flags |= FLUSH_SYNC; | 1005 | } |
1006 | |||
1007 | /* | ||
1008 | * Bypass inodes which have already been cleaned by | ||
1009 | * the inode flush clustering code inside xfs_iflush | ||
1010 | */ | ||
1011 | if (xfs_inode_clean(ip)) | ||
1012 | goto out; | ||
1013 | |||
1014 | /* | ||
1015 | * We make this non-blocking if the inode is contended, return | ||
1016 | * EAGAIN to indicate to the caller that they did not succeed. | ||
1017 | * This prevents the flush path from blocking on inodes inside | ||
1018 | * another operation right now, they get caught later by xfs_sync. | ||
1019 | */ | ||
1020 | if (sync) { | ||
1021 | xfs_ilock(ip, XFS_ILOCK_SHARED); | ||
1022 | xfs_iflock(ip); | ||
1023 | |||
1024 | error = xfs_iflush(ip, XFS_IFLUSH_SYNC); | ||
1025 | } else { | ||
1026 | error = EAGAIN; | ||
1027 | if (!xfs_ilock_nowait(ip, XFS_ILOCK_SHARED)) | ||
1028 | goto out; | ||
1029 | if (xfs_ipincount(ip) || !xfs_iflock_nowait(ip)) | ||
1030 | goto out_unlock; | ||
1031 | |||
1032 | error = xfs_iflush(ip, XFS_IFLUSH_ASYNC_NOBLOCK); | ||
1002 | } | 1033 | } |
1003 | error = xfs_inode_flush(ip, flags); | ||
1004 | 1034 | ||
1005 | out_error: | 1035 | out_unlock: |
1036 | xfs_iunlock(ip, XFS_ILOCK_SHARED); | ||
1037 | out: | ||
1006 | /* | 1038 | /* |
1007 | * if we failed to write out the inode then mark | 1039 | * if we failed to write out the inode then mark |
1008 | * it dirty again so we'll try again later. | 1040 | * it dirty again so we'll try again later. |
1009 | */ | 1041 | */ |
1010 | if (error) | 1042 | if (error) |
1011 | xfs_mark_inode_dirty_sync(ip); | 1043 | xfs_mark_inode_dirty_sync(ip); |
1012 | |||
1013 | return -error; | 1044 | return -error; |
1014 | } | 1045 | } |
1015 | 1046 | ||