From: Jan Kara <jack@suse.cz>
To: Andreas Dilger <adilger@dilger.ca>
Cc: Jan Kara <jack@suse.cz>, Dave Chinner <david@fromorbit.com>,
linux-fsdevel <linux-fsdevel@vger.kernel.org>,
Ext4 Developers List <linux-ext4@vger.kernel.org>,
xfs@oss.sgi.com, cluster-devel <cluster-devel@redhat.com>,
Steven Whitehouse <swhiteho@redhat.com>,
Mark Fasheh <mfasheh@suse.com>, Joel Becker <jlbec@evilplan.org>,
ocfs2-devel@oss.oracle.com, reiserfs-devel@vger.kernel.org,
Jeff Mahoney <jeffm@suse.de>, Dave Kleikamp <shaggy@kernel.org>,
jfs-discussion@lists.sourceforge.net, tytso@mit.edu
Subject: Re: [PATCH 03/12] xfs: Set allowed quota types
Date: Wed, 8 Oct 2014 10:42:51 +0200 [thread overview]
Message-ID: <20141008084251.GB11781@quack.suse.cz> (raw)
In-Reply-To: <3391F66C-E2A7-4FC8-8696-3C1600D54DA9@dilger.ca>
On Tue 07-10-14 13:46:20, Andreas Dilger wrote:
> On Oct 7, 2014, at 1:29 PM, Jan Kara <jack@suse.cz> wrote:
> > On Tue 07-10-14 07:30:28, Dave Chinner wrote:
> >> On Wed, Oct 01, 2014 at 09:31:25PM +0200, Jan Kara wrote:
> >>> We support user, group, and project quotas. Tell VFS about it.
> >>>
> >>> CC: xfs@oss.sgi.com
> >>> CC: Dave Chinner <david@fromorbit.com>
> >>> Signed-off-by: Jan Kara <jack@suse.cz>
> >>> ---
> >>> fs/xfs/xfs_super.c | 2 ++
> >>> 1 file changed, 2 insertions(+)
> >>>
> >>> diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
> >>> index b194652033cd..b32e998e8cbc 100644
> >>> --- a/fs/xfs/xfs_super.c
> >>> +++ b/fs/xfs/xfs_super.c
> >>> @@ -1419,6 +1419,8 @@ xfs_fs_fill_super(
> >>> sb->s_export_op = &xfs_export_operations;
> >>> #ifdef CONFIG_XFS_QUOTA
> >>> sb->s_qcop = &xfs_quotactl_operations;
> >>> + sb->s_dquot.allowed_types = (1 << USRQUOTA) | (1 << GRPQUOTA) |
> >>> + (1 << PRJQUOTA);
> >>
> >> Would it be better to define masks for these rather than open
> >> coding these shifts everywhere?
> > I can do that. Any suggestion for a name? I was thinking about it for a
> > while and couldn't come up with anything satisfactory...
>
> Better to have QUOTA at the start, and TYPE in the name, so maybe:
>
> enum quota_types {
> QUOTA_TYPE_USR = 1 << USRQUOTA,
> QUOTA_TYPE_GRP = 1 << GRPQUOTA,
> QUOTA_TYPE_PRJ = 1 << PRJQUOTA,
> };
>
> or maybe "enum quota_type_mask" or similar.
>
> I prefer named enums over #defines since this makes it more clear
> when declaring variables like "allowed_types" what valid values are
> instead of just "int" that someone might mistakenly set to USRQUOTA
> directly or something.
OK, QUOTA_TYPE_USR etc. looks good. I'm not so sure about named enum. I'd
be fine with named enum for USRQUOTA, GRPQUOTA, etc. - i.e., types which
should have one of the named values but for a bitmask with arbitrary
combinations of flags it looks confusing to me (although technically
it would work).
Honza
--
Jan Kara <jack@suse.cz>
SUSE Labs, CR
next prev parent reply other threads:[~2014-10-08 8:42 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-01 19:31 [PATCH 0/12 RFC] Moving i_dquot out of struct inode Jan Kara
2014-10-01 19:31 ` [PATCH 01/12] quota: Allow each filesystem to specify which quota types it supports Jan Kara
2014-10-01 19:31 ` [PATCH 02/12] gfs2: Set allowed quota types Jan Kara
2014-10-02 10:41 ` Steven Whitehouse
2014-10-01 19:31 ` [PATCH 03/12] xfs: " Jan Kara
2014-10-06 20:30 ` Dave Chinner
2014-10-07 19:29 ` Jan Kara
2014-10-07 19:46 ` Andreas Dilger
2014-10-08 8:42 ` Jan Kara [this message]
2014-10-01 19:31 ` [PATCH 04/12] fs: Generic infrastructure for optional inode fields Jan Kara
2014-10-01 21:05 ` Andreas Dilger
2014-10-08 8:45 ` Jan Kara
2014-10-01 19:31 ` [PATCH 05/12] quota: Use optional inode field for i_dquot pointers Jan Kara
2014-10-01 19:31 ` [PATCH 06/12] ext2: Convert to private i_dquot field Jan Kara
2014-10-01 19:31 ` [PATCH 07/12] ext3: " Jan Kara
2014-10-01 19:31 ` [PATCH 08/12] ext4: " Jan Kara
2014-10-01 19:31 ` [PATCH 09/12] ocfs2: " Jan Kara
2014-10-01 19:31 ` [PATCH 10/12] reiserfs: " Jan Kara
2014-10-01 19:31 ` [PATCH 11/12] jfs: " Jan Kara
2014-10-01 19:31 ` [PATCH 12/12] vfs: Remove i_dquot field from inode Jan Kara
-- strict thread matches above, loose matches on Subject: below --
2014-10-10 14:54 [PATCH 0/12 v2] Moving i_dquot out of struct inode Jan Kara
2014-10-10 14:55 ` [PATCH 03/12] xfs: Set allowed quota types Jan Kara
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20141008084251.GB11781@quack.suse.cz \
--to=jack@suse.cz \
--cc=adilger@dilger.ca \
--cc=cluster-devel@redhat.com \
--cc=david@fromorbit.com \
--cc=jeffm@suse.de \
--cc=jfs-discussion@lists.sourceforge.net \
--cc=jlbec@evilplan.org \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=mfasheh@suse.com \
--cc=ocfs2-devel@oss.oracle.com \
--cc=reiserfs-devel@vger.kernel.org \
--cc=shaggy@kernel.org \
--cc=swhiteho@redhat.com \
--cc=tytso@mit.edu \
--cc=xfs@oss.sgi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).