Commit 7f8d3b3c authored by Dave Chinner's avatar Dave Chinner Committed by Dave Chinner

xfs: convert secondary superblock walk to use perags

Clean up the last external manual AG walk.
Signed-off-by: default avatarDave Chinner <dchinner@redhat.com>
Reviewed-by: default avatarBrian Foster <bfoster@redhat.com>
Reviewed-by: default avatarDarrick J. Wong <djwong@kernel.org>
parent 6f4118fc
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include "xfs_refcount_btree.h" #include "xfs_refcount_btree.h"
#include "xfs_da_format.h" #include "xfs_da_format.h"
#include "xfs_health.h" #include "xfs_health.h"
#include "xfs_ag.h"
/* /*
* Physical superblock buffer manipulations. Shared with libxfs in userspace. * Physical superblock buffer manipulations. Shared with libxfs in userspace.
...@@ -855,17 +856,18 @@ int ...@@ -855,17 +856,18 @@ int
xfs_update_secondary_sbs( xfs_update_secondary_sbs(
struct xfs_mount *mp) struct xfs_mount *mp)
{ {
xfs_agnumber_t agno; struct xfs_perag *pag;
xfs_agnumber_t agno = 1;
int saved_error = 0; int saved_error = 0;
int error = 0; int error = 0;
LIST_HEAD (buffer_list); LIST_HEAD (buffer_list);
/* update secondary superblocks. */ /* update secondary superblocks. */
for (agno = 1; agno < mp->m_sb.sb_agcount; agno++) { for_each_perag_from(mp, agno, pag) {
struct xfs_buf *bp; struct xfs_buf *bp;
error = xfs_buf_get(mp->m_ddev_targp, error = xfs_buf_get(mp->m_ddev_targp,
XFS_AG_DADDR(mp, agno, XFS_SB_DADDR), XFS_AG_DADDR(mp, pag->pag_agno, XFS_SB_DADDR),
XFS_FSS_TO_BB(mp, 1), &bp); XFS_FSS_TO_BB(mp, 1), &bp);
/* /*
* If we get an error reading or writing alternate superblocks, * If we get an error reading or writing alternate superblocks,
...@@ -877,7 +879,7 @@ xfs_update_secondary_sbs( ...@@ -877,7 +879,7 @@ xfs_update_secondary_sbs(
if (error) { if (error) {
xfs_warn(mp, xfs_warn(mp,
"error allocating secondary superblock for ag %d", "error allocating secondary superblock for ag %d",
agno); pag->pag_agno);
if (!saved_error) if (!saved_error)
saved_error = error; saved_error = error;
continue; continue;
...@@ -898,7 +900,7 @@ xfs_update_secondary_sbs( ...@@ -898,7 +900,7 @@ xfs_update_secondary_sbs(
if (error) { if (error) {
xfs_warn(mp, xfs_warn(mp,
"write error %d updating a secondary superblock near ag %d", "write error %d updating a secondary superblock near ag %d",
error, agno); error, pag->pag_agno);
if (!saved_error) if (!saved_error)
saved_error = error; saved_error = error;
continue; continue;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment