1 |
1622 |
jcastillo |
#ifndef _BLK_H
|
2 |
|
|
#define _BLK_H
|
3 |
|
|
|
4 |
|
|
#include <linux/blkdev.h>
|
5 |
|
|
#include <linux/locks.h>
|
6 |
|
|
#include <linux/config.h>
|
7 |
|
|
|
8 |
|
|
/*
|
9 |
|
|
* NR_REQUEST is the number of entries in the request-queue.
|
10 |
|
|
* NOTE that writes may use only the low 2/3 of these: reads
|
11 |
|
|
* take precedence.
|
12 |
|
|
*/
|
13 |
|
|
#define NR_REQUEST 64
|
14 |
|
|
|
15 |
|
|
/*
|
16 |
|
|
* This is used in the elevator algorithm. We don't prioritise reads
|
17 |
|
|
* over writes any more --- although reads are more time-critical than
|
18 |
|
|
* writes, by treating them equally we increase filesystem throughput.
|
19 |
|
|
* This turns out to give better overall performance. -- sct
|
20 |
|
|
*/
|
21 |
|
|
#define IN_ORDER(s1,s2) \
|
22 |
|
|
((s1)->rq_dev < (s2)->rq_dev || (((s1)->rq_dev == (s2)->rq_dev && \
|
23 |
|
|
(s1)->sector < (s2)->sector)))
|
24 |
|
|
|
25 |
|
|
/*
|
26 |
|
|
* These will have to be changed to be aware of different buffer
|
27 |
|
|
* sizes etc.. It actually needs a major cleanup.
|
28 |
|
|
*/
|
29 |
|
|
#if defined(IDE_DRIVER) || defined(MD_DRIVER)
|
30 |
|
|
#define SECTOR_MASK ((BLOCK_SIZE >> 9) - 1)
|
31 |
|
|
#else
|
32 |
|
|
#define SECTOR_MASK (blksize_size[MAJOR_NR] && \
|
33 |
|
|
blksize_size[MAJOR_NR][MINOR(CURRENT->rq_dev)] ? \
|
34 |
|
|
((blksize_size[MAJOR_NR][MINOR(CURRENT->rq_dev)] >> 9) - 1) : \
|
35 |
|
|
((BLOCK_SIZE >> 9) - 1))
|
36 |
|
|
#endif /* IDE_DRIVER */
|
37 |
|
|
|
38 |
|
|
#define SUBSECTOR(block) (CURRENT->current_nr_sectors > 0)
|
39 |
|
|
|
40 |
|
|
#ifdef CONFIG_CDU31A
|
41 |
|
|
extern int cdu31a_init(void);
|
42 |
|
|
#endif CONFIG_CDU31A
|
43 |
|
|
#ifdef CONFIG_MCD
|
44 |
|
|
extern int mcd_init(void);
|
45 |
|
|
#endif CONFIG_MCD
|
46 |
|
|
#ifdef CONFIG_MCDX
|
47 |
|
|
extern int mcdx_init(void);
|
48 |
|
|
#endif CONFIG_MCDX
|
49 |
|
|
#ifdef CONFIG_SBPCD
|
50 |
|
|
extern int sbpcd_init(void);
|
51 |
|
|
#endif CONFIG_SBPCD
|
52 |
|
|
#ifdef CONFIG_AZTCD
|
53 |
|
|
extern int aztcd_init(void);
|
54 |
|
|
#endif CONFIG_AZTCD
|
55 |
|
|
#ifdef CONFIG_CDU535
|
56 |
|
|
extern int sony535_init(void);
|
57 |
|
|
#endif CONFIG_CDU535
|
58 |
|
|
#ifdef CONFIG_GSCD
|
59 |
|
|
extern int gscd_init(void);
|
60 |
|
|
#endif CONFIG_GSCD
|
61 |
|
|
#ifdef CONFIG_CM206
|
62 |
|
|
extern int cm206_init(void);
|
63 |
|
|
#endif CONFIG_CM206
|
64 |
|
|
#ifdef CONFIG_OPTCD
|
65 |
|
|
extern int optcd_init(void);
|
66 |
|
|
#endif CONFIG_OPTCD
|
67 |
|
|
#ifdef CONFIG_SJCD
|
68 |
|
|
extern int sjcd_init(void);
|
69 |
|
|
#endif CONFIG_SJCD
|
70 |
|
|
#ifdef CONFIG_BLK_DEV_HD
|
71 |
|
|
extern int hd_init(void);
|
72 |
|
|
#endif
|
73 |
|
|
#ifdef CONFIG_BLK_DEV_IDE
|
74 |
|
|
extern int ide_init(void);
|
75 |
|
|
#endif
|
76 |
|
|
#ifdef CONFIG_BLK_DEV_XD
|
77 |
|
|
extern int xd_init(void);
|
78 |
|
|
#endif
|
79 |
|
|
#ifdef CONFIG_BLK_DEV_LOOP
|
80 |
|
|
extern int loop_init(void);
|
81 |
|
|
#endif
|
82 |
|
|
#ifdef CONFIG_BLK_DEV_MD
|
83 |
|
|
extern int md_init(void);
|
84 |
|
|
#endif CONFIG_BLK_DEV_MD
|
85 |
|
|
|
86 |
|
|
extern void set_device_ro(kdev_t dev,int flag);
|
87 |
|
|
void add_blkdev_randomness(int major);
|
88 |
|
|
|
89 |
|
|
extern int floppy_init(void);
|
90 |
|
|
extern void rd_load(void);
|
91 |
|
|
extern int rd_init(void);
|
92 |
|
|
extern int rd_doload; /* 1 = load ramdisk, 0 = don't load */
|
93 |
|
|
extern int rd_prompt; /* 1 = prompt for ramdisk, 0 = don't prompt */
|
94 |
|
|
extern int rd_image_start; /* starting block # of image */
|
95 |
|
|
|
96 |
|
|
#ifdef CONFIG_BLK_DEV_INITRD
|
97 |
|
|
|
98 |
|
|
#define INITRD_MINOR 250 /* shouldn't collide with /dev/ram* too soon ... */
|
99 |
|
|
|
100 |
|
|
extern unsigned long initrd_start,initrd_end;
|
101 |
|
|
extern int mount_initrd; /* zero if initrd should not be mounted */
|
102 |
|
|
void initrd_init(void);
|
103 |
|
|
|
104 |
|
|
#endif
|
105 |
|
|
|
106 |
|
|
#define RO_IOCTLS(dev,where) \
|
107 |
|
|
case BLKROSET: { int __err; if (!suser()) return -EACCES; \
|
108 |
|
|
__err = verify_area(VERIFY_READ, (void *) (where), sizeof(long)); \
|
109 |
|
|
if (!__err) set_device_ro((dev),get_fs_long((long *) (where))); return __err; } \
|
110 |
|
|
case BLKROGET: { int __err = verify_area(VERIFY_WRITE, (void *) (where), sizeof(long)); \
|
111 |
|
|
if (!__err) put_fs_long(0!=is_read_only(dev),(long *) (where)); return __err; }
|
112 |
|
|
|
113 |
|
|
#if defined(MAJOR_NR) || defined(IDE_DRIVER)
|
114 |
|
|
|
115 |
|
|
/*
|
116 |
|
|
* Add entries as needed.
|
117 |
|
|
*/
|
118 |
|
|
|
119 |
|
|
#ifdef IDE_DRIVER
|
120 |
|
|
|
121 |
|
|
#define DEVICE_NR(device) (MINOR(device) >> PARTN_BITS)
|
122 |
|
|
#define DEVICE_ON(device) /* nothing */
|
123 |
|
|
#define DEVICE_OFF(device) /* nothing */
|
124 |
|
|
|
125 |
|
|
#elif (MAJOR_NR == RAMDISK_MAJOR)
|
126 |
|
|
|
127 |
|
|
/* ram disk */
|
128 |
|
|
#define DEVICE_NAME "ramdisk"
|
129 |
|
|
#define DEVICE_REQUEST rd_request
|
130 |
|
|
#define DEVICE_NR(device) (MINOR(device))
|
131 |
|
|
#define DEVICE_ON(device)
|
132 |
|
|
#define DEVICE_OFF(device)
|
133 |
|
|
#define DEVICE_NO_RANDOM
|
134 |
|
|
|
135 |
|
|
#elif (MAJOR_NR == FLOPPY_MAJOR)
|
136 |
|
|
|
137 |
|
|
static void floppy_off(unsigned int nr);
|
138 |
|
|
|
139 |
|
|
#define DEVICE_NAME "floppy"
|
140 |
|
|
#define DEVICE_INTR do_floppy
|
141 |
|
|
#define DEVICE_REQUEST do_fd_request
|
142 |
|
|
#define DEVICE_NR(device) ( (MINOR(device) & 3) | ((MINOR(device) & 0x80 ) >> 5 ))
|
143 |
|
|
#define DEVICE_ON(device)
|
144 |
|
|
#define DEVICE_OFF(device) floppy_off(DEVICE_NR(device))
|
145 |
|
|
|
146 |
|
|
#elif (MAJOR_NR == HD_MAJOR)
|
147 |
|
|
|
148 |
|
|
/* harddisk: timeout is 6 seconds.. */
|
149 |
|
|
#define DEVICE_NAME "harddisk"
|
150 |
|
|
#define DEVICE_INTR do_hd
|
151 |
|
|
#define DEVICE_TIMEOUT HD_TIMER
|
152 |
|
|
#define TIMEOUT_VALUE (6*HZ)
|
153 |
|
|
#define DEVICE_REQUEST do_hd_request
|
154 |
|
|
#define DEVICE_NR(device) (MINOR(device)>>6)
|
155 |
|
|
#define DEVICE_ON(device)
|
156 |
|
|
#define DEVICE_OFF(device)
|
157 |
|
|
|
158 |
|
|
#elif (MAJOR_NR == SCSI_DISK_MAJOR)
|
159 |
|
|
|
160 |
|
|
#define DEVICE_NAME "scsidisk"
|
161 |
|
|
#define DEVICE_INTR do_sd
|
162 |
|
|
#define TIMEOUT_VALUE (2*HZ)
|
163 |
|
|
#define DEVICE_REQUEST do_sd_request
|
164 |
|
|
#define DEVICE_NR(device) (MINOR(device) >> 4)
|
165 |
|
|
#define DEVICE_ON(device)
|
166 |
|
|
#define DEVICE_OFF(device)
|
167 |
|
|
|
168 |
|
|
/* Kludge to use the same number for both char and block major numbers */
|
169 |
|
|
#elif (MAJOR_NR == MD_MAJOR) && defined(MD_DRIVER)
|
170 |
|
|
|
171 |
|
|
#define DEVICE_NAME "Multiple devices driver"
|
172 |
|
|
#define DEVICE_REQUEST do_md_request
|
173 |
|
|
#define DEVICE_NR(device) (MINOR(device))
|
174 |
|
|
#define DEVICE_ON(device)
|
175 |
|
|
#define DEVICE_OFF(device)
|
176 |
|
|
|
177 |
|
|
#elif (MAJOR_NR == SCSI_TAPE_MAJOR)
|
178 |
|
|
|
179 |
|
|
#define DEVICE_NAME "scsitape"
|
180 |
|
|
#define DEVICE_INTR do_st
|
181 |
|
|
#define DEVICE_NR(device) (MINOR(device) & 0x7f)
|
182 |
|
|
#define DEVICE_ON(device)
|
183 |
|
|
#define DEVICE_OFF(device)
|
184 |
|
|
|
185 |
|
|
#elif (MAJOR_NR == SCSI_CDROM_MAJOR)
|
186 |
|
|
|
187 |
|
|
#define DEVICE_NAME "CD-ROM"
|
188 |
|
|
#define DEVICE_INTR do_sr
|
189 |
|
|
#define DEVICE_REQUEST do_sr_request
|
190 |
|
|
#define DEVICE_NR(device) (MINOR(device))
|
191 |
|
|
#define DEVICE_ON(device)
|
192 |
|
|
#define DEVICE_OFF(device)
|
193 |
|
|
|
194 |
|
|
#elif (MAJOR_NR == XT_DISK_MAJOR)
|
195 |
|
|
|
196 |
|
|
#define DEVICE_NAME "xt disk"
|
197 |
|
|
#define DEVICE_REQUEST do_xd_request
|
198 |
|
|
#define DEVICE_NR(device) (MINOR(device) >> 6)
|
199 |
|
|
#define DEVICE_ON(device)
|
200 |
|
|
#define DEVICE_OFF(device)
|
201 |
|
|
|
202 |
|
|
#elif defined(MFM_DISK_MAJOR) && (MAJOR_NR == MFM_DISK_MAJOR)
|
203 |
|
|
|
204 |
|
|
#define DEVICE_NAME "mfm disk"
|
205 |
|
|
#define DEVICE_INTR do_mfm
|
206 |
|
|
#define DEVICE_REQUEST do_mfm_request
|
207 |
|
|
#define DEVICE_NR(device) (MINOR(device) >> 6)
|
208 |
|
|
#define DEVICE_ON(device)
|
209 |
|
|
#define DEVICE_OFF(device)
|
210 |
|
|
|
211 |
|
|
#elif (MAJOR_NR == CDU31A_CDROM_MAJOR)
|
212 |
|
|
|
213 |
|
|
#define DEVICE_NAME "CDU31A"
|
214 |
|
|
#define DEVICE_REQUEST do_cdu31a_request
|
215 |
|
|
#define DEVICE_NR(device) (MINOR(device))
|
216 |
|
|
#define DEVICE_ON(device)
|
217 |
|
|
#define DEVICE_OFF(device)
|
218 |
|
|
|
219 |
|
|
#elif (MAJOR_NR == MITSUMI_CDROM_MAJOR)
|
220 |
|
|
|
221 |
|
|
#define DEVICE_NAME "Mitsumi CD-ROM"
|
222 |
|
|
/* #define DEVICE_INTR do_mcd */
|
223 |
|
|
#define DEVICE_REQUEST do_mcd_request
|
224 |
|
|
#define DEVICE_NR(device) (MINOR(device))
|
225 |
|
|
#define DEVICE_ON(device)
|
226 |
|
|
#define DEVICE_OFF(device)
|
227 |
|
|
|
228 |
|
|
#elif (MAJOR_NR == MITSUMI_X_CDROM_MAJOR)
|
229 |
|
|
|
230 |
|
|
#define DEVICE_NAME "Mitsumi CD-ROM"
|
231 |
|
|
/* #define DEVICE_INTR do_mcdx */
|
232 |
|
|
#define DEVICE_REQUEST do_mcdx_request
|
233 |
|
|
#define DEVICE_NR(device) (MINOR(device))
|
234 |
|
|
#define DEVICE_ON(device)
|
235 |
|
|
#define DEVICE_OFF(device)
|
236 |
|
|
|
237 |
|
|
#elif (MAJOR_NR == MATSUSHITA_CDROM_MAJOR)
|
238 |
|
|
|
239 |
|
|
#define DEVICE_NAME "Matsushita CD-ROM controller #1"
|
240 |
|
|
#define DEVICE_REQUEST do_sbpcd_request
|
241 |
|
|
#define DEVICE_NR(device) (MINOR(device))
|
242 |
|
|
#define DEVICE_ON(device)
|
243 |
|
|
#define DEVICE_OFF(device)
|
244 |
|
|
|
245 |
|
|
#elif (MAJOR_NR == MATSUSHITA_CDROM2_MAJOR)
|
246 |
|
|
|
247 |
|
|
#define DEVICE_NAME "Matsushita CD-ROM controller #2"
|
248 |
|
|
#define DEVICE_REQUEST do_sbpcd2_request
|
249 |
|
|
#define DEVICE_NR(device) (MINOR(device))
|
250 |
|
|
#define DEVICE_ON(device)
|
251 |
|
|
#define DEVICE_OFF(device)
|
252 |
|
|
|
253 |
|
|
#elif (MAJOR_NR == MATSUSHITA_CDROM3_MAJOR)
|
254 |
|
|
|
255 |
|
|
#define DEVICE_NAME "Matsushita CD-ROM controller #3"
|
256 |
|
|
#define DEVICE_REQUEST do_sbpcd3_request
|
257 |
|
|
#define DEVICE_NR(device) (MINOR(device))
|
258 |
|
|
#define DEVICE_ON(device)
|
259 |
|
|
#define DEVICE_OFF(device)
|
260 |
|
|
|
261 |
|
|
#elif (MAJOR_NR == MATSUSHITA_CDROM4_MAJOR)
|
262 |
|
|
|
263 |
|
|
#define DEVICE_NAME "Matsushita CD-ROM controller #4"
|
264 |
|
|
#define DEVICE_REQUEST do_sbpcd4_request
|
265 |
|
|
#define DEVICE_NR(device) (MINOR(device))
|
266 |
|
|
#define DEVICE_ON(device)
|
267 |
|
|
#define DEVICE_OFF(device)
|
268 |
|
|
|
269 |
|
|
#elif (MAJOR_NR == AZTECH_CDROM_MAJOR)
|
270 |
|
|
|
271 |
|
|
#define DEVICE_NAME "Aztech CD-ROM"
|
272 |
|
|
#define DEVICE_REQUEST do_aztcd_request
|
273 |
|
|
#define DEVICE_NR(device) (MINOR(device))
|
274 |
|
|
#define DEVICE_ON(device)
|
275 |
|
|
#define DEVICE_OFF(device)
|
276 |
|
|
|
277 |
|
|
#elif (MAJOR_NR == CDU535_CDROM_MAJOR)
|
278 |
|
|
|
279 |
|
|
#define DEVICE_NAME "SONY-CDU535"
|
280 |
|
|
#define DEVICE_INTR do_cdu535
|
281 |
|
|
#define DEVICE_REQUEST do_cdu535_request
|
282 |
|
|
#define DEVICE_NR(device) (MINOR(device))
|
283 |
|
|
#define DEVICE_ON(device)
|
284 |
|
|
#define DEVICE_OFF(device)
|
285 |
|
|
|
286 |
|
|
#elif (MAJOR_NR == GOLDSTAR_CDROM_MAJOR)
|
287 |
|
|
|
288 |
|
|
#define DEVICE_NAME "Goldstar R420"
|
289 |
|
|
#define DEVICE_REQUEST do_gscd_request
|
290 |
|
|
#define DEVICE_NR(device) (MINOR(device))
|
291 |
|
|
#define DEVICE_ON(device)
|
292 |
|
|
#define DEVICE_OFF(device)
|
293 |
|
|
|
294 |
|
|
#elif (MAJOR_NR == CM206_CDROM_MAJOR)
|
295 |
|
|
#define DEVICE_NAME "Philips/LMS cd-rom cm206"
|
296 |
|
|
#define DEVICE_REQUEST do_cm206_request
|
297 |
|
|
#define DEVICE_NR(device) (MINOR(device))
|
298 |
|
|
#define DEVICE_ON(device)
|
299 |
|
|
#define DEVICE_OFF(device)
|
300 |
|
|
|
301 |
|
|
#elif (MAJOR_NR == OPTICS_CDROM_MAJOR)
|
302 |
|
|
|
303 |
|
|
#define DEVICE_NAME "DOLPHIN 8000AT CD-ROM"
|
304 |
|
|
#define DEVICE_REQUEST do_optcd_request
|
305 |
|
|
#define DEVICE_NR(device) (MINOR(device))
|
306 |
|
|
#define DEVICE_ON(device)
|
307 |
|
|
#define DEVICE_OFF(device)
|
308 |
|
|
|
309 |
|
|
#elif (MAJOR_NR == SANYO_CDROM_MAJOR)
|
310 |
|
|
|
311 |
|
|
#define DEVICE_NAME "Sanyo H94A CD-ROM"
|
312 |
|
|
#define DEVICE_REQUEST do_sjcd_request
|
313 |
|
|
#define DEVICE_NR(device) (MINOR(device))
|
314 |
|
|
#define DEVICE_ON(device)
|
315 |
|
|
#define DEVICE_OFF(device)
|
316 |
|
|
|
317 |
|
|
#endif /* MAJOR_NR == whatever */
|
318 |
|
|
|
319 |
|
|
#if (MAJOR_NR != SCSI_TAPE_MAJOR)
|
320 |
|
|
#if !defined(IDE_DRIVER)
|
321 |
|
|
|
322 |
|
|
#ifndef CURRENT
|
323 |
|
|
#define CURRENT (blk_dev[MAJOR_NR].current_request)
|
324 |
|
|
#endif
|
325 |
|
|
|
326 |
|
|
#define CURRENT_DEV DEVICE_NR(CURRENT->rq_dev)
|
327 |
|
|
|
328 |
|
|
#ifdef DEVICE_INTR
|
329 |
|
|
static void (*DEVICE_INTR)(void) = NULL;
|
330 |
|
|
#endif
|
331 |
|
|
#ifdef DEVICE_TIMEOUT
|
332 |
|
|
|
333 |
|
|
#define SET_TIMER \
|
334 |
|
|
((timer_table[DEVICE_TIMEOUT].expires = jiffies + TIMEOUT_VALUE), \
|
335 |
|
|
(timer_active |= 1<<DEVICE_TIMEOUT))
|
336 |
|
|
|
337 |
|
|
#define CLEAR_TIMER \
|
338 |
|
|
timer_active &= ~(1<<DEVICE_TIMEOUT)
|
339 |
|
|
|
340 |
|
|
#define SET_INTR(x) \
|
341 |
|
|
if ((DEVICE_INTR = (x)) != NULL) \
|
342 |
|
|
SET_TIMER; \
|
343 |
|
|
else \
|
344 |
|
|
CLEAR_TIMER;
|
345 |
|
|
|
346 |
|
|
#else
|
347 |
|
|
|
348 |
|
|
#define SET_INTR(x) (DEVICE_INTR = (x))
|
349 |
|
|
|
350 |
|
|
#endif /* DEVICE_TIMEOUT */
|
351 |
|
|
|
352 |
|
|
static void (DEVICE_REQUEST)(void);
|
353 |
|
|
|
354 |
|
|
#ifdef DEVICE_INTR
|
355 |
|
|
#define CLEAR_INTR SET_INTR(NULL)
|
356 |
|
|
#else
|
357 |
|
|
#define CLEAR_INTR
|
358 |
|
|
#endif
|
359 |
|
|
|
360 |
|
|
#define INIT_REQUEST \
|
361 |
|
|
if (!CURRENT) {\
|
362 |
|
|
CLEAR_INTR; \
|
363 |
|
|
return; \
|
364 |
|
|
} \
|
365 |
|
|
if (MAJOR(CURRENT->rq_dev) != MAJOR_NR) \
|
366 |
|
|
panic(DEVICE_NAME ": request list destroyed"); \
|
367 |
|
|
if (CURRENT->bh) { \
|
368 |
|
|
if (!buffer_locked(CURRENT->bh)) \
|
369 |
|
|
panic(DEVICE_NAME ": block not locked"); \
|
370 |
|
|
}
|
371 |
|
|
|
372 |
|
|
#endif /* !defined(IDE_DRIVER) */
|
373 |
|
|
|
374 |
|
|
/* end_request() - SCSI devices have their own version */
|
375 |
|
|
/* - IDE drivers have their own copy too */
|
376 |
|
|
|
377 |
|
|
#if ! SCSI_BLK_MAJOR(MAJOR_NR)
|
378 |
|
|
|
379 |
|
|
#if defined(IDE_DRIVER) && !defined(_IDE_C) /* shared copy for IDE modules */
|
380 |
|
|
void ide_end_request(byte uptodate, ide_hwgroup_t *hwgroup);
|
381 |
|
|
#else
|
382 |
|
|
|
383 |
|
|
#ifdef IDE_DRIVER
|
384 |
|
|
void ide_end_request(byte uptodate, ide_hwgroup_t *hwgroup) {
|
385 |
|
|
struct request *req = hwgroup->rq;
|
386 |
|
|
#else
|
387 |
|
|
static void end_request(int uptodate) {
|
388 |
|
|
struct request *req = CURRENT;
|
389 |
|
|
#endif /* IDE_DRIVER */
|
390 |
|
|
struct buffer_head * bh;
|
391 |
|
|
|
392 |
|
|
req->errors = 0;
|
393 |
|
|
if (!uptodate) {
|
394 |
|
|
printk("end_request: I/O error, dev %s, sector %lu\n",
|
395 |
|
|
kdevname(req->rq_dev), req->sector);
|
396 |
|
|
req->nr_sectors--;
|
397 |
|
|
req->nr_sectors &= ~SECTOR_MASK;
|
398 |
|
|
req->sector += (BLOCK_SIZE / 512);
|
399 |
|
|
req->sector &= ~SECTOR_MASK;
|
400 |
|
|
}
|
401 |
|
|
|
402 |
|
|
if ((bh = req->bh) != NULL) {
|
403 |
|
|
req->bh = bh->b_reqnext;
|
404 |
|
|
bh->b_reqnext = NULL;
|
405 |
|
|
mark_buffer_uptodate(bh, uptodate);
|
406 |
|
|
unlock_buffer(bh);
|
407 |
|
|
if ((bh = req->bh) != NULL) {
|
408 |
|
|
req->current_nr_sectors = bh->b_size >> 9;
|
409 |
|
|
if (req->nr_sectors < req->current_nr_sectors) {
|
410 |
|
|
req->nr_sectors = req->current_nr_sectors;
|
411 |
|
|
printk("end_request: buffer-list destroyed\n");
|
412 |
|
|
}
|
413 |
|
|
req->buffer = bh->b_data;
|
414 |
|
|
return;
|
415 |
|
|
}
|
416 |
|
|
}
|
417 |
|
|
#ifndef DEVICE_NO_RANDOM
|
418 |
|
|
add_blkdev_randomness(MAJOR(req->rq_dev));
|
419 |
|
|
#endif
|
420 |
|
|
#ifdef IDE_DRIVER
|
421 |
|
|
blk_dev[MAJOR(req->rq_dev)].current_request = req->next;
|
422 |
|
|
hwgroup->rq = NULL;
|
423 |
|
|
#else
|
424 |
|
|
DEVICE_OFF(req->rq_dev);
|
425 |
|
|
CURRENT = req->next;
|
426 |
|
|
#endif /* IDE_DRIVER */
|
427 |
|
|
if (req->sem != NULL)
|
428 |
|
|
up(req->sem);
|
429 |
|
|
req->rq_status = RQ_INACTIVE;
|
430 |
|
|
wake_up(&wait_for_request);
|
431 |
|
|
}
|
432 |
|
|
#endif /* defined(IDE_DRIVER) && !defined(_IDE_C) */
|
433 |
|
|
#endif /* ! SCSI_BLK_MAJOR(MAJOR_NR) */
|
434 |
|
|
#endif /* (MAJOR_NR != SCSI_TAPE_MAJOR) */
|
435 |
|
|
|
436 |
|
|
#endif /* defined(MAJOR_NR) || defined(IDE_DRIVER) */
|
437 |
|
|
|
438 |
|
|
#endif /* _BLK_H */
|