History

mm: move readahead prototypes from mm.h

Patch series "Change readahead API", v11. This series adds a readahead address_space operation to replace the readpages operation. The key difference is that pages are added to the page cache as they are allocated (and then looked up by the filesystem) instead of passing them on a list to the readpages operation and having the filesystem add them to the page cache. It's a net reduction in code for each implementation, more efficient than walking a list, and solves the direct-write vs buffered-read problem reported by yu kuai at http://lkml.kernel.org/r/20200116063601.39201-1-yukuai3@huawei.com The only unconverted filesystems are those which use fscache. Their conversion is pending Dave Howells' rewrite which will make the conversion substantially easier. This should be completed by the end of the year. I want to thank the reviewers/testers; Dave Chinner, John Hubbard, Eric Biggers, Johannes Thumshirn, Dave Sterba, Zi Yan, Christoph Hellwig and Miklos Szeredi have done a marvellous job of providing constructive criticism. These patches pass an xfstests run on ext4, xfs & btrfs with no regressions that I can tell (some of the tests seem a little flaky before and remain flaky afterwards). This patch (of 25): The readahead code is part of the page cache so should be found in the pagemap.h file. force_page_cache_readahead is only used within mm, so move it to mm/internal.h instead. Remove the parameter names where they add no value, and rename the ones which were actively misleading.

Matthew Wilcox (Oracle) committed 6 years ago

Commit cee9a0c1 parent 002ae705 files · +13 −19Browse files

Unified · Split

5 files
  1. block/blk-core.c +1 −0
  2. include/linux/mm.h +0 −19
  3. include/linux/pagemap.h +8 −0
  4. mm/fadvise.c +2 −0
  5. mm/internal.h +2 −0
block/blk-core.c+1−0
@@ -20,6 +20,7 @@ · 19 unmodified lines
2020 #include <linux/blk-mq.h>
2121 #include <linux/highmem.h>
2222 #include <linux/mm.h>
23+#include <linux/pagemap.h>
2324 #include <linux/kernel_stat.h>
2425 #include <linux/string.h>
2526 #include <linux/init.h>
include/linux/mm.h+0−19
@@ -2612,25 +2612,6 @@ extern vm_fault_t filemap_page_mkwrite(struct vm_fault *vmf); · 2611 unmodified lines
26122612 int __must_check write_one_page(struct page *page);
26132613 void task_dirty_inc(struct task_struct *tsk);
26142614
2615−/* readahead.c */
2616−#define VM_READAHEAD_PAGES (SZ_128K / PAGE_SIZE)
2617−
2618−int force_page_cache_readahead(struct address_space *mapping, struct file *filp,
2619− pgoff_t offset, unsigned long nr_to_read);
2620−
2621−void page_cache_sync_readahead(struct address_space *mapping,
2622− struct file_ra_state *ra,
2623− struct file *filp,
2624− pgoff_t offset,
2625− unsigned long size);
2626−
2627−void page_cache_async_readahead(struct address_space *mapping,
2628− struct file_ra_state *ra,
2629− struct file *filp,
2630− struct page *pg,
2631− pgoff_t offset,
2632− unsigned long size);
2633−
26342615 extern unsigned long stack_guard_gap;
26352616 /* Generic expand stack which grows the stack according to GROWS{UP,DOWN} */
26362617 extern int expand_stack(struct vm_area_struct *vma, unsigned long address);
include/linux/pagemap.h+8−0
@@ -618,6 +618,14 @@ int replace_page_cache_page(struct page *old, struct page *new, gfp_t gfp_mask); · 617 unmodified lines
618618 void delete_from_page_cache_batch(struct address_space *mapping,
619619 struct pagevec *pvec);
620620
621+#define VM_READAHEAD_PAGES (SZ_128K / PAGE_SIZE)
622+
623+void page_cache_sync_readahead(struct address_space *, struct file_ra_state *,
624+ struct file *, pgoff_t index, unsigned long req_count);
625+void page_cache_async_readahead(struct address_space *, struct file_ra_state *,
626+ struct file *, struct page *, pgoff_t index,
627+ unsigned long req_count);
628+
621629 /*
622630 * Like add_to_page_cache_locked, but used to add newly allocated pages:
623631 * the page is new, so we can just run __SetPageLocked() against it.
mm/fadvise.c+2−0
@@ -22,6 +22,8 @@ · 21 unmodified lines
2222
2323 #include <asm/unistd.h>
2424
25+#include "internal.h"
26+
2527 /*
2628 * POSIX_FADV_WILLNEED could set PG_Referenced, and POSIX_FADV_NOREUSE could
2729 * deactivate the pages and clear PG_Referenced.
mm/internal.h+2−0
@@ -49,6 +49,8 @@ void unmap_page_range(struct mmu_gather *tlb, · 48 unmodified lines
4949 unsigned long addr, unsigned long end,
5050 struct zap_details *details);
5151
52+int force_page_cache_readahead(struct address_space *, struct file *,
53+ pgoff_t index, unsigned long nr_to_read);
5254 extern unsigned int __do_page_cache_readahead(struct address_space *mapping,
5355 struct file *filp, pgoff_t offset, unsigned long nr_to_read,
5456 unsigned long lookahead_size);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t