aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorDavid Chinner <david@fromorbit.com>2008-10-30 02:37:26 -0400
committerLachlan McIlroy <lachlan@sgi.com>2008-10-30 02:37:26 -0400
commit396beb85311689e38634926058d9a3bb0576ca8a (patch)
tree58b3e6904d9618930fe6c0f8abba52aaeea00130 /fs
parent1dc3318ae1c1cc11f9fb8279a806de448e2b90e8 (diff)
[XFS] mark inodes for reclaim via a tag in the inode radix tree
Prepare for removing the deleted inode list by marking inodes for reclaim in the inode radix trees so that we can use the radix trees to find reclaimable inodes. SGI-PV: 988142 SGI-Modid: xfs-linux-melb:xfs-kern:32331a 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')
-rw-r--r--fs/xfs/linux-2.6/xfs_sync.c41
-rw-r--r--fs/xfs/linux-2.6/xfs_sync.h4
-rw-r--r--fs/xfs/xfs_ag.h5
-rw-r--r--fs/xfs/xfs_iget.c3
-rw-r--r--fs/xfs/xfs_vnodeops.c1
5 files changed, 54 insertions, 0 deletions
diff --git a/fs/xfs/linux-2.6/xfs_sync.c b/fs/xfs/linux-2.6/xfs_sync.c
index 34413ceaea9f..9e7f4dccab72 100644
--- a/fs/xfs/linux-2.6/xfs_sync.c
+++ b/fs/xfs/linux-2.6/xfs_sync.c
@@ -644,6 +644,47 @@ xfs_reclaim_inode(
644 return 0; 644 return 0;
645} 645}
646 646
647void
648xfs_inode_set_reclaim_tag(
649 xfs_inode_t *ip)
650{
651 xfs_mount_t *mp = ip->i_mount;
652 xfs_perag_t *pag = xfs_get_perag(mp, ip->i_ino);
653
654 read_lock(&pag->pag_ici_lock);
655 spin_lock(&ip->i_flags_lock);
656 radix_tree_tag_set(&pag->pag_ici_root,
657 XFS_INO_TO_AGINO(mp, ip->i_ino), XFS_ICI_RECLAIM_TAG);
658 spin_unlock(&ip->i_flags_lock);
659 read_unlock(&pag->pag_ici_lock);
660 xfs_put_perag(mp, pag);
661}
662
663void
664__xfs_inode_clear_reclaim_tag(
665 xfs_mount_t *mp,
666 xfs_perag_t *pag,
667 xfs_inode_t *ip)
668{
669 radix_tree_tag_clear(&pag->pag_ici_root,
670 XFS_INO_TO_AGINO(mp, ip->i_ino), XFS_ICI_RECLAIM_TAG);
671}
672
673void
674xfs_inode_clear_reclaim_tag(
675 xfs_inode_t *ip)
676{
677 xfs_mount_t *mp = ip->i_mount;
678 xfs_perag_t *pag = xfs_get_perag(mp, ip->i_ino);
679
680 read_lock(&pag->pag_ici_lock);
681 spin_lock(&ip->i_flags_lock);
682 __xfs_inode_clear_reclaim_tag(mp, pag, ip);
683 spin_unlock(&ip->i_flags_lock);
684 read_unlock(&pag->pag_ici_lock);
685 xfs_put_perag(mp, pag);
686}
687
647int 688int
648xfs_reclaim_inodes( 689xfs_reclaim_inodes(
649 xfs_mount_t *mp, 690 xfs_mount_t *mp,
diff --git a/fs/xfs/linux-2.6/xfs_sync.h b/fs/xfs/linux-2.6/xfs_sync.h
index c1bcd500509a..5f6de1efe1f6 100644
--- a/fs/xfs/linux-2.6/xfs_sync.h
+++ b/fs/xfs/linux-2.6/xfs_sync.h
@@ -48,4 +48,8 @@ void xfs_flush_device(struct xfs_inode *ip);
48int xfs_reclaim_inode(struct xfs_inode *ip, int locked, int sync_mode); 48int xfs_reclaim_inode(struct xfs_inode *ip, int locked, int sync_mode);
49int xfs_reclaim_inodes(struct xfs_mount *mp, int noblock, int mode); 49int xfs_reclaim_inodes(struct xfs_mount *mp, int noblock, int mode);
50 50
51void xfs_inode_set_reclaim_tag(struct xfs_inode *ip);
52void xfs_inode_clear_reclaim_tag(struct xfs_inode *ip);
53void __xfs_inode_clear_reclaim_tag(struct xfs_mount *mp, struct xfs_perag *pag,
54 struct xfs_inode *ip);
51#endif 55#endif
diff --git a/fs/xfs/xfs_ag.h b/fs/xfs/xfs_ag.h
index 729ee3eb39ad..2bfd86329141 100644
--- a/fs/xfs/xfs_ag.h
+++ b/fs/xfs/xfs_ag.h
@@ -204,6 +204,11 @@ typedef struct xfs_perag
204#endif 204#endif
205} xfs_perag_t; 205} xfs_perag_t;
206 206
207/*
208 * tags for inode radix tree
209 */
210#define XFS_ICI_RECLAIM_TAG 0 /* inode is to be reclaimed */
211
207#define XFS_AG_MAXLEVELS(mp) ((mp)->m_ag_maxlevels) 212#define XFS_AG_MAXLEVELS(mp) ((mp)->m_ag_maxlevels)
208#define XFS_MIN_FREELIST_RAW(bl,cl,mp) \ 213#define XFS_MIN_FREELIST_RAW(bl,cl,mp) \
209 (MIN(bl + 1, XFS_AG_MAXLEVELS(mp)) + MIN(cl + 1, XFS_AG_MAXLEVELS(mp))) 214 (MIN(bl + 1, XFS_AG_MAXLEVELS(mp)) + MIN(cl + 1, XFS_AG_MAXLEVELS(mp)))
diff --git a/fs/xfs/xfs_iget.c b/fs/xfs/xfs_iget.c
index c4414e8bce8d..a0387f14c204 100644
--- a/fs/xfs/xfs_iget.c
+++ b/fs/xfs/xfs_iget.c
@@ -91,6 +91,9 @@ xfs_iget_cache_hit(
91 } 91 }
92 xfs_iflags_set(ip, XFS_INEW); 92 xfs_iflags_set(ip, XFS_INEW);
93 xfs_iflags_clear(ip, XFS_IRECLAIMABLE); 93 xfs_iflags_clear(ip, XFS_IRECLAIMABLE);
94
95 /* clear the radix tree reclaim flag as well. */
96 __xfs_inode_clear_reclaim_tag(mp, pag, ip);
94 read_unlock(&pag->pag_ici_lock); 97 read_unlock(&pag->pag_ici_lock);
95 98
96 XFS_MOUNT_ILOCK(mp); 99 XFS_MOUNT_ILOCK(mp);
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c
index 07945634923b..f89a73eb0167 100644
--- a/fs/xfs/xfs_vnodeops.c
+++ b/fs/xfs/xfs_vnodeops.c
@@ -2845,6 +2845,7 @@ xfs_reclaim(
2845 spin_unlock(&ip->i_flags_lock); 2845 spin_unlock(&ip->i_flags_lock);
2846 list_add_tail(&ip->i_reclaim, &mp->m_del_inodes); 2846 list_add_tail(&ip->i_reclaim, &mp->m_del_inodes);
2847 XFS_MOUNT_IUNLOCK(mp); 2847 XFS_MOUNT_IUNLOCK(mp);
2848 xfs_inode_set_reclaim_tag(ip);
2848 } 2849 }
2849 return 0; 2850 return 0;
2850} 2851}