diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-08-10 18:22:42 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-08-10 18:22:42 -0400 |
commit | 2f9e825d3e0e2b407ae8f082de5c00afcf7378fb (patch) | |
tree | f8b3ee40674ce4acd5508a0a0bf52a30904caf6c /drivers/ide | |
parent | 7ae0dea900b027cd90e8a3e14deca9a19e17638b (diff) | |
parent | de75d60d5ea235e6e09f4962ab22541ce0fe176a (diff) |
Merge branch 'for-2.6.36' of git://git.kernel.dk/linux-2.6-block
* 'for-2.6.36' of git://git.kernel.dk/linux-2.6-block: (149 commits)
block: make sure that REQ_* types are seen even with CONFIG_BLOCK=n
xen-blkfront: fix missing out label
blkdev: fix blkdev_issue_zeroout return value
block: update request stacking methods to support discards
block: fix missing export of blk_types.h
writeback: fix bad _bh spinlock nesting
drbd: revert "delay probes", feature is being re-implemented differently
drbd: Initialize all members of sync_conf to their defaults [Bugz 315]
drbd: Disable delay probes for the upcomming release
writeback: cleanup bdi_register
writeback: add new tracepoints
writeback: remove unnecessary init_timer call
writeback: optimize periodic bdi thread wakeups
writeback: prevent unnecessary bdi threads wakeups
writeback: move bdi threads exiting logic to the forker thread
writeback: restructure bdi forker loop a little
writeback: move last_active to bdi
writeback: do not remove bdi from bdi_list
writeback: simplify bdi code a little
writeback: do not lose wake-ups in bdi threads
...
Fixed up pretty trivial conflicts in drivers/block/virtio_blk.c and
drivers/scsi/scsi_error.c as per Jens.
Diffstat (limited to 'drivers/ide')
-rw-r--r-- | drivers/ide/ide-atapi.c | 17 | ||||
-rw-r--r-- | drivers/ide/ide-cd.c | 98 | ||||
-rw-r--r-- | drivers/ide/ide-cd_ioctl.c | 2 | ||||
-rw-r--r-- | drivers/ide/ide-disk.c | 18 | ||||
-rw-r--r-- | drivers/ide/ide-disk_ioctl.c | 9 | ||||
-rw-r--r-- | drivers/ide/ide-eh.c | 5 | ||||
-rw-r--r-- | drivers/ide/ide-floppy.c | 27 | ||||
-rw-r--r-- | drivers/ide/ide-floppy_ioctl.c | 12 | ||||
-rw-r--r-- | drivers/ide/ide-gd.c | 19 | ||||
-rw-r--r-- | drivers/ide/ide-io.c | 8 | ||||
-rw-r--r-- | drivers/ide/ide-pm.c | 8 | ||||
-rw-r--r-- | drivers/ide/ide-tape.c | 22 |
12 files changed, 163 insertions, 82 deletions
diff --git a/drivers/ide/ide-atapi.c b/drivers/ide/ide-atapi.c index f9daffd7d0e3..e88a2cf17711 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 | ||
308 | int ide_cd_get_xferlen(struct request *rq) | 308 | int 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 | } |
318 | EXPORT_SYMBOL_GPL(ide_cd_get_xferlen); | 321 | EXPORT_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 (rq->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 2de76cc08f61..31fc76960a8f 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/delay.h> | 31 | #include <linux/delay.h> |
32 | #include <linux/timer.h> | 32 | #include <linux/timer.h> |
33 | #include <linux/seq_file.h> | 33 | #include <linux/seq_file.h> |
34 | #include <linux/smp_lock.h> | ||
34 | #include <linux/slab.h> | 35 | #include <linux/slab.h> |
35 | #include <linux/interrupt.h> | 36 | #include <linux/interrupt.h> |
36 | #include <linux/errno.h> | 37 | #include <linux/errno.h> |
@@ -176,7 +177,7 @@ static void cdrom_analyze_sense_data(ide_drive_t *drive, | |||
176 | if (!sense->valid) | 177 | if (!sense->valid) |
177 | break; | 178 | break; |
178 | if (failed_command == NULL || | 179 | if (failed_command == NULL || |
179 | !blk_fs_request(failed_command)) | 180 | failed_command->cmd_type != REQ_TYPE_FS) |
180 | break; | 181 | break; |
181 | sector = (sense->information[0] << 24) | | 182 | sector = (sense->information[0] << 24) | |
182 | (sense->information[1] << 16) | | 183 | (sense->information[1] << 16) | |
@@ -292,7 +293,7 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat) | |||
292 | "stat 0x%x", | 293 | "stat 0x%x", |
293 | rq->cmd[0], rq->cmd_type, err, stat); | 294 | rq->cmd[0], rq->cmd_type, err, stat); |
294 | 295 | ||
295 | if (blk_sense_request(rq)) { | 296 | if (rq->cmd_type == REQ_TYPE_SENSE) { |
296 | /* | 297 | /* |
297 | * We got an error trying to get sense info from the drive | 298 | * We got an error trying to get sense info from the drive |
298 | * (probably while trying to recover from a former error). | 299 | * (probably while trying to recover from a former error). |
@@ -303,7 +304,7 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat) | |||
303 | } | 304 | } |
304 | 305 | ||
305 | /* if we have an error, pass CHECK_CONDITION as the SCSI status byte */ | 306 | /* if we have an error, pass CHECK_CONDITION as the SCSI status byte */ |
306 | if (blk_pc_request(rq) && !rq->errors) | 307 | if (rq->cmd_type == REQ_TYPE_BLOCK_PC && !rq->errors) |
307 | rq->errors = SAM_STAT_CHECK_CONDITION; | 308 | rq->errors = SAM_STAT_CHECK_CONDITION; |
308 | 309 | ||
309 | if (blk_noretry_request(rq)) | 310 | if (blk_noretry_request(rq)) |
@@ -311,13 +312,14 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat) | |||
311 | 312 | ||
312 | switch (sense_key) { | 313 | switch (sense_key) { |
313 | case NOT_READY: | 314 | case NOT_READY: |
314 | if (blk_fs_request(rq) && rq_data_dir(rq) == WRITE) { | 315 | if (rq->cmd_type == REQ_TYPE_FS && rq_data_dir(rq) == WRITE) { |
315 | if (ide_cd_breathe(drive, rq)) | 316 | if (ide_cd_breathe(drive, rq)) |
316 | return 1; | 317 | return 1; |
317 | } else { | 318 | } else { |
318 | cdrom_saw_media_change(drive); | 319 | cdrom_saw_media_change(drive); |
319 | 320 | ||
320 | if (blk_fs_request(rq) && !blk_rq_quiet(rq)) | 321 | if (rq->cmd_type == REQ_TYPE_FS && |
322 | !(rq->cmd_flags & REQ_QUIET)) | ||
321 | printk(KERN_ERR PFX "%s: tray open\n", | 323 | printk(KERN_ERR PFX "%s: tray open\n", |
322 | drive->name); | 324 | drive->name); |
323 | } | 325 | } |
@@ -326,7 +328,7 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat) | |||
326 | case UNIT_ATTENTION: | 328 | case UNIT_ATTENTION: |
327 | cdrom_saw_media_change(drive); | 329 | cdrom_saw_media_change(drive); |
328 | 330 | ||
329 | if (blk_fs_request(rq) == 0) | 331 | if (rq->cmd_type != REQ_TYPE_FS) |
330 | return 0; | 332 | return 0; |
331 | 333 | ||
332 | /* | 334 | /* |
@@ -352,7 +354,7 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat) | |||
352 | * No point in retrying after an illegal request or data | 354 | * No point in retrying after an illegal request or data |
353 | * protect error. | 355 | * protect error. |
354 | */ | 356 | */ |
355 | if (!blk_rq_quiet(rq)) | 357 | if (!(rq->cmd_flags & REQ_QUIET)) |
356 | ide_dump_status(drive, "command error", stat); | 358 | ide_dump_status(drive, "command error", stat); |
357 | do_end_request = 1; | 359 | do_end_request = 1; |
358 | break; | 360 | break; |
@@ -361,20 +363,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. | 363 | * No point in re-trying a zillion times on a bad sector. |
362 | * If we got here the error is not correctable. | 364 | * If we got here the error is not correctable. |
363 | */ | 365 | */ |
364 | if (!blk_rq_quiet(rq)) | 366 | if (!(rq->cmd_flags & REQ_QUIET)) |
365 | ide_dump_status(drive, "media error " | 367 | ide_dump_status(drive, "media error " |
366 | "(bad sector)", stat); | 368 | "(bad sector)", stat); |
367 | do_end_request = 1; | 369 | do_end_request = 1; |
368 | break; | 370 | break; |
369 | case BLANK_CHECK: | 371 | case BLANK_CHECK: |
370 | /* disk appears blank? */ | 372 | /* disk appears blank? */ |
371 | if (!blk_rq_quiet(rq)) | 373 | if (!(rq->cmd_flags & REQ_QUIET)) |
372 | ide_dump_status(drive, "media error (blank)", | 374 | ide_dump_status(drive, "media error (blank)", |
373 | stat); | 375 | stat); |
374 | do_end_request = 1; | 376 | do_end_request = 1; |
375 | break; | 377 | break; |
376 | default: | 378 | default: |
377 | if (blk_fs_request(rq) == 0) | 379 | if (rq->cmd_type != REQ_TYPE_FS) |
378 | break; | 380 | break; |
379 | if (err & ~ATA_ABORTED) { | 381 | if (err & ~ATA_ABORTED) { |
380 | /* go to the default handler for other errors */ | 382 | /* go to the default handler for other errors */ |
@@ -385,7 +387,7 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat) | |||
385 | do_end_request = 1; | 387 | do_end_request = 1; |
386 | } | 388 | } |
387 | 389 | ||
388 | if (blk_fs_request(rq) == 0) { | 390 | if (rq->cmd_type != REQ_TYPE_FS) { |
389 | rq->cmd_flags |= REQ_FAILED; | 391 | rq->cmd_flags |= REQ_FAILED; |
390 | do_end_request = 1; | 392 | do_end_request = 1; |
391 | } | 393 | } |
@@ -532,7 +534,7 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive) | |||
532 | ide_expiry_t *expiry = NULL; | 534 | ide_expiry_t *expiry = NULL; |
533 | int dma_error = 0, dma, thislen, uptodate = 0; | 535 | int dma_error = 0, dma, thislen, uptodate = 0; |
534 | int write = (rq_data_dir(rq) == WRITE) ? 1 : 0, rc = 0; | 536 | int write = (rq_data_dir(rq) == WRITE) ? 1 : 0, rc = 0; |
535 | int sense = blk_sense_request(rq); | 537 | int sense = (rq->cmd_type == REQ_TYPE_SENSE); |
536 | unsigned int timeout; | 538 | unsigned int timeout; |
537 | u16 len; | 539 | u16 len; |
538 | u8 ireason, stat; | 540 | u8 ireason, stat; |
@@ -575,7 +577,7 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive) | |||
575 | 577 | ||
576 | ide_read_bcount_and_ireason(drive, &len, &ireason); | 578 | ide_read_bcount_and_ireason(drive, &len, &ireason); |
577 | 579 | ||
578 | thislen = blk_fs_request(rq) ? len : cmd->nleft; | 580 | thislen = (rq->cmd_type == REQ_TYPE_FS) ? len : cmd->nleft; |
579 | if (thislen > len) | 581 | if (thislen > len) |
580 | thislen = len; | 582 | thislen = len; |
581 | 583 | ||
@@ -584,7 +586,7 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive) | |||
584 | 586 | ||
585 | /* If DRQ is clear, the command has completed. */ | 587 | /* If DRQ is clear, the command has completed. */ |
586 | if ((stat & ATA_DRQ) == 0) { | 588 | if ((stat & ATA_DRQ) == 0) { |
587 | if (blk_fs_request(rq)) { | 589 | if (rq->cmd_type == REQ_TYPE_FS) { |
588 | /* | 590 | /* |
589 | * If we're not done reading/writing, complain. | 591 | * If we're not done reading/writing, complain. |
590 | * Otherwise, complete the command normally. | 592 | * Otherwise, complete the command normally. |
@@ -598,7 +600,7 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive) | |||
598 | rq->cmd_flags |= REQ_FAILED; | 600 | rq->cmd_flags |= REQ_FAILED; |
599 | uptodate = 0; | 601 | uptodate = 0; |
600 | } | 602 | } |
601 | } else if (!blk_pc_request(rq)) { | 603 | } else if (rq->cmd_type != REQ_TYPE_BLOCK_PC) { |
602 | ide_cd_request_sense_fixup(drive, cmd); | 604 | ide_cd_request_sense_fixup(drive, cmd); |
603 | 605 | ||
604 | uptodate = cmd->nleft ? 0 : 1; | 606 | uptodate = cmd->nleft ? 0 : 1; |
@@ -647,7 +649,7 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive) | |||
647 | 649 | ||
648 | /* pad, if necessary */ | 650 | /* pad, if necessary */ |
649 | if (len > 0) { | 651 | if (len > 0) { |
650 | if (blk_fs_request(rq) == 0 || write == 0) | 652 | if (rq->cmd_type != REQ_TYPE_FS || write == 0) |
651 | ide_pad_transfer(drive, write, len); | 653 | ide_pad_transfer(drive, write, len); |
652 | else { | 654 | else { |
653 | printk(KERN_ERR PFX "%s: confused, missing data\n", | 655 | printk(KERN_ERR PFX "%s: confused, missing data\n", |
@@ -656,11 +658,11 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive) | |||
656 | } | 658 | } |
657 | } | 659 | } |
658 | 660 | ||
659 | if (blk_pc_request(rq)) { | 661 | if (rq->cmd_type == REQ_TYPE_BLOCK_PC) { |
660 | timeout = rq->timeout; | 662 | timeout = rq->timeout; |
661 | } else { | 663 | } else { |
662 | timeout = ATAPI_WAIT_PC; | 664 | timeout = ATAPI_WAIT_PC; |
663 | if (!blk_fs_request(rq)) | 665 | if (rq->cmd_type != REQ_TYPE_FS) |
664 | expiry = ide_cd_expiry; | 666 | expiry = ide_cd_expiry; |
665 | } | 667 | } |
666 | 668 | ||
@@ -669,7 +671,7 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive) | |||
669 | return ide_started; | 671 | return ide_started; |
670 | 672 | ||
671 | out_end: | 673 | out_end: |
672 | if (blk_pc_request(rq) && rc == 0) { | 674 | if (rq->cmd_type == REQ_TYPE_BLOCK_PC && rc == 0) { |
673 | rq->resid_len = 0; | 675 | rq->resid_len = 0; |
674 | blk_end_request_all(rq, 0); | 676 | blk_end_request_all(rq, 0); |
675 | hwif->rq = NULL; | 677 | hwif->rq = NULL; |
@@ -677,7 +679,7 @@ out_end: | |||
677 | if (sense && uptodate) | 679 | if (sense && uptodate) |
678 | ide_cd_complete_failed_rq(drive, rq); | 680 | ide_cd_complete_failed_rq(drive, rq); |
679 | 681 | ||
680 | if (blk_fs_request(rq)) { | 682 | if (rq->cmd_type == REQ_TYPE_FS) { |
681 | if (cmd->nleft == 0) | 683 | if (cmd->nleft == 0) |
682 | uptodate = 1; | 684 | uptodate = 1; |
683 | } else { | 685 | } else { |
@@ -690,7 +692,7 @@ out_end: | |||
690 | return ide_stopped; | 692 | return ide_stopped; |
691 | 693 | ||
692 | /* make sure it's fully ended */ | 694 | /* make sure it's fully ended */ |
693 | if (blk_fs_request(rq) == 0) { | 695 | if (rq->cmd_type != REQ_TYPE_FS) { |
694 | rq->resid_len -= cmd->nbytes - cmd->nleft; | 696 | rq->resid_len -= cmd->nbytes - cmd->nleft; |
695 | if (uptodate == 0 && (cmd->tf_flags & IDE_TFLAG_WRITE)) | 697 | if (uptodate == 0 && (cmd->tf_flags & IDE_TFLAG_WRITE)) |
696 | rq->resid_len += cmd->last_xfer_len; | 698 | rq->resid_len += cmd->last_xfer_len; |
@@ -750,7 +752,7 @@ static void cdrom_do_block_pc(ide_drive_t *drive, struct request *rq) | |||
750 | ide_debug_log(IDE_DBG_PC, "rq->cmd[0]: 0x%x, rq->cmd_type: 0x%x", | 752 | ide_debug_log(IDE_DBG_PC, "rq->cmd[0]: 0x%x, rq->cmd_type: 0x%x", |
751 | rq->cmd[0], rq->cmd_type); | 753 | rq->cmd[0], rq->cmd_type); |
752 | 754 | ||
753 | if (blk_pc_request(rq)) | 755 | if (rq->cmd_type == REQ_TYPE_BLOCK_PC) |
754 | rq->cmd_flags |= REQ_QUIET; | 756 | rq->cmd_flags |= REQ_QUIET; |
755 | else | 757 | else |
756 | rq->cmd_flags &= ~REQ_FAILED; | 758 | rq->cmd_flags &= ~REQ_FAILED; |
@@ -791,21 +793,26 @@ static ide_startstop_t ide_cd_do_request(ide_drive_t *drive, struct request *rq, | |||
791 | if (drive->debug_mask & IDE_DBG_RQ) | 793 | if (drive->debug_mask & IDE_DBG_RQ) |
792 | blk_dump_rq_flags(rq, "ide_cd_do_request"); | 794 | blk_dump_rq_flags(rq, "ide_cd_do_request"); |
793 | 795 | ||
794 | if (blk_fs_request(rq)) { | 796 | switch (rq->cmd_type) { |
797 | case REQ_TYPE_FS: | ||
795 | if (cdrom_start_rw(drive, rq) == ide_stopped) | 798 | if (cdrom_start_rw(drive, rq) == ide_stopped) |
796 | goto out_end; | 799 | goto out_end; |
797 | } else if (blk_sense_request(rq) || blk_pc_request(rq) || | 800 | break; |
798 | rq->cmd_type == REQ_TYPE_ATA_PC) { | 801 | case REQ_TYPE_SENSE: |
802 | case REQ_TYPE_BLOCK_PC: | ||
803 | case REQ_TYPE_ATA_PC: | ||
799 | if (!rq->timeout) | 804 | if (!rq->timeout) |
800 | rq->timeout = ATAPI_WAIT_PC; | 805 | rq->timeout = ATAPI_WAIT_PC; |
801 | 806 | ||
802 | cdrom_do_block_pc(drive, rq); | 807 | cdrom_do_block_pc(drive, rq); |
803 | } else if (blk_special_request(rq)) { | 808 | break; |
809 | case REQ_TYPE_SPECIAL: | ||
804 | /* right now this can only be a reset... */ | 810 | /* right now this can only be a reset... */ |
805 | uptodate = 1; | 811 | uptodate = 1; |
806 | goto out_end; | 812 | goto out_end; |
807 | } else | 813 | default: |
808 | BUG(); | 814 | BUG(); |
815 | } | ||
809 | 816 | ||
810 | /* prepare sense request for this command */ | 817 | /* prepare sense request for this command */ |
811 | ide_prep_sense(drive, rq); | 818 | ide_prep_sense(drive, rq); |
@@ -817,7 +824,7 @@ static ide_startstop_t ide_cd_do_request(ide_drive_t *drive, struct request *rq, | |||
817 | 824 | ||
818 | cmd.rq = rq; | 825 | cmd.rq = rq; |
819 | 826 | ||
820 | if (blk_fs_request(rq) || blk_rq_bytes(rq)) { | 827 | if (rq->cmd_type == REQ_TYPE_FS || blk_rq_bytes(rq)) { |
821 | ide_init_sg_cmd(&cmd, blk_rq_bytes(rq)); | 828 | ide_init_sg_cmd(&cmd, blk_rq_bytes(rq)); |
822 | ide_map_sg(drive, &cmd); | 829 | ide_map_sg(drive, &cmd); |
823 | } | 830 | } |
@@ -1373,9 +1380,9 @@ static int ide_cdrom_prep_pc(struct request *rq) | |||
1373 | 1380 | ||
1374 | static int ide_cdrom_prep_fn(struct request_queue *q, struct request *rq) | 1381 | static int ide_cdrom_prep_fn(struct request_queue *q, struct request *rq) |
1375 | { | 1382 | { |
1376 | if (blk_fs_request(rq)) | 1383 | if (rq->cmd_type == REQ_TYPE_FS) |
1377 | return ide_cdrom_prep_fs(q, rq); | 1384 | return ide_cdrom_prep_fs(q, rq); |
1378 | else if (blk_pc_request(rq)) | 1385 | else if (rq->cmd_type == REQ_TYPE_BLOCK_PC) |
1379 | return ide_cdrom_prep_pc(rq); | 1386 | return ide_cdrom_prep_pc(rq); |
1380 | 1387 | ||
1381 | return 0; | 1388 | return 0; |
@@ -1592,17 +1599,19 @@ static struct ide_driver ide_cdrom_driver = { | |||
1592 | 1599 | ||
1593 | static int idecd_open(struct block_device *bdev, fmode_t mode) | 1600 | static int idecd_open(struct block_device *bdev, fmode_t mode) |
1594 | { | 1601 | { |
1595 | struct cdrom_info *info = ide_cd_get(bdev->bd_disk); | 1602 | struct cdrom_info *info; |
1596 | int rc = -ENOMEM; | 1603 | int rc = -ENXIO; |
1597 | 1604 | ||
1605 | lock_kernel(); | ||
1606 | info = ide_cd_get(bdev->bd_disk); | ||
1598 | if (!info) | 1607 | if (!info) |
1599 | return -ENXIO; | 1608 | goto out; |
1600 | 1609 | ||
1601 | rc = cdrom_open(&info->devinfo, bdev, mode); | 1610 | rc = cdrom_open(&info->devinfo, bdev, mode); |
1602 | |||
1603 | if (rc < 0) | 1611 | if (rc < 0) |
1604 | ide_cd_put(info); | 1612 | ide_cd_put(info); |
1605 | 1613 | out: | |
1614 | unlock_kernel(); | ||
1606 | return rc; | 1615 | return rc; |
1607 | } | 1616 | } |
1608 | 1617 | ||
@@ -1610,9 +1619,11 @@ static int idecd_release(struct gendisk *disk, fmode_t mode) | |||
1610 | { | 1619 | { |
1611 | struct cdrom_info *info = ide_drv_g(disk, cdrom_info); | 1620 | struct cdrom_info *info = ide_drv_g(disk, cdrom_info); |
1612 | 1621 | ||
1622 | lock_kernel(); | ||
1613 | cdrom_release(&info->devinfo, mode); | 1623 | cdrom_release(&info->devinfo, mode); |
1614 | 1624 | ||
1615 | ide_cd_put(info); | 1625 | ide_cd_put(info); |
1626 | unlock_kernel(); | ||
1616 | 1627 | ||
1617 | return 0; | 1628 | return 0; |
1618 | } | 1629 | } |
@@ -1656,7 +1667,7 @@ static int idecd_get_spindown(struct cdrom_device_info *cdi, unsigned long arg) | |||
1656 | return 0; | 1667 | return 0; |
1657 | } | 1668 | } |
1658 | 1669 | ||
1659 | static int idecd_ioctl(struct block_device *bdev, fmode_t mode, | 1670 | static int idecd_locked_ioctl(struct block_device *bdev, fmode_t mode, |
1660 | unsigned int cmd, unsigned long arg) | 1671 | unsigned int cmd, unsigned long arg) |
1661 | { | 1672 | { |
1662 | struct cdrom_info *info = ide_drv_g(bdev->bd_disk, cdrom_info); | 1673 | struct cdrom_info *info = ide_drv_g(bdev->bd_disk, cdrom_info); |
@@ -1678,6 +1689,19 @@ static int idecd_ioctl(struct block_device *bdev, fmode_t mode, | |||
1678 | return err; | 1689 | return err; |
1679 | } | 1690 | } |
1680 | 1691 | ||
1692 | static int idecd_ioctl(struct block_device *bdev, fmode_t mode, | ||
1693 | unsigned int cmd, unsigned long arg) | ||
1694 | { | ||
1695 | int ret; | ||
1696 | |||
1697 | lock_kernel(); | ||
1698 | ret = idecd_locked_ioctl(bdev, mode, cmd, arg); | ||
1699 | unlock_kernel(); | ||
1700 | |||
1701 | return ret; | ||
1702 | } | ||
1703 | |||
1704 | |||
1681 | static int idecd_media_changed(struct gendisk *disk) | 1705 | static int idecd_media_changed(struct gendisk *disk) |
1682 | { | 1706 | { |
1683 | struct cdrom_info *info = ide_drv_g(disk, cdrom_info); | 1707 | struct cdrom_info *info = ide_drv_g(disk, cdrom_info); |
@@ -1698,7 +1722,7 @@ static const struct block_device_operations idecd_ops = { | |||
1698 | .owner = THIS_MODULE, | 1722 | .owner = THIS_MODULE, |
1699 | .open = idecd_open, | 1723 | .open = idecd_open, |
1700 | .release = idecd_release, | 1724 | .release = idecd_release, |
1701 | .locked_ioctl = idecd_ioctl, | 1725 | .ioctl = idecd_ioctl, |
1702 | .media_changed = idecd_media_changed, | 1726 | .media_changed = idecd_media_changed, |
1703 | .revalidate_disk = idecd_revalidate_disk | 1727 | .revalidate_disk = idecd_revalidate_disk |
1704 | }; | 1728 | }; |
diff --git a/drivers/ide/ide-cd_ioctl.c b/drivers/ide/ide-cd_ioctl.c index 02712bf045c1..766b3deeb23c 100644 --- a/drivers/ide/ide-cd_ioctl.c +++ b/drivers/ide/ide-cd_ioctl.c | |||
@@ -454,7 +454,7 @@ int ide_cdrom_packet(struct cdrom_device_info *cdi, | |||
454 | touch it at all. */ | 454 | touch it at all. */ |
455 | 455 | ||
456 | if (cgc->data_direction == CGC_DATA_WRITE) | 456 | if (cgc->data_direction == CGC_DATA_WRITE) |
457 | flags |= REQ_RW; | 457 | flags |= REQ_WRITE; |
458 | 458 | ||
459 | if (cgc->sense) | 459 | if (cgc->sense) |
460 | memset(cgc->sense, 0, sizeof(struct request_sense)); | 460 | memset(cgc->sense, 0, sizeof(struct request_sense)); |
diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c index 33d65039cce9..7433e07de30e 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 | ||
@@ -427,10 +427,15 @@ static void ide_disk_unlock_native_capacity(ide_drive_t *drive) | |||
427 | drive->dev_flags |= IDE_DFLAG_NOHPA; /* disable HPA on resume */ | 427 | drive->dev_flags |= IDE_DFLAG_NOHPA; /* disable HPA on resume */ |
428 | } | 428 | } |
429 | 429 | ||
430 | static void idedisk_prepare_flush(struct request_queue *q, struct request *rq) | 430 | static int idedisk_prep_fn(struct request_queue *q, struct request *rq) |
431 | { | 431 | { |
432 | ide_drive_t *drive = q->queuedata; | 432 | ide_drive_t *drive = q->queuedata; |
433 | struct ide_cmd *cmd = kmalloc(sizeof(*cmd), GFP_ATOMIC); | 433 | struct ide_cmd *cmd; |
434 | |||
435 | if (!(rq->cmd_flags & REQ_FLUSH)) | ||
436 | return BLKPREP_OK; | ||
437 | |||
438 | cmd = kmalloc(sizeof(*cmd), GFP_ATOMIC); | ||
434 | 439 | ||
435 | /* FIXME: map struct ide_taskfile on rq->cmd[] */ | 440 | /* FIXME: map struct ide_taskfile on rq->cmd[] */ |
436 | BUG_ON(cmd == NULL); | 441 | BUG_ON(cmd == NULL); |
@@ -448,6 +453,8 @@ static void idedisk_prepare_flush(struct request_queue *q, struct request *rq) | |||
448 | rq->cmd_type = REQ_TYPE_ATA_TASKFILE; | 453 | rq->cmd_type = REQ_TYPE_ATA_TASKFILE; |
449 | rq->special = cmd; | 454 | rq->special = cmd; |
450 | cmd->rq = rq; | 455 | cmd->rq = rq; |
456 | |||
457 | return BLKPREP_OK; | ||
451 | } | 458 | } |
452 | 459 | ||
453 | ide_devset_get(multcount, mult_count); | 460 | ide_devset_get(multcount, mult_count); |
@@ -513,7 +520,6 @@ static void update_ordered(ide_drive_t *drive) | |||
513 | { | 520 | { |
514 | u16 *id = drive->id; | 521 | u16 *id = drive->id; |
515 | unsigned ordered = QUEUE_ORDERED_NONE; | 522 | unsigned ordered = QUEUE_ORDERED_NONE; |
516 | prepare_flush_fn *prep_fn = NULL; | ||
517 | 523 | ||
518 | if (drive->dev_flags & IDE_DFLAG_WCACHE) { | 524 | if (drive->dev_flags & IDE_DFLAG_WCACHE) { |
519 | unsigned long long capacity; | 525 | unsigned long long capacity; |
@@ -538,12 +544,12 @@ static void update_ordered(ide_drive_t *drive) | |||
538 | 544 | ||
539 | if (barrier) { | 545 | if (barrier) { |
540 | ordered = QUEUE_ORDERED_DRAIN_FLUSH; | 546 | ordered = QUEUE_ORDERED_DRAIN_FLUSH; |
541 | prep_fn = idedisk_prepare_flush; | 547 | blk_queue_prep_rq(drive->queue, idedisk_prep_fn); |
542 | } | 548 | } |
543 | } else | 549 | } else |
544 | ordered = QUEUE_ORDERED_DRAIN; | 550 | ordered = QUEUE_ORDERED_DRAIN; |
545 | 551 | ||
546 | blk_queue_ordered(drive->queue, ordered, prep_fn); | 552 | blk_queue_ordered(drive->queue, ordered); |
547 | } | 553 | } |
548 | 554 | ||
549 | ide_devset_get_flag(wcache, IDE_DFLAG_WCACHE); | 555 | ide_devset_get_flag(wcache, IDE_DFLAG_WCACHE); |
diff --git a/drivers/ide/ide-disk_ioctl.c b/drivers/ide/ide-disk_ioctl.c index 7b783dd7c0be..ec94c66918f6 100644 --- a/drivers/ide/ide-disk_ioctl.c +++ b/drivers/ide/ide-disk_ioctl.c | |||
@@ -1,6 +1,7 @@ | |||
1 | #include <linux/kernel.h> | 1 | #include <linux/kernel.h> |
2 | #include <linux/ide.h> | 2 | #include <linux/ide.h> |
3 | #include <linux/hdreg.h> | 3 | #include <linux/hdreg.h> |
4 | #include <linux/smp_lock.h> | ||
4 | 5 | ||
5 | #include "ide-disk.h" | 6 | #include "ide-disk.h" |
6 | 7 | ||
@@ -18,9 +19,13 @@ int ide_disk_ioctl(ide_drive_t *drive, struct block_device *bdev, fmode_t mode, | |||
18 | { | 19 | { |
19 | int err; | 20 | int err; |
20 | 21 | ||
22 | lock_kernel(); | ||
21 | err = ide_setting_ioctl(drive, bdev, cmd, arg, ide_disk_ioctl_settings); | 23 | err = ide_setting_ioctl(drive, bdev, cmd, arg, ide_disk_ioctl_settings); |
22 | if (err != -EOPNOTSUPP) | 24 | if (err != -EOPNOTSUPP) |
23 | return err; | 25 | goto out; |
24 | 26 | ||
25 | return generic_ide_ioctl(drive, bdev, cmd, arg); | 27 | err = generic_ide_ioctl(drive, bdev, cmd, arg); |
28 | out: | ||
29 | unlock_kernel(); | ||
30 | return err; | ||
26 | } | 31 | } |
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..5406b6ea3ad1 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; |
@@ -207,7 +207,7 @@ static void idefloppy_create_rw_cmd(ide_drive_t *drive, | |||
207 | memcpy(rq->cmd, pc->c, 12); | 207 | memcpy(rq->cmd, pc->c, 12); |
208 | 208 | ||
209 | pc->rq = rq; | 209 | pc->rq = rq; |
210 | if (rq->cmd_flags & REQ_RW) | 210 | if (rq->cmd_flags & REQ_WRITE) |
211 | pc->flags |= PC_FLAG_WRITING; | 211 | pc->flags |= PC_FLAG_WRITING; |
212 | 212 | ||
213 | pc->flags |= PC_FLAG_DMA_OK; | 213 | pc->flags |= PC_FLAG_DMA_OK; |
@@ -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); |
291 | out_end: | 298 | out_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-floppy_ioctl.c b/drivers/ide/ide-floppy_ioctl.c index 9c2288234dea..fd3d05ab3417 100644 --- a/drivers/ide/ide-floppy_ioctl.c +++ b/drivers/ide/ide-floppy_ioctl.c | |||
@@ -5,6 +5,7 @@ | |||
5 | #include <linux/kernel.h> | 5 | #include <linux/kernel.h> |
6 | #include <linux/ide.h> | 6 | #include <linux/ide.h> |
7 | #include <linux/cdrom.h> | 7 | #include <linux/cdrom.h> |
8 | #include <linux/smp_lock.h> | ||
8 | 9 | ||
9 | #include <asm/unaligned.h> | 10 | #include <asm/unaligned.h> |
10 | 11 | ||
@@ -275,12 +276,15 @@ int ide_floppy_ioctl(ide_drive_t *drive, struct block_device *bdev, | |||
275 | void __user *argp = (void __user *)arg; | 276 | void __user *argp = (void __user *)arg; |
276 | int err; | 277 | int err; |
277 | 278 | ||
278 | if (cmd == CDROMEJECT || cmd == CDROM_LOCKDOOR) | 279 | lock_kernel(); |
279 | return ide_floppy_lockdoor(drive, &pc, arg, cmd); | 280 | if (cmd == CDROMEJECT || cmd == CDROM_LOCKDOOR) { |
281 | err = ide_floppy_lockdoor(drive, &pc, arg, cmd); | ||
282 | goto out; | ||
283 | } | ||
280 | 284 | ||
281 | err = ide_floppy_format_ioctl(drive, &pc, mode, cmd, argp); | 285 | err = ide_floppy_format_ioctl(drive, &pc, mode, cmd, argp); |
282 | if (err != -ENOTTY) | 286 | if (err != -ENOTTY) |
283 | return err; | 287 | goto out; |
284 | 288 | ||
285 | /* | 289 | /* |
286 | * skip SCSI_IOCTL_SEND_COMMAND (deprecated) | 290 | * skip SCSI_IOCTL_SEND_COMMAND (deprecated) |
@@ -293,5 +297,7 @@ int ide_floppy_ioctl(ide_drive_t *drive, struct block_device *bdev, | |||
293 | if (err == -ENOTTY) | 297 | if (err == -ENOTTY) |
294 | err = generic_ide_ioctl(drive, bdev, cmd, arg); | 298 | err = generic_ide_ioctl(drive, bdev, cmd, arg); |
295 | 299 | ||
300 | out: | ||
301 | unlock_kernel(); | ||
296 | return err; | 302 | return err; |
297 | } | 303 | } |
diff --git a/drivers/ide/ide-gd.c b/drivers/ide/ide-gd.c index 79399534782c..70aeeb18833e 100644 --- a/drivers/ide/ide-gd.c +++ b/drivers/ide/ide-gd.c | |||
@@ -1,3 +1,4 @@ | |||
1 | #include <linux/smp_lock.h> | ||
1 | #include <linux/module.h> | 2 | #include <linux/module.h> |
2 | #include <linux/types.h> | 3 | #include <linux/types.h> |
3 | #include <linux/string.h> | 4 | #include <linux/string.h> |
@@ -237,6 +238,18 @@ out_put_idkp: | |||
237 | return ret; | 238 | return ret; |
238 | } | 239 | } |
239 | 240 | ||
241 | static int ide_gd_unlocked_open(struct block_device *bdev, fmode_t mode) | ||
242 | { | ||
243 | int ret; | ||
244 | |||
245 | lock_kernel(); | ||
246 | ret = ide_gd_open(bdev, mode); | ||
247 | unlock_kernel(); | ||
248 | |||
249 | return ret; | ||
250 | } | ||
251 | |||
252 | |||
240 | static int ide_gd_release(struct gendisk *disk, fmode_t mode) | 253 | static int ide_gd_release(struct gendisk *disk, fmode_t mode) |
241 | { | 254 | { |
242 | struct ide_disk_obj *idkp = ide_drv_g(disk, ide_disk_obj); | 255 | struct ide_disk_obj *idkp = ide_drv_g(disk, ide_disk_obj); |
@@ -244,6 +257,7 @@ static int ide_gd_release(struct gendisk *disk, fmode_t mode) | |||
244 | 257 | ||
245 | ide_debug_log(IDE_DBG_FUNC, "enter"); | 258 | ide_debug_log(IDE_DBG_FUNC, "enter"); |
246 | 259 | ||
260 | lock_kernel(); | ||
247 | if (idkp->openers == 1) | 261 | if (idkp->openers == 1) |
248 | drive->disk_ops->flush(drive); | 262 | drive->disk_ops->flush(drive); |
249 | 263 | ||
@@ -255,6 +269,7 @@ static int ide_gd_release(struct gendisk *disk, fmode_t mode) | |||
255 | idkp->openers--; | 269 | idkp->openers--; |
256 | 270 | ||
257 | ide_disk_put(idkp); | 271 | ide_disk_put(idkp); |
272 | unlock_kernel(); | ||
258 | 273 | ||
259 | return 0; | 274 | return 0; |
260 | } | 275 | } |
@@ -321,9 +336,9 @@ static int ide_gd_ioctl(struct block_device *bdev, fmode_t mode, | |||
321 | 336 | ||
322 | static const struct block_device_operations ide_gd_ops = { | 337 | static const struct block_device_operations ide_gd_ops = { |
323 | .owner = THIS_MODULE, | 338 | .owner = THIS_MODULE, |
324 | .open = ide_gd_open, | 339 | .open = ide_gd_unlocked_open, |
325 | .release = ide_gd_release, | 340 | .release = ide_gd_release, |
326 | .locked_ioctl = ide_gd_ioctl, | 341 | .ioctl = ide_gd_ioctl, |
327 | .getgeo = ide_gd_getgeo, | 342 | .getgeo = ide_gd_getgeo, |
328 | .media_changed = ide_gd_media_changed, | 343 | .media_changed = ide_gd_media_changed, |
329 | .unlock_native_capacity = ide_gd_unlock_native_capacity, | 344 | .unlock_native_capacity = ide_gd_unlock_native_capacity, |
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c index 172ac9218154..a381be814070 100644 --- a/drivers/ide/ide-io.c +++ b/drivers/ide/ide-io.c | |||
@@ -135,7 +135,7 @@ EXPORT_SYMBOL(ide_complete_rq); | |||
135 | 135 | ||
136 | void ide_kill_rq(ide_drive_t *drive, struct request *rq) | 136 | void 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..6d622cb5ac81 100644 --- a/drivers/ide/ide-tape.c +++ b/drivers/ide/ide-tape.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <linux/errno.h> | 32 | #include <linux/errno.h> |
33 | #include <linux/genhd.h> | 33 | #include <linux/genhd.h> |
34 | #include <linux/seq_file.h> | 34 | #include <linux/seq_file.h> |
35 | #include <linux/smp_lock.h> | ||
35 | #include <linux/slab.h> | 36 | #include <linux/slab.h> |
36 | #include <linux/pci.h> | 37 | #include <linux/pci.h> |
37 | #include <linux/ide.h> | 38 | #include <linux/ide.h> |
@@ -577,7 +578,8 @@ static ide_startstop_t idetape_do_request(ide_drive_t *drive, | |||
577 | rq->cmd[0], (unsigned long long)blk_rq_pos(rq), | 578 | rq->cmd[0], (unsigned long long)blk_rq_pos(rq), |
578 | blk_rq_sectors(rq)); | 579 | blk_rq_sectors(rq)); |
579 | 580 | ||
580 | BUG_ON(!(blk_special_request(rq) || blk_sense_request(rq))); | 581 | BUG_ON(!(rq->cmd_type == REQ_TYPE_SPECIAL || |
582 | rq->cmd_type == REQ_TYPE_SENSE)); | ||
581 | 583 | ||
582 | /* Retry a failed packet command */ | 584 | /* Retry a failed packet command */ |
583 | if (drive->failed_pc && drive->pc->c[0] == REQUEST_SENSE) { | 585 | if (drive->failed_pc && drive->pc->c[0] == REQUEST_SENSE) { |
@@ -1905,7 +1907,11 @@ static const struct file_operations idetape_fops = { | |||
1905 | 1907 | ||
1906 | static int idetape_open(struct block_device *bdev, fmode_t mode) | 1908 | static int idetape_open(struct block_device *bdev, fmode_t mode) |
1907 | { | 1909 | { |
1908 | struct ide_tape_obj *tape = ide_tape_get(bdev->bd_disk, false, 0); | 1910 | struct ide_tape_obj *tape; |
1911 | |||
1912 | lock_kernel(); | ||
1913 | tape = ide_tape_get(bdev->bd_disk, false, 0); | ||
1914 | unlock_kernel(); | ||
1909 | 1915 | ||
1910 | if (!tape) | 1916 | if (!tape) |
1911 | return -ENXIO; | 1917 | return -ENXIO; |
@@ -1917,7 +1923,10 @@ static int idetape_release(struct gendisk *disk, fmode_t mode) | |||
1917 | { | 1923 | { |
1918 | struct ide_tape_obj *tape = ide_drv_g(disk, ide_tape_obj); | 1924 | struct ide_tape_obj *tape = ide_drv_g(disk, ide_tape_obj); |
1919 | 1925 | ||
1926 | lock_kernel(); | ||
1920 | ide_tape_put(tape); | 1927 | ide_tape_put(tape); |
1928 | unlock_kernel(); | ||
1929 | |||
1921 | return 0; | 1930 | return 0; |
1922 | } | 1931 | } |
1923 | 1932 | ||
@@ -1926,9 +1935,14 @@ static int idetape_ioctl(struct block_device *bdev, fmode_t mode, | |||
1926 | { | 1935 | { |
1927 | struct ide_tape_obj *tape = ide_drv_g(bdev->bd_disk, ide_tape_obj); | 1936 | struct ide_tape_obj *tape = ide_drv_g(bdev->bd_disk, ide_tape_obj); |
1928 | ide_drive_t *drive = tape->drive; | 1937 | ide_drive_t *drive = tape->drive; |
1929 | int err = generic_ide_ioctl(drive, bdev, cmd, arg); | 1938 | int err; |
1939 | |||
1940 | lock_kernel(); | ||
1941 | err = generic_ide_ioctl(drive, bdev, cmd, arg); | ||
1930 | if (err == -EINVAL) | 1942 | if (err == -EINVAL) |
1931 | err = idetape_blkdev_ioctl(drive, cmd, arg); | 1943 | err = idetape_blkdev_ioctl(drive, cmd, arg); |
1944 | unlock_kernel(); | ||
1945 | |||
1932 | return err; | 1946 | return err; |
1933 | } | 1947 | } |
1934 | 1948 | ||
@@ -1936,7 +1950,7 @@ static const struct block_device_operations idetape_block_ops = { | |||
1936 | .owner = THIS_MODULE, | 1950 | .owner = THIS_MODULE, |
1937 | .open = idetape_open, | 1951 | .open = idetape_open, |
1938 | .release = idetape_release, | 1952 | .release = idetape_release, |
1939 | .locked_ioctl = idetape_ioctl, | 1953 | .ioctl = idetape_ioctl, |
1940 | }; | 1954 | }; |
1941 | 1955 | ||
1942 | static int ide_tape_probe(ide_drive_t *drive) | 1956 | static int ide_tape_probe(ide_drive_t *drive) |