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>
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.
16 volatile int rq_status
; /* should split this into a few status bits */
17 #define RQ_INACTIVE (-1)
19 #define RQ_SCSI_BUSY 0xffff
20 #define RQ_SCSI_DONE 0xfffe
21 #define RQ_SCSI_DISCONNECTING 0xffe0
24 int cmd
; /* READ or WRITE */
27 unsigned long nr_sectors
;
28 unsigned long nr_segments
;
29 unsigned long current_nr_sectors
;
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
47 struct request
*current_request
;
49 struct tq_struct plug_tq
;
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)