]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs: drop the type parameter from xfs_dquot_verify
authorDarrick J. Wong <darrick.wong@oracle.com>
Fri, 4 Sep 2020 20:05:20 +0000 (16:05 -0400)
committerEric Sandeen <sandeen@sandeen.net>
Fri, 4 Sep 2020 20:05:20 +0000 (16:05 -0400)
Source kernel commit: f9751c4ad3d17fa93773c187732f10c8a49940e3

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>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
libxfs/xfs_dquot_buf.c
libxfs/xfs_quota_defs.h
repair/dinode.c

index 5b372a23ce215796c55f29948aed760f5b773784..097ed195a0c5979444953c3a75787180a3752966 100644 (file)
@@ -35,8 +35,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:
@@ -58,8 +57,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)
@@ -93,14 +90,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);
 }
 
 /*
@@ -203,7 +199,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 d552db2d5f1ac374e8a5cbf7c09a350b6a1b2a97..8cd84bc27ca648616ebc4d656d8e2b476443c631 100644 (file)
@@ -1126,8 +1126,10 @@ _("cannot read inode %" PRIu64 ", file block %" PRIu64 ", disk block %" PRIu64 "
                                        goto bad;
                                }
                        }
-                       if (libxfs_dquot_verify(mp, &dqb->dd_diskdq, dqid,
-                                               quota_type) != NULL) {
+                       if (libxfs_dquot_verify(mp, &dqb->dd_diskdq, dqid)
+                                               != NULL ||
+                           (dqb->dd_diskdq.d_flags & XFS_DQ_ALLTYPES)
+                                               != quota_type) {
                                do_warn(_("%s: Corrupt quota for id %u. "),
                                                quota_string, dqid);
                                bad_dqb = 1;