summaryrefslogtreecommitdiff
path: root/fs/xfs/xfs_reflink.c
diff options
context:
space:
mode:
authorDave Chinner <dchinner@redhat.com>2021-06-02 03:48:24 +0300
committerDave Chinner <david@fromorbit.com>2021-06-02 03:48:24 +0300
commit934933c3eec9e4a5826d3d7a47aca0742337fded (patch)
tree5254dae6d715f237a952daf6c9ad61d21d683d83 /fs/xfs/xfs_reflink.c
parentf250eedcf7621b9a56d563912b4eeacd524422c7 (diff)
downloadlinux-934933c3eec9e4a5826d3d7a47aca0742337fded.tar.xz
xfs: convert raw ag walks to use for_each_perag
Convert the raw walks to an iterator, pulling the current AG out of pag->pag_agno instead of the loop iterator variable. Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Diffstat (limited to 'fs/xfs/xfs_reflink.c')
-rw-r--r--fs/xfs/xfs_reflink.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/fs/xfs/xfs_reflink.c b/fs/xfs/xfs_reflink.c
index f297d68a931b..0e430b0c1b16 100644
--- a/fs/xfs/xfs_reflink.c
+++ b/fs/xfs/xfs_reflink.c
@@ -755,16 +755,19 @@ int
xfs_reflink_recover_cow(
struct xfs_mount *mp)
{
+ struct xfs_perag *pag;
xfs_agnumber_t agno;
int error = 0;
if (!xfs_sb_version_hasreflink(&mp->m_sb))
return 0;
- for (agno = 0; agno < mp->m_sb.sb_agcount; agno++) {
- error = xfs_refcount_recover_cow_leftovers(mp, agno);
- if (error)
+ for_each_perag(mp, agno, pag) {
+ error = xfs_refcount_recover_cow_leftovers(mp, pag->pag_agno);
+ if (error) {
+ xfs_perag_put(pag);
break;
+ }
}
return error;