xfs: drop the type parameter from xfs_dquot_verify
authorDarrick J. Wong <darrick.wong@oracle.com>
Thu, 16 Jul 2020 00:41:24 +0000 (17:41 -0700)
committerDarrick J. Wong <darrick.wong@oracle.com>
Wed, 29 Jul 2020 03:24:14 +0000 (20:24 -0700)
xfs_qm_reset_dqcounts (aka quotacheck) is the only xfs_dqblk_verify
caller that actually knows the specific quota type that it's looking
for.  Since everything else just pass in type==0 (including the buffer
verifier), drop the parameter and open-code the check like
xfs_dquot_from_disk already does.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
fs/xfs/libxfs/xfs_dquot_buf.c
fs/xfs/libxfs/xfs_quota_defs.h
fs/xfs/xfs_buf_item_recover.c
fs/xfs/xfs_dquot_item_recover.c
fs/xfs/xfs_qm.c

index bedc1e752b601f0c569896af4d30a6844697bae9..eb2412e13f30b1a562f7fffffb76b2e678994132 100644 (file)
@@ -37,8 +37,7 @@ xfs_failaddr_t
 xfs_dquot_verify(
        struct xfs_mount        *mp,
        struct xfs_disk_dquot   *ddq,
-       xfs_dqid_t              id,
-       uint                    type)   /* used only during quotacheck */
+       xfs_dqid_t              id)     /* used only during quotacheck */
 {
        /*
         * We can encounter an uninitialized dquot buffer for 2 reasons:
@@ -60,8 +59,6 @@ xfs_dquot_verify(
        if (ddq->d_version != XFS_DQUOT_VERSION)
                return __this_address;
 
-       if (type && ddq->d_flags != type)
-               return __this_address;
        if (ddq->d_flags != XFS_DQ_USER &&
            ddq->d_flags != XFS_DQ_PROJ &&
            ddq->d_flags != XFS_DQ_GROUP)
@@ -95,14 +92,13 @@ xfs_failaddr_t
 xfs_dqblk_verify(
        struct xfs_mount        *mp,
        struct xfs_dqblk        *dqb,
-       xfs_dqid_t              id,
-       uint                    type)   /* used only during quotacheck */
+       xfs_dqid_t              id)     /* used only during quotacheck */
 {
        if (xfs_sb_version_hascrc(&mp->m_sb) &&
            !uuid_equal(&dqb->dd_uuid, &mp->m_sb.sb_meta_uuid))
                return __this_address;
 
-       return xfs_dquot_verify(mp, &dqb->dd_diskdq, id, type);
+       return xfs_dquot_verify(mp, &dqb->dd_diskdq, id);
 }
 
 /*
@@ -205,7 +201,7 @@ xfs_dquot_buf_verify(
                if (i == 0)
                        id = be32_to_cpu(ddq->d_id);
 
-               fa = xfs_dqblk_verify(mp, &dqb[i], id + i, 0);
+               fa = xfs_dqblk_verify(mp, &dqb[i], id + i);
                if (fa) {
                        if (!readahead)
                                xfs_buf_verifier_error(bp, -EFSCORRUPTED,
index e2da08055e6b7d4c99556500715de7c1ea1af07d..d2245f375719ab94c68f276d558570bd181c811c 100644 (file)
@@ -137,9 +137,9 @@ typedef uint16_t    xfs_qwarncnt_t;
 #define XFS_QMOPT_RESBLK_MASK  (XFS_QMOPT_RES_REGBLKS | XFS_QMOPT_RES_RTBLKS)
 
 extern xfs_failaddr_t xfs_dquot_verify(struct xfs_mount *mp,
-               struct xfs_disk_dquot *ddq, xfs_dqid_t id, uint type);
+               struct xfs_disk_dquot *ddq, xfs_dqid_t id);
 extern xfs_failaddr_t xfs_dqblk_verify(struct xfs_mount *mp,
-               struct xfs_dqblk *dqb, xfs_dqid_t id, uint type);
+               struct xfs_dqblk *dqb, xfs_dqid_t id);
 extern int xfs_calc_dquots_per_chunk(unsigned int nbblks);
 extern void xfs_dqblk_repair(struct xfs_mount *mp, struct xfs_dqblk *dqb,
                xfs_dqid_t id, uint type);
index 74c851f60eeeb1b7c31f204dc598932a64691d0d..8bee582cf66adecef78dadd7a4c7f4cb6159b5d7 100644 (file)
@@ -493,8 +493,7 @@ xlog_recover_do_reg_buffer(
                                        item->ri_buf[i].i_len, __func__);
                                goto next;
                        }
-                       fa = xfs_dquot_verify(mp, item->ri_buf[i].i_addr,
-                                              -1, 0);
+                       fa = xfs_dquot_verify(mp, item->ri_buf[i].i_addr, -1);
                        if (fa) {
                                xfs_alert(mp,
        "dquot corrupt at %pS trying to replay into block 0x%llx",
index f9ea9f55aa7cc807c8dad0be31cdf988fe768ff3..9f64162ca300264bca6ad14f597f38d47c3f5774 100644 (file)
@@ -108,7 +108,7 @@ xlog_recover_dquot_commit_pass2(
         */
        dq_f = item->ri_buf[0].i_addr;
        ASSERT(dq_f);
-       fa = xfs_dquot_verify(mp, recddq, dq_f->qlf_id, 0);
+       fa = xfs_dquot_verify(mp, recddq, dq_f->qlf_id);
        if (fa) {
                xfs_alert(mp, "corrupt dquot ID 0x%x in log at %pS",
                                dq_f->qlf_id, fa);
index 7d83c1623cb2fb3be828490f26004c491eca7df1..bf94c1bbda16423fc2ea23e404524a6aa79454ef 100644 (file)
@@ -830,7 +830,6 @@ xfs_qm_reset_dqcounts(
 {
        struct xfs_dqblk        *dqb;
        int                     j;
-       xfs_failaddr_t          fa;
 
        trace_xfs_reset_dqcounts(bp, _RET_IP_);
 
@@ -855,8 +854,8 @@ xfs_qm_reset_dqcounts(
                 * find uninitialised dquot blks. See comment in
                 * xfs_dquot_verify.
                 */
-               fa = xfs_dqblk_verify(mp, &dqb[j], id + j, type);
-               if (fa)
+               if (xfs_dqblk_verify(mp, &dqb[j], id + j) ||
+                   (dqb[j].dd_diskdq.d_flags & XFS_DQ_ALLTYPES) != type)
                        xfs_dqblk_repair(mp, &dqb[j], id + j, type);
 
                /*