aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2010-08-07 12:17:56 -0400
committerJens Axboe <jaxboe@fusionio.com>2010-08-07 12:17:56 -0400
commit33659ebbae262228eef4e0fe990f393d1f0ed941 (patch)
treefcb537f09359c8dad3a6f6e16dc4319562dc42cc /drivers/ide
parent7e005f79791dcd58436c88ded4a7f5aed1b82147 (diff)
block: remove wrappers for request type/flags
Remove all the trivial wrappers for the cmd_type and cmd_flags fields in struct requests. This allows much easier grepping for different request types instead of unwinding through macros. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
Diffstat (limited to 'drivers/ide')
-rw-r--r--drivers/ide/ide-atapi.c17
-rw-r--r--drivers/ide/ide-cd.c66
-rw-r--r--drivers/ide/ide-disk.c2
-rw-r--r--drivers/ide/ide-eh.c5
-rw-r--r--drivers/ide/ide-floppy.c25
-rw-r--r--drivers/ide/ide-io.c8
-rw-r--r--drivers/ide/ide-pm.c8
-rw-r--r--drivers/ide/ide-tape.c3
8 files changed, 76 insertions, 58 deletions
diff --git a/drivers/ide/ide-atapi.c b/drivers/ide/ide-atapi.c
index f9daffd7d0e3..3117a894d20e 100644
--- a/drivers/ide/ide-atapi.c
+++ b/drivers/ide/ide-atapi.c
@@ -190,7 +190,7 @@ void ide_prep_sense(ide_drive_t *drive, struct request *rq)
190 190
191 BUG_ON(sense_len > sizeof(*sense)); 191 BUG_ON(sense_len > sizeof(*sense));
192 192
193 if (blk_sense_request(rq) || drive->sense_rq_armed) 193 if (rq->cmd_type == REQ_TYPE_SENSE || drive->sense_rq_armed)
194 return; 194 return;
195 195
196 memset(sense, 0, sizeof(*sense)); 196 memset(sense, 0, sizeof(*sense));
@@ -307,13 +307,16 @@ EXPORT_SYMBOL_GPL(ide_cd_expiry);
307 307
308int ide_cd_get_xferlen(struct request *rq) 308int ide_cd_get_xferlen(struct request *rq)
309{ 309{
310 if (blk_fs_request(rq)) 310 switch (rq->cmd_type)
311 case REQ_TYPE_FS:
311 return 32768; 312 return 32768;
312 else if (blk_sense_request(rq) || blk_pc_request(rq) || 313 case REQ_TYPE_SENSE:
313 rq->cmd_type == REQ_TYPE_ATA_PC) 314 case REQ_TYPE_BLOCK_PC:
315 case REQ_TYPE_ATA_PC:
314 return blk_rq_bytes(rq); 316 return blk_rq_bytes(rq);
315 else 317 default:
316 return 0; 318 return 0;
319 }
317} 320}
318EXPORT_SYMBOL_GPL(ide_cd_get_xferlen); 321EXPORT_SYMBOL_GPL(ide_cd_get_xferlen);
319 322
@@ -474,12 +477,12 @@ static ide_startstop_t ide_pc_intr(ide_drive_t *drive)
474 if (uptodate == 0) 477 if (uptodate == 0)
475 drive->failed_pc = NULL; 478 drive->failed_pc = NULL;
476 479
477 if (blk_special_request(rq)) { 480 if (rq->cmd_type == REQ_TYPE_SPECIAL)
478 rq->errors = 0; 481 rq->errors = 0;
479 error = 0; 482 error = 0;
480 } else { 483 } else {
481 484
482 if (blk_fs_request(rq) == 0 && uptodate <= 0) { 485 if (req->cmd_type != REQ_TYPE_FS && uptodate <= 0) {
483 if (rq->errors == 0) 486 if (rq->errors == 0)
484 rq->errors = -EIO; 487 rq->errors = -EIO;
485 } 488 }
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 64207df8da82..26a3688de467 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -176,7 +176,7 @@ static void cdrom_analyze_sense_data(ide_drive_t *drive,
176 if (!sense->valid) 176 if (!sense->valid)
177 break; 177 break;
178 if (failed_command == NULL || 178 if (failed_command == NULL ||
179 !blk_fs_request(failed_command)) 179 failed_command->cmd_type != REQ_TYPE_FS)
180 break; 180 break;
181 sector = (sense->information[0] << 24) | 181 sector = (sense->information[0] << 24) |
182 (sense->information[1] << 16) | 182 (sense->information[1] << 16) |
@@ -292,7 +292,7 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat)
292 "stat 0x%x", 292 "stat 0x%x",
293 rq->cmd[0], rq->cmd_type, err, stat); 293 rq->cmd[0], rq->cmd_type, err, stat);
294 294
295 if (blk_sense_request(rq)) { 295 if (rq->cmd_type == REQ_TYPE_SENSE) {
296 /* 296 /*
297 * We got an error trying to get sense info from the drive 297 * We got an error trying to get sense info from the drive
298 * (probably while trying to recover from a former error). 298 * (probably while trying to recover from a former error).
@@ -303,7 +303,7 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat)
303 } 303 }
304 304
305 /* if we have an error, pass CHECK_CONDITION as the SCSI status byte */ 305 /* if we have an error, pass CHECK_CONDITION as the SCSI status byte */
306 if (blk_pc_request(rq) && !rq->errors) 306 if (rq->cmd_type == REQ_TYPE_BLOCK_PC && !rq->errors)
307 rq->errors = SAM_STAT_CHECK_CONDITION; 307 rq->errors = SAM_STAT_CHECK_CONDITION;
308 308
309 if (blk_noretry_request(rq)) 309 if (blk_noretry_request(rq))
@@ -311,13 +311,14 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat)
311 311
312 switch (sense_key) { 312 switch (sense_key) {
313 case NOT_READY: 313 case NOT_READY:
314 if (blk_fs_request(rq) && rq_data_dir(rq) == WRITE) { 314 if (rq->cmd_type == REQ_TYPE_FS && rq_data_dir(rq) == WRITE) {
315 if (ide_cd_breathe(drive, rq)) 315 if (ide_cd_breathe(drive, rq))
316 return 1; 316 return 1;
317 } else { 317 } else {
318 cdrom_saw_media_change(drive); 318 cdrom_saw_media_change(drive);
319 319
320 if (blk_fs_request(rq) && !blk_rq_quiet(rq)) 320 if (rq->cmd_type == REQ_TYPE_FS &&
321 !(rq->cmd_flags & REQ_QUIET)) {
321 printk(KERN_ERR PFX "%s: tray open\n", 322 printk(KERN_ERR PFX "%s: tray open\n",
322 drive->name); 323 drive->name);
323 } 324 }
@@ -326,7 +327,7 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat)
326 case UNIT_ATTENTION: 327 case UNIT_ATTENTION:
327 cdrom_saw_media_change(drive); 328 cdrom_saw_media_change(drive);
328 329
329 if (blk_fs_request(rq) == 0) 330 if (rq->cmd_type != REQ_TYPE_FS)
330 return 0; 331 return 0;
331 332
332 /* 333 /*
@@ -352,7 +353,7 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat)
352 * No point in retrying after an illegal request or data 353 * No point in retrying after an illegal request or data
353 * protect error. 354 * protect error.
354 */ 355 */
355 if (!blk_rq_quiet(rq)) 356 if (!(rq->cmd_flags & REQ_QUIET))
356 ide_dump_status(drive, "command error", stat); 357 ide_dump_status(drive, "command error", stat);
357 do_end_request = 1; 358 do_end_request = 1;
358 break; 359 break;
@@ -361,20 +362,20 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat)
361 * No point in re-trying a zillion times on a bad sector. 362 * No point in re-trying a zillion times on a bad sector.
362 * If we got here the error is not correctable. 363 * If we got here the error is not correctable.
363 */ 364 */
364 if (!blk_rq_quiet(rq)) 365 if (!(rq->cmd_flags & REQ_QUIET))
365 ide_dump_status(drive, "media error " 366 ide_dump_status(drive, "media error "
366 "(bad sector)", stat); 367 "(bad sector)", stat);
367 do_end_request = 1; 368 do_end_request = 1;
368 break; 369 break;
369 case BLANK_CHECK: 370 case BLANK_CHECK:
370 /* disk appears blank? */ 371 /* disk appears blank? */
371 if (!blk_rq_quiet(rq)) 372 if (!(rq->cmd_flags & REQ_QUIET))
372 ide_dump_status(drive, "media error (blank)", 373 ide_dump_status(drive, "media error (blank)",
373 stat); 374 stat);
374 do_end_request = 1; 375 do_end_request = 1;
375 break; 376 break;
376 default: 377 default:
377 if (blk_fs_request(rq) == 0) 378 if (req->cmd_type != REQ_TYPE_FS)
378 break; 379 break;
379 if (err & ~ATA_ABORTED) { 380 if (err & ~ATA_ABORTED) {
380 /* go to the default handler for other errors */ 381 /* go to the default handler for other errors */
@@ -385,7 +386,7 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat)
385 do_end_request = 1; 386 do_end_request = 1;
386 } 387 }
387 388
388 if (blk_fs_request(rq) == 0) { 389 if (rq->cmd_type != REQ_TYPE_FS) {
389 rq->cmd_flags |= REQ_FAILED; 390 rq->cmd_flags |= REQ_FAILED;
390 do_end_request = 1; 391 do_end_request = 1;
391 } 392 }
@@ -525,7 +526,7 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
525 ide_expiry_t *expiry = NULL; 526 ide_expiry_t *expiry = NULL;
526 int dma_error = 0, dma, thislen, uptodate = 0; 527 int dma_error = 0, dma, thislen, uptodate = 0;
527 int write = (rq_data_dir(rq) == WRITE) ? 1 : 0, rc = 0; 528 int write = (rq_data_dir(rq) == WRITE) ? 1 : 0, rc = 0;
528 int sense = blk_sense_request(rq); 529 int sense = (rq->cmd_type == REQ_TYPE_SENSE);
529 unsigned int timeout; 530 unsigned int timeout;
530 u16 len; 531 u16 len;
531 u8 ireason, stat; 532 u8 ireason, stat;
@@ -568,7 +569,7 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
568 569
569 ide_read_bcount_and_ireason(drive, &len, &ireason); 570 ide_read_bcount_and_ireason(drive, &len, &ireason);
570 571
571 thislen = blk_fs_request(rq) ? len : cmd->nleft; 572 thislen = (rq->cmd_type == REQ_TYPE_FS) ? len : cmd->nleft;
572 if (thislen > len) 573 if (thislen > len)
573 thislen = len; 574 thislen = len;
574 575
@@ -577,7 +578,7 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
577 578
578 /* If DRQ is clear, the command has completed. */ 579 /* If DRQ is clear, the command has completed. */
579 if ((stat & ATA_DRQ) == 0) { 580 if ((stat & ATA_DRQ) == 0) {
580 if (blk_fs_request(rq)) { 581 if (rq->cmd_type == REQ_TYPE_FS) {
581 /* 582 /*
582 * If we're not done reading/writing, complain. 583 * If we're not done reading/writing, complain.
583 * Otherwise, complete the command normally. 584 * Otherwise, complete the command normally.
@@ -591,7 +592,7 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
591 rq->cmd_flags |= REQ_FAILED; 592 rq->cmd_flags |= REQ_FAILED;
592 uptodate = 0; 593 uptodate = 0;
593 } 594 }
594 } else if (!blk_pc_request(rq)) { 595 } else if (rq->cmd_type != REQ_TYPE_BLOCK_PC) {
595 ide_cd_request_sense_fixup(drive, cmd); 596 ide_cd_request_sense_fixup(drive, cmd);
596 597
597 uptodate = cmd->nleft ? 0 : 1; 598 uptodate = cmd->nleft ? 0 : 1;
@@ -640,7 +641,7 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
640 641
641 /* pad, if necessary */ 642 /* pad, if necessary */
642 if (len > 0) { 643 if (len > 0) {
643 if (blk_fs_request(rq) == 0 || write == 0) 644 if (rq->cmd_type != REQ_TYPE_FS || write == 0)
644 ide_pad_transfer(drive, write, len); 645 ide_pad_transfer(drive, write, len);
645 else { 646 else {
646 printk(KERN_ERR PFX "%s: confused, missing data\n", 647 printk(KERN_ERR PFX "%s: confused, missing data\n",
@@ -649,11 +650,11 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
649 } 650 }
650 } 651 }
651 652
652 if (blk_pc_request(rq)) { 653 if (rq->cmd_type == REQ_TYPE_BLOCK_PC) {
653 timeout = rq->timeout; 654 timeout = rq->timeout;
654 } else { 655 } else {
655 timeout = ATAPI_WAIT_PC; 656 timeout = ATAPI_WAIT_PC;
656 if (!blk_fs_request(rq)) 657 if (rq->cmd_type != REQ_TYPE_FS)
657 expiry = ide_cd_expiry; 658 expiry = ide_cd_expiry;
658 } 659 }
659 660
@@ -662,7 +663,7 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
662 return ide_started; 663 return ide_started;
663 664
664out_end: 665out_end:
665 if (blk_pc_request(rq) && rc == 0) { 666 if (rq->cmd_type == REQ_TYPE_BLOCK_PC && rc == 0) {
666 rq->resid_len = 0; 667 rq->resid_len = 0;
667 blk_end_request_all(rq, 0); 668 blk_end_request_all(rq, 0);
668 hwif->rq = NULL; 669 hwif->rq = NULL;
@@ -670,7 +671,7 @@ out_end:
670 if (sense && uptodate) 671 if (sense && uptodate)
671 ide_cd_complete_failed_rq(drive, rq); 672 ide_cd_complete_failed_rq(drive, rq);
672 673
673 if (blk_fs_request(rq)) { 674 if (rq->cmd_type == REQ_TYPE_FS) {
674 if (cmd->nleft == 0) 675 if (cmd->nleft == 0)
675 uptodate = 1; 676 uptodate = 1;
676 } else { 677 } else {
@@ -682,7 +683,7 @@ out_end:
682 ide_cd_error_cmd(drive, cmd); 683 ide_cd_error_cmd(drive, cmd);
683 684
684 /* make sure it's fully ended */ 685 /* make sure it's fully ended */
685 if (blk_fs_request(rq) == 0) { 686 if (rq->cmd_type != REQ_TYPE_FS) {
686 rq->resid_len -= cmd->nbytes - cmd->nleft; 687 rq->resid_len -= cmd->nbytes - cmd->nleft;
687 if (uptodate == 0 && (cmd->tf_flags & IDE_TFLAG_WRITE)) 688 if (uptodate == 0 && (cmd->tf_flags & IDE_TFLAG_WRITE))
688 rq->resid_len += cmd->last_xfer_len; 689 rq->resid_len += cmd->last_xfer_len;
@@ -742,7 +743,7 @@ static void cdrom_do_block_pc(ide_drive_t *drive, struct request *rq)
742 ide_debug_log(IDE_DBG_PC, "rq->cmd[0]: 0x%x, rq->cmd_type: 0x%x", 743 ide_debug_log(IDE_DBG_PC, "rq->cmd[0]: 0x%x, rq->cmd_type: 0x%x",
743 rq->cmd[0], rq->cmd_type); 744 rq->cmd[0], rq->cmd_type);
744 745
745 if (blk_pc_request(rq)) 746 if (rq->cmd_type == REQ_TYPE_BLOCK_PC)
746 rq->cmd_flags |= REQ_QUIET; 747 rq->cmd_flags |= REQ_QUIET;
747 else 748 else
748 rq->cmd_flags &= ~REQ_FAILED; 749 rq->cmd_flags &= ~REQ_FAILED;
@@ -783,21 +784,26 @@ static ide_startstop_t ide_cd_do_request(ide_drive_t *drive, struct request *rq,
783 if (drive->debug_mask & IDE_DBG_RQ) 784 if (drive->debug_mask & IDE_DBG_RQ)
784 blk_dump_rq_flags(rq, "ide_cd_do_request"); 785 blk_dump_rq_flags(rq, "ide_cd_do_request");
785 786
786 if (blk_fs_request(rq)) { 787 switch (rq->cmd_type) {
788 case REQ_TYPE_FS:
787 if (cdrom_start_rw(drive, rq) == ide_stopped) 789 if (cdrom_start_rw(drive, rq) == ide_stopped)
788 goto out_end; 790 goto out_end;
789 } else if (blk_sense_request(rq) || blk_pc_request(rq) || 791 break;
790 rq->cmd_type == REQ_TYPE_ATA_PC) { 792 case REQ_TYPE_SENSE:
793 case REQ_TYPE_BLOCK_PC:
794 case REQ_TYPE_ATA_PC:
791 if (!rq->timeout) 795 if (!rq->timeout)
792 rq->timeout = ATAPI_WAIT_PC; 796 rq->timeout = ATAPI_WAIT_PC;
793 797
794 cdrom_do_block_pc(drive, rq); 798 cdrom_do_block_pc(drive, rq);
795 } else if (blk_special_request(rq)) { 799 break;
800 case REQ_TYPE_SPECIAL:
796 /* right now this can only be a reset... */ 801 /* right now this can only be a reset... */
797 uptodate = 1; 802 uptodate = 1;
798 goto out_end; 803 goto out_end;
799 } else 804 default:
800 BUG(); 805 BUG();
806 }
801 807
802 /* prepare sense request for this command */ 808 /* prepare sense request for this command */
803 ide_prep_sense(drive, rq); 809 ide_prep_sense(drive, rq);
@@ -809,7 +815,7 @@ static ide_startstop_t ide_cd_do_request(ide_drive_t *drive, struct request *rq,
809 815
810 cmd.rq = rq; 816 cmd.rq = rq;
811 817
812 if (blk_fs_request(rq) || blk_rq_bytes(rq)) { 818 if (rq->cmd_type == REQ_TYPE_FS || blk_rq_bytes(rq)) {
813 ide_init_sg_cmd(&cmd, blk_rq_bytes(rq)); 819 ide_init_sg_cmd(&cmd, blk_rq_bytes(rq));
814 ide_map_sg(drive, &cmd); 820 ide_map_sg(drive, &cmd);
815 } 821 }
@@ -1365,9 +1371,9 @@ static int ide_cdrom_prep_pc(struct request *rq)
1365 1371
1366static int ide_cdrom_prep_fn(struct request_queue *q, struct request *rq) 1372static int ide_cdrom_prep_fn(struct request_queue *q, struct request *rq)
1367{ 1373{
1368 if (blk_fs_request(rq)) 1374 if (rq->cmd_type == REQ_TYPE_FS)
1369 return ide_cdrom_prep_fs(q, rq); 1375 return ide_cdrom_prep_fs(q, rq);
1370 else if (blk_pc_request(rq)) 1376 else if (rq->cmd_type == REQ_TYPE_BLOCK_PC)
1371 return ide_cdrom_prep_pc(rq); 1377 return ide_cdrom_prep_pc(rq);
1372 1378
1373 return 0; 1379 return 0;
diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c
index 33d65039cce9..df3d91ba1c96 100644
--- a/drivers/ide/ide-disk.c
+++ b/drivers/ide/ide-disk.c
@@ -184,7 +184,7 @@ static ide_startstop_t ide_do_rw_disk(ide_drive_t *drive, struct request *rq,
184 ide_hwif_t *hwif = drive->hwif; 184 ide_hwif_t *hwif = drive->hwif;
185 185
186 BUG_ON(drive->dev_flags & IDE_DFLAG_BLOCKED); 186 BUG_ON(drive->dev_flags & IDE_DFLAG_BLOCKED);
187 BUG_ON(!blk_fs_request(rq)); 187 BUG_ON(rq->cmd_type != REQ_TYPE_FS);
188 188
189 ledtrig_ide_activity(); 189 ledtrig_ide_activity();
190 190
diff --git a/drivers/ide/ide-eh.c b/drivers/ide/ide-eh.c
index e9abf2c3c335..c0aa93fb7a60 100644
--- a/drivers/ide/ide-eh.c
+++ b/drivers/ide/ide-eh.c
@@ -122,7 +122,7 @@ ide_startstop_t ide_error(ide_drive_t *drive, const char *msg, u8 stat)
122 return ide_stopped; 122 return ide_stopped;
123 123
124 /* retry only "normal" I/O: */ 124 /* retry only "normal" I/O: */
125 if (!blk_fs_request(rq)) { 125 if (rq->cmd_type != REQ_TYPE_FS) {
126 if (rq->cmd_type == REQ_TYPE_ATA_TASKFILE) { 126 if (rq->cmd_type == REQ_TYPE_ATA_TASKFILE) {
127 struct ide_cmd *cmd = rq->special; 127 struct ide_cmd *cmd = rq->special;
128 128
@@ -146,7 +146,8 @@ static inline void ide_complete_drive_reset(ide_drive_t *drive, int err)
146{ 146{
147 struct request *rq = drive->hwif->rq; 147 struct request *rq = drive->hwif->rq;
148 148
149 if (rq && blk_special_request(rq) && rq->cmd[0] == REQ_DRIVE_RESET) { 149 if (rq && rq->cmd_type == REQ_TYPE_SPECIAL &&
150 rq->cmd[0] == REQ_DRIVE_RESET) {
150 if (err <= 0 && rq->errors == 0) 151 if (err <= 0 && rq->errors == 0)
151 rq->errors = -EIO; 152 rq->errors = -EIO;
152 ide_complete_rq(drive, err ? err : 0, blk_rq_bytes(rq)); 153 ide_complete_rq(drive, err ? err : 0, blk_rq_bytes(rq));
diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c
index 4713bdca20b6..c7d0737bb18a 100644
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -73,7 +73,7 @@ static int ide_floppy_callback(ide_drive_t *drive, int dsc)
73 drive->failed_pc = NULL; 73 drive->failed_pc = NULL;
74 74
75 if (pc->c[0] == GPCMD_READ_10 || pc->c[0] == GPCMD_WRITE_10 || 75 if (pc->c[0] == GPCMD_READ_10 || pc->c[0] == GPCMD_WRITE_10 ||
76 (rq && blk_pc_request(rq))) 76 (rq && rq->cmd_type == REQ_TYPE_BLOCK_PC))
77 uptodate = 1; /* FIXME */ 77 uptodate = 1; /* FIXME */
78 else if (pc->c[0] == GPCMD_REQUEST_SENSE) { 78 else if (pc->c[0] == GPCMD_REQUEST_SENSE) {
79 79
@@ -98,7 +98,7 @@ static int ide_floppy_callback(ide_drive_t *drive, int dsc)
98 "Aborting request!\n"); 98 "Aborting request!\n");
99 } 99 }
100 100
101 if (blk_special_request(rq)) 101 if (rq->cmd_type == REQ_TYPE_SPECIAL)
102 rq->errors = uptodate ? 0 : IDE_DRV_ERROR_GENERAL; 102 rq->errors = uptodate ? 0 : IDE_DRV_ERROR_GENERAL;
103 103
104 return uptodate; 104 return uptodate;
@@ -247,14 +247,16 @@ static ide_startstop_t ide_floppy_do_request(ide_drive_t *drive,
247 } else 247 } else
248 printk(KERN_ERR PFX "%s: I/O error\n", drive->name); 248 printk(KERN_ERR PFX "%s: I/O error\n", drive->name);
249 249
250 if (blk_special_request(rq)) { 250 if (rq->cmd_type == REQ_TYPE_SPECIAL) {
251 rq->errors = 0; 251 rq->errors = 0;
252 ide_complete_rq(drive, 0, blk_rq_bytes(rq)); 252 ide_complete_rq(drive, 0, blk_rq_bytes(rq));
253 return ide_stopped; 253 return ide_stopped;
254 } else 254 } else
255 goto out_end; 255 goto out_end;
256 } 256 }
257 if (blk_fs_request(rq)) { 257
258 switch (rq->cmd_type) {
259 case REQ_TYPE_FS:
258 if (((long)blk_rq_pos(rq) % floppy->bs_factor) || 260 if (((long)blk_rq_pos(rq) % floppy->bs_factor) ||
259 (blk_rq_sectors(rq) % floppy->bs_factor)) { 261 (blk_rq_sectors(rq) % floppy->bs_factor)) {
260 printk(KERN_ERR PFX "%s: unsupported r/w rq size\n", 262 printk(KERN_ERR PFX "%s: unsupported r/w rq size\n",
@@ -263,13 +265,18 @@ static ide_startstop_t ide_floppy_do_request(ide_drive_t *drive,
263 } 265 }
264 pc = &floppy->queued_pc; 266 pc = &floppy->queued_pc;
265 idefloppy_create_rw_cmd(drive, pc, rq, (unsigned long)block); 267 idefloppy_create_rw_cmd(drive, pc, rq, (unsigned long)block);
266 } else if (blk_special_request(rq) || blk_sense_request(rq)) { 268 break;
269 case REQ_TYPE_SPECIAL:
270 case REQ_TYPE_SENSE:
267 pc = (struct ide_atapi_pc *)rq->special; 271 pc = (struct ide_atapi_pc *)rq->special;
268 } else if (blk_pc_request(rq)) { 272 break;
273 case REQ_TYPE_BLOCK_PC:
269 pc = &floppy->queued_pc; 274 pc = &floppy->queued_pc;
270 idefloppy_blockpc_cmd(floppy, pc, rq); 275 idefloppy_blockpc_cmd(floppy, pc, rq);
271 } else 276 break;
277 default:
272 BUG(); 278 BUG();
279 }
273 280
274 ide_prep_sense(drive, rq); 281 ide_prep_sense(drive, rq);
275 282
@@ -280,7 +287,7 @@ static ide_startstop_t ide_floppy_do_request(ide_drive_t *drive,
280 287
281 cmd.rq = rq; 288 cmd.rq = rq;
282 289
283 if (blk_fs_request(rq) || blk_rq_bytes(rq)) { 290 if (rq->cmd_type == REQ_TYPE_FS || blk_rq_bytes(rq)) {
284 ide_init_sg_cmd(&cmd, blk_rq_bytes(rq)); 291 ide_init_sg_cmd(&cmd, blk_rq_bytes(rq));
285 ide_map_sg(drive, &cmd); 292 ide_map_sg(drive, &cmd);
286 } 293 }
@@ -290,7 +297,7 @@ static ide_startstop_t ide_floppy_do_request(ide_drive_t *drive,
290 return ide_floppy_issue_pc(drive, &cmd, pc); 297 return ide_floppy_issue_pc(drive, &cmd, pc);
291out_end: 298out_end:
292 drive->failed_pc = NULL; 299 drive->failed_pc = NULL;
293 if (blk_fs_request(rq) == 0 && rq->errors == 0) 300 if (rq->cmd_type != REQ_TYPE_FS && rq->errors == 0)
294 rq->errors = -EIO; 301 rq->errors = -EIO;
295 ide_complete_rq(drive, -EIO, blk_rq_bytes(rq)); 302 ide_complete_rq(drive, -EIO, blk_rq_bytes(rq));
296 return ide_stopped; 303 return ide_stopped;
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c
index 172ac9218154..9304a7e54d9e 100644
--- a/drivers/ide/ide-io.c
+++ b/drivers/ide/ide-io.c
@@ -135,7 +135,7 @@ EXPORT_SYMBOL(ide_complete_rq);
135 135
136void ide_kill_rq(ide_drive_t *drive, struct request *rq) 136void ide_kill_rq(ide_drive_t *drive, struct request *rq)
137{ 137{
138 u8 drv_req = blk_special_request(rq) && rq->rq_disk; 138 u8 drv_req = (rq->cmd_type == REQ_TYPE_SPECIAL) && rq->rq_disk;
139 u8 media = drive->media; 139 u8 media = drive->media;
140 140
141 drive->failed_pc = NULL; 141 drive->failed_pc = NULL;
@@ -145,7 +145,7 @@ void ide_kill_rq(ide_drive_t *drive, struct request *rq)
145 } else { 145 } else {
146 if (media == ide_tape) 146 if (media == ide_tape)
147 rq->errors = IDE_DRV_ERROR_GENERAL; 147 rq->errors = IDE_DRV_ERROR_GENERAL;
148 else if (blk_fs_request(rq) == 0 && rq->errors == 0) 148 else if (rq->cmd_type != REQ_TYPE_FS && rq->errors == 0)
149 rq->errors = -EIO; 149 rq->errors = -EIO;
150 } 150 }
151 151
@@ -307,7 +307,7 @@ static ide_startstop_t start_request (ide_drive_t *drive, struct request *rq)
307{ 307{
308 ide_startstop_t startstop; 308 ide_startstop_t startstop;
309 309
310 BUG_ON(!blk_rq_started(rq)); 310 BUG_ON(!(rq->cmd_flags & REQ_STARTED));
311 311
312#ifdef DEBUG 312#ifdef DEBUG
313 printk("%s: start_request: current=0x%08lx\n", 313 printk("%s: start_request: current=0x%08lx\n",
@@ -353,7 +353,7 @@ static ide_startstop_t start_request (ide_drive_t *drive, struct request *rq)
353 pm->pm_step == IDE_PM_COMPLETED) 353 pm->pm_step == IDE_PM_COMPLETED)
354 ide_complete_pm_rq(drive, rq); 354 ide_complete_pm_rq(drive, rq);
355 return startstop; 355 return startstop;
356 } else if (!rq->rq_disk && blk_special_request(rq)) 356 } else if (!rq->rq_disk && rq->cmd_type == REQ_TYPE_SPECIAL) {
357 /* 357 /*
358 * TODO: Once all ULDs have been modified to 358 * TODO: Once all ULDs have been modified to
359 * check for specific op codes rather than 359 * check for specific op codes rather than
diff --git a/drivers/ide/ide-pm.c b/drivers/ide/ide-pm.c
index 1c08311b0a0e..92406097efeb 100644
--- a/drivers/ide/ide-pm.c
+++ b/drivers/ide/ide-pm.c
@@ -191,10 +191,10 @@ void ide_complete_pm_rq(ide_drive_t *drive, struct request *rq)
191 191
192#ifdef DEBUG_PM 192#ifdef DEBUG_PM
193 printk("%s: completing PM request, %s\n", drive->name, 193 printk("%s: completing PM request, %s\n", drive->name,
194 blk_pm_suspend_request(rq) ? "suspend" : "resume"); 194 (rq->cmd_type == REQ_TYPE_PM_SUSPEND) ? "suspend" : "resume");
195#endif 195#endif
196 spin_lock_irqsave(q->queue_lock, flags); 196 spin_lock_irqsave(q->queue_lock, flags);
197 if (blk_pm_suspend_request(rq)) 197 if (rq->cmd_type == REQ_TYPE_PM_SUSPEND)
198 blk_stop_queue(q); 198 blk_stop_queue(q);
199 else 199 else
200 drive->dev_flags &= ~IDE_DFLAG_BLOCKED; 200 drive->dev_flags &= ~IDE_DFLAG_BLOCKED;
@@ -210,11 +210,11 @@ void ide_check_pm_state(ide_drive_t *drive, struct request *rq)
210{ 210{
211 struct request_pm_state *pm = rq->special; 211 struct request_pm_state *pm = rq->special;
212 212
213 if (blk_pm_suspend_request(rq) && 213 if (rq->cmd_type == REQ_TYPE_PM_SUSPEND &&
214 pm->pm_step == IDE_PM_START_SUSPEND) 214 pm->pm_step == IDE_PM_START_SUSPEND)
215 /* Mark drive blocked when starting the suspend sequence. */ 215 /* Mark drive blocked when starting the suspend sequence. */
216 drive->dev_flags |= IDE_DFLAG_BLOCKED; 216 drive->dev_flags |= IDE_DFLAG_BLOCKED;
217 else if (blk_pm_resume_request(rq) && 217 else if (rq->cmd_type == REQ_TYPE_PM_RESUME &&
218 pm->pm_step == IDE_PM_START_RESUME) { 218 pm->pm_step == IDE_PM_START_RESUME) {
219 /* 219 /*
220 * The first thing we do on wakeup is to wait for BSY bit to 220 * The first thing we do on wakeup is to wait for BSY bit to
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
index b07232880ec9..635fd72d4728 100644
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -577,7 +577,8 @@ static ide_startstop_t idetape_do_request(ide_drive_t *drive,
577 rq->cmd[0], (unsigned long long)blk_rq_pos(rq), 577 rq->cmd[0], (unsigned long long)blk_rq_pos(rq),
578 blk_rq_sectors(rq)); 578 blk_rq_sectors(rq));
579 579
580 BUG_ON(!(blk_special_request(rq) || blk_sense_request(rq))); 580 BUG_ON(!(rq->cmd_type == REQ_TYPE_SPECIAL ||
581 rq->cmd_type == REQ_TYPE_SENSE));
581 582
582 /* Retry a failed packet command */ 583 /* Retry a failed packet command */
583 if (drive->failed_pc && drive->pc->c[0] == REQUEST_SENSE) { 584 if (drive->failed_pc && drive->pc->c[0] == REQUEST_SENSE) {