aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_qm.h
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/xfs_qm.h')
-rw-r--r--fs/xfs/xfs_qm.h83
1 files changed, 58 insertions, 25 deletions
diff --git a/fs/xfs/xfs_qm.h b/fs/xfs/xfs_qm.h
index 5d16a6e6900f..bdb4f8b95207 100644
--- a/fs/xfs/xfs_qm.h
+++ b/fs/xfs/xfs_qm.h
@@ -69,30 +69,62 @@ typedef struct xfs_quotainfo {
69 struct shrinker qi_shrinker; 69 struct shrinker qi_shrinker;
70} xfs_quotainfo_t; 70} xfs_quotainfo_t;
71 71
72#define XFS_DQUOT_TREE(qi, type) \ 72static inline struct radix_tree_root *
73 ((type & XFS_DQ_USER) ? \ 73xfs_dquot_tree(
74 &((qi)->qi_uquota_tree) : \ 74 struct xfs_quotainfo *qi,
75 &((qi)->qi_gquota_tree)) 75 int type)
76{
77 switch (type) {
78 case XFS_DQ_USER:
79 return &qi->qi_uquota_tree;
80 case XFS_DQ_GROUP:
81 case XFS_DQ_PROJ:
82 return &qi->qi_gquota_tree;
83 default:
84 ASSERT(0);
85 }
86 return NULL;
87}
76 88
89static inline struct xfs_inode *
90xfs_dq_to_quota_inode(struct xfs_dquot *dqp)
91{
92 switch (dqp->dq_flags & XFS_DQ_ALLTYPES) {
93 case XFS_DQ_USER:
94 return dqp->q_mount->m_quotainfo->qi_uquotaip;
95 case XFS_DQ_GROUP:
96 case XFS_DQ_PROJ:
97 return dqp->q_mount->m_quotainfo->qi_gquotaip;
98 default:
99 ASSERT(0);
100 }
101 return NULL;
102}
77 103
78extern int xfs_qm_calc_dquots_per_chunk(struct xfs_mount *mp, 104extern int xfs_qm_calc_dquots_per_chunk(struct xfs_mount *mp,
79 unsigned int nbblks); 105 unsigned int nbblks);
80extern void xfs_trans_mod_dquot(xfs_trans_t *, xfs_dquot_t *, uint, long); 106extern void xfs_trans_mod_dquot(struct xfs_trans *,
81extern int xfs_trans_reserve_quota_bydquots(xfs_trans_t *, xfs_mount_t *, 107 struct xfs_dquot *, uint, long);
82 xfs_dquot_t *, xfs_dquot_t *, long, long, uint); 108extern int xfs_trans_reserve_quota_bydquots(struct xfs_trans *,
83extern void xfs_trans_dqjoin(xfs_trans_t *, xfs_dquot_t *); 109 struct xfs_mount *, struct xfs_dquot *,
84extern void xfs_trans_log_dquot(xfs_trans_t *, xfs_dquot_t *); 110 struct xfs_dquot *, long, long, uint);
111extern void xfs_trans_dqjoin(struct xfs_trans *, struct xfs_dquot *);
112extern void xfs_trans_log_dquot(struct xfs_trans *, struct xfs_dquot *);
85 113
86/* 114/*
87 * We keep the usr and grp dquots separately so that locking will be easier 115 * We keep the usr and grp dquots separately so that locking will be easier
88 * to do at commit time. All transactions that we know of at this point 116 * to do at commit time. All transactions that we know of at this point
89 * affect no more than two dquots of one type. Hence, the TRANS_MAXDQS value. 117 * affect no more than two dquots of one type. Hence, the TRANS_MAXDQS value.
90 */ 118 */
119enum {
120 XFS_QM_TRANS_USR = 0,
121 XFS_QM_TRANS_GRP,
122 XFS_QM_TRANS_DQTYPES
123};
91#define XFS_QM_TRANS_MAXDQS 2 124#define XFS_QM_TRANS_MAXDQS 2
92typedef struct xfs_dquot_acct { 125struct xfs_dquot_acct {
93 xfs_dqtrx_t dqa_usrdquots[XFS_QM_TRANS_MAXDQS]; 126 struct xfs_dqtrx dqs[XFS_QM_TRANS_DQTYPES][XFS_QM_TRANS_MAXDQS];
94 xfs_dqtrx_t dqa_grpdquots[XFS_QM_TRANS_MAXDQS]; 127};
95} xfs_dquot_acct_t;
96 128
97/* 129/*
98 * Users are allowed to have a usage exceeding their softlimit for 130 * Users are allowed to have a usage exceeding their softlimit for
@@ -106,22 +138,23 @@ typedef struct xfs_dquot_acct {
106#define XFS_QM_IWARNLIMIT 5 138#define XFS_QM_IWARNLIMIT 5
107#define XFS_QM_RTBWARNLIMIT 5 139#define XFS_QM_RTBWARNLIMIT 5
108 140
109extern void xfs_qm_destroy_quotainfo(xfs_mount_t *); 141extern void xfs_qm_destroy_quotainfo(struct xfs_mount *);
110extern int xfs_qm_quotacheck(xfs_mount_t *); 142extern int xfs_qm_quotacheck(struct xfs_mount *);
111extern int xfs_qm_write_sb_changes(xfs_mount_t *, __int64_t); 143extern int xfs_qm_write_sb_changes(struct xfs_mount *, __int64_t);
112 144
113/* dquot stuff */ 145/* dquot stuff */
114extern void xfs_qm_dqpurge_all(xfs_mount_t *, uint); 146extern void xfs_qm_dqpurge_all(struct xfs_mount *, uint);
115extern void xfs_qm_dqrele_all_inodes(xfs_mount_t *, uint); 147extern void xfs_qm_dqrele_all_inodes(struct xfs_mount *, uint);
116 148
117/* quota ops */ 149/* quota ops */
118extern int xfs_qm_scall_trunc_qfiles(xfs_mount_t *, uint); 150extern int xfs_qm_scall_trunc_qfiles(struct xfs_mount *, uint);
119extern int xfs_qm_scall_getquota(xfs_mount_t *, xfs_dqid_t, uint, 151extern int xfs_qm_scall_getquota(struct xfs_mount *, xfs_dqid_t,
120 fs_disk_quota_t *); 152 uint, struct fs_disk_quota *);
121extern int xfs_qm_scall_setqlim(struct xfs_mount *, xfs_dqid_t, uint, 153extern int xfs_qm_scall_setqlim(struct xfs_mount *, xfs_dqid_t, uint,
122 fs_disk_quota_t *); 154 struct fs_disk_quota *);
123extern int xfs_qm_scall_getqstat(xfs_mount_t *, fs_quota_stat_t *); 155extern int xfs_qm_scall_getqstat(struct xfs_mount *,
124extern int xfs_qm_scall_quotaon(xfs_mount_t *, uint); 156 struct fs_quota_stat *);
125extern int xfs_qm_scall_quotaoff(xfs_mount_t *, uint); 157extern int xfs_qm_scall_quotaon(struct xfs_mount *, uint);
158extern int xfs_qm_scall_quotaoff(struct xfs_mount *, uint);
126 159
127#endif /* __XFS_QM_H__ */ 160#endif /* __XFS_QM_H__ */