Skip to content

Commit 00a342e

Browse files
committed
xfs: remove the XFS_QM_IS[UGP]DQ macros
Remove these macros and use xfs_dquot_type() for everything. Signed-off-by: Darrick J. Wong <[email protected]> Reviewed-by: Dave Chinner <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]>
1 parent dbcbc7b commit 00a342e

File tree

3 files changed

+16
-19
lines changed

3 files changed

+16
-19
lines changed

fs/xfs/xfs_dquot.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,12 @@ static inline void xfs_dqunlock(struct xfs_dquot *dqp)
128128
mutex_unlock(&dqp->q_qlock);
129129
}
130130

131+
static inline int
132+
xfs_dquot_type(const struct xfs_dquot *dqp)
133+
{
134+
return dqp->dq_flags & XFS_DQTYPE_REC_MASK;
135+
}
136+
131137
static inline int xfs_this_quota_on(struct xfs_mount *mp, int type)
132138
{
133139
switch (type & XFS_DQTYPE_REC_MASK) {
@@ -192,9 +198,6 @@ void xfs_dquot_to_disk(struct xfs_disk_dquot *ddqp, struct xfs_dquot *dqp);
192198

193199
#define XFS_DQ_IS_LOCKED(dqp) (mutex_is_locked(&((dqp)->q_qlock)))
194200
#define XFS_DQ_IS_DIRTY(dqp) ((dqp)->q_flags & XFS_DQFLAG_DIRTY)
195-
#define XFS_QM_ISUDQ(dqp) ((dqp)->dq_flags & XFS_DQTYPE_USER)
196-
#define XFS_QM_ISPDQ(dqp) ((dqp)->dq_flags & XFS_DQTYPE_PROJ)
197-
#define XFS_QM_ISGDQ(dqp) ((dqp)->dq_flags & XFS_DQTYPE_GROUP)
198201

199202
void xfs_qm_dqdestroy(struct xfs_dquot *dqp);
200203
int xfs_qm_dqflush(struct xfs_dquot *dqp, struct xfs_buf **bpp);

fs/xfs/xfs_qm.h

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -101,17 +101,6 @@ xfs_quota_inode(xfs_mount_t *mp, uint dq_flags)
101101
return NULL;
102102
}
103103

104-
static inline int
105-
xfs_dquot_type(struct xfs_dquot *dqp)
106-
{
107-
if (XFS_QM_ISUDQ(dqp))
108-
return XFS_DQTYPE_USER;
109-
if (XFS_QM_ISGDQ(dqp))
110-
return XFS_DQTYPE_GROUP;
111-
ASSERT(XFS_QM_ISPDQ(dqp));
112-
return XFS_DQTYPE_PROJ;
113-
}
114-
115104
extern void xfs_trans_mod_dquot(struct xfs_trans *tp, struct xfs_dquot *dqp,
116105
uint field, int64_t delta);
117106
extern void xfs_trans_dqjoin(struct xfs_trans *, struct xfs_dquot *);

fs/xfs/xfs_trans_dquot.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -156,14 +156,19 @@ xfs_trans_get_dqtrx(
156156
int i;
157157
struct xfs_dqtrx *qa;
158158

159-
if (XFS_QM_ISUDQ(dqp))
159+
switch (xfs_dquot_type(dqp)) {
160+
case XFS_DQTYPE_USER:
160161
qa = tp->t_dqinfo->dqs[XFS_QM_TRANS_USR];
161-
else if (XFS_QM_ISGDQ(dqp))
162+
break;
163+
case XFS_DQTYPE_GROUP:
162164
qa = tp->t_dqinfo->dqs[XFS_QM_TRANS_GRP];
163-
else if (XFS_QM_ISPDQ(dqp))
165+
break;
166+
case XFS_DQTYPE_PROJ:
164167
qa = tp->t_dqinfo->dqs[XFS_QM_TRANS_PRJ];
165-
else
168+
break;
169+
default:
166170
return NULL;
171+
}
167172

168173
for (i = 0; i < XFS_QM_TRANS_MAXDQS; i++) {
169174
if (qa[i].qt_dquot == NULL ||
@@ -713,7 +718,7 @@ xfs_trans_dqresv(
713718

714719
error_return:
715720
xfs_dqunlock(dqp);
716-
if (XFS_QM_ISPDQ(dqp))
721+
if (xfs_dquot_type(dqp) == XFS_DQTYPE_PROJ)
717722
return -ENOSPC;
718723
return -EDQUOT;
719724
}

0 commit comments

Comments
 (0)