Commit 29f175d125f0f3a9503af8a5596f93d714cceb08

Authored by Fabian Frederick
Committed by Linus Torvalds
1 parent 55f67141a8

mm/readahead.c: inline ra_submit

Commit f9acc8c7b35a ("readahead: sanify file_ra_state names") left
ra_submit with a single function call.

Move ra_submit to internal.h and inline it to save some stack.  Thanks
to Andrew Morton for commenting different versions.

Signed-off-by: Fabian Frederick <fabf@skynet.be>
Suggested-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Showing 3 changed files with 18 additions and 21 deletions Side-by-side Diff

... ... @@ -1875,9 +1875,6 @@
1875 1875 unsigned long size);
1876 1876  
1877 1877 unsigned long max_sane_readahead(unsigned long nr);
1878   -unsigned long ra_submit(struct file_ra_state *ra,
1879   - struct address_space *mapping,
1880   - struct file *filp);
1881 1878  
1882 1879 /* Generic expand stack which grows the stack according to GROWS{UP,DOWN} */
1883 1880 extern int expand_stack(struct vm_area_struct *vma, unsigned long address);
... ... @@ -11,6 +11,7 @@
11 11 #ifndef __MM_INTERNAL_H
12 12 #define __MM_INTERNAL_H
13 13  
  14 +#include <linux/fs.h>
14 15 #include <linux/mm.h>
15 16  
16 17 void free_pgtables(struct mmu_gather *tlb, struct vm_area_struct *start_vma,
... ... @@ -19,6 +20,20 @@
19 20 static inline void set_page_count(struct page *page, int v)
20 21 {
21 22 atomic_set(&page->_count, v);
  23 +}
  24 +
  25 +extern int __do_page_cache_readahead(struct address_space *mapping,
  26 + struct file *filp, pgoff_t offset, unsigned long nr_to_read,
  27 + unsigned long lookahead_size);
  28 +
  29 +/*
  30 + * Submit IO for the read-ahead request in file_ra_state.
  31 + */
  32 +static inline unsigned long ra_submit(struct file_ra_state *ra,
  33 + struct address_space *mapping, struct file *filp)
  34 +{
  35 + return __do_page_cache_readahead(mapping, filp,
  36 + ra->start, ra->size, ra->async_size);
22 37 }
23 38  
24 39 /*
... ... @@ -8,9 +8,7 @@
8 8 */
9 9  
10 10 #include <linux/kernel.h>
11   -#include <linux/fs.h>
12 11 #include <linux/gfp.h>
13   -#include <linux/mm.h>
14 12 #include <linux/export.h>
15 13 #include <linux/blkdev.h>
16 14 #include <linux/backing-dev.h>
... ... @@ -20,6 +18,8 @@
20 18 #include <linux/syscalls.h>
21 19 #include <linux/file.h>
22 20  
  21 +#include "internal.h"
  22 +
23 23 /*
24 24 * Initialise a struct file's readahead state. Assumes that the caller has
25 25 * memset *ra to zero.
... ... @@ -149,8 +149,7 @@
149 149 *
150 150 * Returns the number of pages requested, or the maximum amount of I/O allowed.
151 151 */
152   -static int
153   -__do_page_cache_readahead(struct address_space *mapping, struct file *filp,
  152 +int __do_page_cache_readahead(struct address_space *mapping, struct file *filp,
154 153 pgoff_t offset, unsigned long nr_to_read,
155 154 unsigned long lookahead_size)
156 155 {
... ... @@ -241,20 +240,6 @@
241 240 unsigned long max_sane_readahead(unsigned long nr)
242 241 {
243 242 return min(nr, MAX_READAHEAD);
244   -}
245   -
246   -/*
247   - * Submit IO for the read-ahead request in file_ra_state.
248   - */
249   -unsigned long ra_submit(struct file_ra_state *ra,
250   - struct address_space *mapping, struct file *filp)
251   -{
252   - int actual;
253   -
254   - actual = __do_page_cache_readahead(mapping, filp,
255   - ra->start, ra->size, ra->async_size);
256   -
257   - return actual;
258 243 }
259 244  
260 245 /*