Re: [PATCH 02/15] block: refactor disk_update_readahead

Christoph Hellwig
2024-01-23T08:40:43Z

On Tue, Jan 23, 2024 at 01:41:05PM +0900, Damien Le Moal wrote:
> > +{
> > + /*
> > + * For read-ahead of large files to be effective, we need to read ahead
> > + * at least twice the optimal I/O size.
> > + */
> > + bdi->ra_pages = max(lim->io_opt * 2 / PAGE_SIZE, VM_READAHEAD_PAGES);
>
> Nit: while at it, you could replace that division by PAGE_SIZE with a right
> shift by PAGE_SHIFT.

I don't really see the point, this is everything but a fast path,
and for simple constant divisions compilers aren't actually bad at
doing optimizations.