[lkml]   [2020]   [Aug]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH] fat: Avoid oops when bdi->io_pages==0
On Mon, Aug 31, 2020 at 10:39:26AM -0600, Jens Axboe wrote:
> We really should ensure that ->io_pages is always set, imho, instead of
> having to work-around it in other spots.

Interestingly, there are only three places in the entire kernel which
_use_ bdi->io_pages. FAT, Verity and the pagecache readahead code.

unsigned long num_ra_pages =
min_t(unsigned long, num_blocks_to_hash - i,

if (ra_pages > sb->s_bdi->io_pages)
ra_pages = rounddown(ra_pages, sb->s_bdi->io_pages);

max_pages = max_t(unsigned long, bdi->io_pages, ra->ra_pages);
if (req_size > max_pages && bdi->io_pages > max_pages)
max_pages = min(req_size, bdi->io_pages);

The funny thing is that all three are using it differently. Verity is
taking io_pages to be the maximum amount to readahead. FAT is using
it as the unit of readahead (round down to the previous multiple) and
the pagecache uses it to limit reads that exceed the current per-file
readahead limit (but allows per-file readahead to exceed io_pages,
in which case it has no effect).

So how should it be used? My inclination is to say that the pagecache
is right, by virtue of being the most-used.

 \ /
  Last update: 2020-08-31 18:58    [W:0.061 / U:0.616 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site