Skip to content

Commit f598cda

Browse files
axboeakpm00
authored andcommitted
mm/filemap: use page_cache_sync_ra() to kick off read-ahead
Rather than use the page_cache_sync_readahead() helper, define our own ractl and use page_cache_sync_ra() directly. In preparation for needing to modify ractl inside filemap_get_pages(). No functional changes in this patch. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]> Reviewed-by: Kirill A. Shutemov <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Reviewed-by: Matthew Wilcox (Oracle) <[email protected]> Cc: Brian Foster <[email protected]> Cc: Chris Mason <[email protected]> Cc: Johannes Weiner <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 9ad6344 commit f598cda

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

mm/filemap.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2499,7 +2499,6 @@ static int filemap_get_pages(struct kiocb *iocb, size_t count,
24992499
{
25002500
struct file *filp = iocb->ki_filp;
25012501
struct address_space *mapping = filp->f_mapping;
2502-
struct file_ra_state *ra = &filp->f_ra;
25032502
pgoff_t index = iocb->ki_pos >> PAGE_SHIFT;
25042503
pgoff_t last_index;
25052504
struct folio *folio;
@@ -2514,12 +2513,13 @@ static int filemap_get_pages(struct kiocb *iocb, size_t count,
25142513

25152514
filemap_get_read_batch(mapping, index, last_index - 1, fbatch);
25162515
if (!folio_batch_count(fbatch)) {
2516+
DEFINE_READAHEAD(ractl, filp, &filp->f_ra, mapping, index);
2517+
25172518
if (iocb->ki_flags & IOCB_NOIO)
25182519
return -EAGAIN;
25192520
if (iocb->ki_flags & IOCB_NOWAIT)
25202521
flags = memalloc_noio_save();
2521-
page_cache_sync_readahead(mapping, ra, filp, index,
2522-
last_index - index);
2522+
page_cache_sync_ra(&ractl, last_index - index);
25232523
if (iocb->ki_flags & IOCB_NOWAIT)
25242524
memalloc_noio_restore(flags);
25252525
filemap_get_read_batch(mapping, index, last_index - 1, fbatch);

0 commit comments

Comments
 (0)