]> git.sesse.net Git - bcachefs-tools-debian/blobdiff - libbcachefs/quota.h
Update bcachefs sources to 2272c5f5b7 bcachefs: Mark stripe buckets with correct...
[bcachefs-tools-debian] / libbcachefs / quota.h
index 509b7f0e069d0f33423f72f70fa5c7b05603b0cf..146264fd16ce0bf24a5dafe285b4921b0355d79f 100644 (file)
@@ -1,22 +1,26 @@
+/* SPDX-License-Identifier: GPL-2.0 */
 #ifndef _BCACHEFS_QUOTA_H
 #define _BCACHEFS_QUOTA_H
 
+#include "inode.h"
 #include "quota_types.h"
 
-extern const struct bkey_ops bch2_bkey_quota_ops;
+extern const struct bch_sb_field_ops bch_sb_field_ops_quota;
 
-enum quota_acct_mode {
-       BCH_QUOTA_PREALLOC,
-       BCH_QUOTA_WARN,
-       BCH_QUOTA_NOCHECK,
-};
+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) {       \
+       .key_invalid    = bch2_quota_invalid,           \
+       .val_to_text    = bch2_quota_to_text,           \
+})
 
 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,
        };
 }
 
@@ -33,7 +37,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 *);
@@ -52,7 +56,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;
 }