From: Brian Foster <bfoster@redhat.com>
To: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH 08/12] xfs: superblock scrub should use short-lived buffers
Date: Thu, 10 May 2018 09:55:05 -0400 [thread overview]
Message-ID: <20180510135504.GG69384@bfoster.bfoster> (raw)
In-Reply-To: <152537080489.16676.3127430066483939602.stgit@magnolia>
On Thu, May 03, 2018 at 11:06:44AM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
>
> Secondary superblocks are rarely used, so create a helper to read a
> given non-primary AG's superblock and ensure that it won't stick around
> hogging memory.
>
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
Reviewed-by: Brian Foster <bfoster@redhat.com>
> fs/xfs/libxfs/xfs_sb.c | 22 ++++++++++++++++++++++
> fs/xfs/libxfs/xfs_sb.h | 3 +++
> fs/xfs/libxfs/xfs_shared.h | 1 +
> fs/xfs/scrub/agheader.c | 4 +---
> 4 files changed, 27 insertions(+), 3 deletions(-)
>
>
> diff --git a/fs/xfs/libxfs/xfs_sb.c b/fs/xfs/libxfs/xfs_sb.c
> index d9b94bd5f689..d9bef41a3f26 100644
> --- a/fs/xfs/libxfs/xfs_sb.c
> +++ b/fs/xfs/libxfs/xfs_sb.c
> @@ -972,3 +972,25 @@ xfs_fs_geometry(
>
> return 0;
> }
> +
> +/* Read a secondary superblock. */
> +int
> +xfs_sb_read_secondary(
> + struct xfs_mount *mp,
> + struct xfs_trans *tp,
> + xfs_agnumber_t agno,
> + struct xfs_buf **bpp)
> +{
> + struct xfs_buf *bp;
> + int error;
> +
> + ASSERT(agno != 0 && agno != NULLAGNUMBER);
> + error = xfs_trans_read_buf(mp, tp, mp->m_ddev_targp,
> + XFS_AG_DADDR(mp, agno, XFS_SB_BLOCK(mp)),
> + XFS_FSS_TO_BB(mp, 1), 0, &bp, &xfs_sb_buf_ops);
> + if (error)
> + return error;
> + xfs_buf_set_ref(bp, XFS_SSB_REF);
> + *bpp = bp;
> + return 0;
> +}
> diff --git a/fs/xfs/libxfs/xfs_sb.h b/fs/xfs/libxfs/xfs_sb.h
> index 63dcd2a1a657..5166d78b2c34 100644
> --- a/fs/xfs/libxfs/xfs_sb.h
> +++ b/fs/xfs/libxfs/xfs_sb.h
> @@ -37,5 +37,8 @@ extern void xfs_sb_quota_from_disk(struct xfs_sb *sbp);
> #define XFS_FS_GEOM_MAX_STRUCT_VER (4)
> extern int xfs_fs_geometry(struct xfs_sb *sbp, struct xfs_fsop_geom *geo,
> int struct_version);
> +extern int xfs_sb_read_secondary(struct xfs_mount *mp,
> + struct xfs_trans *tp, xfs_agnumber_t agno,
> + struct xfs_buf **bpp);
>
> #endif /* __XFS_SB_H__ */
> diff --git a/fs/xfs/libxfs/xfs_shared.h b/fs/xfs/libxfs/xfs_shared.h
> index d0b84da0cb1e..d23f33c02f64 100644
> --- a/fs/xfs/libxfs/xfs_shared.h
> +++ b/fs/xfs/libxfs/xfs_shared.h
> @@ -127,6 +127,7 @@ void xfs_log_get_max_trans_res(struct xfs_mount *mp,
> #define XFS_ATTR_BTREE_REF 1
> #define XFS_DQUOT_REF 1
> #define XFS_REFC_BTREE_REF 1
> +#define XFS_SSB_REF 0
>
> /*
> * Flags for xfs_trans_ichgtime().
> diff --git a/fs/xfs/scrub/agheader.c b/fs/xfs/scrub/agheader.c
> index 018aabbd9394..cd24ac56c21e 100644
> --- a/fs/xfs/scrub/agheader.c
> +++ b/fs/xfs/scrub/agheader.c
> @@ -157,9 +157,7 @@ xfs_scrub_superblock(
> if (agno == 0)
> return 0;
>
> - error = xfs_trans_read_buf(mp, sc->tp, mp->m_ddev_targp,
> - XFS_AGB_TO_DADDR(mp, agno, XFS_SB_BLOCK(mp)),
> - XFS_FSS_TO_BB(mp, 1), 0, &bp, &xfs_sb_buf_ops);
> + error = xfs_sb_read_secondary(mp, sc->tp, agno, &bp);
> /*
> * The superblock verifier can return several different error codes
> * if it thinks the superblock doesn't look right. For a mount these
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2018-05-10 13:55 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-03 18:05 [PATCH v4 00/12] xfs-4.18: various fixes Darrick J. Wong
2018-05-03 18:05 ` [PATCH 01/12] xfs: bmap debugging should never panic the system Darrick J. Wong
2018-05-07 15:06 ` Christoph Hellwig
2018-05-10 13:53 ` Brian Foster
2018-05-10 15:45 ` Darrick J. Wong
2018-05-03 18:06 ` [PATCH 02/12] xfs: add missing rmap error return Darrick J. Wong
2018-05-07 15:06 ` Christoph Hellwig
2018-05-10 13:53 ` Brian Foster
2018-05-03 18:06 ` [PATCH 03/12] xfs: skip scrub xref if corruption already noted Darrick J. Wong
2018-05-10 13:53 ` Brian Foster
2018-05-03 18:06 ` [PATCH 04/12] xfs: don't continue scrub if already corrupt Darrick J. Wong
2018-05-10 13:53 ` Brian Foster
2018-05-10 15:54 ` Darrick J. Wong
2018-05-03 18:06 ` [PATCH 05/12] xfs: avoid ilock games in the quota scrubber Darrick J. Wong
2018-05-03 18:06 ` [PATCH 06/12] xfs: quota scrub should use bmapbtd scrubber Darrick J. Wong
2018-05-10 13:54 ` Brian Foster
2018-05-10 15:34 ` Darrick J. Wong
2018-05-03 18:06 ` [PATCH 07/12] xfs: scrub the data fork of the realtime inodes Darrick J. Wong
2018-05-10 13:54 ` Brian Foster
2018-05-10 16:07 ` Darrick J. Wong
2018-05-03 18:06 ` [PATCH 08/12] xfs: superblock scrub should use short-lived buffers Darrick J. Wong
2018-05-10 13:55 ` Brian Foster [this message]
2018-05-03 18:06 ` [PATCH 09/12] xfs: clean up scrub usage of KM_NOFS Darrick J. Wong
2018-05-03 18:06 ` [PATCH 10/12] xfs: btree scrub should check minrecs Darrick J. Wong
2018-05-03 18:07 ` [PATCH 11/12] xfs: refactor scrub transaction allocation function Darrick J. Wong
2018-05-03 18:07 ` [PATCH 12/12] xfs: avoid ABBA deadlock when scrubbing parent pointers Darrick J. Wong
2018-05-08 0:40 ` [PATCH 13/12] xfs: refactor quota limits initialization Darrick J. Wong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180510135504.GG69384@bfoster.bfoster \
--to=bfoster@redhat.com \
--cc=darrick.wong@oracle.com \
--cc=linux-xfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox