Skip to content

Commit 0b04dd5

Browse files
committed
xfs: always use xfs_dquot_type when extracting type from a dquot
Always use the xfs_dquot_type helper to extract the quota type from an incore dquot. This moves responsibility for filtering internal state information and whatnot to anybody passing around a struct xfs_dquot. Signed-off-by: Darrick J. Wong <[email protected]> Reviewed-by: Dave Chinner <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]>
1 parent e6eb603 commit 0b04dd5

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

fs/xfs/xfs_dquot.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -273,14 +273,15 @@ xfs_dquot_disk_alloc(
273273
struct xfs_trans *tp = *tpp;
274274
struct xfs_mount *mp = tp->t_mountp;
275275
struct xfs_buf *bp;
276-
struct xfs_inode *quotip = xfs_quota_inode(mp, dqp->dq_flags);
276+
uint qtype = xfs_dquot_type(dqp);
277+
struct xfs_inode *quotip = xfs_quota_inode(mp, qtype);
277278
int nmaps = 1;
278279
int error;
279280

280281
trace_xfs_dqalloc(dqp);
281282

282283
xfs_ilock(quotip, XFS_ILOCK_EXCL);
283-
if (!xfs_this_quota_on(dqp->q_mount, dqp->dq_flags)) {
284+
if (!xfs_this_quota_on(dqp->q_mount, qtype)) {
284285
/*
285286
* Return if this type of quotas is turned off while we didn't
286287
* have an inode lock
@@ -317,8 +318,7 @@ xfs_dquot_disk_alloc(
317318
* Make a chunk of dquots out of this buffer and log
318319
* the entire thing.
319320
*/
320-
xfs_qm_init_dquot_blk(tp, mp, dqp->q_id,
321-
dqp->dq_flags & XFS_DQTYPE_REC_MASK, bp);
321+
xfs_qm_init_dquot_blk(tp, mp, dqp->q_id, qtype, bp);
322322
xfs_buf_set_ref(bp, XFS_DQUOT_REF);
323323

324324
/*
@@ -365,13 +365,14 @@ xfs_dquot_disk_read(
365365
{
366366
struct xfs_bmbt_irec map;
367367
struct xfs_buf *bp;
368-
struct xfs_inode *quotip = xfs_quota_inode(mp, dqp->dq_flags);
368+
uint qtype = xfs_dquot_type(dqp);
369+
struct xfs_inode *quotip = xfs_quota_inode(mp, qtype);
369370
uint lock_mode;
370371
int nmaps = 1;
371372
int error;
372373

373374
lock_mode = xfs_ilock_data_map_shared(quotip);
374-
if (!xfs_this_quota_on(mp, dqp->dq_flags)) {
375+
if (!xfs_this_quota_on(mp, qtype)) {
375376
/*
376377
* Return if this type of quotas is turned off while we
377378
* didn't have the quota inode lock.
@@ -487,7 +488,7 @@ xfs_dquot_from_disk(
487488
* Ensure that we got the type and ID we were looking for.
488489
* Everything else was checked by the dquot buffer verifier.
489490
*/
490-
if ((ddqp->d_flags & XFS_DQTYPE_REC_MASK) != dqp->dq_flags ||
491+
if ((ddqp->d_flags & XFS_DQTYPE_REC_MASK) != xfs_dquot_type(dqp) ||
491492
be32_to_cpu(ddqp->d_id) != dqp->q_id) {
492493
xfs_alert_tag(bp->b_mount, XFS_PTAG_VERIFIER_ERROR,
493494
"Metadata corruption detected at %pS, quota %u",

fs/xfs/xfs_dquot.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ static inline bool
167167
xfs_dquot_is_enforced(
168168
const struct xfs_dquot *dqp)
169169
{
170-
switch (dqp->dq_flags & XFS_DQTYPE_REC_MASK) {
170+
switch (xfs_dquot_type(dqp)) {
171171
case XFS_DQTYPE_USER:
172172
return XFS_IS_UQUOTA_ENFORCED(dqp->q_mount);
173173
case XFS_DQTYPE_GROUP:

0 commit comments

Comments
 (0)