brintos

brintos / linux-shallow public Read only

0
0
Text · 1.9 KiB · a62abcc Raw
74 lines · c
1/* SPDX-License-Identifier: GPL-2.0 */2#ifndef _BCACHEFS_QUOTA_H3#define _BCACHEFS_QUOTA_H4 5#include "inode.h"6#include "quota_types.h"7 8enum bch_validate_flags;9extern const struct bch_sb_field_ops bch_sb_field_ops_quota;10 11int bch2_quota_validate(struct bch_fs *, struct bkey_s_c, enum bch_validate_flags);12void bch2_quota_to_text(struct printbuf *, struct bch_fs *, struct bkey_s_c);13 14#define bch2_bkey_ops_quota ((struct bkey_ops) {	\15	.key_validate	= bch2_quota_validate,		\16	.val_to_text	= bch2_quota_to_text,		\17	.min_val_size	= 32,				\18})19 20static inline struct bch_qid bch_qid(struct bch_inode_unpacked *u)21{22	return (struct bch_qid) {23		.q[QTYP_USR] = u->bi_uid,24		.q[QTYP_GRP] = u->bi_gid,25		.q[QTYP_PRJ] = u->bi_project ? u->bi_project - 1 : 0,26	};27}28 29static inline unsigned enabled_qtypes(struct bch_fs *c)30{31	return ((c->opts.usrquota << QTYP_USR)|32		(c->opts.grpquota << QTYP_GRP)|33		(c->opts.prjquota << QTYP_PRJ));34}35 36#ifdef CONFIG_BCACHEFS_QUOTA37 38int bch2_quota_acct(struct bch_fs *, struct bch_qid, enum quota_counters,39		    s64, enum quota_acct_mode);40 41int bch2_quota_transfer(struct bch_fs *, unsigned, struct bch_qid,42			struct bch_qid, u64, enum quota_acct_mode);43 44void bch2_fs_quota_exit(struct bch_fs *);45void bch2_fs_quota_init(struct bch_fs *);46int bch2_fs_quota_read(struct bch_fs *);47 48extern const struct quotactl_ops bch2_quotactl_operations;49 50#else51 52static inline int bch2_quota_acct(struct bch_fs *c, struct bch_qid qid,53				  enum quota_counters counter, s64 v,54				  enum quota_acct_mode mode)55{56	return 0;57}58 59static inline int bch2_quota_transfer(struct bch_fs *c, unsigned qtypes,60				      struct bch_qid dst,61				      struct bch_qid src, u64 space,62				      enum quota_acct_mode mode)63{64	return 0;65}66 67static inline void bch2_fs_quota_exit(struct bch_fs *c) {}68static inline void bch2_fs_quota_init(struct bch_fs *c) {}69static inline int bch2_fs_quota_read(struct bch_fs *c) { return 0; }70 71#endif72 73#endif /* _BCACHEFS_QUOTA_H */74