1 #ifndef _BCACHEFS_QUOTA_H
2 #define _BCACHEFS_QUOTA_H
4 #include "quota_types.h"
6 extern const struct bkey_ops bch2_bkey_quota_ops;
14 static inline struct bch_qid bch_qid(struct bch_inode_unpacked *u)
16 return (struct bch_qid) {
17 .q[QTYP_USR] = u->bi_uid,
18 .q[QTYP_GRP] = u->bi_gid,
19 .q[QTYP_PRJ] = u->bi_project,
23 static inline unsigned enabled_qtypes(struct bch_fs *c)
25 return ((c->opts.usrquota << QTYP_USR)|
26 (c->opts.grpquota << QTYP_GRP)|
27 (c->opts.prjquota << QTYP_PRJ));
30 #ifdef CONFIG_BCACHEFS_QUOTA
32 int bch2_quota_acct(struct bch_fs *, struct bch_qid, enum quota_counters,
33 s64, enum quota_acct_mode);
35 int bch2_quota_transfer(struct bch_fs *, unsigned, struct bch_qid,
38 void bch2_fs_quota_exit(struct bch_fs *);
39 void bch2_fs_quota_init(struct bch_fs *);
40 int bch2_fs_quota_read(struct bch_fs *);
42 extern const struct quotactl_ops bch2_quotactl_operations;
46 static inline int bch2_quota_acct(struct bch_fs *c, struct bch_qid qid,
47 enum quota_counters counter, s64 v,
48 enum quota_acct_mode mode)
53 static inline int bch2_quota_transfer(struct bch_fs *c, unsigned qtypes,
55 struct bch_qid src, u64 space)
60 static inline void bch2_fs_quota_exit(struct bch_fs *c) {}
61 static inline void bch2_fs_quota_init(struct bch_fs *c) {}
62 static inline int bch2_fs_quota_read(struct bch_fs *c) { return 0; }
66 #endif /* _BCACHEFS_QUOTA_H */