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

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
...@@ -109,7 +109,7 @@ xfs_dqblk_repair( ...@@ -109,7 +109,7 @@ xfs_dqblk_repair(
struct xfs_mount *mp, struct xfs_mount *mp,
struct xfs_dqblk *dqb, struct xfs_dqblk *dqb,
xfs_dqid_t id, xfs_dqid_t id,
uint type) xfs_dqtype_t type)
{ {
/* /*
* Typically, a repair is only requested by quotacheck. * Typically, a repair is only requested by quotacheck.
......
...@@ -1149,6 +1149,15 @@ static inline void xfs_dinode_put_rdev(struct xfs_dinode *dip, xfs_dev_t rdev) ...@@ -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_MAGIC 0x4451 /* 'DQ' */
#define XFS_DQUOT_VERSION (uint8_t)0x01 /* latest version number */ #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 * 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 * for a user. We pad this with some more expansion room to construct the on
......
...@@ -18,23 +18,20 @@ ...@@ -18,23 +18,20 @@
typedef uint64_t xfs_qcnt_t; typedef uint64_t xfs_qcnt_t;
typedef uint16_t xfs_qwarncnt_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. * flags for q_flags field in the dquot.
*/ */
#define XFS_DQTYPE_USER 0x0001 /* a user quota */ #define XFS_DQFLAG_DIRTY (1 << 0) /* dquot is dirty */
#define XFS_DQTYPE_PROJ 0x0002 /* project quota */ #define XFS_DQFLAG_FREEING (1 << 1) /* dquot is being torn down */
#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_STRINGS \ #define XFS_DQFLAG_STRINGS \
{ XFS_DQTYPE_USER, "USER" }, \
{ XFS_DQTYPE_PROJ, "PROJ" }, \
{ XFS_DQTYPE_GROUP, "GROUP" }, \
{ XFS_DQFLAG_DIRTY, "DIRTY" }, \ { XFS_DQFLAG_DIRTY, "DIRTY" }, \
{ XFS_DQFLAG_FREEING, "FREEING" } { XFS_DQFLAG_FREEING, "FREEING" }
...@@ -144,6 +141,6 @@ extern xfs_failaddr_t xfs_dqblk_verify(struct xfs_mount *mp, ...@@ -144,6 +141,6 @@ extern xfs_failaddr_t xfs_dqblk_verify(struct xfs_mount *mp,
struct xfs_dqblk *dqb, xfs_dqid_t id); struct xfs_dqblk *dqb, xfs_dqid_t id);
extern int xfs_calc_dquots_per_chunk(unsigned int nbblks); extern int xfs_calc_dquots_per_chunk(unsigned int nbblks);
extern void xfs_dqblk_repair(struct xfs_mount *mp, struct xfs_dqblk *dqb, 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__ */ #endif /* __XFS_QUOTA_H__ */
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
#include "scrub/common.h" #include "scrub/common.h"
/* Convert a scrub type code to a DQ flag, or return 0 if error. */ /* 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( xchk_quota_to_dqtype(
struct xfs_scrub *sc) struct xfs_scrub *sc)
{ {
...@@ -40,7 +40,7 @@ xchk_setup_quota( ...@@ -40,7 +40,7 @@ xchk_setup_quota(
struct xfs_scrub *sc, struct xfs_scrub *sc,
struct xfs_inode *ip) struct xfs_inode *ip)
{ {
uint dqtype; xfs_dqtype_t dqtype;
int error; int error;
if (!XFS_IS_QUOTA_RUNNING(sc->mp) || !XFS_IS_QUOTA_ON(sc->mp)) if (!XFS_IS_QUOTA_RUNNING(sc->mp) || !XFS_IS_QUOTA_ON(sc->mp))
...@@ -73,7 +73,7 @@ struct xchk_quota_info { ...@@ -73,7 +73,7 @@ struct xchk_quota_info {
STATIC int STATIC int
xchk_quota_item( xchk_quota_item(
struct xfs_dquot *dq, struct xfs_dquot *dq,
uint dqtype, xfs_dqtype_t dqtype,
void *priv) void *priv)
{ {
struct xchk_quota_info *sqi = priv; struct xchk_quota_info *sqi = priv;
...@@ -214,7 +214,7 @@ xchk_quota( ...@@ -214,7 +214,7 @@ xchk_quota(
struct xchk_quota_info sqi; struct xchk_quota_info sqi;
struct xfs_mount *mp = sc->mp; struct xfs_mount *mp = sc->mp;
struct xfs_quotainfo *qi = mp->m_quotainfo; struct xfs_quotainfo *qi = mp->m_quotainfo;
uint dqtype; xfs_dqtype_t dqtype;
int error = 0; int error = 0;
dqtype = xchk_quota_to_dqtype(sc); dqtype = xchk_quota_to_dqtype(sc);
......
...@@ -899,11 +899,11 @@ xrep_find_ag_btree_roots( ...@@ -899,11 +899,11 @@ xrep_find_ag_btree_roots(
void void
xrep_force_quotacheck( xrep_force_quotacheck(
struct xfs_scrub *sc, struct xfs_scrub *sc,
uint dqtype) xfs_dqtype_t type)
{ {
uint flag; uint flag;
flag = xfs_quota_chkd_flag(dqtype); flag = xfs_quota_chkd_flag(type);
if (!(flag & sc->mp->m_qflags)) if (!(flag & sc->mp->m_qflags))
return; return;
......
...@@ -6,6 +6,8 @@ ...@@ -6,6 +6,8 @@
#ifndef __XFS_SCRUB_REPAIR_H__ #ifndef __XFS_SCRUB_REPAIR_H__
#define __XFS_SCRUB_REPAIR_H__ #define __XFS_SCRUB_REPAIR_H__
#include "xfs_quota_defs.h"
static inline int xrep_notsupported(struct xfs_scrub *sc) static inline int xrep_notsupported(struct xfs_scrub *sc)
{ {
return -EOPNOTSUPP; return -EOPNOTSUPP;
...@@ -49,7 +51,7 @@ struct xrep_find_ag_btree { ...@@ -49,7 +51,7 @@ struct xrep_find_ag_btree {
int xrep_find_ag_btree_roots(struct xfs_scrub *sc, struct xfs_buf *agf_bp, int xrep_find_ag_btree_roots(struct xfs_scrub *sc, struct xfs_buf *agf_bp,
struct xrep_find_ag_btree *btree_info, struct xfs_buf *agfl_bp); struct xrep_find_ag_btree *btree_info, struct xfs_buf *agfl_bp);
void xrep_force_quotacheck(struct xfs_scrub *sc, uint dqtype); void xrep_force_quotacheck(struct xfs_scrub *sc, xfs_dqtype_t type);
int xrep_ino_dqattach(struct xfs_scrub *sc); int xrep_ino_dqattach(struct xfs_scrub *sc);
/* Metadata repairers */ /* Metadata repairers */
......
...@@ -158,7 +158,7 @@ xfs_qm_init_dquot_blk( ...@@ -158,7 +158,7 @@ xfs_qm_init_dquot_blk(
struct xfs_trans *tp, struct xfs_trans *tp,
struct xfs_mount *mp, struct xfs_mount *mp,
xfs_dqid_t id, xfs_dqid_t id,
uint type, xfs_dqtype_t type,
struct xfs_buf *bp) struct xfs_buf *bp)
{ {
struct xfs_quotainfo *q = mp->m_quotainfo; struct xfs_quotainfo *q = mp->m_quotainfo;
...@@ -273,7 +273,7 @@ xfs_dquot_disk_alloc( ...@@ -273,7 +273,7 @@ xfs_dquot_disk_alloc(
struct xfs_trans *tp = *tpp; struct xfs_trans *tp = *tpp;
struct xfs_mount *mp = tp->t_mountp; struct xfs_mount *mp = tp->t_mountp;
struct xfs_buf *bp; struct xfs_buf *bp;
uint qtype = xfs_dquot_type(dqp); xfs_dqtype_t qtype = xfs_dquot_type(dqp);
struct xfs_inode *quotip = xfs_quota_inode(mp, qtype); struct xfs_inode *quotip = xfs_quota_inode(mp, qtype);
int nmaps = 1; int nmaps = 1;
int error; int error;
...@@ -365,7 +365,7 @@ xfs_dquot_disk_read( ...@@ -365,7 +365,7 @@ xfs_dquot_disk_read(
{ {
struct xfs_bmbt_irec map; struct xfs_bmbt_irec map;
struct xfs_buf *bp; struct xfs_buf *bp;
uint qtype = xfs_dquot_type(dqp); xfs_dqtype_t qtype = xfs_dquot_type(dqp);
struct xfs_inode *quotip = xfs_quota_inode(mp, qtype); struct xfs_inode *quotip = xfs_quota_inode(mp, qtype);
uint lock_mode; uint lock_mode;
int nmaps = 1; int nmaps = 1;
...@@ -424,13 +424,13 @@ STATIC struct xfs_dquot * ...@@ -424,13 +424,13 @@ STATIC struct xfs_dquot *
xfs_dquot_alloc( xfs_dquot_alloc(
struct xfs_mount *mp, struct xfs_mount *mp,
xfs_dqid_t id, xfs_dqid_t id,
uint type) xfs_dqtype_t type)
{ {
struct xfs_dquot *dqp; struct xfs_dquot *dqp;
dqp = kmem_zone_zalloc(xfs_qm_dqzone, 0); dqp = kmem_zone_zalloc(xfs_qm_dqzone, 0);
dqp->dq_flags = type; dqp->q_type = type;
dqp->q_id = id; dqp->q_id = id;
dqp->q_mount = mp; dqp->q_mount = mp;
INIT_LIST_HEAD(&dqp->q_lru); INIT_LIST_HEAD(&dqp->q_lru);
...@@ -498,6 +498,7 @@ xfs_dquot_from_disk( ...@@ -498,6 +498,7 @@ xfs_dquot_from_disk(
} }
/* copy everything from disk dquot to the incore dquot */ /* copy everything from disk dquot to the incore dquot */
dqp->q_type = ddqp->d_flags;
dqp->q_blk.hardlimit = be64_to_cpu(ddqp->d_blk_hardlimit); dqp->q_blk.hardlimit = be64_to_cpu(ddqp->d_blk_hardlimit);
dqp->q_blk.softlimit = be64_to_cpu(ddqp->d_blk_softlimit); dqp->q_blk.softlimit = be64_to_cpu(ddqp->d_blk_softlimit);
dqp->q_ino.hardlimit = be64_to_cpu(ddqp->d_ino_hardlimit); dqp->q_ino.hardlimit = be64_to_cpu(ddqp->d_ino_hardlimit);
...@@ -538,7 +539,7 @@ xfs_dquot_to_disk( ...@@ -538,7 +539,7 @@ xfs_dquot_to_disk(
{ {
ddqp->d_magic = cpu_to_be16(XFS_DQUOT_MAGIC); ddqp->d_magic = cpu_to_be16(XFS_DQUOT_MAGIC);
ddqp->d_version = XFS_DQUOT_VERSION; ddqp->d_version = XFS_DQUOT_VERSION;
ddqp->d_flags = dqp->dq_flags & XFS_DQTYPE_REC_MASK; ddqp->d_flags = dqp->q_type;
ddqp->d_id = cpu_to_be32(dqp->q_id); ddqp->d_id = cpu_to_be32(dqp->q_id);
ddqp->d_pad0 = 0; ddqp->d_pad0 = 0;
ddqp->d_pad = 0; ddqp->d_pad = 0;
...@@ -609,7 +610,7 @@ static int ...@@ -609,7 +610,7 @@ static int
xfs_qm_dqread( xfs_qm_dqread(
struct xfs_mount *mp, struct xfs_mount *mp,
xfs_dqid_t id, xfs_dqid_t id,
uint type, xfs_dqtype_t type,
bool can_alloc, bool can_alloc,
struct xfs_dquot **dqpp) struct xfs_dquot **dqpp)
{ {
...@@ -657,7 +658,7 @@ xfs_qm_dqread( ...@@ -657,7 +658,7 @@ xfs_qm_dqread(
static int static int
xfs_dq_get_next_id( xfs_dq_get_next_id(
struct xfs_mount *mp, struct xfs_mount *mp,
uint type, xfs_dqtype_t type,
xfs_dqid_t *id) xfs_dqid_t *id)
{ {
struct xfs_inode *quotip = xfs_quota_inode(mp, type); struct xfs_inode *quotip = xfs_quota_inode(mp, type);
...@@ -781,7 +782,7 @@ xfs_qm_dqget_cache_insert( ...@@ -781,7 +782,7 @@ xfs_qm_dqget_cache_insert(
static int static int
xfs_qm_dqget_checks( xfs_qm_dqget_checks(
struct xfs_mount *mp, struct xfs_mount *mp,
uint type) xfs_dqtype_t type)
{ {
if (WARN_ON_ONCE(!XFS_IS_QUOTA_RUNNING(mp))) if (WARN_ON_ONCE(!XFS_IS_QUOTA_RUNNING(mp)))
return -ESRCH; return -ESRCH;
...@@ -813,7 +814,7 @@ int ...@@ -813,7 +814,7 @@ int
xfs_qm_dqget( xfs_qm_dqget(
struct xfs_mount *mp, struct xfs_mount *mp,
xfs_dqid_t id, xfs_dqid_t id,
uint type, xfs_dqtype_t type,
bool can_alloc, bool can_alloc,
struct xfs_dquot **O_dqpp) struct xfs_dquot **O_dqpp)
{ {
...@@ -863,7 +864,7 @@ int ...@@ -863,7 +864,7 @@ int
xfs_qm_dqget_uncached( xfs_qm_dqget_uncached(
struct xfs_mount *mp, struct xfs_mount *mp,
xfs_dqid_t id, xfs_dqid_t id,
uint type, xfs_dqtype_t type,
struct xfs_dquot **dqpp) struct xfs_dquot **dqpp)
{ {
int error; int error;
...@@ -879,7 +880,7 @@ xfs_qm_dqget_uncached( ...@@ -879,7 +880,7 @@ xfs_qm_dqget_uncached(
xfs_dqid_t xfs_dqid_t
xfs_qm_id_for_quotatype( xfs_qm_id_for_quotatype(
struct xfs_inode *ip, struct xfs_inode *ip,
uint type) xfs_dqtype_t type)
{ {
switch (type) { switch (type) {
case XFS_DQTYPE_USER: case XFS_DQTYPE_USER:
...@@ -901,7 +902,7 @@ xfs_qm_id_for_quotatype( ...@@ -901,7 +902,7 @@ xfs_qm_id_for_quotatype(
int int
xfs_qm_dqget_inode( xfs_qm_dqget_inode(
struct xfs_inode *ip, struct xfs_inode *ip,
uint type, xfs_dqtype_t type,
bool can_alloc, bool can_alloc,
struct xfs_dquot **O_dqpp) struct xfs_dquot **O_dqpp)
{ {
...@@ -987,7 +988,7 @@ int ...@@ -987,7 +988,7 @@ int
xfs_qm_dqget_next( xfs_qm_dqget_next(
struct xfs_mount *mp, struct xfs_mount *mp,
xfs_dqid_t id, xfs_dqid_t id,
uint type, xfs_dqtype_t type,
struct xfs_dquot **dqpp) struct xfs_dquot **dqpp)
{ {
struct xfs_dquot *dqp; struct xfs_dquot *dqp;
...@@ -1122,7 +1123,7 @@ static xfs_failaddr_t ...@@ -1122,7 +1123,7 @@ static xfs_failaddr_t
xfs_qm_dqflush_check( xfs_qm_dqflush_check(
struct xfs_dquot *dqp) struct xfs_dquot *dqp)
{ {
__u8 type = dqp->dq_flags & XFS_DQTYPE_REC_MASK; xfs_dqtype_t type = xfs_dquot_type(dqp);
if (type != XFS_DQTYPE_USER && if (type != XFS_DQTYPE_USER &&
type != XFS_DQTYPE_GROUP && type != XFS_DQTYPE_GROUP &&
...@@ -1317,7 +1318,7 @@ xfs_qm_exit(void) ...@@ -1317,7 +1318,7 @@ xfs_qm_exit(void)
int int
xfs_qm_dqiterate( xfs_qm_dqiterate(
struct xfs_mount *mp, struct xfs_mount *mp,
uint dqtype, xfs_dqtype_t type,
xfs_qm_dqiterate_fn iter_fn, xfs_qm_dqiterate_fn iter_fn,
void *priv) void *priv)
{ {
...@@ -1326,13 +1327,13 @@ xfs_qm_dqiterate( ...@@ -1326,13 +1327,13 @@ xfs_qm_dqiterate(
int error; int error;
do { do {
error = xfs_qm_dqget_next(mp, id, dqtype, &dq); error = xfs_qm_dqget_next(mp, id, type, &dq);
if (error == -ENOENT) if (error == -ENOENT)
return 0; return 0;
if (error) if (error)
return error; return error;
error = iter_fn(dq, dqtype, priv); error = iter_fn(dq, type, priv);
id = dq->q_id; id = dq->q_id;
xfs_qm_dqput(dq); xfs_qm_dqput(dq);
} while (error == 0 && id != 0); } while (error == 0 && id != 0);
......
...@@ -60,7 +60,7 @@ struct xfs_dquot_res { ...@@ -60,7 +60,7 @@ struct xfs_dquot_res {
struct xfs_dquot { struct xfs_dquot {
struct list_head q_lru; struct list_head q_lru;
struct xfs_mount *q_mount; struct xfs_mount *q_mount;
uint8_t dq_flags; xfs_dqtype_t q_type;
uint16_t q_flags; uint16_t q_flags;
xfs_dqid_t q_id; xfs_dqid_t q_id;
uint q_nrefs; uint q_nrefs;
...@@ -131,10 +131,10 @@ static inline void xfs_dqunlock(struct xfs_dquot *dqp) ...@@ -131,10 +131,10 @@ static inline void xfs_dqunlock(struct xfs_dquot *dqp)
static inline int static inline int
xfs_dquot_type(const struct xfs_dquot *dqp) 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) { switch (type) {
case XFS_DQTYPE_USER: case XFS_DQTYPE_USER:
...@@ -148,7 +148,9 @@ static inline int xfs_this_quota_on(struct xfs_mount *mp, int type) ...@@ -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) { switch (type) {
case XFS_DQTYPE_USER: case XFS_DQTYPE_USER:
...@@ -205,18 +207,17 @@ void xfs_qm_dqunpin_wait(struct xfs_dquot *dqp); ...@@ -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_dqtimers(struct xfs_dquot *d);
void xfs_qm_adjust_dqlimits(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, 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, int xfs_qm_dqget(struct xfs_mount *mp, xfs_dqid_t id,
uint type, bool can_alloc, xfs_dqtype_t type, bool can_alloc,
struct xfs_dquot **dqpp); struct xfs_dquot **dqpp);
int xfs_qm_dqget_inode(struct xfs_inode *ip, uint type, int xfs_qm_dqget_inode(struct xfs_inode *ip, xfs_dqtype_t type,
bool can_alloc, bool can_alloc, struct xfs_dquot **dqpp);
struct xfs_dquot **dqpp);
int xfs_qm_dqget_next(struct xfs_mount *mp, xfs_dqid_t id, 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, int xfs_qm_dqget_uncached(struct xfs_mount *mp,
xfs_dqid_t id, uint type, xfs_dqid_t id, xfs_dqtype_t type,
struct xfs_dquot **dqpp); struct xfs_dquot **dqpp);
void xfs_qm_dqput(struct xfs_dquot *dqp); void xfs_qm_dqput(struct xfs_dquot *dqp);
void xfs_dqlock2(struct xfs_dquot *, struct xfs_dquot *); 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) ...@@ -231,9 +232,9 @@ static inline struct xfs_dquot *xfs_qm_dqhold(struct xfs_dquot *dqp)
return dqp; return dqp;
} }
typedef int (*xfs_qm_dqiterate_fn)(struct xfs_dquot *dq, uint dqtype, typedef int (*xfs_qm_dqiterate_fn)(struct xfs_dquot *dq,
void *priv); xfs_dqtype_t type, void *priv);
int xfs_qm_dqiterate(struct xfs_mount *mp, uint dqtype, int xfs_qm_dqiterate(struct xfs_mount *mp, xfs_dqtype_t type,
xfs_qm_dqiterate_fn iter_fn, void *priv); xfs_qm_dqiterate_fn iter_fn, void *priv);
#endif /* __XFS_DQUOT_H__ */ #endif /* __XFS_DQUOT_H__ */
...@@ -293,11 +293,11 @@ xfs_iomap_write_direct( ...@@ -293,11 +293,11 @@ xfs_iomap_write_direct(
STATIC bool STATIC bool
xfs_quota_need_throttle( xfs_quota_need_throttle(
struct xfs_inode *ip, struct xfs_inode *ip,
int type, xfs_dqtype_t type,
xfs_fsblock_t alloc_blocks) xfs_fsblock_t alloc_blocks)
{ {
struct xfs_dquot *dq = xfs_inode_dquot(ip, type); struct xfs_dquot *dq = xfs_inode_dquot(ip, type);
if (!dq || !xfs_this_quota_on(ip->i_mount, type)) if (!dq || !xfs_this_quota_on(ip->i_mount, type))
return false; return false;
...@@ -315,15 +315,15 @@ xfs_quota_need_throttle( ...@@ -315,15 +315,15 @@ xfs_quota_need_throttle(
STATIC void STATIC void
xfs_quota_calc_throttle( xfs_quota_calc_throttle(
struct xfs_inode *ip, struct xfs_inode *ip,
int type, xfs_dqtype_t type,
xfs_fsblock_t *qblocks, xfs_fsblock_t *qblocks,
int *qshift, int *qshift,
int64_t *qfreesp) int64_t *qfreesp)
{ {
int64_t freesp; struct xfs_dquot *dq = xfs_inode_dquot(ip, type);
int shift = 0; int64_t freesp;
struct xfs_dquot *dq = xfs_inode_dquot(ip, type); int shift = 0;
/* no dq, or over hi wmark, squash the prealloc completely */ /* no dq, or over hi wmark, squash the prealloc completely */
if (!dq || dq->q_blk.reserved >= dq->q_prealloc_hi_wmark) { if (!dq || dq->q_blk.reserved >= dq->q_prealloc_hi_wmark) {
......
...@@ -47,7 +47,7 @@ STATIC void xfs_qm_dqfree_one(struct xfs_dquot *dqp); ...@@ -47,7 +47,7 @@ STATIC void xfs_qm_dqfree_one(struct xfs_dquot *dqp);
STATIC int STATIC int
xfs_qm_dquot_walk( xfs_qm_dquot_walk(
struct xfs_mount *mp, struct xfs_mount *mp,
int type, xfs_dqtype_t type,
int (*execute)(struct xfs_dquot *dqp, void *data), int (*execute)(struct xfs_dquot *dqp, void *data),
void *data) void *data)
{ {
...@@ -250,7 +250,7 @@ STATIC int ...@@ -250,7 +250,7 @@ STATIC int
xfs_qm_dqattach_one( xfs_qm_dqattach_one(
struct xfs_inode *ip, struct xfs_inode *ip,
xfs_dqid_t id, xfs_dqid_t id,
uint type, xfs_dqtype_t type,
bool doalloc, bool doalloc,
struct xfs_dquot **IO_idqpp) struct xfs_dquot **IO_idqpp)
{ {
...@@ -545,7 +545,7 @@ xfs_qm_shrink_count( ...@@ -545,7 +545,7 @@ xfs_qm_shrink_count(
STATIC void STATIC void
xfs_qm_set_defquota( xfs_qm_set_defquota(
struct xfs_mount *mp, struct xfs_mount *mp,
uint type, xfs_dqtype_t type,
struct xfs_quotainfo *qinf) struct xfs_quotainfo *qinf)
{ {
struct xfs_dquot *dqp; struct xfs_dquot *dqp;
...@@ -575,7 +575,7 @@ xfs_qm_set_defquota( ...@@ -575,7 +575,7 @@ xfs_qm_set_defquota(
static void static void
xfs_qm_init_timelimits( xfs_qm_init_timelimits(
struct xfs_mount *mp, struct xfs_mount *mp,
uint type) xfs_dqtype_t type)
{ {
struct xfs_quotainfo *qinf = mp->m_quotainfo; struct xfs_quotainfo *qinf = mp->m_quotainfo;
struct xfs_def_quota *defq; struct xfs_def_quota *defq;
...@@ -823,10 +823,10 @@ xfs_qm_qino_alloc( ...@@ -823,10 +823,10 @@ xfs_qm_qino_alloc(
STATIC void STATIC void
xfs_qm_reset_dqcounts( xfs_qm_reset_dqcounts(
xfs_mount_t *mp, struct xfs_mount *mp,
xfs_buf_t *bp, struct xfs_buf *bp,
xfs_dqid_t id, xfs_dqid_t id,
uint type) xfs_dqtype_t type)
{ {
struct xfs_dqblk *dqb; struct xfs_dqblk *dqb;
int j; int j;
...@@ -895,7 +895,7 @@ xfs_qm_reset_dqcounts_all( ...@@ -895,7 +895,7 @@ xfs_qm_reset_dqcounts_all(
xfs_dqid_t firstid, xfs_dqid_t firstid,
xfs_fsblock_t bno, xfs_fsblock_t bno,
xfs_filblks_t blkcnt, xfs_filblks_t blkcnt,
uint type, xfs_dqtype_t type,
struct list_head *buffer_list) struct list_head *buffer_list)
{ {
struct xfs_buf *bp; struct xfs_buf *bp;
...@@ -961,7 +961,7 @@ STATIC int ...@@ -961,7 +961,7 @@ STATIC int
xfs_qm_reset_dqcounts_buf( xfs_qm_reset_dqcounts_buf(
struct xfs_mount *mp, struct xfs_mount *mp,
struct xfs_inode *qip, struct xfs_inode *qip,
uint type, xfs_dqtype_t type,
struct list_head *buffer_list) struct list_head *buffer_list)
{ {
struct xfs_bmbt_irec *map; struct xfs_bmbt_irec *map;
...@@ -1059,7 +1059,7 @@ xfs_qm_reset_dqcounts_buf( ...@@ -1059,7 +1059,7 @@ xfs_qm_reset_dqcounts_buf(
STATIC int STATIC int
xfs_qm_quotacheck_dqadjust( xfs_qm_quotacheck_dqadjust(
struct xfs_inode *ip, struct xfs_inode *ip,
uint type, xfs_dqtype_t type,
xfs_qcnt_t nblks, xfs_qcnt_t nblks,
xfs_qcnt_t rtblks) xfs_qcnt_t rtblks)
{ {
......
...@@ -70,7 +70,7 @@ struct xfs_quotainfo { ...@@ -70,7 +70,7 @@ struct xfs_quotainfo {
static inline struct radix_tree_root * static inline struct radix_tree_root *
xfs_dquot_tree( xfs_dquot_tree(
struct xfs_quotainfo *qi, struct xfs_quotainfo *qi,
int type) xfs_dqtype_t type)
{ {
switch (type) { switch (type) {
case XFS_DQTYPE_USER: case XFS_DQTYPE_USER:
...@@ -86,9 +86,9 @@ xfs_dquot_tree( ...@@ -86,9 +86,9 @@ xfs_dquot_tree(
} }
static inline struct xfs_inode * static inline struct xfs_inode *
xfs_quota_inode(xfs_mount_t *mp, uint dq_flags) xfs_quota_inode(struct xfs_mount *mp, xfs_dqtype_t type)
{ {
switch (dq_flags) { switch (type) {
case XFS_DQTYPE_USER: case XFS_DQTYPE_USER:
return mp->m_quotainfo->qi_uquotaip; return mp->m_quotainfo->qi_uquotaip;
case XFS_DQTYPE_GROUP: case XFS_DQTYPE_GROUP:
...@@ -142,17 +142,23 @@ extern void xfs_qm_dqrele_all_inodes(struct xfs_mount *, uint); ...@@ -142,17 +142,23 @@ extern void xfs_qm_dqrele_all_inodes(struct xfs_mount *, uint);
/* quota ops */ /* quota ops */
extern int xfs_qm_scall_trunc_qfiles(struct xfs_mount *, uint); extern int xfs_qm_scall_trunc_qfiles(struct xfs_mount *, uint);
extern int xfs_qm_scall_getquota(struct xfs_mount *, xfs_dqid_t, extern int xfs_qm_scall_getquota(struct xfs_mount *mp,
uint, struct qc_dqblk *); xfs_dqid_t id,
extern int xfs_qm_scall_getquota_next(struct xfs_mount *, xfs_dqtype_t type,
xfs_dqid_t *, uint, struct qc_dqblk *); struct qc_dqblk *dst);
extern int xfs_qm_scall_setqlim(struct xfs_mount *, xfs_dqid_t, uint, extern int xfs_qm_scall_getquota_next(struct xfs_mount *mp,
struct qc_dqblk *); xfs_dqid_t *id,
xfs_dqtype_t type,
struct qc_dqblk *dst);
extern int xfs_qm_scall_setqlim(struct xfs_mount *mp,
xfs_dqid_t id,
xfs_dqtype_t type,
struct qc_dqblk *newlim);
extern int xfs_qm_scall_quotaon(struct xfs_mount *, uint); extern int xfs_qm_scall_quotaon(struct xfs_mount *, uint);
extern int xfs_qm_scall_quotaoff(struct xfs_mount *, uint); extern int xfs_qm_scall_quotaoff(struct xfs_mount *, uint);
static inline struct xfs_def_quota * static inline struct xfs_def_quota *
xfs_get_defquota(struct xfs_quotainfo *qi, int type) xfs_get_defquota(struct xfs_quotainfo *qi, xfs_dqtype_t type)
{ {
switch (type) { switch (type) {
case XFS_DQTYPE_USER: case XFS_DQTYPE_USER:
......
...@@ -495,7 +495,7 @@ int ...@@ -495,7 +495,7 @@ int
xfs_qm_scall_setqlim( xfs_qm_scall_setqlim(
struct xfs_mount *mp, struct xfs_mount *mp,
xfs_dqid_t id, xfs_dqid_t id,
uint type, xfs_dqtype_t type,
struct qc_dqblk *newlim) struct qc_dqblk *newlim)
{ {
struct xfs_quotainfo *q = mp->m_quotainfo; struct xfs_quotainfo *q = mp->m_quotainfo;
...@@ -634,7 +634,7 @@ xfs_qm_scall_setqlim( ...@@ -634,7 +634,7 @@ xfs_qm_scall_setqlim(
static void static void
xfs_qm_scall_getquota_fill_qc( xfs_qm_scall_getquota_fill_qc(
struct xfs_mount *mp, struct xfs_mount *mp,
uint type, xfs_dqtype_t type,
const struct xfs_dquot *dqp, const struct xfs_dquot *dqp,
struct qc_dqblk *dst) struct qc_dqblk *dst)
{ {
...@@ -685,7 +685,7 @@ int ...@@ -685,7 +685,7 @@ int
xfs_qm_scall_getquota( xfs_qm_scall_getquota(
struct xfs_mount *mp, struct xfs_mount *mp,
xfs_dqid_t id, xfs_dqid_t id,
uint type, xfs_dqtype_t type,
struct qc_dqblk *dst) struct qc_dqblk *dst)
{ {
struct xfs_dquot *dqp; struct xfs_dquot *dqp;
...@@ -723,7 +723,7 @@ int ...@@ -723,7 +723,7 @@ int
xfs_qm_scall_getquota_next( xfs_qm_scall_getquota_next(
struct xfs_mount *mp, struct xfs_mount *mp,
xfs_dqid_t *id, xfs_dqid_t *id,
uint type, xfs_dqtype_t type,
struct qc_dqblk *dst) struct qc_dqblk *dst)
{ {
struct xfs_dquot *dqp; struct xfs_dquot *dqp;
......
...@@ -39,9 +39,9 @@ struct xfs_buf; ...@@ -39,9 +39,9 @@ struct xfs_buf;
static inline uint static inline uint
xfs_quota_chkd_flag( xfs_quota_chkd_flag(
uint dqtype) xfs_dqtype_t type)
{ {
switch (dqtype) { switch (type) {
case XFS_DQTYPE_USER: case XFS_DQTYPE_USER:
return XFS_UQUOTA_CHKD; return XFS_UQUOTA_CHKD;
case XFS_DQTYPE_GROUP: case XFS_DQTYPE_GROUP:
......
...@@ -85,7 +85,7 @@ xfs_fs_get_quota_state( ...@@ -85,7 +85,7 @@ xfs_fs_get_quota_state(
return 0; return 0;
} }
STATIC int STATIC xfs_dqtype_t
xfs_quota_type(int type) xfs_quota_type(int type)
{ {
switch (type) { switch (type) {
......
...@@ -865,6 +865,7 @@ DECLARE_EVENT_CLASS(xfs_dquot_class, ...@@ -865,6 +865,7 @@ DECLARE_EVENT_CLASS(xfs_dquot_class,
TP_STRUCT__entry( TP_STRUCT__entry(
__field(dev_t, dev) __field(dev_t, dev)
__field(u32, id) __field(u32, id)
__field(xfs_dqtype_t, type)
__field(unsigned, flags) __field(unsigned, flags)
__field(unsigned, nrefs) __field(unsigned, nrefs)
__field(unsigned long long, res_bcount) __field(unsigned long long, res_bcount)
...@@ -885,7 +886,8 @@ DECLARE_EVENT_CLASS(xfs_dquot_class, ...@@ -885,7 +886,8 @@ DECLARE_EVENT_CLASS(xfs_dquot_class,
TP_fast_assign( TP_fast_assign(
__entry->dev = dqp->q_mount->m_super->s_dev; __entry->dev = dqp->q_mount->m_super->s_dev;
__entry->id = dqp->q_id; __entry->id = dqp->q_id;
__entry->flags = dqp->dq_flags | dqp->q_flags; __entry->type = dqp->q_type;
__entry->flags = dqp->q_flags;
__entry->nrefs = dqp->q_nrefs; __entry->nrefs = dqp->q_nrefs;
__entry->res_bcount = dqp->q_blk.reserved; __entry->res_bcount = dqp->q_blk.reserved;
...@@ -903,13 +905,14 @@ DECLARE_EVENT_CLASS(xfs_dquot_class, ...@@ -903,13 +905,14 @@ DECLARE_EVENT_CLASS(xfs_dquot_class,
__entry->ino_hardlimit = dqp->q_ino.hardlimit; __entry->ino_hardlimit = dqp->q_ino.hardlimit;
__entry->ino_softlimit = dqp->q_ino.softlimit; __entry->ino_softlimit = dqp->q_ino.softlimit;
), ),
TP_printk("dev %d:%d id 0x%x flags %s nrefs %u " TP_printk("dev %d:%d id 0x%x type %s flags %s nrefs %u "
"res_bc 0x%llx res_rtbc 0x%llx res_ic 0x%llx " "res_bc 0x%llx res_rtbc 0x%llx res_ic 0x%llx "
"bcnt 0x%llx bhardlimit 0x%llx bsoftlimit 0x%llx " "bcnt 0x%llx bhardlimit 0x%llx bsoftlimit 0x%llx "
"rtbcnt 0x%llx rtbhardlimit 0x%llx rtbsoftlimit 0x%llx " "rtbcnt 0x%llx rtbhardlimit 0x%llx rtbsoftlimit 0x%llx "
"icnt 0x%llx ihardlimit 0x%llx isoftlimit 0x%llx]", "icnt 0x%llx ihardlimit 0x%llx isoftlimit 0x%llx]",
MAJOR(__entry->dev), MINOR(__entry->dev), MAJOR(__entry->dev), MINOR(__entry->dev),
__entry->id, __entry->id,
__print_flags(__entry->type, "|", XFS_DQTYPE_STRINGS),
__print_flags(__entry->flags, "|", XFS_DQFLAG_STRINGS), __print_flags(__entry->flags, "|", XFS_DQFLAG_STRINGS),
__entry->nrefs, __entry->nrefs,
__entry->res_bcount, __entry->res_bcount,
...@@ -976,6 +979,7 @@ TRACE_EVENT(xfs_trans_mod_dquot, ...@@ -976,6 +979,7 @@ TRACE_EVENT(xfs_trans_mod_dquot,
TP_ARGS(tp, dqp, field, delta), TP_ARGS(tp, dqp, field, delta),
TP_STRUCT__entry( TP_STRUCT__entry(
__field(dev_t, dev) __field(dev_t, dev)
__field(xfs_dqtype_t, type)
__field(unsigned int, flags) __field(unsigned int, flags)
__field(unsigned int, dqid) __field(unsigned int, dqid)
__field(unsigned int, field) __field(unsigned int, field)
...@@ -983,14 +987,16 @@ TRACE_EVENT(xfs_trans_mod_dquot, ...@@ -983,14 +987,16 @@ TRACE_EVENT(xfs_trans_mod_dquot,
), ),
TP_fast_assign( TP_fast_assign(
__entry->dev = tp->t_mountp->m_super->s_dev; __entry->dev = tp->t_mountp->m_super->s_dev;
__entry->flags = dqp->dq_flags | dqp->q_flags; __entry->type = dqp->q_type;
__entry->flags = dqp->q_flags;
__entry->dqid = dqp->q_id; __entry->dqid = dqp->q_id;
__entry->field = field; __entry->field = field;
__entry->delta = delta; __entry->delta = delta;
), ),
TP_printk("dev %d:%d dquot id 0x%x flags %s field %s delta %lld", TP_printk("dev %d:%d dquot id 0x%x type %s flags %s field %s delta %lld",
MAJOR(__entry->dev), MINOR(__entry->dev), MAJOR(__entry->dev), MINOR(__entry->dev),
__entry->dqid, __entry->dqid,
__print_flags(__entry->type, "|", XFS_DQTYPE_STRINGS),
__print_flags(__entry->flags, "|", XFS_DQFLAG_STRINGS), __print_flags(__entry->flags, "|", XFS_DQFLAG_STRINGS),
__print_flags(__entry->field, "|", XFS_QMOPT_FLAGS), __print_flags(__entry->field, "|", XFS_QMOPT_FLAGS),
__entry->delta) __entry->delta)
...@@ -1001,6 +1007,7 @@ DECLARE_EVENT_CLASS(xfs_dqtrx_class, ...@@ -1001,6 +1007,7 @@ DECLARE_EVENT_CLASS(xfs_dqtrx_class,
TP_ARGS(qtrx), TP_ARGS(qtrx),
TP_STRUCT__entry( TP_STRUCT__entry(
__field(dev_t, dev) __field(dev_t, dev)
__field(xfs_dqtype_t, type)
__field(unsigned int, flags) __field(unsigned int, flags)
__field(u32, dqid) __field(u32, dqid)
...@@ -1019,7 +1026,8 @@ DECLARE_EVENT_CLASS(xfs_dqtrx_class, ...@@ -1019,7 +1026,8 @@ DECLARE_EVENT_CLASS(xfs_dqtrx_class,
), ),
TP_fast_assign( TP_fast_assign(
__entry->dev = qtrx->qt_dquot->q_mount->m_super->s_dev; __entry->dev = qtrx->qt_dquot->q_mount->m_super->s_dev;
__entry->flags = qtrx->qt_dquot->dq_flags | qtrx->qt_dquot->q_flags; __entry->type = qtrx->qt_dquot->q_type;
__entry->flags = qtrx->qt_dquot->q_flags;
__entry->dqid = qtrx->qt_dquot->q_id; __entry->dqid = qtrx->qt_dquot->q_id;
__entry->blk_res = qtrx->qt_blk_res; __entry->blk_res = qtrx->qt_blk_res;
...@@ -1035,12 +1043,13 @@ DECLARE_EVENT_CLASS(xfs_dqtrx_class, ...@@ -1035,12 +1043,13 @@ DECLARE_EVENT_CLASS(xfs_dqtrx_class,
__entry->ino_res_used = qtrx->qt_ino_res_used; __entry->ino_res_used = qtrx->qt_ino_res_used;
__entry->icount_delta = qtrx->qt_icount_delta; __entry->icount_delta = qtrx->qt_icount_delta;
), ),
TP_printk("dev %d:%d dquot id 0x%x flags %s" TP_printk("dev %d:%d dquot id 0x%x type %s flags %s"
"blk_res %llu bcount_delta %lld delbcnt_delta %lld " "blk_res %llu bcount_delta %lld delbcnt_delta %lld "
"rtblk_res %llu rtblk_res_used %llu rtbcount_delta %lld delrtb_delta %lld " "rtblk_res %llu rtblk_res_used %llu rtbcount_delta %lld delrtb_delta %lld "
"ino_res %llu ino_res_used %llu icount_delta %lld", "ino_res %llu ino_res_used %llu icount_delta %lld",
MAJOR(__entry->dev), MINOR(__entry->dev), MAJOR(__entry->dev), MINOR(__entry->dev),
__entry->dqid, __entry->dqid,
__print_flags(__entry->type, "|", XFS_DQTYPE_STRINGS),
__print_flags(__entry->flags, "|", XFS_DQFLAG_STRINGS), __print_flags(__entry->flags, "|", XFS_DQFLAG_STRINGS),
__entry->blk_res, __entry->blk_res,
......
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