From: Jan Kara <jack@suse.cz>
To: Miklos Szeredi <miklos@szeredi.hu>
Cc: viro@ZenIV.linux.org.uk, torvalds@linux-foundation.org,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
hch@infradead.org, akpm@linux-foundation.org,
dhowells@redhat.com, zab@redhat.com, jack@suse.cz,
luto@amacapital.net, mszeredi@suse.cz
Subject: Re: [PATCH 08/11] ext4: rename: create ext4_renament structure for local vars
Date: Tue, 26 Nov 2013 09:04:36 +0100 [thread overview]
Message-ID: <20131126080436.GA1384@quack.suse.cz> (raw)
In-Reply-To: <1384952512-21600-9-git-send-email-miklos@szeredi.hu>
On Wed 20-11-13 14:01:49, Miklos Szeredi wrote:
> From: Miklos Szeredi <mszeredi@suse.cz>
>
> Need to split up ext4_rename() into helpers but there are two many local
^^ too
> variables involved, so create a new structure. This also, apparently,
> makes the generated code size slightly smaller.
>
> Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
> ---
> fs/ext4/namei.c | 211 ++++++++++++++++++++++++++++++--------------------------
> 1 file changed, 114 insertions(+), 97 deletions(-)
>
> diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
> index e0129b6e74cf..c9e38bd30e8b 100644
> --- a/fs/ext4/namei.c
> +++ b/fs/ext4/namei.c
> @@ -3001,6 +3001,22 @@ static struct buffer_head *ext4_get_first_dir_block(handle_t *handle,
> return ext4_get_first_inline_block(inode, parent_de, retval);
> }
>
> +struct ext4_renament {
> + struct inode *dir;
> + struct dentry *dentry;
> + struct inode *inode;
> +
> + /* entry for "dentry" */
> + struct buffer_head *bh;
> + struct ext4_dir_entry_2 *de;
> + int inlined;
> +
> + /* entry for parent block of inode if it's a directory */
Maybe "entry for '..' in inode if it is a directory"? It looks more
comprehensible to me.
> + struct buffer_head *dir_bh;
> + struct ext4_dir_entry_2 *parent_de;
> + int dir_inlined;
> +};
> +
> /*
> * Anybody can rename anything with this: the permission checks are left to the
> * higher-level routines.
> @@ -3014,196 +3030,197 @@ static int ext4_rename(struct inode *old_dir, struct dentry *old_dentry,
> unsigned int flags)
> {
> handle_t *handle = NULL;
> - struct inode *old_inode, *new_inode;
> - struct buffer_head *old_bh, *new_bh, *dir_bh;
> - struct ext4_dir_entry_2 *old_de, *new_de;
> + struct ext4_renament old = {
> + .dir = old_dir,
> + .dentry = old_dentry,
> + };
> + struct ext4_renament new = {
> + .dir = new_dir,
> + .dentry = new_dentry,
> + };
The code would look slightly more logical if we initialized .inode as
well. Not sure if it is worth an extra patch or if you just fold it here...
Otherwise the patch looks good. You can add:
Reviewed-by: Jan Kara <jack@suse.cz>
Honza
--
Jan Kara <jack@suse.cz>
SUSE Labs, CR
next prev parent reply other threads:[~2013-11-26 8:04 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-20 13:01 [PATCH 00/11] cross rename v2 Miklos Szeredi
2013-11-20 13:01 ` [PATCH 01/11] vfs: add d_is_dir() Miklos Szeredi
2013-11-20 13:01 ` [PATCH 02/11] vfs: rename: move d_move() up Miklos Szeredi
2013-11-20 13:01 ` [PATCH 03/11] vfs: rename: use common code for dir and non-dir Miklos Szeredi
2013-11-20 13:01 ` [PATCH 04/11] vfs: add renameat2 syscall Miklos Szeredi
2013-11-20 16:34 ` Andy Lutomirski
2013-11-21 4:10 ` Stephen Rothwell
2013-11-21 12:37 ` Miklos Szeredi
2013-11-20 13:01 ` [PATCH 05/11] vfs: add RENAME_NOREPLACE flag Miklos Szeredi
2013-11-20 13:01 ` [PATCH 06/11] security: add flags to rename hooks Miklos Szeredi
2013-11-20 13:01 ` [PATCH 07/11] vfs: add cross-rename Miklos Szeredi
2013-11-20 16:39 ` Andy Lutomirski
2013-11-20 16:44 ` Miklos Szeredi
2013-11-20 16:51 ` Andy Lutomirski
2013-11-20 13:01 ` [PATCH 08/11] ext4: rename: create ext4_renament structure for local vars Miklos Szeredi
2013-11-26 8:04 ` Jan Kara [this message]
2013-11-20 13:01 ` [PATCH 09/11] ext4: rename: move EMLINK check up Miklos Szeredi
2013-11-20 13:01 ` [PATCH 10/11] ext4: rename: split out helper functions Miklos Szeredi
2013-11-20 13:01 ` [PATCH 11/11] ext4: add cross rename support Miklos Szeredi
2013-11-26 9:51 ` Jan Kara
2013-11-26 13:47 ` Miklos Szeredi
-- strict thread matches above, loose matches on Subject: below --
2014-01-08 22:10 [PATCH 00/11] cross rename v3 Miklos Szeredi
2014-01-08 22:10 ` [PATCH 08/11] ext4: rename: create ext4_renament structure for local vars Miklos Szeredi
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=20131126080436.GA1384@quack.suse.cz \
--to=jack@suse.cz \
--cc=akpm@linux-foundation.org \
--cc=dhowells@redhat.com \
--cc=hch@infradead.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@amacapital.net \
--cc=miklos@szeredi.hu \
--cc=mszeredi@suse.cz \
--cc=torvalds@linux-foundation.org \
--cc=viro@ZenIV.linux.org.uk \
--cc=zab@redhat.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).