FILESYSTEM: dynamic read-ahead
/mm/readahead.c
blob:867f9dd82dcde9d5c11f49bde159c3c6a0276c4e -> blob:286251a4d091da15b8f993b9214bacf4783738e5
--- mm/readahead.c
+++ mm/readahead.c
@@ -18,6 +18,32 @@
#include <linux/pagevec.h>
#include <linux/pagemap.h>
+unsigned long max_readahead_pages = VM_MAX_READAHEAD * 1024 / PAGE_CACHE_SIZE;
+
+static int __init readahead(char *str)
+{
+ unsigned long bytes;
+
+ if (!str)
+ return -EINVAL;
+ bytes = memparse(str, &str);
+ if (*str != '\0')
+ return -EINVAL;
+
+ if (bytes) {
+ if (bytes < PAGE_CACHE_SIZE) /* missed 'k'/'m' suffixes? */
+ return -EINVAL;
+ if (bytes > 256 << 20) /* limit to 256MB */
+ bytes = 256 << 20;
+ }
+
+ max_readahead_pages = bytes / PAGE_CACHE_SIZE;
+ default_backing_dev_info.ra_pages = max_readahead_pages;
+ return 0;
+}
+
+early_param("readahead", readahead);
+
/*
* Initialise a struct file's readahead state. Assumes that the caller has
* memset *ra to zero.