diff options
author | Dave Chinner <david@fromorbit.com> | 2010-01-11 06:47:40 -0500 |
---|---|---|
committer | Alex Elder <aelder@sgi.com> | 2010-01-15 16:33:02 -0500 |
commit | 5017e97d52628fb8ae56e434e86ac2e72ddaac2b (patch) | |
tree | bbad07b8fc75e9d309d0a4c450a886eaf7e687fd | |
parent | c9c129714e71c890bed1bd5b61697a896c3c2d54 (diff) |
xfs: rename xfs_get_perag
xfs_get_perag is really getting the perag that an inode belongs to
based on it's inode number. Convert the use of this function to just
get the perag from a provided ag number. Use this new function to
obtain the per-ag structure when traversing the per AG inode trees
for sync and reclaim.
Signed-off-by: Dave Chinner <david@fromorbit.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Alex Elder <aelder@sgi.com>
-rw-r--r-- | fs/xfs/linux-2.6/xfs_sync.c | 22 | ||||
-rw-r--r-- | fs/xfs/xfs_iget.c | 10 | ||||
-rw-r--r-- | fs/xfs/xfs_inode.c | 8 | ||||
-rw-r--r-- | fs/xfs/xfs_mount.h | 8 |
4 files changed, 27 insertions, 21 deletions
diff --git a/fs/xfs/linux-2.6/xfs_sync.c b/fs/xfs/linux-2.6/xfs_sync.c index 0f90bfe2815f..cc964faf12e9 100644 --- a/fs/xfs/linux-2.6/xfs_sync.c +++ b/fs/xfs/linux-2.6/xfs_sync.c | |||
@@ -90,14 +90,13 @@ xfs_inode_ag_lookup( | |||
90 | STATIC int | 90 | STATIC int |
91 | xfs_inode_ag_walk( | 91 | xfs_inode_ag_walk( |
92 | struct xfs_mount *mp, | 92 | struct xfs_mount *mp, |
93 | xfs_agnumber_t ag, | 93 | struct xfs_perag *pag, |
94 | int (*execute)(struct xfs_inode *ip, | 94 | int (*execute)(struct xfs_inode *ip, |
95 | struct xfs_perag *pag, int flags), | 95 | struct xfs_perag *pag, int flags), |
96 | int flags, | 96 | int flags, |
97 | int tag, | 97 | int tag, |
98 | int exclusive) | 98 | int exclusive) |
99 | { | 99 | { |
100 | struct xfs_perag *pag = &mp->m_perag[ag]; | ||
101 | uint32_t first_index; | 100 | uint32_t first_index; |
102 | int last_error = 0; | 101 | int last_error = 0; |
103 | int skipped; | 102 | int skipped; |
@@ -141,8 +140,6 @@ restart: | |||
141 | delay(1); | 140 | delay(1); |
142 | goto restart; | 141 | goto restart; |
143 | } | 142 | } |
144 | |||
145 | xfs_put_perag(mp, pag); | ||
146 | return last_error; | 143 | return last_error; |
147 | } | 144 | } |
148 | 145 | ||
@@ -160,10 +157,16 @@ xfs_inode_ag_iterator( | |||
160 | xfs_agnumber_t ag; | 157 | xfs_agnumber_t ag; |
161 | 158 | ||
162 | for (ag = 0; ag < mp->m_sb.sb_agcount; ag++) { | 159 | for (ag = 0; ag < mp->m_sb.sb_agcount; ag++) { |
163 | if (!mp->m_perag[ag].pag_ici_init) | 160 | struct xfs_perag *pag; |
161 | |||
162 | pag = xfs_perag_get(mp, ag); | ||
163 | if (!pag->pag_ici_init) { | ||
164 | xfs_perag_put(pag); | ||
164 | continue; | 165 | continue; |
165 | error = xfs_inode_ag_walk(mp, ag, execute, flags, tag, | 166 | } |
167 | error = xfs_inode_ag_walk(mp, pag, execute, flags, tag, | ||
166 | exclusive); | 168 | exclusive); |
169 | xfs_perag_put(pag); | ||
167 | if (error) { | 170 | if (error) { |
168 | last_error = error; | 171 | last_error = error; |
169 | if (error == EFSCORRUPTED) | 172 | if (error == EFSCORRUPTED) |
@@ -690,16 +693,17 @@ void | |||
690 | xfs_inode_set_reclaim_tag( | 693 | xfs_inode_set_reclaim_tag( |
691 | xfs_inode_t *ip) | 694 | xfs_inode_t *ip) |
692 | { | 695 | { |
693 | xfs_mount_t *mp = ip->i_mount; | 696 | struct xfs_mount *mp = ip->i_mount; |
694 | xfs_perag_t *pag = xfs_get_perag(mp, ip->i_ino); | 697 | struct xfs_perag *pag; |
695 | 698 | ||
699 | pag = xfs_perag_get(mp, XFS_INO_TO_AGNO(mp, ip->i_ino)); | ||
696 | read_lock(&pag->pag_ici_lock); | 700 | read_lock(&pag->pag_ici_lock); |
697 | spin_lock(&ip->i_flags_lock); | 701 | spin_lock(&ip->i_flags_lock); |
698 | __xfs_inode_set_reclaim_tag(pag, ip); | 702 | __xfs_inode_set_reclaim_tag(pag, ip); |
699 | __xfs_iflags_set(ip, XFS_IRECLAIMABLE); | 703 | __xfs_iflags_set(ip, XFS_IRECLAIMABLE); |
700 | spin_unlock(&ip->i_flags_lock); | 704 | spin_unlock(&ip->i_flags_lock); |
701 | read_unlock(&pag->pag_ici_lock); | 705 | read_unlock(&pag->pag_ici_lock); |
702 | xfs_put_perag(mp, pag); | 706 | xfs_perag_put(pag); |
703 | } | 707 | } |
704 | 708 | ||
705 | void | 709 | void |
diff --git a/fs/xfs/xfs_iget.c b/fs/xfs/xfs_iget.c index 155e798f30a1..e281eb4a1c49 100644 --- a/fs/xfs/xfs_iget.c +++ b/fs/xfs/xfs_iget.c | |||
@@ -374,7 +374,7 @@ xfs_iget( | |||
374 | return EINVAL; | 374 | return EINVAL; |
375 | 375 | ||
376 | /* get the perag structure and ensure that it's inode capable */ | 376 | /* get the perag structure and ensure that it's inode capable */ |
377 | pag = xfs_get_perag(mp, ino); | 377 | pag = xfs_perag_get(mp, XFS_INO_TO_AGNO(mp, ino)); |
378 | if (!pag->pagi_inodeok) | 378 | if (!pag->pagi_inodeok) |
379 | return EINVAL; | 379 | return EINVAL; |
380 | ASSERT(pag->pag_ici_init); | 380 | ASSERT(pag->pag_ici_init); |
@@ -398,7 +398,7 @@ again: | |||
398 | if (error) | 398 | if (error) |
399 | goto out_error_or_again; | 399 | goto out_error_or_again; |
400 | } | 400 | } |
401 | xfs_put_perag(mp, pag); | 401 | xfs_perag_put(pag); |
402 | 402 | ||
403 | *ipp = ip; | 403 | *ipp = ip; |
404 | 404 | ||
@@ -417,7 +417,7 @@ out_error_or_again: | |||
417 | delay(1); | 417 | delay(1); |
418 | goto again; | 418 | goto again; |
419 | } | 419 | } |
420 | xfs_put_perag(mp, pag); | 420 | xfs_perag_put(pag); |
421 | return error; | 421 | return error; |
422 | } | 422 | } |
423 | 423 | ||
@@ -488,12 +488,12 @@ xfs_ireclaim( | |||
488 | * added to the tree assert that it's been there before to catch | 488 | * added to the tree assert that it's been there before to catch |
489 | * problems with the inode life time early on. | 489 | * problems with the inode life time early on. |
490 | */ | 490 | */ |
491 | pag = xfs_get_perag(mp, ip->i_ino); | 491 | pag = xfs_perag_get(mp, XFS_INO_TO_AGNO(mp, ip->i_ino)); |
492 | write_lock(&pag->pag_ici_lock); | 492 | write_lock(&pag->pag_ici_lock); |
493 | if (!radix_tree_delete(&pag->pag_ici_root, agino)) | 493 | if (!radix_tree_delete(&pag->pag_ici_root, agino)) |
494 | ASSERT(0); | 494 | ASSERT(0); |
495 | write_unlock(&pag->pag_ici_lock); | 495 | write_unlock(&pag->pag_ici_lock); |
496 | xfs_put_perag(mp, pag); | 496 | xfs_perag_put(pag); |
497 | 497 | ||
498 | /* | 498 | /* |
499 | * Here we do an (almost) spurious inode lock in order to coordinate | 499 | * Here we do an (almost) spurious inode lock in order to coordinate |
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c index ef77fd88c8e3..bd3d81636d51 100644 --- a/fs/xfs/xfs_inode.c +++ b/fs/xfs/xfs_inode.c | |||
@@ -1946,8 +1946,9 @@ xfs_ifree_cluster( | |||
1946 | xfs_inode_t *ip, **ip_found; | 1946 | xfs_inode_t *ip, **ip_found; |
1947 | xfs_inode_log_item_t *iip; | 1947 | xfs_inode_log_item_t *iip; |
1948 | xfs_log_item_t *lip; | 1948 | xfs_log_item_t *lip; |
1949 | xfs_perag_t *pag = xfs_get_perag(mp, inum); | 1949 | struct xfs_perag *pag; |
1950 | 1950 | ||
1951 | pag = xfs_perag_get(mp, XFS_INO_TO_AGNO(mp, inum)); | ||
1951 | if (mp->m_sb.sb_blocksize >= XFS_INODE_CLUSTER_SIZE(mp)) { | 1952 | if (mp->m_sb.sb_blocksize >= XFS_INODE_CLUSTER_SIZE(mp)) { |
1952 | blks_per_cluster = 1; | 1953 | blks_per_cluster = 1; |
1953 | ninodes = mp->m_sb.sb_inopblock; | 1954 | ninodes = mp->m_sb.sb_inopblock; |
@@ -2088,7 +2089,7 @@ xfs_ifree_cluster( | |||
2088 | } | 2089 | } |
2089 | 2090 | ||
2090 | kmem_free(ip_found); | 2091 | kmem_free(ip_found); |
2091 | xfs_put_perag(mp, pag); | 2092 | xfs_perag_put(pag); |
2092 | } | 2093 | } |
2093 | 2094 | ||
2094 | /* | 2095 | /* |
@@ -2675,7 +2676,7 @@ xfs_iflush_cluster( | |||
2675 | xfs_buf_t *bp) | 2676 | xfs_buf_t *bp) |
2676 | { | 2677 | { |
2677 | xfs_mount_t *mp = ip->i_mount; | 2678 | xfs_mount_t *mp = ip->i_mount; |
2678 | xfs_perag_t *pag = xfs_get_perag(mp, ip->i_ino); | 2679 | struct xfs_perag *pag; |
2679 | unsigned long first_index, mask; | 2680 | unsigned long first_index, mask; |
2680 | unsigned long inodes_per_cluster; | 2681 | unsigned long inodes_per_cluster; |
2681 | int ilist_size; | 2682 | int ilist_size; |
@@ -2686,6 +2687,7 @@ xfs_iflush_cluster( | |||
2686 | int bufwasdelwri; | 2687 | int bufwasdelwri; |
2687 | int i; | 2688 | int i; |
2688 | 2689 | ||
2690 | pag = xfs_perag_get(mp, XFS_INO_TO_AGNO(mp, ip->i_ino)); | ||
2689 | ASSERT(pag->pagi_inodeok); | 2691 | ASSERT(pag->pagi_inodeok); |
2690 | ASSERT(pag->pag_ici_init); | 2692 | ASSERT(pag->pag_ici_init); |
2691 | 2693 | ||
diff --git a/fs/xfs/xfs_mount.h b/fs/xfs/xfs_mount.h index 1df7e4502967..f8a68a2319b5 100644 --- a/fs/xfs/xfs_mount.h +++ b/fs/xfs/xfs_mount.h | |||
@@ -386,14 +386,14 @@ xfs_daddr_to_agbno(struct xfs_mount *mp, xfs_daddr_t d) | |||
386 | /* | 386 | /* |
387 | * perag get/put wrappers for eventual ref counting | 387 | * perag get/put wrappers for eventual ref counting |
388 | */ | 388 | */ |
389 | static inline xfs_perag_t * | 389 | static inline struct xfs_perag * |
390 | xfs_get_perag(struct xfs_mount *mp, xfs_ino_t ino) | 390 | xfs_perag_get(struct xfs_mount *mp, xfs_agnumber_t agno) |
391 | { | 391 | { |
392 | return &mp->m_perag[XFS_INO_TO_AGNO(mp, ino)]; | 392 | return &mp->m_perag[agno]; |
393 | } | 393 | } |
394 | 394 | ||
395 | static inline void | 395 | static inline void |
396 | xfs_put_perag(struct xfs_mount *mp, xfs_perag_t *pag) | 396 | xfs_perag_put(struct xfs_perag *pag) |
397 | { | 397 | { |
398 | /* nothing to see here, move along */ | 398 | /* nothing to see here, move along */ |
399 | } | 399 | } |