aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_vnodeops.c
diff options
context:
space:
mode:
authorDavid Chinner <david@fromorbit.com>2008-10-30 02:36:14 -0400
committerLachlan McIlroy <lachlan@sgi.com>2008-10-30 02:36:14 -0400
commitbf904248a2adb3f3be4eb4fb1837ce3bb28cca76 (patch)
tree288306924f640f19d881166a3b50fa59b6e9e7e7 /fs/xfs/xfs_vnodeops.c
parent8290c35f87304a6b73d4fd17b03580b4f7425de8 (diff)
[XFS] Combine the XFS and Linux inodes
To avoid issues with different lifecycles of XFS and Linux inodes, embedd the linux inode inside the XFS inode. This means that the linux inode has the same lifecycle as the XFS inode, even when it has been released by the OS. XFS inodes don't live much longer than this (a short stint in reclaim at most), so there isn't significant memory usage penalties here. Version 3 o kill xfs_icount() Version 2 o remove unused commented out code from xfs_iget(). o kill useless cast in VFS_I() SGI-PV: 988141 SGI-Modid: xfs-linux-melb:xfs-kern:32323a Signed-off-by: David Chinner <david@fromorbit.com> Signed-off-by: Lachlan McIlroy <lachlan@sgi.com> Signed-off-by: Christoph Hellwig <hch@infradead.org>
Diffstat (limited to 'fs/xfs/xfs_vnodeops.c')
-rw-r--r--fs/xfs/xfs_vnodeops.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c
index a6714579a414..7fb577c9f9d8 100644
--- a/fs/xfs/xfs_vnodeops.c
+++ b/fs/xfs/xfs_vnodeops.c
@@ -2833,6 +2833,7 @@ xfs_reclaim(
2833 if (!ip->i_update_core && (ip->i_itemp == NULL)) { 2833 if (!ip->i_update_core && (ip->i_itemp == NULL)) {
2834 xfs_ilock(ip, XFS_ILOCK_EXCL); 2834 xfs_ilock(ip, XFS_ILOCK_EXCL);
2835 xfs_iflock(ip); 2835 xfs_iflock(ip);
2836 xfs_iflags_set(ip, XFS_IRECLAIMABLE);
2836 return xfs_finish_reclaim(ip, 1, XFS_IFLUSH_DELWRI_ELSE_SYNC); 2837 return xfs_finish_reclaim(ip, 1, XFS_IFLUSH_DELWRI_ELSE_SYNC);
2837 } else { 2838 } else {
2838 xfs_mount_t *mp = ip->i_mount; 2839 xfs_mount_t *mp = ip->i_mount;
@@ -2841,8 +2842,6 @@ xfs_reclaim(
2841 XFS_MOUNT_ILOCK(mp); 2842 XFS_MOUNT_ILOCK(mp);
2842 spin_lock(&ip->i_flags_lock); 2843 spin_lock(&ip->i_flags_lock);
2843 __xfs_iflags_set(ip, XFS_IRECLAIMABLE); 2844 __xfs_iflags_set(ip, XFS_IRECLAIMABLE);
2844 VFS_I(ip)->i_private = NULL;
2845 ip->i_vnode = NULL;
2846 spin_unlock(&ip->i_flags_lock); 2845 spin_unlock(&ip->i_flags_lock);
2847 list_add_tail(&ip->i_reclaim, &mp->m_del_inodes); 2846 list_add_tail(&ip->i_reclaim, &mp->m_del_inodes);
2848 XFS_MOUNT_IUNLOCK(mp); 2847 XFS_MOUNT_IUNLOCK(mp);
@@ -2857,10 +2856,6 @@ xfs_finish_reclaim(
2857 int sync_mode) 2856 int sync_mode)
2858{ 2857{
2859 xfs_perag_t *pag = xfs_get_perag(ip->i_mount, ip->i_ino); 2858 xfs_perag_t *pag = xfs_get_perag(ip->i_mount, ip->i_ino);
2860 struct inode *vp = VFS_I(ip);
2861
2862 if (vp && VN_BAD(vp))
2863 goto reclaim;
2864 2859
2865 /* The hash lock here protects a thread in xfs_iget_core from 2860 /* The hash lock here protects a thread in xfs_iget_core from
2866 * racing with us on linking the inode back with a vnode. 2861 * racing with us on linking the inode back with a vnode.
@@ -2870,7 +2865,7 @@ xfs_finish_reclaim(
2870 write_lock(&pag->pag_ici_lock); 2865 write_lock(&pag->pag_ici_lock);
2871 spin_lock(&ip->i_flags_lock); 2866 spin_lock(&ip->i_flags_lock);
2872 if (__xfs_iflags_test(ip, XFS_IRECLAIM) || 2867 if (__xfs_iflags_test(ip, XFS_IRECLAIM) ||
2873 (!__xfs_iflags_test(ip, XFS_IRECLAIMABLE) && vp == NULL)) { 2868 !__xfs_iflags_test(ip, XFS_IRECLAIMABLE)) {
2874 spin_unlock(&ip->i_flags_lock); 2869 spin_unlock(&ip->i_flags_lock);
2875 write_unlock(&pag->pag_ici_lock); 2870 write_unlock(&pag->pag_ici_lock);
2876 if (locked) { 2871 if (locked) {
@@ -2904,15 +2899,13 @@ xfs_finish_reclaim(
2904 * In the case of a forced shutdown we rely on xfs_iflush() to 2899 * In the case of a forced shutdown we rely on xfs_iflush() to
2905 * wait for the inode to be unpinned before returning an error. 2900 * wait for the inode to be unpinned before returning an error.
2906 */ 2901 */
2907 if (xfs_iflush(ip, sync_mode) == 0) { 2902 if (!is_bad_inode(VFS_I(ip)) && xfs_iflush(ip, sync_mode) == 0) {
2908 /* synchronize with xfs_iflush_done */ 2903 /* synchronize with xfs_iflush_done */
2909 xfs_iflock(ip); 2904 xfs_iflock(ip);
2910 xfs_ifunlock(ip); 2905 xfs_ifunlock(ip);
2911 } 2906 }
2912 2907
2913 xfs_iunlock(ip, XFS_ILOCK_EXCL); 2908 xfs_iunlock(ip, XFS_ILOCK_EXCL);
2914
2915 reclaim:
2916 xfs_ireclaim(ip); 2909 xfs_ireclaim(ip);
2917 return 0; 2910 return 0;
2918} 2911}