From: Jan Kara <jack@suse.cz>
To: Li Xi <pkuelelixi@gmail.com>
Cc: linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org,
linux-api@vger.kernel.org, tytso@mit.edu, adilger@dilger.ca,
jack@suse.cz, viro@zeniv.linux.org.uk, hch@infradead.org,
dmonakhov@openvz.org
Subject: Re: [PATCH 2/4] Adds project ID support for ext4
Date: Wed, 24 Sep 2014 19:11:08 +0200 [thread overview]
Message-ID: <20140924171108.GG27000@quack.suse.cz> (raw)
In-Reply-To: <1411567470-31799-3-git-send-email-lixi@ddn.com>
On Wed 24-09-14 22:04:28, Li Xi wrote:
> This patch adds a new internal field of ext4 inode to save project
> identifier. Also a new flag EXT4_INODE_PROJINHERIT is added for
> inheriting project ID from parent directory.
Nice. Just a few smaller things below.
Firstly, I think your patch forgets to add a check to EXT4_IOC_SETFLAGS
ioctl so that EXT4_INODE_PROJINHERIT flag can be set only when
EXT4_FEATURE_RO_COMPAT_PROJECT is enabled.
> Signed-off-by: Li Xi <lixi@ddn.com>
> ---
> fs/ext4/ext4.h | 21 +++++++++++++++++----
> fs/ext4/ialloc.c | 6 ++++++
> fs/ext4/inode.c | 29 ++++++++++++++++++++++++++++-
> fs/ext4/namei.c | 10 ++++++++++
> fs/ext4/super.c | 1 +
> 5 files changed, 62 insertions(+), 5 deletions(-)
>
...
> diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c
> index 5b87fc3..b6b7284 100644
> --- a/fs/ext4/ialloc.c
> +++ b/fs/ext4/ialloc.c
> @@ -756,6 +756,12 @@ struct inode *__ext4_new_inode(handle_t *handle, struct inode *dir,
> inode->i_gid = dir->i_gid;
> } else
> inode_init_owner(inode, dir, mode);
> + if (ext4_test_inode_flag(dir, EXT4_INODE_PROJINHERIT)) {
> + ei->i_projid = EXT4_I(dir)->i_projid;
> + } else {
> + ei->i_projid =
> + make_kprojid(&init_user_ns, EXT4_DEF_PROJID);
> + }
> dquot_initialize(inode);
>
> if (!goal)
> diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
> index d5dd7d4..8c641eb 100644
> --- a/fs/ext4/inode.c
> +++ b/fs/ext4/inode.c
> @@ -3874,6 +3874,24 @@ static inline void ext4_iget_extra_inode(struct inode *inode,
> EXT4_I(inode)->i_inline_off = 0;
> }
>
> +static projid_t ext4_inode_projid_get(struct inode *inode, struct ext4_inode *raw,
> + struct ext4_inode_info *ei)
> +{
> + return (projid_t)le32_to_cpu(raw->i_projid);
> +}
> +
> +static void ext4_inode_projid_set(struct inode *inode, struct ext4_inode *raw,
> + struct ext4_inode_info *ei, projid_t projid)
> +{
> + raw->i_projid = cpu_to_le32(projid);
> +}
I don't see a need for these two wrappers. IMHO they just obfuscate the
code. Please just write the code directly in appropriate place.
> @@ -4204,7 +4228,8 @@ static int ext4_do_update_inode(handle_t *handle,
> EXT4_INODE_SET_XTIME(i_atime, inode, raw_inode);
> EXT4_EINODE_SET_XTIME(i_crtime, ei, raw_inode);
>
> - if (ext4_inode_blocks_set(handle, raw_inode, ei)) {
> + err = ext4_inode_blocks_set(handle, raw_inode, ei);
> + if (err) {
> spin_unlock(&ei->i_raw_lock);
> goto out_brelse;
> }
This is an unrelated fix, right? Please send as a separate patch. Thanks!
> @@ -4255,6 +4280,8 @@ static int ext4_do_update_inode(handle_t *handle,
>
> ext4_inode_csum_set(inode, raw_inode, ei);
>
> + ext4_inode_projid_set(inode, raw_inode, ei, i_projid);
> +
This is wrong - you have to set project ID before a checksum is computed.
Honza
--
Jan Kara <jack@suse.cz>
SUSE Labs, CR
next prev parent reply other threads:[~2014-09-24 17:11 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-24 14:04 [PATCH 0/4] quota: add project quota support Li Xi
2014-09-24 14:04 ` [PATCH 1/4] Adds general codes to enforces project quota limits Li Xi
2014-09-24 16:08 ` Jan Kara
[not found] ` <1411567470-31799-2-git-send-email-lixi-LfVdkaOWEx8@public.gmane.org>
2014-09-24 16:14 ` Christoph Hellwig
[not found] ` <20140924161417.GA1978-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2014-09-24 17:10 ` Jan Kara
[not found] ` <20140924171020.GF27000-+0h/O2h83AeN3ZZ/Hiejyg@public.gmane.org>
2014-09-24 17:13 ` Christoph Hellwig
[not found] ` <20140924171306.GA23874-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2014-09-24 17:37 ` Jan Kara
2014-09-30 20:07 ` Jan Kara
2014-09-24 14:04 ` [PATCH 2/4] Adds project ID support for ext4 Li Xi
2014-09-24 17:11 ` Jan Kara [this message]
2014-09-25 1:09 ` Li Xi
2014-09-24 14:04 ` [PATCH 3/4] Adds project quota " Li Xi
[not found] ` <1411567470-31799-4-git-send-email-lixi-LfVdkaOWEx8@public.gmane.org>
2014-09-24 17:31 ` Jan Kara
[not found] ` <20140924173123.GH27000-+0h/O2h83AeN3ZZ/Hiejyg@public.gmane.org>
2014-09-25 1:28 ` Li Xi
[not found] ` <CAPTn0cB8X3DYprX-oKCu8aV5OLLfJJ2rh9YvMY7re69gi1s-LA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-09-25 11:55 ` Jan Kara
2014-09-24 14:04 ` [PATCH 4/4] Adds ioctl interface support for ext4 project Li Xi
2014-09-24 16:25 ` Jan Kara
2014-09-24 16:26 ` Christoph Hellwig
2014-09-24 17:01 ` Jan Kara
2014-09-25 7:59 ` Dave Chinner
2014-09-25 11:34 ` lixi
[not found] ` <C31A739F-4502-4B40-9AE3-F2FE49291657-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-09-26 0:10 ` Dave Chinner
2014-09-26 2:45 ` Li Xi
2014-09-25 13:41 ` Theodore Ts'o
[not found] ` <20140925134136.GE4592-AKGzg7BKzIDYtjvyW6yDsg@public.gmane.org>
2014-09-25 22:22 ` Dave Chinner
2014-09-25 13:52 ` Jan Kara
2014-09-25 22:42 ` Dave Chinner
2014-09-26 12:01 ` Theodore Ts'o
2014-09-29 15:55 ` Jan Kara
2014-09-25 7:26 ` Dave Chinner
[not found] ` <1411567470-31799-5-git-send-email-lixi-LfVdkaOWEx8@public.gmane.org>
2014-09-24 16:43 ` 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=20140924171108.GG27000@quack.suse.cz \
--to=jack@suse.cz \
--cc=adilger@dilger.ca \
--cc=dmonakhov@openvz.org \
--cc=hch@infradead.org \
--cc=linux-api@vger.kernel.org \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=pkuelelixi@gmail.com \
--cc=tytso@mit.edu \
--cc=viro@zeniv.linux.org.uk \
/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).