summaryrefslogtreecommitdiff
path: root/drivers/block
diff options
context:
space:
mode:
authorMartin Dalecki <dalecki@evision-ventures.com>2002-05-28 02:25:46 -0700
committerLinus Torvalds <torvalds@home.transmeta.com>2002-05-28 02:25:46 -0700
commitcdac1baf3630ab913db678327ec03c2c03ee6c11 (patch)
tree4b18b8e5e1bec7646ed5830879ff139cff224020 /drivers/block
parent5fb231d28e7fd73eb5a1adb8f263d07355e198b7 (diff)
[PATCH] 2.5.18 QUEUE_EMPTY and the unpleasant friends.
- Eliminate all usages of the obscure QUEUE_EMPTY macro. - Eliminate all unneccessary checks for RQ_INACTIVE, this can't happen during the time we run the request strategy routine of a single major number block device. Perhaps the still remaining usage in scsi and i2o_block.c should be killed as well, since the upper ll_rw_blk layer shouldn't pass inactive requests down. Those are all places where we have deeply burried and hidden major number indexed arrays. Let's deal with them slowly...
Diffstat (limited to 'drivers/block')
-rw-r--r--drivers/block/acsi.c31
-rw-r--r--drivers/block/amiflop.c19
-rw-r--r--drivers/block/ataflop.c32
-rw-r--r--drivers/block/floppy.c10
-rw-r--r--drivers/block/nbd.c2
-rw-r--r--drivers/block/paride/pd.c3
-rw-r--r--drivers/block/paride/pf.c3
-rw-r--r--drivers/block/ps2esdi.c10
-rw-r--r--drivers/block/swim3.c2
-rw-r--r--drivers/block/swim_iop.c2
-rw-r--r--drivers/block/xd.c5
11 files changed, 33 insertions, 86 deletions
diff --git a/drivers/block/acsi.c b/drivers/block/acsi.c
index 9c522c8a87bc..4ea1c91e0dcf 100644
--- a/drivers/block/acsi.c
+++ b/drivers/block/acsi.c
@@ -768,7 +768,7 @@ static void unexpected_acsi_interrupt( void )
static void bad_rw_intr( void )
{
- if (QUEUE_EMPTY)
+ if (blk_queue_empty(QUEUE))
return;
if (++CURRENT->errors >= MAX_ERRORS)
@@ -842,7 +842,8 @@ static void acsi_times_out( unsigned long dummy )
DEVICE_INTR = NULL;
printk( KERN_ERR "ACSI timeout\n" );
- if (QUEUE_EMPTY) return;
+ if (blk_queue_empty(QUEUE))
+ return;
if (++CURRENT->errors >= MAX_ERRORS) {
#ifdef DEBUG
printk( KERN_ERR "ACSI: too many errors.\n" );
@@ -951,40 +952,20 @@ static void redo_acsi_request( void )
char *buffer;
unsigned long pbuffer;
struct buffer_head *bh;
-
- if (!QUEUE_EMPTY && CURRENT->rq_status == RQ_INACTIVE) {
- if (!DEVICE_INTR) {
- ENABLE_IRQ();
- stdma_release();
- }
- return;
- }
-
- if (DEVICE_INTR)
- return;
repeat:
CLEAR_TIMER();
- /* Another check here: An interrupt or timer event could have
- * happened since the last check!
- */
- if (!QUEUE_EMPTY && CURRENT->rq_status == RQ_INACTIVE) {
- if (!DEVICE_INTR) {
- ENABLE_IRQ();
- stdma_release();
- }
- return;
- }
+
if (DEVICE_INTR)
return;
- if (QUEUE_EMPTY) {
+ if (blk_queue_empty(QUEUE)) {
CLEAR_INTR;
ENABLE_IRQ();
stdma_release();
return;
}
-
+
if (MAJOR(CURRENT->rq_dev) != MAJOR_NR)
panic(DEVICE_NAME ": request list destroyed");
if (CURRENT->bh) {
diff --git a/drivers/block/amiflop.c b/drivers/block/amiflop.c
index c01361d6bb63..afac2dc96f61 100644
--- a/drivers/block/amiflop.c
+++ b/drivers/block/amiflop.c
@@ -209,17 +209,6 @@ static int fd_ref[4] = { 0,0,0,0 };
static kdev_t fd_device[4] = { NODEV, NODEV, NODEV, NODEV };
/*
- * Current device number. Taken either from the block header or from the
- * format request descriptor.
- */
-#define CURRENT_DEVICE (CURRENT->rq_dev)
-
-/* Current error count. */
-#define CURRENT_ERRORS (CURRENT->errors)
-
-
-
-/*
* Here come the actual hardware access and helper functions.
* They are not reentrant and single threaded because all drives
* share the same hardware and the same trackbuffer.
@@ -1383,12 +1372,8 @@ static void redo_fd_request(void)
char *data;
unsigned long flags;
- if (!QUEUE_EMPTY && CURRENT->rq_status == RQ_INACTIVE){
- return;
- }
-
repeat:
- if (QUEUE_EMPTY) {
+ if (blk_queue_empty(QUEUE)) {
/* Nothing left to do */
return;
}
@@ -1396,7 +1381,7 @@ static void redo_fd_request(void)
if (major(CURRENT->rq_dev) != MAJOR_NR)
panic(DEVICE_NAME ": request list destroyed");
- device = minor(CURRENT_DEVICE);
+ device = minor(CURRENT->rq_dev);
if (device < 8) {
/* manual selection */
drive = device & 3;
diff --git a/drivers/block/ataflop.c b/drivers/block/ataflop.c
index 13cc803b0e5a..85c691a0a6e8 100644
--- a/drivers/block/ataflop.c
+++ b/drivers/block/ataflop.c
@@ -625,8 +625,10 @@ static void fd_error( void )
wake_up( &format_wait );
return;
}
-
- if (QUEUE_EMPTY) return;
+
+ if (blk_queue_empty(QUEUE))
+ return;
+
CURRENT->errors++;
if (CURRENT->errors >= MAX_ERRORS) {
printk(KERN_ERR "fd%d: too many errors.\n", SelectedDrive );
@@ -1335,16 +1337,6 @@ static void finish_fdc_done( int dummy )
static int fd_ref[4] = { 0,0,0,0 };
static int fd_device[4] = { 0,0,0,0 };
-/*
- * Current device number. Taken either from the block header or from the
- * format request descriptor.
- */
-#define CURRENT_DEVICE (CURRENT->rq_dev)
-
-/* Current error count. */
-#define CURRENT_ERRORS (CURRENT->errors)
-
-
/* dummy for blk.h */
static void floppy_off( unsigned int nr) {}
@@ -1437,7 +1429,7 @@ static void setup_req_params( int drive )
ReqData = ReqBuffer + 512 * ReqCnt;
if (UseTrackbuffer)
- read_track = (ReqCmd == READ && CURRENT_ERRORS == 0);
+ read_track = (ReqCmd == READ && CURRENT->errors == 0);
else
read_track = 0;
@@ -1451,18 +1443,14 @@ static void redo_fd_request(void)
int device, drive, type;
DPRINT(("redo_fd_request: CURRENT=%08lx CURRENT->dev=%04x CURRENT->sector=%ld\n",
- (unsigned long)CURRENT, !QUEUE_EMPTY ? CURRENT->rq_dev : 0,
- !QUEUE_EMPTY ? CURRENT->sector : 0 ));
+ (unsigned long)CURRENT, !blk_queue_empty(QUEUE) ? CURRENT->rq_dev : 0,
+ !blk_queue_empty(QUEUE) ? CURRENT->sector : 0 ));
IsFormatting = 0;
- if (!QUEUE_EMPTY && CURRENT->rq_status == RQ_INACTIVE){
- return;
- }
-
repeat:
-
- if (QUEUE_EMPTY)
+
+ if (blk_queue_empty(QUEUE))
goto the_end;
if (major(CURRENT->rq_dev) != MAJOR_NR)
@@ -1471,7 +1459,7 @@ repeat:
if (CURRENT->bh && !buffer_locked(CURRENT->bh))
panic(DEVICE_NAME ": block not locked");
- device = minor(CURRENT_DEVICE);
+ device = minor(CURRENT->rq_dev);
drive = device & 3;
type = device >> 2;
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
index 63f38685e5cb..13bc90dbe06f 100644
--- a/drivers/block/floppy.c
+++ b/drivers/block/floppy.c
@@ -2918,14 +2918,8 @@ static void redo_fd_request(void)
if (current_drive < N_DRIVE)
floppy_off(current_drive);
- if (!QUEUE_EMPTY && CURRENT->rq_status == RQ_INACTIVE){
- CLEAR_INTR;
- unlock_fdc();
- return;
- }
-
- while(1){
- if (QUEUE_EMPTY) {
+ for (;;) {
+ if (blk_queue_empty(QUEUE)) {
CLEAR_INTR;
unlock_fdc();
return;
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index d2d42e341f04..d64aa828ac51 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -323,7 +323,7 @@ static void do_nbd_request(request_queue_t * q)
int dev = 0;
struct nbd_device *lo;
- while (!QUEUE_EMPTY) {
+ while (!blk_queue_empty(QUEUE)) {
req = CURRENT;
#ifdef PARANOIA
if (!req)
diff --git a/drivers/block/paride/pd.c b/drivers/block/paride/pd.c
index 331743a6addb..a9eac50c95b0 100644
--- a/drivers/block/paride/pd.c
+++ b/drivers/block/paride/pd.c
@@ -877,10 +877,9 @@ static void pd_next_buf( int unit )
/* paranoia */
- if (QUEUE_EMPTY ||
+ if (blk_queue_empty(QUEUE) ||
(rq_data_dir(CURRENT) != pd_cmd) ||
(minor(CURRENT->rq_dev) != pd_dev) ||
- (CURRENT->rq_status == RQ_INACTIVE) ||
(CURRENT->sector != pd_block))
printk("%s: OUCH: request list changed unexpectedly\n",
PD.name);
diff --git a/drivers/block/paride/pf.c b/drivers/block/paride/pf.c
index 505b4d05ea75..b63731da7aed 100644
--- a/drivers/block/paride/pf.c
+++ b/drivers/block/paride/pf.c
@@ -881,10 +881,9 @@ static void pf_next_buf( int unit )
/* paranoia */
- if (QUEUE_EMPTY ||
+ if (blk_queue_empty(QUEUE) ||
(rq_data_dir(CURRENT) != pf_cmd) ||
(DEVICE_NR(CURRENT->rq_dev) != pf_unit) ||
- (CURRENT->rq_status == RQ_INACTIVE) ||
(CURRENT->sector != pf_block))
printk("%s: OUCH: request list changed unexpectedly\n",
PF.name);
diff --git a/drivers/block/ps2esdi.c b/drivers/block/ps2esdi.c
index 756a905899ff..aa701c81b474 100644
--- a/drivers/block/ps2esdi.c
+++ b/drivers/block/ps2esdi.c
@@ -466,7 +466,7 @@ static void do_ps2esdi_request(request_queue_t * q)
#if 0
printk("%s:got request. device : %d minor : %d command : %d sector : %ld count : %ld, buffer: %p\n",
DEVICE_NAME,
- CURRENT_DEV, minor(CURRENT->rq_dev),
+ DEVICE_NR(CURRENT->rq_dev), minor(CURRENT->rq_dev),
CURRENT->cmd, CURRENT->sector,
CURRENT->current_nr_sectors, CURRENT->buffer);
#endif
@@ -482,14 +482,14 @@ static void do_ps2esdi_request(request_queue_t * q)
printk("%s: DMA above 16MB not supported\n", DEVICE_NAME);
end_request(FAIL);
} /* check for above 16Mb dmas */
- else if ((CURRENT_DEV < ps2esdi_drives) &&
+ else if ((DEVICE_NR(CURRENT->rq_dev) < ps2esdi_drives) &&
(CURRENT->sector + CURRENT->current_nr_sectors <=
ps2esdi[minor(CURRENT->rq_dev)].nr_sects) &&
CURRENT->flags & REQ_CMD) {
#if 0
printk("%s:got request. device : %d minor : %d command : %d sector : %ld count : %ld\n",
DEVICE_NAME,
- CURRENT_DEV, minor(CURRENT->rq_dev),
+ DEVICE_NR(CURRENT->rq_dev), minor(CURRENT->rq_dev),
CURRENT->cmd, CURRENT->sector,
CURRENT->current_nr_sectors);
#endif
@@ -499,10 +499,10 @@ static void do_ps2esdi_request(request_queue_t * q)
switch (rq_data_dir(CURRENT)) {
case READ:
- ps2esdi_readwrite(READ, CURRENT_DEV, block, count);
+ ps2esdi_readwrite(READ, DEVICE_NR(CURRENT->rq_dev), block, count);
break;
case WRITE:
- ps2esdi_readwrite(WRITE, CURRENT_DEV, block, count);
+ ps2esdi_readwrite(WRITE, DEVICE_NR(CURRENT->rq_dev), block, count);
break;
default:
printk("%s: Unknown command\n", DEVICE_NAME);
diff --git a/drivers/block/swim3.c b/drivers/block/swim3.c
index d83408ba14fb..90c0f028829e 100644
--- a/drivers/block/swim3.c
+++ b/drivers/block/swim3.c
@@ -313,7 +313,7 @@ static void start_request(struct floppy_state *fs)
wake_up(&fs->wait);
return;
}
- while (!QUEUE_EMPTY && fs->state == idle) {
+ while (!blk_queue_empty(QUEUE) && fs->state == idle) {
if (major(CURRENT->rq_dev) != MAJOR_NR)
panic(DEVICE_NAME ": request list destroyed");
// if (CURRENT->bh && !buffer_locked(CURRENT->bh))
diff --git a/drivers/block/swim_iop.c b/drivers/block/swim_iop.c
index d57ff9d3bbfb..98a60662b2bf 100644
--- a/drivers/block/swim_iop.c
+++ b/drivers/block/swim_iop.c
@@ -552,7 +552,7 @@ static void start_request(struct floppy_state *fs)
wake_up(&fs->wait);
return;
}
- while (!QUEUE_EMPTY && fs->state == idle) {
+ while (!blk_queue_empty(QUEUE) && fs->state == idle) {
if (MAJOR(CURRENT->rq_dev) != MAJOR_NR)
panic(DEVICE_NAME ": request list destroyed");
if (CURRENT->bh && !buffer_locked(CURRENT->bh))
diff --git a/drivers/block/xd.c b/drivers/block/xd.c
index df12c3b6ca8e..dfdd35ffc120 100644
--- a/drivers/block/xd.c
+++ b/drivers/block/xd.c
@@ -286,7 +286,7 @@ static void do_xd_request (request_queue_t * q)
return;
}
- if (CURRENT_DEV < xd_drives
+ if (DEVICE_NR(CURRENT->rq_dev) < xd_drives
&& (CURRENT->flags & REQ_CMD)
&& CURRENT->sector + CURRENT->nr_sectors
<= xd_struct[minor(CURRENT->rq_dev)].nr_sects) {
@@ -297,7 +297,8 @@ static void do_xd_request (request_queue_t * q)
case READ:
case WRITE:
for (retry = 0; (retry < XD_RETRIES) && !code; retry++)
- code = xd_readwrite(rq_data_dir(CURRENT),CURRENT_DEV,CURRENT->buffer,block,count);
+ code = xd_readwrite(rq_data_dir(CURRENT),DEVICE_NR(CURRENT->rq_dev),
+ CURRENT->buffer,block,count);
break;
default:
printk("do_xd_request: unknown request\n");