Re: [PATCH v11 01/25] mm: Move readahead prototypes from mm.h

2020-04-15 Thread Johannes Thumshirn
Looks good,
Reviewed-by: Johannes Thumshirn 


[PATCH v11 01/25] mm: Move readahead prototypes from mm.h

2020-04-14 Thread Matthew Wilcox
From: "Matthew Wilcox (Oracle)" 

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.

Signed-off-by: Matthew Wilcox (Oracle) 
Reviewed-by: John Hubbard 
Reviewed-by: Christoph Hellwig 
Reviewed-by: William Kucharski 
---
 block/blk-core.c|  1 +
 include/linux/mm.h  | 19 ---
 include/linux/pagemap.h |  8 
 mm/fadvise.c|  2 ++
 mm/internal.h   |  2 ++
 5 files changed, 13 insertions(+), 19 deletions(-)

diff --git a/block/blk-core.c b/block/blk-core.c
index 7e4a1da0715e..f9b4457fd78d 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -20,6 +20,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 5a323422d783..581e56275bc4 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -2601,25 +2601,6 @@ extern vm_fault_t filemap_page_mkwrite(struct vm_fault 
*vmf);
 int __must_check write_one_page(struct page *page);
 void task_dirty_inc(struct task_struct *tsk);
 
-/* readahead.c */
-#define VM_READAHEAD_PAGES (SZ_128K / PAGE_SIZE)
-
-int force_page_cache_readahead(struct address_space *mapping, struct file 
*filp,
-   pgoff_t offset, unsigned long nr_to_read);
-
-void page_cache_sync_readahead(struct address_space *mapping,
-  struct file_ra_state *ra,
-  struct file *filp,
-  pgoff_t offset,
-  unsigned long size);
-
-void page_cache_async_readahead(struct address_space *mapping,
-   struct file_ra_state *ra,
-   struct file *filp,
-   struct page *pg,
-   pgoff_t offset,
-   unsigned long size);
-
 extern unsigned long stack_guard_gap;
 /* Generic expand stack which grows the stack according to GROWS{UP,DOWN} */
 extern int expand_stack(struct vm_area_struct *vma, unsigned long address);
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index a8f7bd8ea1c6..6c61535aa7ff 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -615,6 +615,14 @@ int replace_page_cache_page(struct page *old, struct page 
*new, gfp_t gfp_mask);
 void delete_from_page_cache_batch(struct address_space *mapping,
  struct pagevec *pvec);
 
+#define VM_READAHEAD_PAGES (SZ_128K / PAGE_SIZE)
+
+void page_cache_sync_readahead(struct address_space *, struct file_ra_state *,
+   struct file *, pgoff_t index, unsigned long req_count);
+void page_cache_async_readahead(struct address_space *, struct file_ra_state *,
+   struct file *, struct page *, pgoff_t index,
+   unsigned long req_count);
+
 /*
  * Like add_to_page_cache_locked, but used to add newly allocated pages:
  * the page is new, so we can just run __SetPageLocked() against it.
diff --git a/mm/fadvise.c b/mm/fadvise.c
index 4f17c83db575..3efebfb9952c 100644
--- a/mm/fadvise.c
+++ b/mm/fadvise.c
@@ -22,6 +22,8 @@
 
 #include 
 
+#include "internal.h"
+
 /*
  * POSIX_FADV_WILLNEED could set PG_Referenced, and POSIX_FADV_NOREUSE could
  * deactivate the pages and clear PG_Referenced.
diff --git a/mm/internal.h b/mm/internal.h
index b5634e78f01d..25fee17c7334 100644
--- a/mm/internal.h
+++ b/mm/internal.h
@@ -49,6 +49,8 @@ void unmap_page_range(struct mmu_gather *tlb,
 unsigned long addr, unsigned long end,
 struct zap_details *details);
 
+int force_page_cache_readahead(struct address_space *, struct file *,
+   pgoff_t index, unsigned long nr_to_read);
 extern unsigned int __do_page_cache_readahead(struct address_space *mapping,
struct file *filp, pgoff_t offset, unsigned long nr_to_read,
unsigned long lookahead_size);
-- 
2.25.1