diff options
Diffstat (limited to 'fs/xfs/xfs_qm.h')
-rw-r--r-- | fs/xfs/xfs_qm.h | 97 |
1 files changed, 68 insertions, 29 deletions
diff --git a/fs/xfs/xfs_qm.h b/fs/xfs/xfs_qm.h index 5d16a6e6900f..579d6a02a5b6 100644 --- a/fs/xfs/xfs_qm.h +++ b/fs/xfs/xfs_qm.h | |||
@@ -44,9 +44,11 @@ extern struct kmem_zone *xfs_qm_dqtrxzone; | |||
44 | typedef struct xfs_quotainfo { | 44 | typedef struct xfs_quotainfo { |
45 | struct radix_tree_root qi_uquota_tree; | 45 | struct radix_tree_root qi_uquota_tree; |
46 | struct radix_tree_root qi_gquota_tree; | 46 | struct radix_tree_root qi_gquota_tree; |
47 | struct radix_tree_root qi_pquota_tree; | ||
47 | struct mutex qi_tree_lock; | 48 | struct mutex qi_tree_lock; |
48 | xfs_inode_t *qi_uquotaip; /* user quota inode */ | 49 | struct xfs_inode *qi_uquotaip; /* user quota inode */ |
49 | xfs_inode_t *qi_gquotaip; /* group quota inode */ | 50 | struct xfs_inode *qi_gquotaip; /* group quota inode */ |
51 | struct xfs_inode *qi_pquotaip; /* project quota inode */ | ||
50 | struct list_head qi_lru_list; | 52 | struct list_head qi_lru_list; |
51 | struct mutex qi_lru_lock; | 53 | struct mutex qi_lru_lock; |
52 | int qi_lru_count; | 54 | int qi_lru_count; |
@@ -69,30 +71,66 @@ typedef struct xfs_quotainfo { | |||
69 | struct shrinker qi_shrinker; | 71 | struct shrinker qi_shrinker; |
70 | } xfs_quotainfo_t; | 72 | } xfs_quotainfo_t; |
71 | 73 | ||
72 | #define XFS_DQUOT_TREE(qi, type) \ | 74 | static inline struct radix_tree_root * |
73 | ((type & XFS_DQ_USER) ? \ | 75 | xfs_dquot_tree( |
74 | &((qi)->qi_uquota_tree) : \ | 76 | struct xfs_quotainfo *qi, |
75 | &((qi)->qi_gquota_tree)) | 77 | int type) |
78 | { | ||
79 | switch (type) { | ||
80 | case XFS_DQ_USER: | ||
81 | return &qi->qi_uquota_tree; | ||
82 | case XFS_DQ_GROUP: | ||
83 | return &qi->qi_gquota_tree; | ||
84 | case XFS_DQ_PROJ: | ||
85 | return &qi->qi_pquota_tree; | ||
86 | default: | ||
87 | ASSERT(0); | ||
88 | } | ||
89 | return NULL; | ||
90 | } | ||
76 | 91 | ||
92 | static inline struct xfs_inode * | ||
93 | xfs_dq_to_quota_inode(struct xfs_dquot *dqp) | ||
94 | { | ||
95 | switch (dqp->dq_flags & XFS_DQ_ALLTYPES) { | ||
96 | case XFS_DQ_USER: | ||
97 | return dqp->q_mount->m_quotainfo->qi_uquotaip; | ||
98 | case XFS_DQ_GROUP: | ||
99 | return dqp->q_mount->m_quotainfo->qi_gquotaip; | ||
100 | case XFS_DQ_PROJ: | ||
101 | return dqp->q_mount->m_quotainfo->qi_pquotaip; | ||
102 | default: | ||
103 | ASSERT(0); | ||
104 | } | ||
105 | return NULL; | ||
106 | } | ||
77 | 107 | ||
78 | extern int xfs_qm_calc_dquots_per_chunk(struct xfs_mount *mp, | 108 | extern int xfs_qm_calc_dquots_per_chunk(struct xfs_mount *mp, |
79 | unsigned int nbblks); | 109 | unsigned int nbblks); |
80 | extern void xfs_trans_mod_dquot(xfs_trans_t *, xfs_dquot_t *, uint, long); | 110 | extern void xfs_trans_mod_dquot(struct xfs_trans *, |
81 | extern int xfs_trans_reserve_quota_bydquots(xfs_trans_t *, xfs_mount_t *, | 111 | struct xfs_dquot *, uint, long); |
82 | xfs_dquot_t *, xfs_dquot_t *, long, long, uint); | 112 | extern int xfs_trans_reserve_quota_bydquots(struct xfs_trans *, |
83 | extern void xfs_trans_dqjoin(xfs_trans_t *, xfs_dquot_t *); | 113 | struct xfs_mount *, struct xfs_dquot *, |
84 | extern void xfs_trans_log_dquot(xfs_trans_t *, xfs_dquot_t *); | 114 | struct xfs_dquot *, struct xfs_dquot *, |
115 | long, long, uint); | ||
116 | extern void xfs_trans_dqjoin(struct xfs_trans *, struct xfs_dquot *); | ||
117 | extern void xfs_trans_log_dquot(struct xfs_trans *, struct xfs_dquot *); | ||
85 | 118 | ||
86 | /* | 119 | /* |
87 | * We keep the usr and grp dquots separately so that locking will be easier | 120 | * We keep the usr, grp, and prj dquots separately so that locking will be |
88 | * to do at commit time. All transactions that we know of at this point | 121 | * easier 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. | 122 | * affect no more than two dquots of one type. Hence, the TRANS_MAXDQS value. |
90 | */ | 123 | */ |
124 | enum { | ||
125 | XFS_QM_TRANS_USR = 0, | ||
126 | XFS_QM_TRANS_GRP, | ||
127 | XFS_QM_TRANS_PRJ, | ||
128 | XFS_QM_TRANS_DQTYPES | ||
129 | }; | ||
91 | #define XFS_QM_TRANS_MAXDQS 2 | 130 | #define XFS_QM_TRANS_MAXDQS 2 |
92 | typedef struct xfs_dquot_acct { | 131 | struct xfs_dquot_acct { |
93 | xfs_dqtrx_t dqa_usrdquots[XFS_QM_TRANS_MAXDQS]; | 132 | struct xfs_dqtrx dqs[XFS_QM_TRANS_DQTYPES][XFS_QM_TRANS_MAXDQS]; |
94 | xfs_dqtrx_t dqa_grpdquots[XFS_QM_TRANS_MAXDQS]; | 133 | }; |
95 | } xfs_dquot_acct_t; | ||
96 | 134 | ||
97 | /* | 135 | /* |
98 | * Users are allowed to have a usage exceeding their softlimit for | 136 | * Users are allowed to have a usage exceeding their softlimit for |
@@ -106,22 +144,23 @@ typedef struct xfs_dquot_acct { | |||
106 | #define XFS_QM_IWARNLIMIT 5 | 144 | #define XFS_QM_IWARNLIMIT 5 |
107 | #define XFS_QM_RTBWARNLIMIT 5 | 145 | #define XFS_QM_RTBWARNLIMIT 5 |
108 | 146 | ||
109 | extern void xfs_qm_destroy_quotainfo(xfs_mount_t *); | 147 | extern void xfs_qm_destroy_quotainfo(struct xfs_mount *); |
110 | extern int xfs_qm_quotacheck(xfs_mount_t *); | 148 | extern int xfs_qm_quotacheck(struct xfs_mount *); |
111 | extern int xfs_qm_write_sb_changes(xfs_mount_t *, __int64_t); | 149 | extern int xfs_qm_write_sb_changes(struct xfs_mount *, __int64_t); |
112 | 150 | ||
113 | /* dquot stuff */ | 151 | /* dquot stuff */ |
114 | extern void xfs_qm_dqpurge_all(xfs_mount_t *, uint); | 152 | extern void xfs_qm_dqpurge_all(struct xfs_mount *, uint); |
115 | extern void xfs_qm_dqrele_all_inodes(xfs_mount_t *, uint); | 153 | extern void xfs_qm_dqrele_all_inodes(struct xfs_mount *, uint); |
116 | 154 | ||
117 | /* quota ops */ | 155 | /* quota ops */ |
118 | extern int xfs_qm_scall_trunc_qfiles(xfs_mount_t *, uint); | 156 | 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, | 157 | extern int xfs_qm_scall_getquota(struct xfs_mount *, xfs_dqid_t, |
120 | fs_disk_quota_t *); | 158 | uint, struct fs_disk_quota *); |
121 | extern int xfs_qm_scall_setqlim(struct xfs_mount *, xfs_dqid_t, uint, | 159 | extern int xfs_qm_scall_setqlim(struct xfs_mount *, xfs_dqid_t, uint, |
122 | fs_disk_quota_t *); | 160 | struct fs_disk_quota *); |
123 | extern int xfs_qm_scall_getqstat(xfs_mount_t *, fs_quota_stat_t *); | 161 | extern int xfs_qm_scall_getqstat(struct xfs_mount *, |
124 | extern int xfs_qm_scall_quotaon(xfs_mount_t *, uint); | 162 | struct fs_quota_stat *); |
125 | extern int xfs_qm_scall_quotaoff(xfs_mount_t *, uint); | 163 | extern int xfs_qm_scall_quotaon(struct xfs_mount *, uint); |
164 | extern int xfs_qm_scall_quotaoff(struct xfs_mount *, uint); | ||
126 | 165 | ||
127 | #endif /* __XFS_QM_H__ */ | 166 | #endif /* __XFS_QM_H__ */ |