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

xfs: refactor quota type testing

Certain functions can only act upon one quota type, so refactor those
functions to use switch statements, in keeping with all the other high
level xfs quota api calls.
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 00a342e4
...@@ -171,6 +171,24 @@ xfs_qm_init_dquot_blk( ...@@ -171,6 +171,24 @@ xfs_qm_init_dquot_blk(
ASSERT(tp); ASSERT(tp);
ASSERT(xfs_buf_islocked(bp)); ASSERT(xfs_buf_islocked(bp));
switch (type) {
case XFS_DQTYPE_USER:
qflag = XFS_UQUOTA_CHKD;
blftype = XFS_BLF_UDQUOT_BUF;
break;
case XFS_DQTYPE_PROJ:
qflag = XFS_PQUOTA_CHKD;
blftype = XFS_BLF_PDQUOT_BUF;
break;
case XFS_DQTYPE_GROUP:
qflag = XFS_GQUOTA_CHKD;
blftype = XFS_BLF_GDQUOT_BUF;
break;
default:
ASSERT(0);
return;
}
d = bp->b_addr; d = bp->b_addr;
/* /*
...@@ -190,17 +208,6 @@ xfs_qm_init_dquot_blk( ...@@ -190,17 +208,6 @@ xfs_qm_init_dquot_blk(
} }
} }
if (type & XFS_DQTYPE_USER) {
qflag = XFS_UQUOTA_CHKD;
blftype = XFS_BLF_UDQUOT_BUF;
} else if (type & XFS_DQTYPE_PROJ) {
qflag = XFS_PQUOTA_CHKD;
blftype = XFS_BLF_PDQUOT_BUF;
} else {
qflag = XFS_GQUOTA_CHKD;
blftype = XFS_BLF_GDQUOT_BUF;
}
xfs_trans_dquot_buf(tp, bp, blftype); xfs_trans_dquot_buf(tp, bp, blftype);
/* /*
......
...@@ -556,14 +556,21 @@ xfs_quota_warn( ...@@ -556,14 +556,21 @@ xfs_quota_warn(
struct xfs_dquot *dqp, struct xfs_dquot *dqp,
int type) int type)
{ {
enum quota_type qtype; enum quota_type qtype;
if (dqp->dq_flags & XFS_DQTYPE_PROJ) switch (xfs_dquot_type(dqp)) {
case XFS_DQTYPE_PROJ:
qtype = PRJQUOTA; qtype = PRJQUOTA;
else if (dqp->dq_flags & XFS_DQTYPE_USER) break;
case XFS_DQTYPE_USER:
qtype = USRQUOTA; qtype = USRQUOTA;
else break;
case XFS_DQTYPE_GROUP:
qtype = GRPQUOTA; qtype = GRPQUOTA;
break;
default:
return;
}
quota_send_warning(make_kqid(&init_user_ns, qtype, dqp->q_id), quota_send_warning(make_kqid(&init_user_ns, qtype, dqp->q_id),
mp->m_super->s_dev, type); mp->m_super->s_dev, 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