From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Eric Sandeen <sandeen@redhat.com>
Cc: linux-xfs <linux-xfs@vger.kernel.org>
Subject: Re: [PATCH 2/4] xfs: New function for secondary superblock updates
Date: Tue, 15 May 2018 13:17:48 -0700 [thread overview]
Message-ID: <20180515201748.GL4933@magnolia> (raw)
In-Reply-To: <7e8d428a-2150-d044-c1f3-5b53c5404246@redhat.com>
On Mon, May 14, 2018 at 12:36:36PM -0500, Eric Sandeen wrote:
> Relabel must update all secondary superblocks, as offline relabel does.
>
> This is essentially a simpler copy of the current growfs code, which is
> undergoing an independent refactor; we can see about merging stuff back
> together after all this work is done. In the meantime, this is a fairly
> small, simple bit of code to facilitate the online label work.
>
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
> ---
> fs/xfs/xfs_fsops.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++
> fs/xfs/xfs_fsops.h | 1 +
> 2 files changed, 49 insertions(+)
>
> diff --git a/fs/xfs/xfs_fsops.c b/fs/xfs/xfs_fsops.c
> index 523792768080..1aaa93051f78 100644
> --- a/fs/xfs/xfs_fsops.c
> +++ b/fs/xfs/xfs_fsops.c
> @@ -71,6 +71,54 @@ xfs_growfs_get_hdr_buf(
> return bp;
> }
>
> +/*
> + * Copy the contents of the primary super to all backup supers.
> + * Not currently used for growfs, as it only looks at existing supers.
> + */
> +int
> +xfs_update_secondary_supers(
> + xfs_mount_t *mp)
> +{
> + int error, saved_error;
> + xfs_agnumber_t agno;
> + xfs_buf_t *bp;
> +
> + error = saved_error = 0;
> +
> + for (agno = 1; agno < mp->m_sb.sb_agcount; agno++) {
> + error = xfs_trans_read_buf(mp, NULL, 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);
This whole thing /should/ use the new xfs_sb_read_secondary() helper,
but between Dave's growfs refactor, this series, and secondary sb online
repair I think I prefer to land all three and immediately clean up all
three common use cases.
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
--D
> + /*
> + * If we get an error reading or writing alternate superblocks,
> + * continue. xfs_repair chooses the "best" superblock based
> + * on most matches; if we break early, we'll leave more
> + * superblocks un-updated than updated, and xfs_repair may
> + * pick them over the properly-updated primary.
> + */
> + if (error) {
> + xfs_warn(mp,
> + "error %d reading secondary superblock for ag %d",
> + error, agno);
> + saved_error = error;
> + continue;
> + }
> + xfs_sb_to_disk(XFS_BUF_TO_SBP(bp), &mp->m_sb);
> +
> + error = xfs_bwrite(bp);
> + xfs_buf_relse(bp);
> + if (error) {
> + xfs_warn(mp,
> + "write error %d updating secondary superblock for ag %d",
> + error, agno);
> + saved_error = error;
> + continue;
> + }
> + }
> +
> + return saved_error ? saved_error : error;
> +}
> +
> static int
> xfs_growfs_data_private(
> xfs_mount_t *mp, /* mount point for filesystem */
> diff --git a/fs/xfs/xfs_fsops.h b/fs/xfs/xfs_fsops.h
> index 20484ed5e919..257d3018bc39 100644
> --- a/fs/xfs/xfs_fsops.h
> +++ b/fs/xfs/xfs_fsops.h
> @@ -18,6 +18,7 @@
> #ifndef __XFS_FSOPS_H__
> #define __XFS_FSOPS_H__
>
> +extern int xfs_update_secondary_supers(xfs_mount_t *mp);
> extern int xfs_growfs_data(xfs_mount_t *mp, xfs_growfs_data_t *in);
> extern int xfs_growfs_log(xfs_mount_t *mp, xfs_growfs_log_t *in);
> extern int xfs_fs_counts(xfs_mount_t *mp, xfs_fsop_counts_t *cnt);
> --
> 2.17.0
>
> --
> 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-15 20:18 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-14 17:30 [PATCH V2 0/5] xfs: online label Eric Sandeen
2018-05-14 17:35 ` [PATCH V2 1/5] fs: copy BTRFS_IOC_[SG]ET_FSLABEL to vfs Eric Sandeen
2018-05-14 17:37 ` Darrick J. Wong
2018-05-14 17:36 ` [PATCH 2/4] xfs: New function for secondary superblock updates Eric Sandeen
2018-05-15 20:17 ` Darrick J. Wong [this message]
2018-05-14 17:39 ` [PATCH 3/5 V2] xfs: implement online get/set fs label Eric Sandeen
2018-05-15 1:07 ` Darrick J. Wong
2018-05-16 1:04 ` Darrick J. Wong
2018-05-14 17:42 ` [PATCH 4/5] btrfs: use common label ioctl definitions Eric Sandeen
2018-05-14 21:41 ` Darrick J. Wong
2018-05-14 17:43 ` [PATCH 5/5] xfs_io: add label command Eric Sandeen
2018-05-15 4:32 ` Dave Chinner
2018-05-15 15:06 ` Eric Sandeen
2018-05-16 0:57 ` Dave Chinner
2018-05-15 15:32 ` [PATCH 5/5 V2] " Eric Sandeen
2018-05-15 20:12 ` Darrick J. Wong
2018-05-17 15:22 ` [PATCH 5/5 V3] " Eric Sandeen
2018-05-17 21:56 ` Dave Chinner
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=20180515201748.GL4933@magnolia \
--to=darrick.wong@oracle.com \
--cc=linux-xfs@vger.kernel.org \
--cc=sandeen@redhat.com \
/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;
as well as URLs for NNTP newsgroup(s).