aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJens Axboe <[email protected]>2024-12-20 15:47:40 +0000
committerAndrew Morton <[email protected]>2025-01-26 04:22:42 +0000
commitf598cdaafc370a797ae883d370a7c18c1ffc43ef (patch)
tree49c9311bec9532e5fdb1d04d6681bee99223b9a8
parentmm/filemap: change filemap_create_folio() to take a struct kiocb (diff)
downloadkernel-f598cdaafc370a797ae883d370a7c18c1ffc43ef.tar.gz
kernel-f598cdaafc370a797ae883d370a7c18c1ffc43ef.zip
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]>
-rw-r--r--mm/filemap.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/mm/filemap.c b/mm/filemap.c
index 904d8fa2bfc0..a1fda00aa6bc 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -2499,7 +2499,6 @@ static int filemap_get_pages(struct kiocb *iocb, size_t count,
{
struct file *filp = iocb->ki_filp;
struct address_space *mapping = filp->f_mapping;
- struct file_ra_state *ra = &filp->f_ra;
pgoff_t index = iocb->ki_pos >> PAGE_SHIFT;
pgoff_t last_index;
struct folio *folio;
@@ -2514,12 +2513,13 @@ retry:
filemap_get_read_batch(mapping, index, last_index - 1, fbatch);
if (!folio_batch_count(fbatch)) {
+ DEFINE_READAHEAD(ractl, filp, &filp->f_ra, mapping, index);
+
if (iocb->ki_flags & IOCB_NOIO)
return -EAGAIN;
if (iocb->ki_flags & IOCB_NOWAIT)
flags = memalloc_noio_save();
- page_cache_sync_readahead(mapping, ra, filp, index,
- last_index - index);
+ page_cache_sync_ra(&ractl, last_index - index);
if (iocb->ki_flags & IOCB_NOWAIT)
memalloc_noio_restore(flags);
filemap_get_read_batch(mapping, index, last_index - 1, fbatch);