From patchwork Thu Feb 12 09:36:45 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konstantin Khlebnikov X-Patchwork-Id: 5818521 Return-Path: X-Original-To: patchwork-linux-fsdevel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 25BF89F380 for ; Thu, 12 Feb 2015 09:38:14 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 01EE720219 for ; Thu, 12 Feb 2015 09:38:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B936B200C6 for ; Thu, 12 Feb 2015 09:38:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755409AbbBLJgx (ORCPT ); Thu, 12 Feb 2015 04:36:53 -0500 Received: from forward-corp1f.mail.yandex.net ([95.108.130.40]:41562 "EHLO forward-corp1f.mail.yandex.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752573AbbBLJgt (ORCPT ); Thu, 12 Feb 2015 04:36:49 -0500 Received: from smtpcorp1m.mail.yandex.net (smtpcorp1m.mail.yandex.net [77.88.61.150]) by forward-corp1f.mail.yandex.net (Yandex) with ESMTP id 5921824202B3; Thu, 12 Feb 2015 12:36:46 +0300 (MSK) Received: from smtpcorp1m.mail.yandex.net (localhost [127.0.0.1]) by smtpcorp1m.mail.yandex.net (Yandex) with ESMTP id 22DD22CA0439; Thu, 12 Feb 2015 12:36:46 +0300 (MSK) Received: from unknown (unknown [2a02:6b8:0:408:a4ea:72ba:f9d0:413c]) by smtpcorp1m.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id saHcM29Nzp-akOmZBe5; Thu, 12 Feb 2015 12:36:46 +0300 (using TLSv1.2 with cipher AES128-SHA (128/128 bits)) (Client certificate not present) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1423733806; bh=4Eg9K82ZhcNhONU0iPREHTw8c6NzJM7pLLx+cRnPZ6Q=; h=Subject:From:To:Cc:Date:Message-ID:In-Reply-To:References: User-Agent:MIME-Version:Content-Type:Content-Transfer-Encoding; b=A3dyiTezQEzmrqHLOyS+wGA1rtwBz5hmOEK3fNCiBEcNKHGn1PHPlA+/ananCZhBj O/u3RZAyelOu4O5sFaHxQFDmBLuPdEUK3BKzsZ43ImOOCerNP+rPmU92Lv6q6sTOj0 uxBuoiQcj3syH2Aa9+fm/BSUMHSsaANDuJ0Kholg= Authentication-Results: smtpcorp1m.mail.yandex.net; dkim=pass header.i=@yandex-team.ru Subject: [PATCH 2/2] quota: merge sb->s_quota_types into sb->s_dquot.flags From: Konstantin Khlebnikov To: linux-fsdevel@vger.kernel.org, Jan Kara Cc: linux-kernel@vger.kernel.org Date: Thu, 12 Feb 2015 12:36:45 +0300 Message-ID: <20150212093645.6055.77105.stgit@buzz> In-Reply-To: <20150212093644.6055.17019.stgit@buzz> References: <20150212093644.6055.17019.stgit@buzz> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch converts supported quota types bitmask (sb->s_quota_types) into per-type flag DQUOT_SUPPORTED in sb->s_dquot.flags. Signed-off-by: Konstantin Khlebnikov --- fs/ext2/super.c | 3 ++- fs/ext3/super.c | 3 ++- fs/ext4/super.c | 3 ++- fs/gfs2/ops_fstype.c | 3 ++- fs/jfs/super.c | 3 ++- fs/ocfs2/super.c | 3 ++- fs/quota/quota.c | 6 +++--- fs/reiserfs/super.c | 3 ++- fs/xfs/xfs_super.c | 5 ++++- include/linux/fs.h | 1 - include/linux/quota.h | 4 +++- include/linux/quotaops.h | 10 ++++++++++ 12 files changed, 34 insertions(+), 13 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/fs/ext2/super.c b/fs/ext2/super.c index ae55fdd..9e2b1c3 100644 --- a/fs/ext2/super.c +++ b/fs/ext2/super.c @@ -1099,7 +1099,8 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent) #ifdef CONFIG_QUOTA sb->dq_op = &dquot_operations; sb->s_qcop = &dquot_quotactl_ops; - sb->s_quota_types = QTYPE_MASK_USR | QTYPE_MASK_GRP; + sb_set_quota_supported(sb, USRQUOTA); + sb_set_quota_supported(sb, GRPQUOTA); #endif root = ext2_iget(sb, EXT2_ROOT_INO); diff --git a/fs/ext3/super.c b/fs/ext3/super.c index d4dbf3c..fc71d08 100644 --- a/fs/ext3/super.c +++ b/fs/ext3/super.c @@ -2012,7 +2012,8 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent) #ifdef CONFIG_QUOTA sb->s_qcop = &ext3_qctl_operations; sb->dq_op = &ext3_quota_operations; - sb->s_quota_types = QTYPE_MASK_USR | QTYPE_MASK_GRP; + sb_set_quota_supported(sb, USRQUOTA); + sb_set_quota_supported(sb, GRPQUOTA); #endif memcpy(sb->s_uuid, es->s_uuid, sizeof(es->s_uuid)); INIT_LIST_HEAD(&sbi->s_orphan); /* unlinked but open files */ diff --git a/fs/ext4/super.c b/fs/ext4/super.c index ac64edb..e36d73c 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -3925,7 +3925,8 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) sb->s_qcop = &dquot_quotactl_sysfile_ops; else sb->s_qcop = &ext4_qctl_operations; - sb->s_quota_types = QTYPE_MASK_USR | QTYPE_MASK_GRP; + sb_set_quota_supported(sb, USRQUOTA); + sb_set_quota_supported(sb, GRPQUOTA); #endif memcpy(sb->s_uuid, es->s_uuid, sizeof(es->s_uuid)); diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c index 8633ad3..3e8f590 100644 --- a/fs/gfs2/ops_fstype.c +++ b/fs/gfs2/ops_fstype.c @@ -1074,7 +1074,8 @@ static int fill_super(struct super_block *sb, struct gfs2_args *args, int silent sb->s_export_op = &gfs2_export_ops; sb->s_xattr = gfs2_xattr_handlers; sb->s_qcop = &gfs2_quotactl_ops; - sb->s_quota_types = QTYPE_MASK_USR | QTYPE_MASK_GRP; + sb_set_quota_supported(sb, USRQUOTA); + sb_set_quota_supported(sb, GRPQUOTA); sb_dqopt(sb)->flags |= DQUOT_QUOTA_SYS_FILE; sb->s_time_gran = 1; sb->s_maxbytes = MAX_LFS_FILESIZE; diff --git a/fs/jfs/super.c b/fs/jfs/super.c index 16c3a95..b820b76 100644 --- a/fs/jfs/super.c +++ b/fs/jfs/super.c @@ -540,7 +540,8 @@ static int jfs_fill_super(struct super_block *sb, void *data, int silent) #ifdef CONFIG_QUOTA sb->dq_op = &dquot_operations; sb->s_qcop = &dquot_quotactl_ops; - sb->s_quota_types = QTYPE_MASK_USR | QTYPE_MASK_GRP; + sb_set_quota_supported(sb, USRQUOTA); + sb_set_quota_supported(sb, GRPQUOTA); #endif /* diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c index 87a1f76..1db5903 100644 --- a/fs/ocfs2/super.c +++ b/fs/ocfs2/super.c @@ -2059,7 +2059,8 @@ static int ocfs2_initialize_super(struct super_block *sb, sb->s_export_op = &ocfs2_export_ops; sb->s_qcop = &dquot_quotactl_sysfile_ops; sb->dq_op = &ocfs2_quota_operations; - sb->s_quota_types = QTYPE_MASK_USR | QTYPE_MASK_GRP; + sb_set_quota_supported(sb, USRQUOTA); + sb_set_quota_supported(sb, GRPQUOTA); sb->s_xattr = ocfs2_xattr_handlers; sb->s_time_gran = 1; sb->s_flags |= MS_NOATIME; diff --git a/fs/quota/quota.c b/fs/quota/quota.c index d14a799..28d54bc 100644 --- a/fs/quota/quota.c +++ b/fs/quota/quota.c @@ -50,7 +50,7 @@ static void quota_sync_one(struct super_block *sb, void *arg) int type = *(int *)arg; if (sb->s_qcop && sb->s_qcop->quota_sync && - (sb->s_quota_types & (1 << type))) + sb_has_quota_supported(sb, type)) sb->s_qcop->quota_sync(sb, type); } @@ -446,12 +446,12 @@ static int do_quotactl(struct super_block *sb, int type, int cmd, qid_t id, if (type >= (XQM_COMMAND(cmd) ? XQM_MAXQUOTAS : MAXQUOTAS)) return -EINVAL; /* - * Quota not supported on this fs? Check this before s_quota_types + * Quota not supported on this fs? Check this before sb_dqopt flags * since they needn't be set if quota is not supported at all. */ if (!sb->s_qcop) return -ENOSYS; - if (!(sb->s_quota_types & (1 << type))) + if (!sb_has_quota_supported(sb, type)) return -EINVAL; ret = check_quotactl_permission(sb, type, cmd, id); diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c index 71fbbe3..f08740f 100644 --- a/fs/reiserfs/super.c +++ b/fs/reiserfs/super.c @@ -1643,7 +1643,8 @@ static int read_super_block(struct super_block *s, int offset) #ifdef CONFIG_QUOTA s->s_qcop = &reiserfs_qctl_operations; s->dq_op = &reiserfs_quota_operations; - s->s_quota_types = QTYPE_MASK_USR | QTYPE_MASK_GRP; + sb_set_quota_supported(sb, USRQUOTA); + sb_set_quota_supported(sb, GRPQUOTA); #endif /* diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c index f2449fd..f8806c89 100644 --- a/fs/xfs/xfs_super.c +++ b/fs/xfs/xfs_super.c @@ -55,6 +55,7 @@ #include #include #include +#include static const struct super_operations xfs_super_operations; static kmem_zone_t *xfs_ioend_zone; @@ -1434,7 +1435,9 @@ xfs_fs_fill_super( sb->s_export_op = &xfs_export_operations; #ifdef CONFIG_XFS_QUOTA sb->s_qcop = &xfs_quotactl_operations; - sb->s_quota_types = QTYPE_MASK_USR | QTYPE_MASK_GRP | QTYPE_MASK_PRJ; + sb_set_quota_supported(sb, USRQUOTA); + sb_set_quota_supported(sb, GRPQUOTA); + sb_set_quota_supported(sb, PRJQUOTA); #endif sb->s_op = &xfs_super_operations; diff --git a/include/linux/fs.h b/include/linux/fs.h index f125b88..e1d19b6 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -1257,7 +1257,6 @@ struct super_block { struct backing_dev_info *s_bdi; struct mtd_info *s_mtd; struct hlist_node s_instances; - unsigned int s_quota_types; /* Bitmask of supported quota types */ struct quota_info s_dquot; /* Diskquota specific options */ struct sb_writers s_writers; diff --git a/include/linux/quota.h b/include/linux/quota.h index 205b4f7..3c6cc80 100644 --- a/include/linux/quota.h +++ b/include/linux/quota.h @@ -391,13 +391,15 @@ struct quota_format_type { /* Quota state flags - they actually come in two flavors - for users and groups */ enum { - _DQUOT_USAGE_ENABLED = 0, /* Track disk usage for users */ + _DQUOT_SUPPORTED = 0, /* Quota type supported by fs */ + _DQUOT_USAGE_ENABLED, /* Track disk usage for users */ _DQUOT_LIMITS_ENABLED, /* Enforce quota limits for users */ _DQUOT_SUSPENDED, /* User diskquotas are off, but * we have necessary info in * memory to turn them on */ _DQUOT_STATE_FLAGS }; +#define DQUOT_SUPPORTED (1 << _DQUOT_SUPPORTED * MAXQUOTAS) #define DQUOT_USAGE_ENABLED (1 << _DQUOT_USAGE_ENABLED * MAXQUOTAS) #define DQUOT_LIMITS_ENABLED (1 << _DQUOT_LIMITS_ENABLED * MAXQUOTAS) #define DQUOT_SUSPENDED (1 << _DQUOT_SUSPENDED * MAXQUOTAS) diff --git a/include/linux/quotaops.h b/include/linux/quotaops.h index 8778ec4..e431a87 100644 --- a/include/linux/quotaops.h +++ b/include/linux/quotaops.h @@ -110,10 +110,20 @@ static inline struct mem_dqinfo *sb_dqinfo(struct super_block *sb, int type) return sb_dqopt(sb)->info + type; } +static inline void sb_set_quota_supported(struct super_block *sb, unsigned type) +{ + sb_dqopt(sb)->flags |= dquot_state_flag(DQUOT_SUPPORTED, type); +} + /* * Functions for checking status of quota */ +static inline bool sb_has_quota_supported(struct super_block *sb, unsigned type) +{ + return sb_dqopt(sb)->flags & dquot_state_flag(DQUOT_SUPPORTED, type); +} + static inline bool sb_has_quota_usage_enabled(struct super_block *sb, int type) { return sb_dqopt(sb)->flags &