aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/fs/xfs/xfs_dquot.h
diff options
context:
space:
mode:
authorDarrick J. Wong <darrick.wong@oracle.com>2020-07-15 17:53:43 -0700
committerDarrick J. Wong <darrick.wong@oracle.com>2020-07-28 20:24:14 -0700
commit1a7ed271653a4f418a6398465f861ee795d34468 (patch)
tree595141cdbc3cda946dbdbdd0a025356092d21d20 /fs/xfs/xfs_dquot.h
parentxfs: replace a few open-coded XFS_DQTYPE_REC_MASK uses (diff)
downloadwireguard-linux-1a7ed271653a4f418a6398465f861ee795d34468.tar.xz
wireguard-linux-1a7ed271653a4f418a6398465f861ee795d34468.zip
xfs: create xfs_dqtype_t to represent quota types
Create a new type (xfs_dqtype_t) to represent the type of an incore dquot (user, group, project, or none). Rename the incore dquot's dq_flags field to q_type. This allows us to replace all the "uint type" arguments to the quota functions with "xfs_dqtype_t type", to make it obvious when we're passing a quota type argument into a function. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'fs/xfs/xfs_dquot.h')
-rw-r--r--fs/xfs/xfs_dquot.h33
1 files changed, 17 insertions, 16 deletions
diff --git a/fs/xfs/xfs_dquot.h b/fs/xfs/xfs_dquot.h
index 81ba614439bd..282a65da93c7 100644
--- a/fs/xfs/xfs_dquot.h
+++ b/fs/xfs/xfs_dquot.h
@@ -60,7 +60,7 @@ struct xfs_dquot_res {
struct xfs_dquot {
struct list_head q_lru;
struct xfs_mount *q_mount;
- uint8_t dq_flags;
+ xfs_dqtype_t q_type;
uint16_t q_flags;
xfs_dqid_t q_id;
uint q_nrefs;
@@ -131,10 +131,10 @@ static inline void xfs_dqunlock(struct xfs_dquot *dqp)
static inline int
xfs_dquot_type(const struct xfs_dquot *dqp)
{
- return dqp->dq_flags & XFS_DQTYPE_REC_MASK;
+ return dqp->q_type & XFS_DQTYPE_REC_MASK;
}
-static inline int xfs_this_quota_on(struct xfs_mount *mp, int type)
+static inline int xfs_this_quota_on(struct xfs_mount *mp, xfs_dqtype_t type)
{
switch (type) {
case XFS_DQTYPE_USER:
@@ -148,7 +148,9 @@ static inline int xfs_this_quota_on(struct xfs_mount *mp, int type)
}
}
-static inline struct xfs_dquot *xfs_inode_dquot(struct xfs_inode *ip, int type)
+static inline struct xfs_dquot *xfs_inode_dquot(
+ struct xfs_inode *ip,
+ xfs_dqtype_t type)
{
switch (type) {
case XFS_DQTYPE_USER:
@@ -205,18 +207,17 @@ void xfs_qm_dqunpin_wait(struct xfs_dquot *dqp);
void xfs_qm_adjust_dqtimers(struct xfs_dquot *d);
void xfs_qm_adjust_dqlimits(struct xfs_dquot *d);
xfs_dqid_t xfs_qm_id_for_quotatype(struct xfs_inode *ip,
- uint type);
+ xfs_dqtype_t type);
int xfs_qm_dqget(struct xfs_mount *mp, xfs_dqid_t id,
- uint type, bool can_alloc,
- struct xfs_dquot **dqpp);
-int xfs_qm_dqget_inode(struct xfs_inode *ip, uint type,
- bool can_alloc,
- struct xfs_dquot **dqpp);
+ xfs_dqtype_t type, bool can_alloc,
+ struct xfs_dquot **dqpp);
+int xfs_qm_dqget_inode(struct xfs_inode *ip, xfs_dqtype_t type,
+ bool can_alloc, struct xfs_dquot **dqpp);
int xfs_qm_dqget_next(struct xfs_mount *mp, xfs_dqid_t id,
- uint type, struct xfs_dquot **dqpp);
+ xfs_dqtype_t type, struct xfs_dquot **dqpp);
int xfs_qm_dqget_uncached(struct xfs_mount *mp,
- xfs_dqid_t id, uint type,
- struct xfs_dquot **dqpp);
+ xfs_dqid_t id, xfs_dqtype_t type,
+ struct xfs_dquot **dqpp);
void xfs_qm_dqput(struct xfs_dquot *dqp);
void xfs_dqlock2(struct xfs_dquot *, struct xfs_dquot *);
@@ -231,9 +232,9 @@ static inline struct xfs_dquot *xfs_qm_dqhold(struct xfs_dquot *dqp)
return dqp;
}
-typedef int (*xfs_qm_dqiterate_fn)(struct xfs_dquot *dq, uint dqtype,
- void *priv);
-int xfs_qm_dqiterate(struct xfs_mount *mp, uint dqtype,
+typedef int (*xfs_qm_dqiterate_fn)(struct xfs_dquot *dq,
+ xfs_dqtype_t type, void *priv);
+int xfs_qm_dqiterate(struct xfs_mount *mp, xfs_dqtype_t type,
xfs_qm_dqiterate_fn iter_fn, void *priv);
#endif /* __XFS_DQUOT_H__ */