summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/blkdev.h12
-rw-r--r--include/linux/fs.h16
-rw-r--r--include/linux/mm.h7
-rw-r--r--include/linux/raid/md_k.h1
4 files changed, 28 insertions, 8 deletions
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 7a43ff774fe0..914498e8e4b9 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -153,6 +153,12 @@ struct request_queue
prep_rq_fn *prep_rq_fn;
/*
+ * The VM-level readahead tunable for this device. In
+ * units of 512-byte sectors.
+ */
+ unsigned ra_sectors;
+
+ /*
* The queue owner gets to use this for whatever they like.
* ll_rw_blk doesn't touch it.
*/
@@ -308,6 +314,8 @@ extern void blk_queue_hardsect_size(request_queue_t *q, unsigned short);
extern void blk_queue_segment_boundary(request_queue_t *q, unsigned long);
extern void blk_queue_assign_lock(request_queue_t *q, spinlock_t *);
extern void blk_queue_prep_rq(request_queue_t *q, prep_rq_fn *pfn);
+extern int blk_set_readahead(kdev_t dev, unsigned sectors);
+extern unsigned blk_get_readahead(kdev_t dev);
extern int blk_rq_map_sg(request_queue_t *, struct request *, struct scatterlist *);
extern void blk_dump_rq_flags(struct request *, char *);
@@ -322,10 +330,6 @@ extern int * blksize_size[MAX_BLKDEV];
#define MAX_SEGMENT_SIZE 65536
-/* read-ahead in pages.. */
-#define MAX_READAHEAD 31
-#define MIN_READAHEAD 3
-
#define blkdev_entry_to_request(entry) list_entry((entry), struct request, queuelist)
extern void drive_stat_acct(struct request *, int, int);
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 676ddd28ebe2..75c9b5892f38 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -173,12 +173,10 @@ extern int leases_enable, dir_notify_enable, lease_break_time;
#define BLKRRPART _IO(0x12,95) /* re-read partition table */
#define BLKGETSIZE _IO(0x12,96) /* return device size /512 (long *arg) */
#define BLKFLSBUF _IO(0x12,97) /* flush buffer cache */
-#if 0 /* Obsolete, these don't do anything. */
#define BLKRASET _IO(0x12,98) /* set read ahead for block device */
#define BLKRAGET _IO(0x12,99) /* get current read ahead setting */
#define BLKFRASET _IO(0x12,100)/* set filesystem (mm/filemap.c) read-ahead */
#define BLKFRAGET _IO(0x12,101)/* get filesystem (mm/filemap.c) read-ahead */
-#endif
#define BLKSECTSET _IO(0x12,102)/* set max sectors per request (ll_rw_blk.c) */
#define BLKSECTGET _IO(0x12,103)/* get max sectors per request (ll_rw_blk.c) */
#define BLKSSZGET _IO(0x12,104)/* get block device sector size */
@@ -487,6 +485,18 @@ struct fown_struct {
int signum; /* posix.1b rt signal to be delivered on IO */
};
+/*
+ * Track a single file's readahead state
+ */
+struct file_ra_state {
+ unsigned long start; /* Current window */
+ unsigned long size;
+ unsigned long next_size; /* Next window size */
+ unsigned long prev_page; /* Cache last read() position */
+ unsigned long ahead_start; /* Ahead window */
+ unsigned long ahead_size;
+};
+
struct file {
struct list_head f_list;
struct dentry *f_dentry;
@@ -496,10 +506,10 @@ struct file {
unsigned int f_flags;
mode_t f_mode;
loff_t f_pos;
- unsigned long f_reada, f_ramax, f_raend, f_ralen, f_rawin;
struct fown_struct f_owner;
unsigned int f_uid, f_gid;
int f_error;
+ struct file_ra_state f_ra;
unsigned long f_version;
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 05293f0ab136..9f676c226ce8 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -531,6 +531,13 @@ extern void truncate_inode_pages(struct address_space *, loff_t);
extern int filemap_sync(struct vm_area_struct *, unsigned long, size_t, unsigned int);
extern struct page *filemap_nopage(struct vm_area_struct *, unsigned long, int);
+/* readahead.c */
+void do_page_cache_readahead(struct file *file,
+ unsigned long offset, unsigned long nr_to_read);
+void page_cache_readahead(struct file *file, unsigned long offset);
+void page_cache_readaround(struct file *file, unsigned long offset);
+void handle_ra_thrashing(struct file *file);
+
/* vma is the first one with address < vma->vm_end,
* and even address < vma->vm_start. Have to extend vma. */
static inline int expand_stack(struct vm_area_struct * vma, unsigned long address)
diff --git a/include/linux/raid/md_k.h b/include/linux/raid/md_k.h
index c0c21e26f2c3..997d45fa7be7 100644
--- a/include/linux/raid/md_k.h
+++ b/include/linux/raid/md_k.h
@@ -91,7 +91,6 @@ static inline mddev_t * kdev_to_mddev (kdev_t dev)
/*
* default readahead
*/
-#define MD_READAHEAD MAX_READAHEAD
static inline int disk_faulty(mdp_disk_t * d)
{