[4/4] xfs_repair: skip mount time quotacheck if our quotacheck was ok
diff mbox series

Message ID 159476319479.3156699.12134117203484512536.stgit@magnolia
State Accepted
Headers show
Series
  • xfs_repair: check quota counters
Related show

Commit Message

Darrick J. Wong July 14, 2020, 9:46 p.m. UTC
From: Darrick J. Wong <darrick.wong@oracle.com>

If we verified that the incore quota counts match the ondisk quota
contents, we can leave the CHKD flags set so that the next mount doesn't
have to repeat the quotacheck.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 repair/quotacheck.c |   10 ++++++++++
 repair/quotacheck.h |    1 +
 repair/xfs_repair.c |    2 +-
 3 files changed, 12 insertions(+), 1 deletion(-)

Comments

Christoph Hellwig July 15, 2020, 6:30 p.m. UTC | #1
On Tue, Jul 14, 2020 at 02:46:34PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> If we verified that the incore quota counts match the ondisk quota
> contents, we can leave the CHKD flags set so that the next mount doesn't
> have to repeat the quotacheck.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>

Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>

Patch
diff mbox series

diff --git a/repair/quotacheck.c b/repair/quotacheck.c
index 481a1289..0df1f2be 100644
--- a/repair/quotacheck.c
+++ b/repair/quotacheck.c
@@ -24,6 +24,16 @@  void quotacheck_skip(void)
  */
 static uint16_t chkd_flags;
 
+/*
+ * Return CHKD flags for the quota types that we checked.  If we encountered
+ * any errors at all, return zero.
+ */
+uint16_t
+quotacheck_results(void)
+{
+	return chkd_flags;
+}
+
 /* Global incore dquot tree */
 struct qc_dquots {
 	pthread_mutex_t		lock;
diff --git a/repair/quotacheck.h b/repair/quotacheck.h
index 08e11d17..d745696f 100644
--- a/repair/quotacheck.h
+++ b/repair/quotacheck.h
@@ -9,6 +9,7 @@ 
 void quotacheck_skip(void);
 void quotacheck_adjust(struct xfs_mount *mp, xfs_ino_t ino);
 void quotacheck_verify(struct xfs_mount *mp, unsigned int type);
+uint16_t quotacheck_results(void);
 int quotacheck_setup(struct xfs_mount *mp);
 void quotacheck_teardown(void);
 
diff --git a/repair/xfs_repair.c b/repair/xfs_repair.c
index a787da4c..d687edea 100644
--- a/repair/xfs_repair.c
+++ b/repair/xfs_repair.c
@@ -1106,7 +1106,7 @@  _("Warning:  project quota information would be cleared.\n"
 
 	dsb = sbp->b_addr;
 
-	if (mp->m_sb.sb_qflags & XFS_ALL_QUOTA_CHKD) {
+	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 |