]> git.sesse.net Git - bcachefs-tools-debian/blob - c_src/libbcachefs/quota_types.h
6a136083d3899d29ac96222eb46a26dd113060b2
[bcachefs-tools-debian] / c_src / libbcachefs / quota_types.h
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _BCACHEFS_QUOTA_TYPES_H
3 #define _BCACHEFS_QUOTA_TYPES_H
4
5 #include <linux/generic-radix-tree.h>
6
7 struct bch_qid {
8         u32             q[QTYP_NR];
9 };
10
11 enum quota_acct_mode {
12         KEY_TYPE_QUOTA_PREALLOC,
13         KEY_TYPE_QUOTA_WARN,
14         KEY_TYPE_QUOTA_NOCHECK,
15 };
16
17 struct memquota_counter {
18         u64                             v;
19         u64                             hardlimit;
20         u64                             softlimit;
21         s64                             timer;
22         int                             warns;
23         int                             warning_issued;
24 };
25
26 struct bch_memquota {
27         struct memquota_counter         c[Q_COUNTERS];
28 };
29
30 typedef GENRADIX(struct bch_memquota)   bch_memquota_table;
31
32 struct quota_limit {
33         u32                             timelimit;
34         u32                             warnlimit;
35 };
36
37 struct bch_memquota_type {
38         struct quota_limit              limits[Q_COUNTERS];
39         bch_memquota_table              table;
40         struct mutex                    lock;
41 };
42
43 #endif /* _BCACHEFS_QUOTA_TYPES_H */