From 4506cd5ead31209a6a646c2412cbc7be735ebda4 Mon Sep 17 00:00:00 2001 From: Kent Overstreet Date: Fri, 9 Feb 2018 14:18:56 -0500 Subject: bcachefs: minor prjquota fixes --- fs/bcachefs/quota.c | 12 ++---------- fs/bcachefs/quota.h | 7 +++++++ fs/bcachefs/super.c | 4 ++-- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/fs/bcachefs/quota.c b/fs/bcachefs/quota.c index 6ab2c866a168..d28f1333e693 100644 --- a/fs/bcachefs/quota.c +++ b/fs/bcachefs/quota.c @@ -74,13 +74,6 @@ static inline unsigned __next_qtype(unsigned i, unsigned qtypes) _i < QTYP_NR); \ _i++) -static inline unsigned enabled_qtypes(struct bch_fs *c) -{ - return ((c->opts.usrquota << QTYP_USR)| - (c->opts.grpquota << QTYP_GRP)| - (c->opts.prjquota << QTYP_PRJ)); -} - static bool ignore_hardlimit(struct bch_memquota_type *q) { if (capable(CAP_SYS_RESOURCE)) @@ -478,7 +471,7 @@ static int bch2_quota_enable(struct super_block *sb, unsigned uflags) if ((uflags & FS_QUOTA_GDQ_ENFD) && !c->opts.grpquota) return -EINVAL; - if (uflags & FS_QUOTA_PDQ_ENFD) + if (uflags & FS_QUOTA_PDQ_ENFD && !c->opts.prjquota) return -EINVAL; mutex_lock(&c->sb_lock); @@ -487,10 +480,9 @@ static int bch2_quota_enable(struct super_block *sb, unsigned uflags) if (uflags & FS_QUOTA_GDQ_ENFD) SET_BCH_SB_GRPQUOTA(c->disk_sb, true); -#if 0 + if (uflags & FS_QUOTA_PDQ_ENFD) SET_BCH_SB_PRJQUOTA(c->disk_sb, true); -#endif bch2_write_super(c); mutex_unlock(&c->sb_lock); diff --git a/fs/bcachefs/quota.h b/fs/bcachefs/quota.h index b5536be94ed4..509b7f0e069d 100644 --- a/fs/bcachefs/quota.h +++ b/fs/bcachefs/quota.h @@ -20,6 +20,13 @@ static inline struct bch_qid bch_qid(struct bch_inode_unpacked *u) }; } +static inline unsigned enabled_qtypes(struct bch_fs *c) +{ + return ((c->opts.usrquota << QTYP_USR)| + (c->opts.grpquota << QTYP_GRP)| + (c->opts.prjquota << QTYP_PRJ)); +} + #ifdef CONFIG_BCACHEFS_QUOTA int bch2_quota_acct(struct bch_fs *, struct bch_qid, enum quota_counters, diff --git a/fs/bcachefs/super.c b/fs/bcachefs/super.c index d450bc48b5b1..f48744fa9acb 100644 --- a/fs/bcachefs/super.c +++ b/fs/bcachefs/super.c @@ -814,7 +814,7 @@ static const char *__bch2_fs_start(struct bch_fs *c) goto err; bch_verbose(c, "fsck done"); - if (c->opts.usrquota || c->opts.grpquota) { + if (enabled_qtypes(c)) { bch_verbose(c, "reading quotas:"); ret = bch2_fs_quota_read(c); if (ret) @@ -869,7 +869,7 @@ static const char *__bch2_fs_start(struct bch_fs *c) NULL, NULL, NULL, 0)) goto err; - if (c->opts.usrquota || c->opts.grpquota) { + if (enabled_qtypes(c)) { ret = bch2_fs_quota_read(c); if (ret) goto err; -- cgit v1.2.3