hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/fs/xfs/xfs_qm.h
....@@ -20,76 +20,68 @@
2020 #define XFS_DQITER_MAP_SIZE 10
2121
2222 #define XFS_IS_DQUOT_UNINITIALIZED(dqp) ( \
23
- !dqp->q_core.d_blk_hardlimit && \
24
- !dqp->q_core.d_blk_softlimit && \
25
- !dqp->q_core.d_rtb_hardlimit && \
26
- !dqp->q_core.d_rtb_softlimit && \
27
- !dqp->q_core.d_ino_hardlimit && \
28
- !dqp->q_core.d_ino_softlimit && \
29
- !dqp->q_core.d_bcount && \
30
- !dqp->q_core.d_rtbcount && \
31
- !dqp->q_core.d_icount)
23
+ !dqp->q_blk.hardlimit && \
24
+ !dqp->q_blk.softlimit && \
25
+ !dqp->q_rtb.hardlimit && \
26
+ !dqp->q_rtb.softlimit && \
27
+ !dqp->q_ino.hardlimit && \
28
+ !dqp->q_ino.softlimit && \
29
+ !dqp->q_blk.count && \
30
+ !dqp->q_rtb.count && \
31
+ !dqp->q_ino.count)
3232
33
-/*
34
- * This defines the unit of allocation of dquots.
35
- * Currently, it is just one file system block, and a 4K blk contains 30
36
- * (136 * 30 = 4080) dquots. It's probably not worth trying to make
37
- * this more dynamic.
38
- * XXXsup However, if this number is changed, we have to make sure that we don't
39
- * implicitly assume that we do allocations in chunks of a single filesystem
40
- * block in the dquot/xqm code.
41
- */
42
-#define XFS_DQUOT_CLUSTER_SIZE_FSB (xfs_filblks_t)1
33
+struct xfs_quota_limits {
34
+ xfs_qcnt_t hard; /* default hard limit */
35
+ xfs_qcnt_t soft; /* default soft limit */
36
+ time64_t time; /* limit for timers */
37
+ xfs_qwarncnt_t warn; /* limit for warnings */
38
+};
4339
40
+/* Defaults for each quota type: time limits, warn limits, usage limits */
4441 struct xfs_def_quota {
45
- xfs_qcnt_t bhardlimit; /* default data blk hard limit */
46
- xfs_qcnt_t bsoftlimit; /* default data blk soft limit */
47
- xfs_qcnt_t ihardlimit; /* default inode count hard limit */
48
- xfs_qcnt_t isoftlimit; /* default inode count soft limit */
49
- xfs_qcnt_t rtbhardlimit; /* default realtime blk hard limit */
50
- xfs_qcnt_t rtbsoftlimit; /* default realtime blk soft limit */
42
+ struct xfs_quota_limits blk;
43
+ struct xfs_quota_limits ino;
44
+ struct xfs_quota_limits rtb;
5145 };
5246
5347 /*
5448 * Various quota information for individual filesystems.
5549 * The mount structure keeps a pointer to this.
5650 */
57
-typedef struct xfs_quotainfo {
58
- struct radix_tree_root qi_uquota_tree;
59
- struct radix_tree_root qi_gquota_tree;
60
- struct radix_tree_root qi_pquota_tree;
61
- struct mutex qi_tree_lock;
51
+struct xfs_quotainfo {
52
+ struct radix_tree_root qi_uquota_tree;
53
+ struct radix_tree_root qi_gquota_tree;
54
+ struct radix_tree_root qi_pquota_tree;
55
+ struct mutex qi_tree_lock;
6256 struct xfs_inode *qi_uquotaip; /* user quota inode */
6357 struct xfs_inode *qi_gquotaip; /* group quota inode */
6458 struct xfs_inode *qi_pquotaip; /* project quota inode */
65
- struct list_lru qi_lru;
66
- int qi_dquots;
67
- time_t qi_btimelimit; /* limit for blks timer */
68
- time_t qi_itimelimit; /* limit for inodes timer */
69
- time_t qi_rtbtimelimit;/* limit for rt blks timer */
70
- xfs_qwarncnt_t qi_bwarnlimit; /* limit for blks warnings */
71
- xfs_qwarncnt_t qi_iwarnlimit; /* limit for inodes warnings */
72
- xfs_qwarncnt_t qi_rtbwarnlimit;/* limit for rt blks warnings */
73
- struct mutex qi_quotaofflock;/* to serialize quotaoff */
74
- xfs_filblks_t qi_dqchunklen; /* # BBs in a chunk of dqs */
75
- uint qi_dqperchunk; /* # ondisk dqs in above chunk */
59
+ struct list_lru qi_lru;
60
+ int qi_dquots;
61
+ struct mutex qi_quotaofflock;/* to serialize quotaoff */
62
+ xfs_filblks_t qi_dqchunklen; /* # BBs in a chunk of dqs */
63
+ uint qi_dqperchunk; /* # ondisk dq in above chunk */
7664 struct xfs_def_quota qi_usr_default;
7765 struct xfs_def_quota qi_grp_default;
7866 struct xfs_def_quota qi_prj_default;
79
- struct shrinker qi_shrinker;
80
-} xfs_quotainfo_t;
67
+ struct shrinker qi_shrinker;
68
+
69
+ /* Minimum and maximum quota expiration timestamp values. */
70
+ time64_t qi_expiry_min;
71
+ time64_t qi_expiry_max;
72
+};
8173
8274 static inline struct radix_tree_root *
8375 xfs_dquot_tree(
8476 struct xfs_quotainfo *qi,
85
- int type)
77
+ xfs_dqtype_t type)
8678 {
8779 switch (type) {
88
- case XFS_DQ_USER:
80
+ case XFS_DQTYPE_USER:
8981 return &qi->qi_uquota_tree;
90
- case XFS_DQ_GROUP:
82
+ case XFS_DQTYPE_GROUP:
9183 return &qi->qi_gquota_tree;
92
- case XFS_DQ_PROJ:
84
+ case XFS_DQTYPE_PROJ:
9385 return &qi->qi_pquota_tree;
9486 default:
9587 ASSERT(0);
....@@ -98,14 +90,14 @@
9890 }
9991
10092 static inline struct xfs_inode *
101
-xfs_quota_inode(xfs_mount_t *mp, uint dq_flags)
93
+xfs_quota_inode(struct xfs_mount *mp, xfs_dqtype_t type)
10294 {
103
- switch (dq_flags & XFS_DQ_ALLTYPES) {
104
- case XFS_DQ_USER:
95
+ switch (type) {
96
+ case XFS_DQTYPE_USER:
10597 return mp->m_quotainfo->qi_uquotaip;
106
- case XFS_DQ_GROUP:
98
+ case XFS_DQTYPE_GROUP:
10799 return mp->m_quotainfo->qi_gquotaip;
108
- case XFS_DQ_PROJ:
100
+ case XFS_DQTYPE_PROJ:
109101 return mp->m_quotainfo->qi_pquotaip;
110102 default:
111103 ASSERT(0);
....@@ -113,12 +105,8 @@
113105 return NULL;
114106 }
115107
116
-extern void xfs_trans_mod_dquot(struct xfs_trans *,
117
- struct xfs_dquot *, uint, long);
118
-extern int xfs_trans_reserve_quota_bydquots(struct xfs_trans *,
119
- struct xfs_mount *, struct xfs_dquot *,
120
- struct xfs_dquot *, struct xfs_dquot *,
121
- long, long, uint);
108
+extern void xfs_trans_mod_dquot(struct xfs_trans *tp, struct xfs_dquot *dqp,
109
+ uint field, int64_t delta);
122110 extern void xfs_trans_dqjoin(struct xfs_trans *, struct xfs_dquot *);
123111 extern void xfs_trans_log_dquot(struct xfs_trans *, struct xfs_dquot *);
124112
....@@ -158,29 +146,35 @@
158146
159147 /* quota ops */
160148 extern int xfs_qm_scall_trunc_qfiles(struct xfs_mount *, uint);
161
-extern int xfs_qm_scall_getquota(struct xfs_mount *, xfs_dqid_t,
162
- uint, struct qc_dqblk *);
163
-extern int xfs_qm_scall_getquota_next(struct xfs_mount *,
164
- xfs_dqid_t *, uint, struct qc_dqblk *);
165
-extern int xfs_qm_scall_setqlim(struct xfs_mount *, xfs_dqid_t, uint,
166
- struct qc_dqblk *);
149
+extern int xfs_qm_scall_getquota(struct xfs_mount *mp,
150
+ xfs_dqid_t id,
151
+ xfs_dqtype_t type,
152
+ struct qc_dqblk *dst);
153
+extern int xfs_qm_scall_getquota_next(struct xfs_mount *mp,
154
+ xfs_dqid_t *id,
155
+ xfs_dqtype_t type,
156
+ struct qc_dqblk *dst);
157
+extern int xfs_qm_scall_setqlim(struct xfs_mount *mp,
158
+ xfs_dqid_t id,
159
+ xfs_dqtype_t type,
160
+ struct qc_dqblk *newlim);
167161 extern int xfs_qm_scall_quotaon(struct xfs_mount *, uint);
168162 extern int xfs_qm_scall_quotaoff(struct xfs_mount *, uint);
169163
170164 static inline struct xfs_def_quota *
171
-xfs_get_defquota(struct xfs_dquot *dqp, struct xfs_quotainfo *qi)
165
+xfs_get_defquota(struct xfs_quotainfo *qi, xfs_dqtype_t type)
172166 {
173
- struct xfs_def_quota *defq;
174
-
175
- if (XFS_QM_ISUDQ(dqp))
176
- defq = &qi->qi_usr_default;
177
- else if (XFS_QM_ISGDQ(dqp))
178
- defq = &qi->qi_grp_default;
179
- else {
180
- ASSERT(XFS_QM_ISPDQ(dqp));
181
- defq = &qi->qi_prj_default;
167
+ switch (type) {
168
+ case XFS_DQTYPE_USER:
169
+ return &qi->qi_usr_default;
170
+ case XFS_DQTYPE_GROUP:
171
+ return &qi->qi_grp_default;
172
+ case XFS_DQTYPE_PROJ:
173
+ return &qi->qi_prj_default;
174
+ default:
175
+ ASSERT(0);
176
+ return NULL;
182177 }
183
- return defq;
184178 }
185179
186180 #endif /* __XFS_QM_H__ */