123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197 |
- #ifndef __XFS_QM_H__
- #define __XFS_QM_H__
- #include "xfs_dquot_item.h"
- #include "xfs_dquot.h"
- struct xfs_inode;
- extern struct kmem_zone *xfs_qm_dqtrxzone;
- #define XFS_DQITER_MAP_SIZE 10
- #define XFS_IS_DQUOT_UNINITIALIZED(dqp) ( \
- !dqp->q_core.d_blk_hardlimit && \
- !dqp->q_core.d_blk_softlimit && \
- !dqp->q_core.d_rtb_hardlimit && \
- !dqp->q_core.d_rtb_softlimit && \
- !dqp->q_core.d_ino_hardlimit && \
- !dqp->q_core.d_ino_softlimit && \
- !dqp->q_core.d_bcount && \
- !dqp->q_core.d_rtbcount && \
- !dqp->q_core.d_icount)
- #define XFS_DQUOT_CLUSTER_SIZE_FSB (xfs_filblks_t)1
- struct xfs_def_quota {
- xfs_qcnt_t bhardlimit;
- xfs_qcnt_t bsoftlimit;
- xfs_qcnt_t ihardlimit;
- xfs_qcnt_t isoftlimit;
- xfs_qcnt_t rtbhardlimit;
- xfs_qcnt_t rtbsoftlimit;
- };
- typedef struct xfs_quotainfo {
- struct radix_tree_root qi_uquota_tree;
- struct radix_tree_root qi_gquota_tree;
- struct radix_tree_root qi_pquota_tree;
- struct mutex qi_tree_lock;
- struct xfs_inode *qi_uquotaip;
- struct xfs_inode *qi_gquotaip;
- struct xfs_inode *qi_pquotaip;
- struct list_lru qi_lru;
- int qi_dquots;
- time_t qi_btimelimit;
- time_t qi_itimelimit;
- time_t qi_rtbtimelimit;
- xfs_qwarncnt_t qi_bwarnlimit;
- xfs_qwarncnt_t qi_iwarnlimit;
- xfs_qwarncnt_t qi_rtbwarnlimit;
- struct mutex qi_quotaofflock;
- xfs_filblks_t qi_dqchunklen;
- uint qi_dqperchunk;
- struct xfs_def_quota qi_usr_default;
- struct xfs_def_quota qi_grp_default;
- struct xfs_def_quota qi_prj_default;
- struct shrinker qi_shrinker;
- } xfs_quotainfo_t;
- static inline struct radix_tree_root *
- xfs_dquot_tree(
- struct xfs_quotainfo *qi,
- int type)
- {
- switch (type) {
- case XFS_DQ_USER:
- return &qi->qi_uquota_tree;
- case XFS_DQ_GROUP:
- return &qi->qi_gquota_tree;
- case XFS_DQ_PROJ:
- return &qi->qi_pquota_tree;
- default:
- ASSERT(0);
- }
- return NULL;
- }
- static inline struct xfs_inode *
- xfs_quota_inode(xfs_mount_t *mp, uint dq_flags)
- {
- switch (dq_flags & XFS_DQ_ALLTYPES) {
- case XFS_DQ_USER:
- return mp->m_quotainfo->qi_uquotaip;
- case XFS_DQ_GROUP:
- return mp->m_quotainfo->qi_gquotaip;
- case XFS_DQ_PROJ:
- return mp->m_quotainfo->qi_pquotaip;
- default:
- ASSERT(0);
- }
- return NULL;
- }
- extern void xfs_trans_mod_dquot(struct xfs_trans *,
- struct xfs_dquot *, uint, long);
- extern int xfs_trans_reserve_quota_bydquots(struct xfs_trans *,
- struct xfs_mount *, struct xfs_dquot *,
- struct xfs_dquot *, struct xfs_dquot *,
- long, long, uint);
- extern void xfs_trans_dqjoin(struct xfs_trans *, struct xfs_dquot *);
- extern void xfs_trans_log_dquot(struct xfs_trans *, struct xfs_dquot *);
- enum {
- XFS_QM_TRANS_USR = 0,
- XFS_QM_TRANS_GRP,
- XFS_QM_TRANS_PRJ,
- XFS_QM_TRANS_DQTYPES
- };
- #define XFS_QM_TRANS_MAXDQS 2
- struct xfs_dquot_acct {
- struct xfs_dqtrx dqs[XFS_QM_TRANS_DQTYPES][XFS_QM_TRANS_MAXDQS];
- };
- #define XFS_QM_BTIMELIMIT (7 * 24*60*60)
- #define XFS_QM_RTBTIMELIMIT (7 * 24*60*60)
- #define XFS_QM_ITIMELIMIT (7 * 24*60*60)
- #define XFS_QM_BWARNLIMIT 5
- #define XFS_QM_IWARNLIMIT 5
- #define XFS_QM_RTBWARNLIMIT 5
- extern void xfs_qm_destroy_quotainfo(struct xfs_mount *);
- extern void xfs_qm_dqpurge_all(struct xfs_mount *, uint);
- extern void xfs_qm_dqrele_all_inodes(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 *,
- uint, struct qc_dqblk *, uint);
- extern int xfs_qm_scall_setqlim(struct xfs_mount *, xfs_dqid_t, uint,
- struct qc_dqblk *);
- extern int xfs_qm_scall_quotaon(struct xfs_mount *, uint);
- extern int xfs_qm_scall_quotaoff(struct xfs_mount *, uint);
- static inline struct xfs_def_quota *
- xfs_get_defquota(struct xfs_dquot *dqp, struct xfs_quotainfo *qi)
- {
- struct xfs_def_quota *defq;
- if (XFS_QM_ISUDQ(dqp))
- defq = &qi->qi_usr_default;
- else if (XFS_QM_ISGDQ(dqp))
- defq = &qi->qi_grp_default;
- else {
- ASSERT(XFS_QM_ISPDQ(dqp));
- defq = &qi->qi_prj_default;
- }
- return defq;
- }
- #endif
|