X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libbcachefs%2Fquota.h;h=b0f7d4ee775e17ae15e0177652c49d8006086558;hb=5ef62f56ab50c5799f713e3a42f5c7ad7e8283d3;hp=0c3eb6973de1e8eed3b00fca671d40b6816368dd;hpb=0c7db4eca3e6519043c10288cb41f8a0ee634a0b;p=bcachefs-tools-debian diff --git a/libbcachefs/quota.h b/libbcachefs/quota.h index 0c3eb69..b0f7d4e 100644 --- a/libbcachefs/quota.h +++ b/libbcachefs/quota.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef _BCACHEFS_QUOTA_H #define _BCACHEFS_QUOTA_H @@ -6,26 +7,21 @@ extern const struct bch_sb_field_ops bch_sb_field_ops_quota; -const char *bch2_quota_invalid(const struct bch_fs *, struct bkey_s_c); +int bch2_quota_invalid(const struct bch_fs *, struct bkey_s_c, unsigned, struct printbuf *); void bch2_quota_to_text(struct printbuf *, struct bch_fs *, struct bkey_s_c); -#define bch2_bkey_ops_quota (struct bkey_ops) { \ +#define bch2_bkey_ops_quota ((struct bkey_ops) { \ .key_invalid = bch2_quota_invalid, \ .val_to_text = bch2_quota_to_text, \ -} - -enum quota_acct_mode { - KEY_TYPE_QUOTA_PREALLOC, - KEY_TYPE_QUOTA_WARN, - KEY_TYPE_QUOTA_NOCHECK, -}; + .min_val_size = 32, \ +}) static inline struct bch_qid bch_qid(struct bch_inode_unpacked *u) { return (struct bch_qid) { .q[QTYP_USR] = u->bi_uid, .q[QTYP_GRP] = u->bi_gid, - .q[QTYP_PRJ] = u->bi_project, + .q[QTYP_PRJ] = u->bi_project ? u->bi_project - 1 : 0, }; } @@ -42,7 +38,7 @@ int bch2_quota_acct(struct bch_fs *, struct bch_qid, enum quota_counters, s64, enum quota_acct_mode); int bch2_quota_transfer(struct bch_fs *, unsigned, struct bch_qid, - struct bch_qid, u64); + struct bch_qid, u64, enum quota_acct_mode); void bch2_fs_quota_exit(struct bch_fs *); void bch2_fs_quota_init(struct bch_fs *); @@ -61,7 +57,8 @@ static inline int bch2_quota_acct(struct bch_fs *c, struct bch_qid qid, static inline int bch2_quota_transfer(struct bch_fs *c, unsigned qtypes, struct bch_qid dst, - struct bch_qid src, u64 space) + struct bch_qid src, u64 space, + enum quota_acct_mode mode) { return 0; }