Message ID | 161404925290.425352.17614643483707405953.stgit@magnolia (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
Series | xfsprogs: add the ability to flag a fs for repair | expand |
On 2/22/21 8:00 PM, Darrick J. Wong wrote: > From: Darrick J. Wong <djwong@kernel.org> > > At the end of a repair run, xfs_repair clears the superblock's quota > checked flags if it found mistakes in the quota accounting to force a > quotacheck at the next mount. This is currently the last time repair > modifies the primary superblock, so it is sufficient to update the > ondisk buffer and not the incore mount structure. > > However, we're about to introduce code to clear the needsrepair feature > at the very end of repair, after all metadata blocks have been written > to disk and all disk caches flush. Since the convention everywhere else > in xfs is to update the incore superblock, call libxfs_sb_to_disk to > translate that into the ondisk buffer, and then write the buffer to > disk, switch the quota CHKD code to use this mechanism too. > > (Get rid of dsb too, since the incore super should be in sync with the > ondisk super.) > > Signed-off-by: Darrick J. Wong <djwong@kernel.org> > Reviewed-by: Christoph Hellwig <hch@lst.de> > Reviewed-by: Brian Foster <bfoster@redhat.com> Ok, makes sense Reviewed-by: Allison Henderson <allison.henderson@oracle.com> > --- > repair/xfs_repair.c | 12 ++++-------- > 1 file changed, 4 insertions(+), 8 deletions(-) > > > diff --git a/repair/xfs_repair.c b/repair/xfs_repair.c > index 9409f0d8..40352458 100644 > --- a/repair/xfs_repair.c > +++ b/repair/xfs_repair.c > @@ -717,7 +717,6 @@ main(int argc, char **argv) > { > xfs_mount_t *temp_mp; > xfs_mount_t *mp; > - xfs_dsb_t *dsb; > struct xfs_buf *sbp; > xfs_mount_t xfs_m; > struct xlog log = {0}; > @@ -1103,22 +1102,19 @@ _("Warning: project quota information would be cleared.\n" > if (!sbp) > do_error(_("couldn't get superblock\n")); > > - dsb = sbp->b_addr; > - > if ((mp->m_sb.sb_qflags & XFS_ALL_QUOTA_CHKD) != quotacheck_results()) { > do_warn(_("Note - quota info will be regenerated on next " > "quota mount.\n")); > - dsb->sb_qflags &= cpu_to_be16(~(XFS_UQUOTA_CHKD | > - XFS_GQUOTA_CHKD | > - XFS_PQUOTA_CHKD | > - XFS_OQUOTA_CHKD)); > + mp->m_sb.sb_qflags &= ~(XFS_UQUOTA_CHKD | XFS_GQUOTA_CHKD | > + XFS_PQUOTA_CHKD | XFS_OQUOTA_CHKD); > + libxfs_sb_to_disk(sbp->b_addr, &mp->m_sb); > } > > if (copied_sunit) { > do_warn( > _("Note - stripe unit (%d) and width (%d) were copied from a backup superblock.\n" > "Please reset with mount -o sunit=<value>,swidth=<value> if necessary\n"), > - be32_to_cpu(dsb->sb_unit), be32_to_cpu(dsb->sb_width)); > + mp->m_sb.sb_unit, mp->m_sb.sb_width); > } > > libxfs_buf_mark_dirty(sbp); >
diff --git a/repair/xfs_repair.c b/repair/xfs_repair.c index 9409f0d8..40352458 100644 --- a/repair/xfs_repair.c +++ b/repair/xfs_repair.c @@ -717,7 +717,6 @@ main(int argc, char **argv) { xfs_mount_t *temp_mp; xfs_mount_t *mp; - xfs_dsb_t *dsb; struct xfs_buf *sbp; xfs_mount_t xfs_m; struct xlog log = {0}; @@ -1103,22 +1102,19 @@ _("Warning: project quota information would be cleared.\n" if (!sbp) do_error(_("couldn't get superblock\n")); - dsb = sbp->b_addr; - if ((mp->m_sb.sb_qflags & XFS_ALL_QUOTA_CHKD) != quotacheck_results()) { do_warn(_("Note - quota info will be regenerated on next " "quota mount.\n")); - dsb->sb_qflags &= cpu_to_be16(~(XFS_UQUOTA_CHKD | - XFS_GQUOTA_CHKD | - XFS_PQUOTA_CHKD | - XFS_OQUOTA_CHKD)); + mp->m_sb.sb_qflags &= ~(XFS_UQUOTA_CHKD | XFS_GQUOTA_CHKD | + XFS_PQUOTA_CHKD | XFS_OQUOTA_CHKD); + libxfs_sb_to_disk(sbp->b_addr, &mp->m_sb); } if (copied_sunit) { do_warn( _("Note - stripe unit (%d) and width (%d) were copied from a backup superblock.\n" "Please reset with mount -o sunit=<value>,swidth=<value> if necessary\n"), - be32_to_cpu(dsb->sb_unit), be32_to_cpu(dsb->sb_width)); + mp->m_sb.sb_unit, mp->m_sb.sb_width); } libxfs_buf_mark_dirty(sbp);