aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide
diff options
context:
space:
mode:
authorJens Axboe <axboe@suse.de>2006-08-10 02:44:47 -0400
committerJens Axboe <axboe@nelson.home.kernel.dk>2006-09-30 14:23:37 -0400
commit4aff5e2333c9a1609662f2091f55c3f6fffdad36 (patch)
treeb73d8c2b7c1bdc03d3313c108da7dfc95ee95525 /drivers/ide
parent77ed74da26f50fa28471571ee7a2251b77526d84 (diff)
[PATCH] Split struct request ->flags into two parts
Right now ->flags is a bit of a mess: some are request types, and others are just modifiers. Clean this up by splitting it into ->cmd_type and ->cmd_flags. This allows introduction of generic Linux block message types, useful for sending generic Linux commands to block devices. Signed-off-by: Jens Axboe <axboe@suse.de>
Diffstat (limited to 'drivers/ide')
-rw-r--r--drivers/ide/ide-cd.c69
-rw-r--r--drivers/ide/ide-disk.c5
-rw-r--r--drivers/ide/ide-dma.c2
-rw-r--r--drivers/ide/ide-floppy.c14
-rw-r--r--drivers/ide/ide-io.c36
-rw-r--r--drivers/ide/ide-lib.c5
-rw-r--r--drivers/ide/ide-tape.c8
-rw-r--r--drivers/ide/ide-taskfile.c8
-rw-r--r--drivers/ide/ide.c4
-rw-r--r--drivers/ide/legacy/hd.c2
10 files changed, 78 insertions, 75 deletions
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 654d4cd09847..69bbb6206a00 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -372,7 +372,7 @@ static int cdrom_log_sense(ide_drive_t *drive, struct request *rq,
372{ 372{
373 int log = 0; 373 int log = 0;
374 374
375 if (!sense || !rq || (rq->flags & REQ_QUIET)) 375 if (!sense || !rq || (rq->cmd_flags & REQ_QUIET))
376 return 0; 376 return 0;
377 377
378 switch (sense->sense_key) { 378 switch (sense->sense_key) {
@@ -597,7 +597,7 @@ static void cdrom_prepare_request(ide_drive_t *drive, struct request *rq)
597 struct cdrom_info *cd = drive->driver_data; 597 struct cdrom_info *cd = drive->driver_data;
598 598
599 ide_init_drive_cmd(rq); 599 ide_init_drive_cmd(rq);
600 rq->flags = REQ_PC; 600 rq->cmd_type = REQ_TYPE_BLOCK_PC;
601 rq->rq_disk = cd->disk; 601 rq->rq_disk = cd->disk;
602} 602}
603 603
@@ -617,7 +617,7 @@ static void cdrom_queue_request_sense(ide_drive_t *drive, void *sense,
617 rq->cmd[0] = GPCMD_REQUEST_SENSE; 617 rq->cmd[0] = GPCMD_REQUEST_SENSE;
618 rq->cmd[4] = rq->data_len = 18; 618 rq->cmd[4] = rq->data_len = 18;
619 619
620 rq->flags = REQ_SENSE; 620 rq->cmd_type = REQ_TYPE_SENSE;
621 621
622 /* NOTE! Save the failed command in "rq->buffer" */ 622 /* NOTE! Save the failed command in "rq->buffer" */
623 rq->buffer = (void *) failed_command; 623 rq->buffer = (void *) failed_command;
@@ -630,10 +630,10 @@ static void cdrom_end_request (ide_drive_t *drive, int uptodate)
630 struct request *rq = HWGROUP(drive)->rq; 630 struct request *rq = HWGROUP(drive)->rq;
631 int nsectors = rq->hard_cur_sectors; 631 int nsectors = rq->hard_cur_sectors;
632 632
633 if ((rq->flags & REQ_SENSE) && uptodate) { 633 if (blk_sense_request(rq) && uptodate) {
634 /* 634 /*
635 * For REQ_SENSE, "rq->buffer" points to the original failed 635 * For REQ_TYPE_SENSE, "rq->buffer" points to the original
636 * request 636 * failed request
637 */ 637 */
638 struct request *failed = (struct request *) rq->buffer; 638 struct request *failed = (struct request *) rq->buffer;
639 struct cdrom_info *info = drive->driver_data; 639 struct cdrom_info *info = drive->driver_data;
@@ -706,17 +706,17 @@ static int cdrom_decode_status(ide_drive_t *drive, int good_stat, int *stat_ret)
706 return 1; 706 return 1;
707 } 707 }
708 708
709 if (rq->flags & REQ_SENSE) { 709 if (blk_sense_request(rq)) {
710 /* We got an error trying to get sense info 710 /* We got an error trying to get sense info
711 from the drive (probably while trying 711 from the drive (probably while trying
712 to recover from a former error). Just give up. */ 712 to recover from a former error). Just give up. */
713 713
714 rq->flags |= REQ_FAILED; 714 rq->cmd_flags |= REQ_FAILED;
715 cdrom_end_request(drive, 0); 715 cdrom_end_request(drive, 0);
716 ide_error(drive, "request sense failure", stat); 716 ide_error(drive, "request sense failure", stat);
717 return 1; 717 return 1;
718 718
719 } else if (rq->flags & (REQ_PC | REQ_BLOCK_PC)) { 719 } else if (blk_pc_request(rq)) {
720 /* All other functions, except for READ. */ 720 /* All other functions, except for READ. */
721 unsigned long flags; 721 unsigned long flags;
722 722
@@ -724,7 +724,7 @@ static int cdrom_decode_status(ide_drive_t *drive, int good_stat, int *stat_ret)
724 * if we have an error, pass back CHECK_CONDITION as the 724 * if we have an error, pass back CHECK_CONDITION as the
725 * scsi status byte 725 * scsi status byte
726 */ 726 */
727 if ((rq->flags & REQ_BLOCK_PC) && !rq->errors) 727 if (!rq->errors)
728 rq->errors = SAM_STAT_CHECK_CONDITION; 728 rq->errors = SAM_STAT_CHECK_CONDITION;
729 729
730 /* Check for tray open. */ 730 /* Check for tray open. */
@@ -735,12 +735,12 @@ static int cdrom_decode_status(ide_drive_t *drive, int good_stat, int *stat_ret)
735 cdrom_saw_media_change (drive); 735 cdrom_saw_media_change (drive);
736 /*printk("%s: media changed\n",drive->name);*/ 736 /*printk("%s: media changed\n",drive->name);*/
737 return 0; 737 return 0;
738 } else if (!(rq->flags & REQ_QUIET)) { 738 } else if (!(rq->cmd_flags & REQ_QUIET)) {
739 /* Otherwise, print an error. */ 739 /* Otherwise, print an error. */
740 ide_dump_status(drive, "packet command error", stat); 740 ide_dump_status(drive, "packet command error", stat);
741 } 741 }
742 742
743 rq->flags |= REQ_FAILED; 743 rq->cmd_flags |= REQ_FAILED;
744 744
745 /* 745 /*
746 * instead of playing games with moving completions around, 746 * instead of playing games with moving completions around,
@@ -881,7 +881,7 @@ static int cdrom_timer_expiry(ide_drive_t *drive)
881 wait = ATAPI_WAIT_PC; 881 wait = ATAPI_WAIT_PC;
882 break; 882 break;
883 default: 883 default:
884 if (!(rq->flags & REQ_QUIET)) 884 if (!(rq->cmd_flags & REQ_QUIET))
885 printk(KERN_INFO "ide-cd: cmd 0x%x timed out\n", rq->cmd[0]); 885 printk(KERN_INFO "ide-cd: cmd 0x%x timed out\n", rq->cmd[0]);
886 wait = 0; 886 wait = 0;
887 break; 887 break;
@@ -1124,7 +1124,7 @@ static ide_startstop_t cdrom_read_intr (ide_drive_t *drive)
1124 if (rq->current_nr_sectors > 0) { 1124 if (rq->current_nr_sectors > 0) {
1125 printk (KERN_ERR "%s: cdrom_read_intr: data underrun (%d blocks)\n", 1125 printk (KERN_ERR "%s: cdrom_read_intr: data underrun (%d blocks)\n",
1126 drive->name, rq->current_nr_sectors); 1126 drive->name, rq->current_nr_sectors);
1127 rq->flags |= REQ_FAILED; 1127 rq->cmd_flags |= REQ_FAILED;
1128 cdrom_end_request(drive, 0); 1128 cdrom_end_request(drive, 0);
1129 } else 1129 } else
1130 cdrom_end_request(drive, 1); 1130 cdrom_end_request(drive, 1);
@@ -1456,7 +1456,7 @@ static ide_startstop_t cdrom_pc_intr (ide_drive_t *drive)
1456 printk ("%s: cdrom_pc_intr: data underrun %d\n", 1456 printk ("%s: cdrom_pc_intr: data underrun %d\n",
1457 drive->name, pc->buflen); 1457 drive->name, pc->buflen);
1458 */ 1458 */
1459 rq->flags |= REQ_FAILED; 1459 rq->cmd_flags |= REQ_FAILED;
1460 cdrom_end_request(drive, 0); 1460 cdrom_end_request(drive, 0);
1461 } 1461 }
1462 return ide_stopped; 1462 return ide_stopped;
@@ -1509,7 +1509,7 @@ static ide_startstop_t cdrom_pc_intr (ide_drive_t *drive)
1509 rq->data += thislen; 1509 rq->data += thislen;
1510 rq->data_len -= thislen; 1510 rq->data_len -= thislen;
1511 1511
1512 if (rq->flags & REQ_SENSE) 1512 if (blk_sense_request(rq))
1513 rq->sense_len += thislen; 1513 rq->sense_len += thislen;
1514 } else { 1514 } else {
1515confused: 1515confused:
@@ -1517,7 +1517,7 @@ confused:
1517 "appears confused (ireason = 0x%02x). " 1517 "appears confused (ireason = 0x%02x). "
1518 "Trying to recover by ending request.\n", 1518 "Trying to recover by ending request.\n",
1519 drive->name, ireason); 1519 drive->name, ireason);
1520 rq->flags |= REQ_FAILED; 1520 rq->cmd_flags |= REQ_FAILED;
1521 cdrom_end_request(drive, 0); 1521 cdrom_end_request(drive, 0);
1522 return ide_stopped; 1522 return ide_stopped;
1523 } 1523 }
@@ -1546,7 +1546,7 @@ static ide_startstop_t cdrom_do_packet_command (ide_drive_t *drive)
1546 struct cdrom_info *info = drive->driver_data; 1546 struct cdrom_info *info = drive->driver_data;
1547 1547
1548 info->dma = 0; 1548 info->dma = 0;
1549 rq->flags &= ~REQ_FAILED; 1549 rq->cmd_flags &= ~REQ_FAILED;
1550 len = rq->data_len; 1550 len = rq->data_len;
1551 1551
1552 /* Start sending the command to the drive. */ 1552 /* Start sending the command to the drive. */
@@ -1558,7 +1558,7 @@ static int cdrom_queue_packet_command(ide_drive_t *drive, struct request *rq)
1558{ 1558{
1559 struct request_sense sense; 1559 struct request_sense sense;
1560 int retries = 10; 1560 int retries = 10;
1561 unsigned int flags = rq->flags; 1561 unsigned int flags = rq->cmd_flags;
1562 1562
1563 if (rq->sense == NULL) 1563 if (rq->sense == NULL)
1564 rq->sense = &sense; 1564 rq->sense = &sense;
@@ -1567,14 +1567,14 @@ static int cdrom_queue_packet_command(ide_drive_t *drive, struct request *rq)
1567 do { 1567 do {
1568 int error; 1568 int error;
1569 unsigned long time = jiffies; 1569 unsigned long time = jiffies;
1570 rq->flags = flags; 1570 rq->cmd_flags = flags;
1571 1571
1572 error = ide_do_drive_cmd(drive, rq, ide_wait); 1572 error = ide_do_drive_cmd(drive, rq, ide_wait);
1573 time = jiffies - time; 1573 time = jiffies - time;
1574 1574
1575 /* FIXME: we should probably abort/retry or something 1575 /* FIXME: we should probably abort/retry or something
1576 * in case of failure */ 1576 * in case of failure */
1577 if (rq->flags & REQ_FAILED) { 1577 if (rq->cmd_flags & REQ_FAILED) {
1578 /* The request failed. Retry if it was due to a unit 1578 /* The request failed. Retry if it was due to a unit
1579 attention status 1579 attention status
1580 (usually means media was changed). */ 1580 (usually means media was changed). */
@@ -1596,10 +1596,10 @@ static int cdrom_queue_packet_command(ide_drive_t *drive, struct request *rq)
1596 } 1596 }
1597 1597
1598 /* End of retry loop. */ 1598 /* End of retry loop. */
1599 } while ((rq->flags & REQ_FAILED) && retries >= 0); 1599 } while ((rq->cmd_flags & REQ_FAILED) && retries >= 0);
1600 1600
1601 /* Return an error if the command failed. */ 1601 /* Return an error if the command failed. */
1602 return (rq->flags & REQ_FAILED) ? -EIO : 0; 1602 return (rq->cmd_flags & REQ_FAILED) ? -EIO : 0;
1603} 1603}
1604 1604
1605/* 1605/*
@@ -1963,7 +1963,7 @@ static ide_startstop_t cdrom_do_block_pc(ide_drive_t *drive, struct request *rq)
1963{ 1963{
1964 struct cdrom_info *info = drive->driver_data; 1964 struct cdrom_info *info = drive->driver_data;
1965 1965
1966 rq->flags |= REQ_QUIET; 1966 rq->cmd_flags |= REQ_QUIET;
1967 1967
1968 info->dma = 0; 1968 info->dma = 0;
1969 1969
@@ -2023,11 +2023,11 @@ ide_do_rw_cdrom (ide_drive_t *drive, struct request *rq, sector_t block)
2023 } 2023 }
2024 info->last_block = block; 2024 info->last_block = block;
2025 return action; 2025 return action;
2026 } else if (rq->flags & (REQ_PC | REQ_SENSE)) { 2026 } else if (rq->cmd_type == REQ_TYPE_SENSE) {
2027 return cdrom_do_packet_command(drive); 2027 return cdrom_do_packet_command(drive);
2028 } else if (rq->flags & REQ_BLOCK_PC) { 2028 } else if (blk_pc_request(rq)) {
2029 return cdrom_do_block_pc(drive, rq); 2029 return cdrom_do_block_pc(drive, rq);
2030 } else if (rq->flags & REQ_SPECIAL) { 2030 } else if (blk_special_request(rq)) {
2031 /* 2031 /*
2032 * right now this can only be a reset... 2032 * right now this can only be a reset...
2033 */ 2033 */
@@ -2105,7 +2105,7 @@ static int cdrom_check_status(ide_drive_t *drive, struct request_sense *sense)
2105 2105
2106 req.sense = sense; 2106 req.sense = sense;
2107 req.cmd[0] = GPCMD_TEST_UNIT_READY; 2107 req.cmd[0] = GPCMD_TEST_UNIT_READY;
2108 req.flags |= REQ_QUIET; 2108 req.cmd_flags |= REQ_QUIET;
2109 2109
2110#if ! STANDARD_ATAPI 2110#if ! STANDARD_ATAPI
2111 /* the Sanyo 3 CD changer uses byte 7 of TEST_UNIT_READY to 2111 /* the Sanyo 3 CD changer uses byte 7 of TEST_UNIT_READY to
@@ -2207,7 +2207,7 @@ static int cdrom_read_capacity(ide_drive_t *drive, unsigned long *capacity,
2207 req.cmd[0] = GPCMD_READ_CDVD_CAPACITY; 2207 req.cmd[0] = GPCMD_READ_CDVD_CAPACITY;
2208 req.data = (char *)&capbuf; 2208 req.data = (char *)&capbuf;
2209 req.data_len = sizeof(capbuf); 2209 req.data_len = sizeof(capbuf);
2210 req.flags |= REQ_QUIET; 2210 req.cmd_flags |= REQ_QUIET;
2211 2211
2212 stat = cdrom_queue_packet_command(drive, &req); 2212 stat = cdrom_queue_packet_command(drive, &req);
2213 if (stat == 0) { 2213 if (stat == 0) {
@@ -2230,7 +2230,7 @@ static int cdrom_read_tocentry(ide_drive_t *drive, int trackno, int msf_flag,
2230 req.sense = sense; 2230 req.sense = sense;
2231 req.data = buf; 2231 req.data = buf;
2232 req.data_len = buflen; 2232 req.data_len = buflen;
2233 req.flags |= REQ_QUIET; 2233 req.cmd_flags |= REQ_QUIET;
2234 req.cmd[0] = GPCMD_READ_TOC_PMA_ATIP; 2234 req.cmd[0] = GPCMD_READ_TOC_PMA_ATIP;
2235 req.cmd[6] = trackno; 2235 req.cmd[6] = trackno;
2236 req.cmd[7] = (buflen >> 8); 2236 req.cmd[7] = (buflen >> 8);
@@ -2531,7 +2531,7 @@ static int ide_cdrom_packet(struct cdrom_device_info *cdi,
2531 req.timeout = cgc->timeout; 2531 req.timeout = cgc->timeout;
2532 2532
2533 if (cgc->quiet) 2533 if (cgc->quiet)
2534 req.flags |= REQ_QUIET; 2534 req.cmd_flags |= REQ_QUIET;
2535 2535
2536 req.sense = cgc->sense; 2536 req.sense = cgc->sense;
2537 cgc->stat = cdrom_queue_packet_command(drive, &req); 2537 cgc->stat = cdrom_queue_packet_command(drive, &req);
@@ -2629,7 +2629,8 @@ int ide_cdrom_reset (struct cdrom_device_info *cdi)
2629 int ret; 2629 int ret;
2630 2630
2631 cdrom_prepare_request(drive, &req); 2631 cdrom_prepare_request(drive, &req);
2632 req.flags = REQ_SPECIAL | REQ_QUIET; 2632 req.cmd_type = REQ_TYPE_SPECIAL;
2633 req.cmd_flags = REQ_QUIET;
2633 ret = ide_do_drive_cmd(drive, &req, ide_wait); 2634 ret = ide_do_drive_cmd(drive, &req, ide_wait);
2634 2635
2635 /* 2636 /*
@@ -3116,9 +3117,9 @@ static int ide_cdrom_prep_pc(struct request *rq)
3116 3117
3117static int ide_cdrom_prep_fn(request_queue_t *q, struct request *rq) 3118static int ide_cdrom_prep_fn(request_queue_t *q, struct request *rq)
3118{ 3119{
3119 if (rq->flags & REQ_CMD) 3120 if (blk_fs_request(rq))
3120 return ide_cdrom_prep_fs(q, rq); 3121 return ide_cdrom_prep_fs(q, rq);
3121 else if (rq->flags & REQ_BLOCK_PC) 3122 else if (blk_pc_request(rq))
3122 return ide_cdrom_prep_pc(rq); 3123 return ide_cdrom_prep_pc(rq);
3123 3124
3124 return 0; 3125 return 0;
diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c
index 7cf3eb023521..0a05a377d66a 100644
--- a/drivers/ide/ide-disk.c
+++ b/drivers/ide/ide-disk.c
@@ -699,7 +699,8 @@ static void idedisk_prepare_flush(request_queue_t *q, struct request *rq)
699 rq->cmd[0] = WIN_FLUSH_CACHE; 699 rq->cmd[0] = WIN_FLUSH_CACHE;
700 700
701 701
702 rq->flags |= REQ_DRIVE_TASK; 702 rq->cmd_type = REQ_TYPE_ATA_TASK;
703 rq->cmd_flags |= REQ_SOFTBARRIER;
703 rq->buffer = rq->cmd; 704 rq->buffer = rq->cmd;
704} 705}
705 706
@@ -740,7 +741,7 @@ static int set_multcount(ide_drive_t *drive, int arg)
740 if (drive->special.b.set_multmode) 741 if (drive->special.b.set_multmode)
741 return -EBUSY; 742 return -EBUSY;
742 ide_init_drive_cmd (&rq); 743 ide_init_drive_cmd (&rq);
743 rq.flags = REQ_DRIVE_CMD; 744 rq.cmd_type = REQ_TYPE_ATA_CMD;
744 drive->mult_req = arg; 745 drive->mult_req = arg;
745 drive->special.b.set_multmode = 1; 746 drive->special.b.set_multmode = 1;
746 (void) ide_do_drive_cmd (drive, &rq, ide_wait); 747 (void) ide_do_drive_cmd (drive, &rq, ide_wait);
diff --git a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c
index 7c3a13e1cf64..c3546fe9af63 100644
--- a/drivers/ide/ide-dma.c
+++ b/drivers/ide/ide-dma.c
@@ -205,7 +205,7 @@ int ide_build_sglist(ide_drive_t *drive, struct request *rq)
205 ide_hwif_t *hwif = HWIF(drive); 205 ide_hwif_t *hwif = HWIF(drive);
206 struct scatterlist *sg = hwif->sg_table; 206 struct scatterlist *sg = hwif->sg_table;
207 207
208 BUG_ON((rq->flags & REQ_DRIVE_TASKFILE) && rq->nr_sectors > 256); 208 BUG_ON((rq->cmd_type == REQ_TYPE_ATA_TASKFILE) && rq->nr_sectors > 256);
209 209
210 ide_map_sg(drive, rq); 210 ide_map_sg(drive, rq);
211 211
diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c
index adbe9f76a505..0edc32204915 100644
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -588,7 +588,7 @@ static int idefloppy_do_end_request(ide_drive_t *drive, int uptodate, int nsecs)
588 /* Why does this happen? */ 588 /* Why does this happen? */
589 if (!rq) 589 if (!rq)
590 return 0; 590 return 0;
591 if (!(rq->flags & REQ_SPECIAL)) { //if (!IDEFLOPPY_RQ_CMD (rq->cmd)) { 591 if (!blk_special_request(rq)) {
592 /* our real local end request function */ 592 /* our real local end request function */
593 ide_end_request(drive, uptodate, nsecs); 593 ide_end_request(drive, uptodate, nsecs);
594 return 0; 594 return 0;
@@ -689,7 +689,7 @@ static void idefloppy_queue_pc_head (ide_drive_t *drive,idefloppy_pc_t *pc,struc
689 689
690 ide_init_drive_cmd(rq); 690 ide_init_drive_cmd(rq);
691 rq->buffer = (char *) pc; 691 rq->buffer = (char *) pc;
692 rq->flags = REQ_SPECIAL; //rq->cmd = IDEFLOPPY_PC_RQ; 692 rq->cmd_type = REQ_TYPE_SPECIAL;
693 rq->rq_disk = floppy->disk; 693 rq->rq_disk = floppy->disk;
694 (void) ide_do_drive_cmd(drive, rq, ide_preempt); 694 (void) ide_do_drive_cmd(drive, rq, ide_preempt);
695} 695}
@@ -1250,7 +1250,7 @@ static void idefloppy_create_rw_cmd (idefloppy_floppy_t *floppy, idefloppy_pc_t
1250 pc->callback = &idefloppy_rw_callback; 1250 pc->callback = &idefloppy_rw_callback;
1251 pc->rq = rq; 1251 pc->rq = rq;
1252 pc->b_count = cmd == READ ? 0 : rq->bio->bi_size; 1252 pc->b_count = cmd == READ ? 0 : rq->bio->bi_size;
1253 if (rq->flags & REQ_RW) 1253 if (rq->cmd_flags & REQ_RW)
1254 set_bit(PC_WRITING, &pc->flags); 1254 set_bit(PC_WRITING, &pc->flags);
1255 pc->buffer = NULL; 1255 pc->buffer = NULL;
1256 pc->request_transfer = pc->buffer_size = blocks * floppy->block_size; 1256 pc->request_transfer = pc->buffer_size = blocks * floppy->block_size;
@@ -1303,7 +1303,7 @@ static ide_startstop_t idefloppy_do_request (ide_drive_t *drive, struct request
1303 idefloppy_do_end_request(drive, 0, 0); 1303 idefloppy_do_end_request(drive, 0, 0);
1304 return ide_stopped; 1304 return ide_stopped;
1305 } 1305 }
1306 if (rq->flags & REQ_CMD) { 1306 if (blk_fs_request(rq)) {
1307 if (((long)rq->sector % floppy->bs_factor) || 1307 if (((long)rq->sector % floppy->bs_factor) ||
1308 (rq->nr_sectors % floppy->bs_factor)) { 1308 (rq->nr_sectors % floppy->bs_factor)) {
1309 printk("%s: unsupported r/w request size\n", 1309 printk("%s: unsupported r/w request size\n",
@@ -1313,9 +1313,9 @@ static ide_startstop_t idefloppy_do_request (ide_drive_t *drive, struct request
1313 } 1313 }
1314 pc = idefloppy_next_pc_storage(drive); 1314 pc = idefloppy_next_pc_storage(drive);
1315 idefloppy_create_rw_cmd(floppy, pc, rq, block); 1315 idefloppy_create_rw_cmd(floppy, pc, rq, block);
1316 } else if (rq->flags & REQ_SPECIAL) { 1316 } else if (blk_special_request(rq)) {
1317 pc = (idefloppy_pc_t *) rq->buffer; 1317 pc = (idefloppy_pc_t *) rq->buffer;
1318 } else if (rq->flags & REQ_BLOCK_PC) { 1318 } else if (blk_pc_request(rq)) {
1319 pc = idefloppy_next_pc_storage(drive); 1319 pc = idefloppy_next_pc_storage(drive);
1320 if (idefloppy_blockpc_cmd(floppy, pc, rq)) { 1320 if (idefloppy_blockpc_cmd(floppy, pc, rq)) {
1321 idefloppy_do_end_request(drive, 0, 0); 1321 idefloppy_do_end_request(drive, 0, 0);
@@ -1343,7 +1343,7 @@ static int idefloppy_queue_pc_tail (ide_drive_t *drive,idefloppy_pc_t *pc)
1343 1343
1344 ide_init_drive_cmd (&rq); 1344 ide_init_drive_cmd (&rq);
1345 rq.buffer = (char *) pc; 1345 rq.buffer = (char *) pc;
1346 rq.flags = REQ_SPECIAL; // rq.cmd = IDEFLOPPY_PC_RQ; 1346 rq.cmd_type = REQ_TYPE_SPECIAL;
1347 rq.rq_disk = floppy->disk; 1347 rq.rq_disk = floppy->disk;
1348 1348
1349 return ide_do_drive_cmd(drive, &rq, ide_wait); 1349 return ide_do_drive_cmd(drive, &rq, ide_wait);
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c
index fb6795236e76..3436b1f104eb 100644
--- a/drivers/ide/ide-io.c
+++ b/drivers/ide/ide-io.c
@@ -59,7 +59,7 @@ static int __ide_end_request(ide_drive_t *drive, struct request *rq,
59{ 59{
60 int ret = 1; 60 int ret = 1;
61 61
62 BUG_ON(!(rq->flags & REQ_STARTED)); 62 BUG_ON(!blk_rq_started(rq));
63 63
64 /* 64 /*
65 * if failfast is set on a request, override number of sectors and 65 * if failfast is set on a request, override number of sectors and
@@ -244,7 +244,7 @@ int ide_end_dequeued_request(ide_drive_t *drive, struct request *rq,
244 244
245 spin_lock_irqsave(&ide_lock, flags); 245 spin_lock_irqsave(&ide_lock, flags);
246 246
247 BUG_ON(!(rq->flags & REQ_STARTED)); 247 BUG_ON(!blk_rq_started(rq));
248 248
249 /* 249 /*
250 * if failfast is set on a request, override number of sectors and 250 * if failfast is set on a request, override number of sectors and
@@ -366,7 +366,7 @@ void ide_end_drive_cmd (ide_drive_t *drive, u8 stat, u8 err)
366 rq = HWGROUP(drive)->rq; 366 rq = HWGROUP(drive)->rq;
367 spin_unlock_irqrestore(&ide_lock, flags); 367 spin_unlock_irqrestore(&ide_lock, flags);
368 368
369 if (rq->flags & REQ_DRIVE_CMD) { 369 if (rq->cmd_type == REQ_TYPE_ATA_CMD) {
370 u8 *args = (u8 *) rq->buffer; 370 u8 *args = (u8 *) rq->buffer;
371 if (rq->errors == 0) 371 if (rq->errors == 0)
372 rq->errors = !OK_STAT(stat,READY_STAT,BAD_STAT); 372 rq->errors = !OK_STAT(stat,READY_STAT,BAD_STAT);
@@ -376,7 +376,7 @@ void ide_end_drive_cmd (ide_drive_t *drive, u8 stat, u8 err)
376 args[1] = err; 376 args[1] = err;
377 args[2] = hwif->INB(IDE_NSECTOR_REG); 377 args[2] = hwif->INB(IDE_NSECTOR_REG);
378 } 378 }
379 } else if (rq->flags & REQ_DRIVE_TASK) { 379 } else if (rq->cmd_type == REQ_TYPE_ATA_TASK) {
380 u8 *args = (u8 *) rq->buffer; 380 u8 *args = (u8 *) rq->buffer;
381 if (rq->errors == 0) 381 if (rq->errors == 0)
382 rq->errors = !OK_STAT(stat,READY_STAT,BAD_STAT); 382 rq->errors = !OK_STAT(stat,READY_STAT,BAD_STAT);
@@ -390,7 +390,7 @@ void ide_end_drive_cmd (ide_drive_t *drive, u8 stat, u8 err)
390 args[5] = hwif->INB(IDE_HCYL_REG); 390 args[5] = hwif->INB(IDE_HCYL_REG);
391 args[6] = hwif->INB(IDE_SELECT_REG); 391 args[6] = hwif->INB(IDE_SELECT_REG);
392 } 392 }
393 } else if (rq->flags & REQ_DRIVE_TASKFILE) { 393 } else if (rq->cmd_type == REQ_TYPE_ATA_TASKFILE) {
394 ide_task_t *args = (ide_task_t *) rq->special; 394 ide_task_t *args = (ide_task_t *) rq->special;
395 if (rq->errors == 0) 395 if (rq->errors == 0)
396 rq->errors = !OK_STAT(stat,READY_STAT,BAD_STAT); 396 rq->errors = !OK_STAT(stat,READY_STAT,BAD_STAT);
@@ -587,7 +587,7 @@ ide_startstop_t ide_error (ide_drive_t *drive, const char *msg, u8 stat)
587 return ide_stopped; 587 return ide_stopped;
588 588
589 /* retry only "normal" I/O: */ 589 /* retry only "normal" I/O: */
590 if (rq->flags & (REQ_DRIVE_CMD | REQ_DRIVE_TASK | REQ_DRIVE_TASKFILE)) { 590 if (!blk_fs_request(rq)) {
591 rq->errors = 1; 591 rq->errors = 1;
592 ide_end_drive_cmd(drive, stat, err); 592 ide_end_drive_cmd(drive, stat, err);
593 return ide_stopped; 593 return ide_stopped;
@@ -638,7 +638,7 @@ ide_startstop_t ide_abort(ide_drive_t *drive, const char *msg)
638 return ide_stopped; 638 return ide_stopped;
639 639
640 /* retry only "normal" I/O: */ 640 /* retry only "normal" I/O: */
641 if (rq->flags & (REQ_DRIVE_CMD | REQ_DRIVE_TASK | REQ_DRIVE_TASKFILE)) { 641 if (!blk_fs_request(rq)) {
642 rq->errors = 1; 642 rq->errors = 1;
643 ide_end_drive_cmd(drive, BUSY_STAT, 0); 643 ide_end_drive_cmd(drive, BUSY_STAT, 0);
644 return ide_stopped; 644 return ide_stopped;
@@ -808,7 +808,7 @@ void ide_map_sg(ide_drive_t *drive, struct request *rq)
808 if (hwif->sg_mapped) /* needed by ide-scsi */ 808 if (hwif->sg_mapped) /* needed by ide-scsi */
809 return; 809 return;
810 810
811 if ((rq->flags & REQ_DRIVE_TASKFILE) == 0) { 811 if (rq->cmd_type != REQ_TYPE_ATA_TASKFILE) {
812 hwif->sg_nents = blk_rq_map_sg(drive->queue, rq, sg); 812 hwif->sg_nents = blk_rq_map_sg(drive->queue, rq, sg);
813 } else { 813 } else {
814 sg_init_one(sg, rq->buffer, rq->nr_sectors * SECTOR_SIZE); 814 sg_init_one(sg, rq->buffer, rq->nr_sectors * SECTOR_SIZE);
@@ -844,7 +844,7 @@ static ide_startstop_t execute_drive_cmd (ide_drive_t *drive,
844 struct request *rq) 844 struct request *rq)
845{ 845{
846 ide_hwif_t *hwif = HWIF(drive); 846 ide_hwif_t *hwif = HWIF(drive);
847 if (rq->flags & REQ_DRIVE_TASKFILE) { 847 if (rq->cmd_type == REQ_TYPE_ATA_TASKFILE) {
848 ide_task_t *args = rq->special; 848 ide_task_t *args = rq->special;
849 849
850 if (!args) 850 if (!args)
@@ -866,7 +866,7 @@ static ide_startstop_t execute_drive_cmd (ide_drive_t *drive,
866 if (args->tf_out_flags.all != 0) 866 if (args->tf_out_flags.all != 0)
867 return flagged_taskfile(drive, args); 867 return flagged_taskfile(drive, args);
868 return do_rw_taskfile(drive, args); 868 return do_rw_taskfile(drive, args);
869 } else if (rq->flags & REQ_DRIVE_TASK) { 869 } else if (rq->cmd_type == REQ_TYPE_ATA_TASK) {
870 u8 *args = rq->buffer; 870 u8 *args = rq->buffer;
871 u8 sel; 871 u8 sel;
872 872
@@ -892,7 +892,7 @@ static ide_startstop_t execute_drive_cmd (ide_drive_t *drive,
892 hwif->OUTB(sel, IDE_SELECT_REG); 892 hwif->OUTB(sel, IDE_SELECT_REG);
893 ide_cmd(drive, args[0], args[2], &drive_cmd_intr); 893 ide_cmd(drive, args[0], args[2], &drive_cmd_intr);
894 return ide_started; 894 return ide_started;
895 } else if (rq->flags & REQ_DRIVE_CMD) { 895 } else if (rq->cmd_type == REQ_TYPE_ATA_CMD) {
896 u8 *args = rq->buffer; 896 u8 *args = rq->buffer;
897 897
898 if (!args) 898 if (!args)
@@ -980,7 +980,7 @@ static ide_startstop_t start_request (ide_drive_t *drive, struct request *rq)
980 ide_startstop_t startstop; 980 ide_startstop_t startstop;
981 sector_t block; 981 sector_t block;
982 982
983 BUG_ON(!(rq->flags & REQ_STARTED)); 983 BUG_ON(!blk_rq_started(rq));
984 984
985#ifdef DEBUG 985#ifdef DEBUG
986 printk("%s: start_request: current=0x%08lx\n", 986 printk("%s: start_request: current=0x%08lx\n",
@@ -1013,9 +1013,9 @@ static ide_startstop_t start_request (ide_drive_t *drive, struct request *rq)
1013 if (!drive->special.all) { 1013 if (!drive->special.all) {
1014 ide_driver_t *drv; 1014 ide_driver_t *drv;
1015 1015
1016 if (rq->flags & (REQ_DRIVE_CMD | REQ_DRIVE_TASK)) 1016 if (rq->cmd_type == REQ_TYPE_ATA_CMD ||
1017 return execute_drive_cmd(drive, rq); 1017 rq->cmd_type == REQ_TYPE_ATA_TASK ||
1018 else if (rq->flags & REQ_DRIVE_TASKFILE) 1018 rq->cmd_type == REQ_TYPE_ATA_TASKFILE)
1019 return execute_drive_cmd(drive, rq); 1019 return execute_drive_cmd(drive, rq);
1020 else if (blk_pm_request(rq)) { 1020 else if (blk_pm_request(rq)) {
1021 struct request_pm_state *pm = rq->end_io_data; 1021 struct request_pm_state *pm = rq->end_io_data;
@@ -1264,7 +1264,7 @@ static void ide_do_request (ide_hwgroup_t *hwgroup, int masked_irq)
1264 * We count how many times we loop here to make sure we service 1264 * We count how many times we loop here to make sure we service
1265 * all drives in the hwgroup without looping for ever 1265 * all drives in the hwgroup without looping for ever
1266 */ 1266 */
1267 if (drive->blocked && !blk_pm_request(rq) && !(rq->flags & REQ_PREEMPT)) { 1267 if (drive->blocked && !blk_pm_request(rq) && !(rq->cmd_flags & REQ_PREEMPT)) {
1268 drive = drive->next ? drive->next : hwgroup->drive; 1268 drive = drive->next ? drive->next : hwgroup->drive;
1269 if (loops++ < 4 && !blk_queue_plugged(drive->queue)) 1269 if (loops++ < 4 && !blk_queue_plugged(drive->queue))
1270 goto again; 1270 goto again;
@@ -1670,7 +1670,7 @@ irqreturn_t ide_intr (int irq, void *dev_id, struct pt_regs *regs)
1670void ide_init_drive_cmd (struct request *rq) 1670void ide_init_drive_cmd (struct request *rq)
1671{ 1671{
1672 memset(rq, 0, sizeof(*rq)); 1672 memset(rq, 0, sizeof(*rq));
1673 rq->flags = REQ_DRIVE_CMD; 1673 rq->cmd_type = REQ_TYPE_ATA_CMD;
1674 rq->ref_count = 1; 1674 rq->ref_count = 1;
1675} 1675}
1676 1676
@@ -1727,7 +1727,7 @@ int ide_do_drive_cmd (ide_drive_t *drive, struct request *rq, ide_action_t actio
1727 hwgroup->rq = NULL; 1727 hwgroup->rq = NULL;
1728 if (action == ide_preempt || action == ide_head_wait) { 1728 if (action == ide_preempt || action == ide_head_wait) {
1729 where = ELEVATOR_INSERT_FRONT; 1729 where = ELEVATOR_INSERT_FRONT;
1730 rq->flags |= REQ_PREEMPT; 1730 rq->cmd_flags |= REQ_PREEMPT;
1731 } 1731 }
1732 __elv_add_request(drive->queue, rq, where, 0); 1732 __elv_add_request(drive->queue, rq, where, 0);
1733 ide_do_request(hwgroup, IDE_NO_IRQ); 1733 ide_do_request(hwgroup, IDE_NO_IRQ);
diff --git a/drivers/ide/ide-lib.c b/drivers/ide/ide-lib.c
index 1feff23487d4..850ef63cc986 100644
--- a/drivers/ide/ide-lib.c
+++ b/drivers/ide/ide-lib.c
@@ -456,13 +456,14 @@ static void ide_dump_opcode(ide_drive_t *drive)
456 spin_unlock(&ide_lock); 456 spin_unlock(&ide_lock);
457 if (!rq) 457 if (!rq)
458 return; 458 return;
459 if (rq->flags & (REQ_DRIVE_CMD | REQ_DRIVE_TASK)) { 459 if (rq->cmd_type == REQ_TYPE_ATA_CMD ||
460 rq->cmd_type == REQ_TYPE_ATA_TASK) {
460 char *args = rq->buffer; 461 char *args = rq->buffer;
461 if (args) { 462 if (args) {
462 opcode = args[0]; 463 opcode = args[0];
463 found = 1; 464 found = 1;
464 } 465 }
465 } else if (rq->flags & REQ_DRIVE_TASKFILE) { 466 } else if (rq->cmd_type == REQ_TYPE_ATA_TASKFILE) {
466 ide_task_t *args = rq->special; 467 ide_task_t *args = rq->special;
467 if (args) { 468 if (args) {
468 task_struct_t *tf = (task_struct_t *) args->tfRegister; 469 task_struct_t *tf = (task_struct_t *) args->tfRegister;
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
index 7067ab997927..643e4b9ac651 100644
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -1776,7 +1776,7 @@ static void idetape_create_request_sense_cmd (idetape_pc_t *pc)
1776static void idetape_init_rq(struct request *rq, u8 cmd) 1776static void idetape_init_rq(struct request *rq, u8 cmd)
1777{ 1777{
1778 memset(rq, 0, sizeof(*rq)); 1778 memset(rq, 0, sizeof(*rq));
1779 rq->flags = REQ_SPECIAL; 1779 rq->cmd_type = REQ_TYPE_SPECIAL;
1780 rq->cmd[0] = cmd; 1780 rq->cmd[0] = cmd;
1781} 1781}
1782 1782
@@ -2433,12 +2433,12 @@ static ide_startstop_t idetape_do_request(ide_drive_t *drive,
2433 rq->sector, rq->nr_sectors, rq->current_nr_sectors); 2433 rq->sector, rq->nr_sectors, rq->current_nr_sectors);
2434#endif /* IDETAPE_DEBUG_LOG */ 2434#endif /* IDETAPE_DEBUG_LOG */
2435 2435
2436 if ((rq->flags & REQ_SPECIAL) == 0) { 2436 if (!blk_special_request(rq)) {
2437 /* 2437 /*
2438 * We do not support buffer cache originated requests. 2438 * We do not support buffer cache originated requests.
2439 */ 2439 */
2440 printk(KERN_NOTICE "ide-tape: %s: Unsupported request in " 2440 printk(KERN_NOTICE "ide-tape: %s: Unsupported request in "
2441 "request queue (%ld)\n", drive->name, rq->flags); 2441 "request queue (%d)\n", drive->name, rq->cmd_type);
2442 ide_end_request(drive, 0, 0); 2442 ide_end_request(drive, 0, 0);
2443 return ide_stopped; 2443 return ide_stopped;
2444 } 2444 }
@@ -2768,7 +2768,7 @@ static void idetape_wait_for_request (ide_drive_t *drive, struct request *rq)
2768 idetape_tape_t *tape = drive->driver_data; 2768 idetape_tape_t *tape = drive->driver_data;
2769 2769
2770#if IDETAPE_DEBUG_BUGS 2770#if IDETAPE_DEBUG_BUGS
2771 if (rq == NULL || (rq->flags & REQ_SPECIAL) == 0) { 2771 if (rq == NULL || !blk_special_request(rq)) {
2772 printk (KERN_ERR "ide-tape: bug: Trying to sleep on non-valid request\n"); 2772 printk (KERN_ERR "ide-tape: bug: Trying to sleep on non-valid request\n");
2773 return; 2773 return;
2774 } 2774 }
diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c
index 97a9244312fc..1d0470c1f957 100644
--- a/drivers/ide/ide-taskfile.c
+++ b/drivers/ide/ide-taskfile.c
@@ -363,7 +363,7 @@ static ide_startstop_t task_error(ide_drive_t *drive, struct request *rq,
363 363
364static void task_end_request(ide_drive_t *drive, struct request *rq, u8 stat) 364static void task_end_request(ide_drive_t *drive, struct request *rq, u8 stat)
365{ 365{
366 if (rq->flags & REQ_DRIVE_TASKFILE) { 366 if (rq->cmd_type == REQ_TYPE_ATA_TASKFILE) {
367 ide_task_t *task = rq->special; 367 ide_task_t *task = rq->special;
368 368
369 if (task->tf_out_flags.all) { 369 if (task->tf_out_flags.all) {
@@ -474,7 +474,7 @@ static int ide_diag_taskfile(ide_drive_t *drive, ide_task_t *args, unsigned long
474 struct request rq; 474 struct request rq;
475 475
476 memset(&rq, 0, sizeof(rq)); 476 memset(&rq, 0, sizeof(rq));
477 rq.flags = REQ_DRIVE_TASKFILE; 477 rq.cmd_type = REQ_TYPE_ATA_TASKFILE;
478 rq.buffer = buf; 478 rq.buffer = buf;
479 479
480 /* 480 /*
@@ -499,7 +499,7 @@ static int ide_diag_taskfile(ide_drive_t *drive, ide_task_t *args, unsigned long
499 rq.hard_cur_sectors = rq.current_nr_sectors = rq.nr_sectors; 499 rq.hard_cur_sectors = rq.current_nr_sectors = rq.nr_sectors;
500 500
501 if (args->command_type == IDE_DRIVE_TASK_RAW_WRITE) 501 if (args->command_type == IDE_DRIVE_TASK_RAW_WRITE)
502 rq.flags |= REQ_RW; 502 rq.cmd_flags |= REQ_RW;
503 } 503 }
504 504
505 rq.special = args; 505 rq.special = args;
@@ -737,7 +737,7 @@ static int ide_wait_cmd_task(ide_drive_t *drive, u8 *buf)
737 struct request rq; 737 struct request rq;
738 738
739 ide_init_drive_cmd(&rq); 739 ide_init_drive_cmd(&rq);
740 rq.flags = REQ_DRIVE_TASK; 740 rq.cmd_type = REQ_TYPE_ATA_TASK;
741 rq.buffer = buf; 741 rq.buffer = buf;
742 return ide_do_drive_cmd(drive, &rq, ide_wait); 742 return ide_do_drive_cmd(drive, &rq, ide_wait);
743} 743}
diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c
index 9c8468de1a75..9384a3fdde6c 100644
--- a/drivers/ide/ide.c
+++ b/drivers/ide/ide.c
@@ -1217,7 +1217,7 @@ static int generic_ide_suspend(struct device *dev, pm_message_t mesg)
1217 memset(&rq, 0, sizeof(rq)); 1217 memset(&rq, 0, sizeof(rq));
1218 memset(&rqpm, 0, sizeof(rqpm)); 1218 memset(&rqpm, 0, sizeof(rqpm));
1219 memset(&args, 0, sizeof(args)); 1219 memset(&args, 0, sizeof(args));
1220 rq.flags = REQ_PM_SUSPEND; 1220 rq.cmd_type = REQ_TYPE_PM_SUSPEND;
1221 rq.special = &args; 1221 rq.special = &args;
1222 rq.end_io_data = &rqpm; 1222 rq.end_io_data = &rqpm;
1223 rqpm.pm_step = ide_pm_state_start_suspend; 1223 rqpm.pm_step = ide_pm_state_start_suspend;
@@ -1238,7 +1238,7 @@ static int generic_ide_resume(struct device *dev)
1238 memset(&rq, 0, sizeof(rq)); 1238 memset(&rq, 0, sizeof(rq));
1239 memset(&rqpm, 0, sizeof(rqpm)); 1239 memset(&rqpm, 0, sizeof(rqpm));
1240 memset(&args, 0, sizeof(args)); 1240 memset(&args, 0, sizeof(args));
1241 rq.flags = REQ_PM_RESUME; 1241 rq.cmd_type = REQ_TYPE_PM_RESUME;
1242 rq.special = &args; 1242 rq.special = &args;
1243 rq.end_io_data = &rqpm; 1243 rq.end_io_data = &rqpm;
1244 rqpm.pm_step = ide_pm_state_start_resume; 1244 rqpm.pm_step = ide_pm_state_start_resume;
diff --git a/drivers/ide/legacy/hd.c b/drivers/ide/legacy/hd.c
index aebecd8f51cc..4ab931145673 100644
--- a/drivers/ide/legacy/hd.c
+++ b/drivers/ide/legacy/hd.c
@@ -626,7 +626,7 @@ repeat:
626 req->rq_disk->disk_name, (req->cmd == READ)?"read":"writ", 626 req->rq_disk->disk_name, (req->cmd == READ)?"read":"writ",
627 cyl, head, sec, nsect, req->buffer); 627 cyl, head, sec, nsect, req->buffer);
628#endif 628#endif
629 if (req->flags & REQ_CMD) { 629 if (blk_fs_request(req)) {
630 switch (rq_data_dir(req)) { 630 switch (rq_data_dir(req)) {
631 case READ: 631 case READ:
632 hd_out(disk,nsect,sec,head,cyl,WIN_READ,&read_intr); 632 hd_out(disk,nsect,sec,head,cyl,WIN_READ,&read_intr);