diff options
author | 2020-10-15 20:06:31 -0700 | |
---|---|---|
committer | 2020-10-16 11:11:16 -0700 | |
commit | db660d462525c4a152b25e033c3dfa9c25d188e6 (patch) | |
tree | 046f42a1cba6cf374fccf30aecf980efeea96643 /mm | |
parent | mm/readahead: add page_cache_sync_ra and page_cache_async_ra (diff) | |
download | linux-db660d462525c4a152b25e033c3dfa9c25d188e6.tar.gz linux-db660d462525c4a152b25e033c3dfa9c25d188e6.tar.bz2 linux-db660d462525c4a152b25e033c3dfa9c25d188e6.zip |
mm/filemap: fold ra_submit into do_sync_mmap_readahead
Fold ra_submit() into its last remaining user and pass the
readahead_control struct to both do_page_cache_ra() and
page_cache_sync_ra().
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Eric Biggers <ebiggers@google.com>
Link: https://lkml.kernel.org/r/20200903140844.14194-9-willy@infradead.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/filemap.c | 10 | ||||
-rw-r--r-- | mm/internal.h | 10 |
2 files changed, 5 insertions, 15 deletions
diff --git a/mm/filemap.c b/mm/filemap.c index 2937b57329be..8aad142ec4be 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -2588,8 +2588,8 @@ static struct file *do_sync_mmap_readahead(struct vm_fault *vmf) struct file *file = vmf->vma->vm_file; struct file_ra_state *ra = &file->f_ra; struct address_space *mapping = file->f_mapping; + DEFINE_READAHEAD(ractl, file, mapping, vmf->pgoff); struct file *fpin = NULL; - pgoff_t offset = vmf->pgoff; unsigned int mmap_miss; /* If we don't want any read-ahead, don't bother */ @@ -2600,8 +2600,7 @@ static struct file *do_sync_mmap_readahead(struct vm_fault *vmf) if (vmf->vma->vm_flags & VM_SEQ_READ) { fpin = maybe_unlock_mmap_for_io(vmf, fpin); - page_cache_sync_readahead(mapping, ra, file, offset, - ra->ra_pages); + page_cache_sync_ra(&ractl, ra, ra->ra_pages); return fpin; } @@ -2621,10 +2620,11 @@ static struct file *do_sync_mmap_readahead(struct vm_fault *vmf) * mmap read-around */ fpin = maybe_unlock_mmap_for_io(vmf, fpin); - ra->start = max_t(long, 0, offset - ra->ra_pages / 2); + ra->start = max_t(long, 0, vmf->pgoff - ra->ra_pages / 2); ra->size = ra->ra_pages; ra->async_size = ra->ra_pages / 4; - ra_submit(ra, mapping, file); + ractl._index = ra->start; + do_page_cache_ra(&ractl, ra->size, ra->async_size); return fpin; } diff --git a/mm/internal.h b/mm/internal.h index 059ad0115ec1..03654797a3a9 100644 --- a/mm/internal.h +++ b/mm/internal.h @@ -59,16 +59,6 @@ static inline void force_page_cache_readahead(struct address_space *mapping, force_page_cache_ra(&ractl, nr_to_read); } -/* - * Submit IO for the read-ahead request in file_ra_state. - */ -static inline void ra_submit(struct file_ra_state *ra, - struct address_space *mapping, struct file *file) -{ - DEFINE_READAHEAD(ractl, file, mapping, ra->start); - do_page_cache_ra(&ractl, ra->size, ra->async_size); -} - struct page *find_get_entry(struct address_space *mapping, pgoff_t index); struct page *find_lock_entry(struct address_space *mapping, pgoff_t index); |