Commit f9751c4a authored by Darrick J. Wong's avatar Darrick J. Wong

xfs: drop the type parameter from xfs_dquot_verify

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: default avatarDarrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: default avatarDave Chinner <dchinner@redhat.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
parent 2cb91bab
...@@ -37,8 +37,7 @@ xfs_failaddr_t ...@@ -37,8 +37,7 @@ xfs_failaddr_t
xfs_dquot_verify( xfs_dquot_verify(
struct xfs_mount *mp, struct xfs_mount *mp,
struct xfs_disk_dquot *ddq, struct xfs_disk_dquot *ddq,
xfs_dqid_t id, xfs_dqid_t id) /* used only during quotacheck */
uint type) /* used only during quotacheck */
{ {
/* /*
* We can encounter an uninitialized dquot buffer for 2 reasons: * We can encounter an uninitialized dquot buffer for 2 reasons:
...@@ -60,8 +59,6 @@ xfs_dquot_verify( ...@@ -60,8 +59,6 @@ xfs_dquot_verify(
if (ddq->d_version != XFS_DQUOT_VERSION) if (ddq->d_version != XFS_DQUOT_VERSION)
return __this_address; return __this_address;
if (type && ddq->d_flags != type)
return __this_address;
if (ddq->d_flags != XFS_DQ_USER && if (ddq->d_flags != XFS_DQ_USER &&
ddq->d_flags != XFS_DQ_PROJ && ddq->d_flags != XFS_DQ_PROJ &&
ddq->d_flags != XFS_DQ_GROUP) ddq->d_flags != XFS_DQ_GROUP)
...@@ -95,14 +92,13 @@ xfs_failaddr_t ...@@ -95,14 +92,13 @@ xfs_failaddr_t
xfs_dqblk_verify( xfs_dqblk_verify(
struct xfs_mount *mp, struct xfs_mount *mp,
struct xfs_dqblk *dqb, struct xfs_dqblk *dqb,
xfs_dqid_t id, xfs_dqid_t id) /* used only during quotacheck */
uint type) /* used only during quotacheck */
{ {
if (xfs_sb_version_hascrc(&mp->m_sb) && if (xfs_sb_version_hascrc(&mp->m_sb) &&
!uuid_equal(&dqb->dd_uuid, &mp->m_sb.sb_meta_uuid)) !uuid_equal(&dqb->dd_uuid, &mp->m_sb.sb_meta_uuid))
return __this_address; 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( ...@@ -205,7 +201,7 @@ xfs_dquot_buf_verify(
if (i == 0) if (i == 0)
id = be32_to_cpu(ddq->d_id); 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 (fa) {
if (!readahead) if (!readahead)
xfs_buf_verifier_error(bp, -EFSCORRUPTED, xfs_buf_verifier_error(bp, -EFSCORRUPTED,
......
...@@ -137,9 +137,9 @@ typedef uint16_t xfs_qwarncnt_t; ...@@ -137,9 +137,9 @@ typedef uint16_t xfs_qwarncnt_t;
#define XFS_QMOPT_RESBLK_MASK (XFS_QMOPT_RES_REGBLKS | XFS_QMOPT_RES_RTBLKS) #define XFS_QMOPT_RESBLK_MASK (XFS_QMOPT_RES_REGBLKS | XFS_QMOPT_RES_RTBLKS)
extern xfs_failaddr_t xfs_dquot_verify(struct xfs_mount *mp, 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, 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 int xfs_calc_dquots_per_chunk(unsigned int nbblks);
extern void xfs_dqblk_repair(struct xfs_mount *mp, struct xfs_dqblk *dqb, extern void xfs_dqblk_repair(struct xfs_mount *mp, struct xfs_dqblk *dqb,
xfs_dqid_t id, uint type); xfs_dqid_t id, uint type);
......
...@@ -493,8 +493,7 @@ xlog_recover_do_reg_buffer( ...@@ -493,8 +493,7 @@ xlog_recover_do_reg_buffer(
item->ri_buf[i].i_len, __func__); item->ri_buf[i].i_len, __func__);
goto next; goto next;
} }
fa = xfs_dquot_verify(mp, item->ri_buf[i].i_addr, fa = xfs_dquot_verify(mp, item->ri_buf[i].i_addr, -1);
-1, 0);
if (fa) { if (fa) {
xfs_alert(mp, xfs_alert(mp,
"dquot corrupt at %pS trying to replay into block 0x%llx", "dquot corrupt at %pS trying to replay into block 0x%llx",
......
...@@ -108,7 +108,7 @@ xlog_recover_dquot_commit_pass2( ...@@ -108,7 +108,7 @@ xlog_recover_dquot_commit_pass2(
*/ */
dq_f = item->ri_buf[0].i_addr; dq_f = item->ri_buf[0].i_addr;
ASSERT(dq_f); 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) { if (fa) {
xfs_alert(mp, "corrupt dquot ID 0x%x in log at %pS", xfs_alert(mp, "corrupt dquot ID 0x%x in log at %pS",
dq_f->qlf_id, fa); dq_f->qlf_id, fa);
......
...@@ -830,7 +830,6 @@ xfs_qm_reset_dqcounts( ...@@ -830,7 +830,6 @@ xfs_qm_reset_dqcounts(
{ {
struct xfs_dqblk *dqb; struct xfs_dqblk *dqb;
int j; int j;
xfs_failaddr_t fa;
trace_xfs_reset_dqcounts(bp, _RET_IP_); trace_xfs_reset_dqcounts(bp, _RET_IP_);
...@@ -855,8 +854,8 @@ xfs_qm_reset_dqcounts( ...@@ -855,8 +854,8 @@ xfs_qm_reset_dqcounts(
* find uninitialised dquot blks. See comment in * find uninitialised dquot blks. See comment in
* xfs_dquot_verify. * xfs_dquot_verify.
*/ */
fa = xfs_dqblk_verify(mp, &dqb[j], id + j, type); if (xfs_dqblk_verify(mp, &dqb[j], id + j) ||
if (fa) (dqb[j].dd_diskdq.d_flags & XFS_DQ_ALLTYPES) != type)
xfs_dqblk_repair(mp, &dqb[j], id + j, type); xfs_dqblk_repair(mp, &dqb[j], id + j, type);
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment