[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230421223420.GH3223426@dread.disaster.area>
Date: Sat, 22 Apr 2023 08:34:20 +1000
From: Dave Chinner <david@...morbit.com>
To: Luis Chamberlain <mcgrof@...nel.org>
Cc: Matthew Wilcox <willy@...radead.org>, axboe@...nel.dk,
agk@...hat.com, snitzer@...nel.org, philipp.reisner@...bit.com,
lars.ellenberg@...bit.com, christoph.boehmwalder@...bit.com,
hch@...radead.org, djwong@...nel.org, minchan@...nel.org,
senozhatsky@...omium.org, patches@...ts.linux.dev,
linux-block@...r.kernel.org, linux-mm@...ck.org,
linux-xfs@...r.kernel.org, linux-fsdevel@...r.kernel.org,
dm-devel@...hat.com, drbd-dev@...ts.linbit.com,
linux-kernel@...r.kernel.org, hare@...e.de, p.raghav@...sung.com,
da.gomez@...sung.com, kbusch@...nel.org
Subject: Re: [PATCH 3/5] iomap: simplify iomap_init() with PAGE_SECTORS
On Fri, Apr 21, 2023 at 03:02:30PM -0700, Luis Chamberlain wrote:
> On Fri, Apr 21, 2023 at 09:14:00PM +0100, Matthew Wilcox wrote:
> > On Fri, Apr 21, 2023 at 12:58:05PM -0700, Luis Chamberlain wrote:
> > > Just use the PAGE_SECTORS generic define. This produces no functional
> > > changes. While at it use left shift to simplify this even further.
> >
> > How is FOO << 2 simpler than FOO * 4?
> >
> > > - return bioset_init(&iomap_ioend_bioset, 4 * (PAGE_SIZE / SECTOR_SIZE),
> > > + return bioset_init(&iomap_ioend_bioset, PAGE_SECTORS << 2,
>
> We could just do:
>
>
> - return bioset_init(&iomap_ioend_bioset, 4 * (PAGE_SIZE / SECTOR_SIZE),
> + return bioset_init(&iomap_ioend_bioset, 4 * PAGE_SECTORS,
Yes, please.
> The shift just seemed optimal if we're just going to change it.
Nope, it's just premature optimisation at the expense of
maintainability. The compiler will optimise the multiplication into
shifts if that is the fastest way to do it for the given
architecture the code is being compiled to.
-Dave.
--
Dave Chinner
david@...morbit.com
Powered by blists - more mailing lists