diff options
Diffstat (limited to 'fs/xfs/xfs_qm.h')
-rw-r--r-- | fs/xfs/xfs_qm.h | 83 |
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) \ | 72 | static inline struct radix_tree_root * |
73 | ((type & XFS_DQ_USER) ? \ | 73 | xfs_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 | ||
89 | static inline struct xfs_inode * | ||
90 | xfs_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 | ||
78 | extern int xfs_qm_calc_dquots_per_chunk(struct xfs_mount *mp, | 104 | extern int xfs_qm_calc_dquots_per_chunk(struct xfs_mount *mp, |
79 | unsigned int nbblks); | 105 | unsigned int nbblks); |
80 | extern void xfs_trans_mod_dquot(xfs_trans_t *, xfs_dquot_t *, uint, long); | 106 | extern void xfs_trans_mod_dquot(struct xfs_trans *, |
81 | extern 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); | 108 | extern int xfs_trans_reserve_quota_bydquots(struct xfs_trans *, |
83 | extern void xfs_trans_dqjoin(xfs_trans_t *, xfs_dquot_t *); | 109 | struct xfs_mount *, struct xfs_dquot *, |
84 | extern void xfs_trans_log_dquot(xfs_trans_t *, xfs_dquot_t *); | 110 | struct xfs_dquot *, long, long, uint); |
111 | extern void xfs_trans_dqjoin(struct xfs_trans *, struct xfs_dquot *); | ||
112 | extern 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 | */ |
119 | enum { | ||
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 |
92 | typedef struct xfs_dquot_acct { | 125 | struct 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 | ||
109 | extern void xfs_qm_destroy_quotainfo(xfs_mount_t *); | 141 | extern void xfs_qm_destroy_quotainfo(struct xfs_mount *); |
110 | extern int xfs_qm_quotacheck(xfs_mount_t *); | 142 | extern int xfs_qm_quotacheck(struct xfs_mount *); |
111 | extern int xfs_qm_write_sb_changes(xfs_mount_t *, __int64_t); | 143 | extern int xfs_qm_write_sb_changes(struct xfs_mount *, __int64_t); |
112 | 144 | ||
113 | /* dquot stuff */ | 145 | /* dquot stuff */ |
114 | extern void xfs_qm_dqpurge_all(xfs_mount_t *, uint); | 146 | extern void xfs_qm_dqpurge_all(struct xfs_mount *, uint); |
115 | extern void xfs_qm_dqrele_all_inodes(xfs_mount_t *, uint); | 147 | extern void xfs_qm_dqrele_all_inodes(struct xfs_mount *, uint); |
116 | 148 | ||
117 | /* quota ops */ | 149 | /* quota ops */ |
118 | extern int xfs_qm_scall_trunc_qfiles(xfs_mount_t *, uint); | 150 | extern int xfs_qm_scall_trunc_qfiles(struct xfs_mount *, uint); |
119 | extern int xfs_qm_scall_getquota(xfs_mount_t *, xfs_dqid_t, uint, | 151 | extern int xfs_qm_scall_getquota(struct xfs_mount *, xfs_dqid_t, |
120 | fs_disk_quota_t *); | 152 | uint, struct fs_disk_quota *); |
121 | extern int xfs_qm_scall_setqlim(struct xfs_mount *, xfs_dqid_t, uint, | 153 | extern int xfs_qm_scall_setqlim(struct xfs_mount *, xfs_dqid_t, uint, |
122 | fs_disk_quota_t *); | 154 | struct fs_disk_quota *); |
123 | extern int xfs_qm_scall_getqstat(xfs_mount_t *, fs_quota_stat_t *); | 155 | extern int xfs_qm_scall_getqstat(struct xfs_mount *, |
124 | extern int xfs_qm_scall_quotaon(xfs_mount_t *, uint); | 156 | struct fs_quota_stat *); |
125 | extern int xfs_qm_scall_quotaoff(xfs_mount_t *, uint); | 157 | extern int xfs_qm_scall_quotaon(struct xfs_mount *, uint); |
158 | extern int xfs_qm_scall_quotaoff(struct xfs_mount *, uint); | ||
126 | 159 | ||
127 | #endif /* __XFS_QM_H__ */ | 160 | #endif /* __XFS_QM_H__ */ |