lkml.org 
[lkml]   [2023]   [Apr]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 3/5] iomap: simplify iomap_init() with PAGE_SECTORS
On Sat, Apr 22, 2023 at 08:34:20AM +1000, Dave Chinner wrote:
> >
> > - 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.

We still had cases of the compiler not doing obvious
multiplication/division to shift conversion lately. That being said:

1) this is an initialization path, no one actually cares
2) we're dealing with constants here, and compilers are really good
at constant folding

so yes, this should be using the much more readable version.

\
 
 \ /
  Last update: 2023-04-24 07:59    [W:0.121 / U:0.508 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site