[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230310064312.GP3390869@ZenIV>
Date: Fri, 10 Mar 2023 06:43:12 +0000
From: Al Viro <viro@...iv.linux.org.uk>
To: Eric Biggers <ebiggers@...nel.org>
Cc: Yangtao Li <frank.li@...o.com>, tytso@....edu,
adilger.kernel@...ger.ca, linux-ext4@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] ext4: convert to DIV_ROUND_UP() in
mpage_process_page_bufs()
On Fri, Mar 10, 2023 at 06:37:29AM +0000, Al Viro wrote:
> On Thu, Mar 09, 2023 at 10:17:16PM -0800, Eric Biggers wrote:
> > On Fri, Mar 10, 2023 at 02:07:34PM +0800, Yangtao Li wrote:
> > > Just for better readability, no code logic change.
> > >
> > > Signed-off-by: Yangtao Li <frank.li@...o.com>
> > > ---
> > > fs/ext4/inode.c | 3 +--
> > > 1 file changed, 1 insertion(+), 2 deletions(-)
> > >
> > > diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
> > > index d251d705c276..d121cde74522 100644
> > > --- a/fs/ext4/inode.c
> > > +++ b/fs/ext4/inode.c
> > > @@ -2218,8 +2218,7 @@ static int mpage_process_page_bufs(struct mpage_da_data *mpd,
> > > {
> > > struct inode *inode = mpd->inode;
> > > int err;
> > > - ext4_lblk_t blocks = (i_size_read(inode) + i_blocksize(inode) - 1)
> > > - >> inode->i_blkbits;
> > > + ext4_lblk_t blocks = DIV_ROUND_UP(i_size_read(inode), i_blocksize(inode));
> > >
> >
> > Please don't do this. This makes the code compile down to a division, which is
> > far less efficient. I've verified this by checking the assembly generated.
>
> Which compiler is doing that?
While we are at it, replace
return (1 << node->i_blkbits);
with
return (1u << node->i_blkbits);
and see if that changes the things.
Powered by blists - more mailing lists