Message ID | 20240128165813.3213508-3-hch@lst.de (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [01/14] block: move max_{open,active}_zones to struct queue_limits | expand |
On 1/28/24 08:58, Christoph Hellwig wrote: > +static void blk_apply_bdi_limits(struct backing_dev_info *bdi, > + struct queue_limits *lim) > +{ > + /* > + * 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); > + bdi->io_pages = lim->max_sectors >> (PAGE_SHIFT - 9); > +} Would this be a good opportunity to change (PAGE_SHIFT - 9) into PAGE_SECTORS_SHIFT? Thanks, Bart.
On Sun, Jan 28, 2024 at 06:59:31PM -0800, Bart Van Assche 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); >> + bdi->io_pages = lim->max_sectors >> (PAGE_SHIFT - 9); >> +} > > Would this be a good opportunity to change (PAGE_SHIFT - 9) into > PAGE_SECTORS_SHIFT? If I have to respin for some reason I'll include it. Otherwise feel free to send a trivial follow on patch.
diff --git a/block/blk-settings.c b/block/blk-settings.c index 06ea91e51b8b2e..e872b0e168525e 100644 --- a/block/blk-settings.c +++ b/block/blk-settings.c @@ -85,6 +85,17 @@ void blk_set_stacking_limits(struct queue_limits *lim) } EXPORT_SYMBOL(blk_set_stacking_limits); +static void blk_apply_bdi_limits(struct backing_dev_info *bdi, + struct queue_limits *lim) +{ + /* + * 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); + bdi->io_pages = lim->max_sectors >> (PAGE_SHIFT - 9); +} + /** * blk_queue_bounce_limit - set bounce buffer limit for queue * @q: the request queue for the device @@ -393,15 +404,7 @@ EXPORT_SYMBOL(blk_queue_alignment_offset); void disk_update_readahead(struct gendisk *disk) { - struct request_queue *q = disk->queue; - - /* - * For read-ahead of large files to be effective, we need to read ahead - * at least twice the optimal I/O size. - */ - disk->bdi->ra_pages = - max(queue_io_opt(q) * 2 / PAGE_SIZE, VM_READAHEAD_PAGES); - disk->bdi->io_pages = queue_max_sectors(q) >> (PAGE_SHIFT - 9); + blk_apply_bdi_limits(disk->bdi, &disk->queue->limits); } EXPORT_SYMBOL_GPL(disk_update_readahead);