Import 2.3.25pre1
[davej-history.git] / include / linux / blkdev.h
blobd3aa602c9917ea4e7c0b080f84d52d1fc6ed8d96
1 #ifndef _LINUX_BLKDEV_H
2 #define _LINUX_BLKDEV_H
4 #include <linux/major.h>
5 #include <linux/sched.h>
6 #include <linux/genhd.h>
7 #include <linux/tqueue.h>
9 /*
10 * Ok, this is an expanded form so that we can use the same
11 * request for paging requests when that is implemented. In
12 * paging, 'bh' is NULL, and the semaphore is used to wait
13 * for read/write completion.
15 struct request {
16 volatile int rq_status; /* should split this into a few status bits */
17 #define RQ_INACTIVE (-1)
18 #define RQ_ACTIVE 1
19 #define RQ_SCSI_BUSY 0xffff
20 #define RQ_SCSI_DONE 0xfffe
21 #define RQ_SCSI_DISCONNECTING 0xffe0
23 kdev_t rq_dev;
24 int cmd; /* READ or WRITE */
25 int errors;
26 unsigned long sector;
27 unsigned long nr_sectors;
28 unsigned long nr_segments;
29 unsigned long current_nr_sectors;
30 char * buffer;
31 struct semaphore * sem;
32 struct buffer_head * bh;
33 struct buffer_head * bhtail;
34 struct request * next;
37 typedef void (request_fn_proc) (void);
38 typedef struct request ** (queue_proc) (kdev_t dev);
40 struct blk_dev_struct {
41 request_fn_proc *request_fn;
43 * queue_proc has to be atomic
45 queue_proc *queue;
46 void *data;
47 struct request *current_request;
48 struct request plug;
49 struct tq_struct plug_tq;
52 struct sec_size {
53 unsigned block_size;
54 unsigned block_size_bits;
57 extern struct sec_size * blk_sec[MAX_BLKDEV];
58 extern struct blk_dev_struct blk_dev[MAX_BLKDEV];
59 extern wait_queue_head_t wait_for_request;
60 extern void resetup_one_dev(struct gendisk *dev, int drive);
61 extern void unplug_device(void * data);
62 extern void make_request(int major,int rw, struct buffer_head * bh);
64 /* md needs this function to remap requests */
65 extern int md_map (int minor, kdev_t *rdev, unsigned long *rsector, unsigned long size);
66 extern int md_make_request (int minor, int rw, struct buffer_head * bh);
67 extern int md_error (kdev_t mddev, kdev_t rdev);
69 extern int * blk_size[MAX_BLKDEV];
71 extern int * blksize_size[MAX_BLKDEV];
73 extern int * hardsect_size[MAX_BLKDEV];
75 extern int * max_readahead[MAX_BLKDEV];
77 extern int * max_sectors[MAX_BLKDEV];
79 extern int * max_segments[MAX_BLKDEV];
81 #define MAX_SECTORS 128
83 #define MAX_SEGMENTS MAX_SECTORS
85 #define PageAlignSize(size) (((size) + PAGE_SIZE -1) & PAGE_MASK)
86 #if 0 /* small readahead */
87 #define MAX_READAHEAD PageAlignSize(4096*7)
88 #define MIN_READAHEAD PageAlignSize(4096*2)
89 #else /* large readahead */
90 #define MAX_READAHEAD PageAlignSize(4096*31)
91 #define MIN_READAHEAD PageAlignSize(4096*3)
92 #endif
94 #endif