Commit 1a7ed271 authored by Darrick J. Wong's avatar Darrick J. Wong
Browse files

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: 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 74ddd6b3
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -109,7 +109,7 @@ xfs_dqblk_repair(
	struct xfs_mount	*mp,
	struct xfs_dqblk	*dqb,
	xfs_dqid_t		id,
	uint			type)
	xfs_dqtype_t		type)
{
	/*
	 * Typically, a repair is only requested by quotacheck.
+9 −0
Original line number Diff line number Diff line
@@ -1149,6 +1149,15 @@ static inline void xfs_dinode_put_rdev(struct xfs_dinode *dip, xfs_dev_t rdev)
#define XFS_DQUOT_MAGIC		0x4451		/* 'DQ' */
#define XFS_DQUOT_VERSION	(uint8_t)0x01	/* latest version number */

#define XFS_DQTYPE_USER		0x01		/* user dquot record */
#define XFS_DQTYPE_PROJ		0x02		/* project dquot record */
#define XFS_DQTYPE_GROUP	0x04		/* group dquot record */

/* bitmask to determine if this is a user/group/project dquot */
#define XFS_DQTYPE_REC_MASK	(XFS_DQTYPE_USER | \
				 XFS_DQTYPE_PROJ | \
				 XFS_DQTYPE_GROUP)

/*
 * This is the main portion of the on-disk representation of quota information
 * for a user.  We pad this with some more expansion room to construct the on
+10 −13
Original line number Diff line number Diff line
@@ -18,23 +18,20 @@
typedef uint64_t	xfs_qcnt_t;
typedef uint16_t	xfs_qwarncnt_t;

typedef uint8_t		xfs_dqtype_t;

#define XFS_DQTYPE_STRINGS \
	{ XFS_DQTYPE_USER,	"USER" }, \
	{ XFS_DQTYPE_PROJ,	"PROJ" }, \
	{ XFS_DQTYPE_GROUP,	"GROUP" }

/*
 * flags for q_flags field in the dquot.
 */
#define XFS_DQTYPE_USER		0x0001		/* a user quota */
#define XFS_DQTYPE_PROJ		0x0002		/* project quota */
#define XFS_DQTYPE_GROUP	0x0004		/* a group quota */
#define XFS_DQFLAG_DIRTY	0x0008		/* dquot is dirty */
#define XFS_DQFLAG_FREEING	0x0010		/* dquot is being torn down */

#define XFS_DQTYPE_REC_MASK	(XFS_DQTYPE_USER | \
				 XFS_DQTYPE_PROJ | \
				 XFS_DQTYPE_GROUP)
#define XFS_DQFLAG_DIRTY	(1 << 0)	/* dquot is dirty */
#define XFS_DQFLAG_FREEING	(1 << 1)	/* dquot is being torn down */

#define XFS_DQFLAG_STRINGS \
	{ XFS_DQTYPE_USER,	"USER" }, \
	{ XFS_DQTYPE_PROJ,	"PROJ" }, \
	{ XFS_DQTYPE_GROUP,	"GROUP" }, \
	{ XFS_DQFLAG_DIRTY,	"DIRTY" }, \
	{ XFS_DQFLAG_FREEING,	"FREEING" }

@@ -144,6 +141,6 @@ extern xfs_failaddr_t xfs_dqblk_verify(struct xfs_mount *mp,
		struct xfs_dqblk *dqb, xfs_dqid_t id);
extern int xfs_calc_dquots_per_chunk(unsigned int nbblks);
extern void xfs_dqblk_repair(struct xfs_mount *mp, struct xfs_dqblk *dqb,
		xfs_dqid_t id, uint type);
		xfs_dqid_t id, xfs_dqtype_t type);

#endif	/* __XFS_QUOTA_H__ */
+4 −4
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@
#include "scrub/common.h"

/* Convert a scrub type code to a DQ flag, or return 0 if error. */
static inline uint
static inline xfs_dqtype_t
xchk_quota_to_dqtype(
	struct xfs_scrub	*sc)
{
@@ -40,7 +40,7 @@ xchk_setup_quota(
	struct xfs_scrub	*sc,
	struct xfs_inode	*ip)
{
	uint			dqtype;
	xfs_dqtype_t		dqtype;
	int			error;

	if (!XFS_IS_QUOTA_RUNNING(sc->mp) || !XFS_IS_QUOTA_ON(sc->mp))
@@ -73,7 +73,7 @@ struct xchk_quota_info {
STATIC int
xchk_quota_item(
	struct xfs_dquot	*dq,
	uint			dqtype,
	xfs_dqtype_t		dqtype,
	void			*priv)
{
	struct xchk_quota_info	*sqi = priv;
@@ -214,7 +214,7 @@ xchk_quota(
	struct xchk_quota_info	sqi;
	struct xfs_mount	*mp = sc->mp;
	struct xfs_quotainfo	*qi = mp->m_quotainfo;
	uint			dqtype;
	xfs_dqtype_t		dqtype;
	int			error = 0;

	dqtype = xchk_quota_to_dqtype(sc);
+2 −2
Original line number Diff line number Diff line
@@ -899,11 +899,11 @@ xrep_find_ag_btree_roots(
void
xrep_force_quotacheck(
	struct xfs_scrub	*sc,
	uint			dqtype)
	xfs_dqtype_t		type)
{
	uint			flag;

	flag = xfs_quota_chkd_flag(dqtype);
	flag = xfs_quota_chkd_flag(type);
	if (!(flag & sc->mp->m_qflags))
		return;

Loading