public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton@redhat.com>
To: Jan Kara <jack@suse.cz>
Cc: tytso@mit.edu, adilger.kernel@dilger.ca,
	linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH] ext4: convert swap_inode_data() over to use swap() on most of the fields
Date: Wed, 04 Jan 2017 15:21:28 -0500	[thread overview]
Message-ID: <1483561288.1826.1.camel@redhat.com> (raw)
In-Reply-To: <20170104154332.GA3607@quack2.suse.cz>

On Wed, 2017-01-04 at 16:43 +0100, Jan Kara wrote:
> On Tue 20-12-16 10:55:41, Jeff Layton wrote:
> > 
> > For some odd reason, it forces a byte-by-byte copy of each field. A
> > plain old swap() on most of these fields would be more efficient. We
> > do need to retain one memswap however as that field is an array.
> > 
> > Signed-off-by: Jeff Layton <jlayton@redhat.com>
> 
> Looks good to me. You can add:
> 
> Reviewed-by: Jan Kara <jack@suse.cz>
> 
> 								Honza
> 

Thanks. Yeah, it's certainly nothing critical -- just something I
noticed while looking at the i_version rework. Seems like it might be
good to let soak in next for v4.11?

> > 
> > ---
> >  fs/ext4/ioctl.c | 18 ++++++++----------
> >  1 file changed, 8 insertions(+), 10 deletions(-)
> > 
> > diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c
> > index 49fd1371bfa2..fb844da4836f 100644
> > --- a/fs/ext4/ioctl.c
> > +++ b/fs/ext4/ioctl.c
> > @@ -60,18 +60,16 @@ static void swap_inode_data(struct inode *inode1, struct inode *inode2)
> >  	ei1 = EXT4_I(inode1);
> >  	ei2 = EXT4_I(inode2);
> >  
> > -	memswap(&inode1->i_flags, &inode2->i_flags, sizeof(inode1->i_flags));
> > -	memswap(&inode1->i_version, &inode2->i_version,
> > -		  sizeof(inode1->i_version));
> > -	memswap(&inode1->i_blocks, &inode2->i_blocks,
> > -		  sizeof(inode1->i_blocks));
> > -	memswap(&inode1->i_bytes, &inode2->i_bytes, sizeof(inode1->i_bytes));
> > -	memswap(&inode1->i_atime, &inode2->i_atime, sizeof(inode1->i_atime));
> > -	memswap(&inode1->i_mtime, &inode2->i_mtime, sizeof(inode1->i_mtime));
> > +	swap(inode1->i_flags, inode2->i_flags);
> > +	swap(inode1->i_version, inode2->i_version);
> > +	swap(inode1->i_blocks, inode2->i_blocks);
> > +	swap(inode1->i_bytes, inode2->i_bytes);
> > +	swap(inode1->i_atime, inode2->i_atime);
> > +	swap(inode1->i_mtime, inode2->i_mtime);
> >  
> >  	memswap(ei1->i_data, ei2->i_data, sizeof(ei1->i_data));
> > -	memswap(&ei1->i_flags, &ei2->i_flags, sizeof(ei1->i_flags));
> > -	memswap(&ei1->i_disksize, &ei2->i_disksize, sizeof(ei1->i_disksize));
> > +	swap(ei1->i_flags, ei2->i_flags);
> > +	swap(ei1->i_disksize, ei2->i_disksize);
> >  	ext4_es_remove_extent(inode1, 0, EXT_MAX_BLOCKS);
> >  	ext4_es_remove_extent(inode2, 0, EXT_MAX_BLOCKS);
> >  
> > -- 
> > 2.7.4
> > 
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 
Jeff Layton <jlayton@redhat.com>

  reply	other threads:[~2017-01-04 20:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-20 15:55 [RFC PATCH] ext4: convert swap_inode_data() over to use swap() on most of the fields Jeff Layton
2017-01-04 15:43 ` Jan Kara
2017-01-04 20:21   ` Jeff Layton [this message]
2017-01-05  7:24     ` 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=1483561288.1826.1.camel@redhat.com \
    --to=jlayton@redhat.com \
    --cc=adilger.kernel@dilger.ca \
    --cc=jack@suse.cz \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tytso@mit.edu \
    /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