diff options
author | Christoph Hellwig <hch@sgi.com> | 2005-09-02 02:58:38 -0400 |
---|---|---|
committer | Nathan Scott <nathans@sgi.com> | 2005-09-02 02:58:38 -0400 |
commit | 51c91ed52b8a9a30fcb2a465b40c20a1f11735ba (patch) | |
tree | edebb01cbfe550a2edb066d5b4185445cfff11ba /fs/xfs/xfs_vnodeops.c | |
parent | 592cb26bda6fe69838529acf71e50a6dee7acbb4 (diff) |
[XFS] add infrastructure for waiting on I/O completion at inode reclaim
time
SGI-PV: 934766
SGI-Modid: xfs-linux:xfs-kern:196854a
Signed-off-by: Christoph Hellwig <hch@sgi.com>
Signed-off-by: Nathan Scott <nathans@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_vnodeops.c')
-rw-r--r-- | fs/xfs/xfs_vnodeops.c | 47 |
1 files changed, 3 insertions, 44 deletions
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c index c4aa24ff85a2..58bfe629b933 100644 --- a/fs/xfs/xfs_vnodeops.c +++ b/fs/xfs/xfs_vnodeops.c | |||
@@ -3846,51 +3846,10 @@ xfs_reclaim( | |||
3846 | return 0; | 3846 | return 0; |
3847 | } | 3847 | } |
3848 | 3848 | ||
3849 | if ((ip->i_d.di_mode & S_IFMT) == S_IFREG) { | 3849 | vn_iowait(vp); |
3850 | if (ip->i_d.di_size > 0) { | ||
3851 | /* | ||
3852 | * Flush and invalidate any data left around that is | ||
3853 | * a part of this file. | ||
3854 | * | ||
3855 | * Get the inode's i/o lock so that buffers are pushed | ||
3856 | * out while holding the proper lock. We can't hold | ||
3857 | * the inode lock here since flushing out buffers may | ||
3858 | * cause us to try to get the lock in xfs_strategy(). | ||
3859 | * | ||
3860 | * We don't have to call remapf() here, because there | ||
3861 | * cannot be any mapped file references to this vnode | ||
3862 | * since it is being reclaimed. | ||
3863 | */ | ||
3864 | xfs_ilock(ip, XFS_IOLOCK_EXCL); | ||
3865 | |||
3866 | /* | ||
3867 | * If we hit an IO error, we need to make sure that the | ||
3868 | * buffer and page caches of file data for | ||
3869 | * the file are tossed away. We don't want to use | ||
3870 | * VOP_FLUSHINVAL_PAGES here because we don't want dirty | ||
3871 | * pages to stay attached to the vnode, but be | ||
3872 | * marked P_BAD. pdflush/vnode_pagebad | ||
3873 | * hates that. | ||
3874 | */ | ||
3875 | if (!XFS_FORCED_SHUTDOWN(ip->i_mount)) { | ||
3876 | VOP_FLUSHINVAL_PAGES(vp, 0, -1, FI_NONE); | ||
3877 | } else { | ||
3878 | VOP_TOSS_PAGES(vp, 0, -1, FI_NONE); | ||
3879 | } | ||
3880 | 3850 | ||
3881 | ASSERT(VN_CACHED(vp) == 0); | 3851 | ASSERT(XFS_FORCED_SHUTDOWN(ip->i_mount) || ip->i_delayed_blks == 0); |
3882 | ASSERT(XFS_FORCED_SHUTDOWN(ip->i_mount) || | 3852 | ASSERT(VN_CACHED(vp) == 0); |
3883 | ip->i_delayed_blks == 0); | ||
3884 | xfs_iunlock(ip, XFS_IOLOCK_EXCL); | ||
3885 | } else if (XFS_FORCED_SHUTDOWN(ip->i_mount)) { | ||
3886 | /* | ||
3887 | * di_size field may not be quite accurate if we're | ||
3888 | * shutting down. | ||
3889 | */ | ||
3890 | VOP_TOSS_PAGES(vp, 0, -1, FI_NONE); | ||
3891 | ASSERT(VN_CACHED(vp) == 0); | ||
3892 | } | ||
3893 | } | ||
3894 | 3853 | ||
3895 | /* If we have nothing to flush with this inode then complete the | 3854 | /* If we have nothing to flush with this inode then complete the |
3896 | * teardown now, otherwise break the link between the xfs inode | 3855 | * teardown now, otherwise break the link between the xfs inode |