diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-01-28 16:51:32 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-01-28 16:51:32 -0500 |
commit | f0f0052069989b80d2a3e50c9cd2f2a650bc1aea (patch) | |
tree | 40ff39bc341aed8318a54d1bd61a381f41844f71 /drivers/scsi/scsi_lib.c | |
parent | 68fbda7de07e56eb90dd6e58a162527411b388b1 (diff) | |
parent | a65b58663d983e588aed8d1bfc75edaac2527fa7 (diff) |
Merge branch 'blk-end-request' of git://git.kernel.dk/linux-2.6-block
* 'blk-end-request' of git://git.kernel.dk/linux-2.6-block: (30 commits)
blk_end_request: changing xsysace (take 4)
blk_end_request: changing ub (take 4)
blk_end_request: cleanup of request completion (take 4)
blk_end_request: cleanup 'uptodate' related code (take 4)
blk_end_request: remove/unexport end_that_request_* (take 4)
blk_end_request: changing scsi (take 4)
blk_end_request: add bidi completion interface (take 4)
blk_end_request: changing ide-cd (take 4)
blk_end_request: add callback feature (take 4)
blk_end_request: changing ide normal caller (take 4)
blk_end_request: changing cpqarray (take 4)
blk_end_request: changing cciss (take 4)
blk_end_request: changing ide-scsi (take 4)
blk_end_request: changing s390 (take 4)
blk_end_request: changing mmc (take 4)
blk_end_request: changing i2o_block (take 4)
blk_end_request: changing viocd (take 4)
blk_end_request: changing xen-blkfront (take 4)
blk_end_request: changing viodasd (take 4)
blk_end_request: changing sx8 (take 4)
...
Diffstat (limited to 'drivers/scsi/scsi_lib.c')
-rw-r--r-- | drivers/scsi/scsi_lib.c | 31 |
1 files changed, 11 insertions, 20 deletions
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index eb4911a61641..7c4c889c5221 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c | |||
@@ -634,7 +634,7 @@ void scsi_run_host_queues(struct Scsi_Host *shost) | |||
634 | * of upper level post-processing and scsi_io_completion). | 634 | * of upper level post-processing and scsi_io_completion). |
635 | * | 635 | * |
636 | * Arguments: cmd - command that is complete. | 636 | * Arguments: cmd - command that is complete. |
637 | * uptodate - 1 if I/O indicates success, <= 0 for I/O error. | 637 | * error - 0 if I/O indicates success, < 0 for I/O error. |
638 | * bytes - number of bytes of completed I/O | 638 | * bytes - number of bytes of completed I/O |
639 | * requeue - indicates whether we should requeue leftovers. | 639 | * requeue - indicates whether we should requeue leftovers. |
640 | * | 640 | * |
@@ -649,26 +649,25 @@ void scsi_run_host_queues(struct Scsi_Host *shost) | |||
649 | * at some point during this call. | 649 | * at some point during this call. |
650 | * Notes: If cmd was requeued, upon return it will be a stale pointer. | 650 | * Notes: If cmd was requeued, upon return it will be a stale pointer. |
651 | */ | 651 | */ |
652 | static struct scsi_cmnd *scsi_end_request(struct scsi_cmnd *cmd, int uptodate, | 652 | static struct scsi_cmnd *scsi_end_request(struct scsi_cmnd *cmd, int error, |
653 | int bytes, int requeue) | 653 | int bytes, int requeue) |
654 | { | 654 | { |
655 | struct request_queue *q = cmd->device->request_queue; | 655 | struct request_queue *q = cmd->device->request_queue; |
656 | struct request *req = cmd->request; | 656 | struct request *req = cmd->request; |
657 | unsigned long flags; | ||
658 | 657 | ||
659 | /* | 658 | /* |
660 | * If there are blocks left over at the end, set up the command | 659 | * If there are blocks left over at the end, set up the command |
661 | * to queue the remainder of them. | 660 | * to queue the remainder of them. |
662 | */ | 661 | */ |
663 | if (end_that_request_chunk(req, uptodate, bytes)) { | 662 | if (blk_end_request(req, error, bytes)) { |
664 | int leftover = (req->hard_nr_sectors << 9); | 663 | int leftover = (req->hard_nr_sectors << 9); |
665 | 664 | ||
666 | if (blk_pc_request(req)) | 665 | if (blk_pc_request(req)) |
667 | leftover = req->data_len; | 666 | leftover = req->data_len; |
668 | 667 | ||
669 | /* kill remainder if no retrys */ | 668 | /* kill remainder if no retrys */ |
670 | if (!uptodate && blk_noretry_request(req)) | 669 | if (error && blk_noretry_request(req)) |
671 | end_that_request_chunk(req, 0, leftover); | 670 | blk_end_request(req, error, leftover); |
672 | else { | 671 | else { |
673 | if (requeue) { | 672 | if (requeue) { |
674 | /* | 673 | /* |
@@ -683,14 +682,6 @@ static struct scsi_cmnd *scsi_end_request(struct scsi_cmnd *cmd, int uptodate, | |||
683 | } | 682 | } |
684 | } | 683 | } |
685 | 684 | ||
686 | add_disk_randomness(req->rq_disk); | ||
687 | |||
688 | spin_lock_irqsave(q->queue_lock, flags); | ||
689 | if (blk_rq_tagged(req)) | ||
690 | blk_queue_end_tag(q, req); | ||
691 | end_that_request_last(req, uptodate); | ||
692 | spin_unlock_irqrestore(q->queue_lock, flags); | ||
693 | |||
694 | /* | 685 | /* |
695 | * This will goose the queue request function at the end, so we don't | 686 | * This will goose the queue request function at the end, so we don't |
696 | * need to worry about launching another command. | 687 | * need to worry about launching another command. |
@@ -892,7 +883,7 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes) | |||
892 | * are leftovers and there is some kind of error | 883 | * are leftovers and there is some kind of error |
893 | * (result != 0), retry the rest. | 884 | * (result != 0), retry the rest. |
894 | */ | 885 | */ |
895 | if (scsi_end_request(cmd, 1, good_bytes, result == 0) == NULL) | 886 | if (scsi_end_request(cmd, 0, good_bytes, result == 0) == NULL) |
896 | return; | 887 | return; |
897 | 888 | ||
898 | /* good_bytes = 0, or (inclusive) there were leftovers and | 889 | /* good_bytes = 0, or (inclusive) there were leftovers and |
@@ -906,7 +897,7 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes) | |||
906 | * and quietly refuse further access. | 897 | * and quietly refuse further access. |
907 | */ | 898 | */ |
908 | cmd->device->changed = 1; | 899 | cmd->device->changed = 1; |
909 | scsi_end_request(cmd, 0, this_count, 1); | 900 | scsi_end_request(cmd, -EIO, this_count, 1); |
910 | return; | 901 | return; |
911 | } else { | 902 | } else { |
912 | /* Must have been a power glitch, or a | 903 | /* Must have been a power glitch, or a |
@@ -938,7 +929,7 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes) | |||
938 | scsi_requeue_command(q, cmd); | 929 | scsi_requeue_command(q, cmd); |
939 | return; | 930 | return; |
940 | } else { | 931 | } else { |
941 | scsi_end_request(cmd, 0, this_count, 1); | 932 | scsi_end_request(cmd, -EIO, this_count, 1); |
942 | return; | 933 | return; |
943 | } | 934 | } |
944 | break; | 935 | break; |
@@ -966,7 +957,7 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes) | |||
966 | "Device not ready", | 957 | "Device not ready", |
967 | &sshdr); | 958 | &sshdr); |
968 | 959 | ||
969 | scsi_end_request(cmd, 0, this_count, 1); | 960 | scsi_end_request(cmd, -EIO, this_count, 1); |
970 | return; | 961 | return; |
971 | case VOLUME_OVERFLOW: | 962 | case VOLUME_OVERFLOW: |
972 | if (!(req->cmd_flags & REQ_QUIET)) { | 963 | if (!(req->cmd_flags & REQ_QUIET)) { |
@@ -976,7 +967,7 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes) | |||
976 | scsi_print_sense("", cmd); | 967 | scsi_print_sense("", cmd); |
977 | } | 968 | } |
978 | /* See SSC3rXX or current. */ | 969 | /* See SSC3rXX or current. */ |
979 | scsi_end_request(cmd, 0, this_count, 1); | 970 | scsi_end_request(cmd, -EIO, this_count, 1); |
980 | return; | 971 | return; |
981 | default: | 972 | default: |
982 | break; | 973 | break; |
@@ -997,7 +988,7 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes) | |||
997 | scsi_print_sense("", cmd); | 988 | scsi_print_sense("", cmd); |
998 | } | 989 | } |
999 | } | 990 | } |
1000 | scsi_end_request(cmd, 0, this_count, !result); | 991 | scsi_end_request(cmd, -EIO, this_count, !result); |
1001 | } | 992 | } |
1002 | 993 | ||
1003 | /* | 994 | /* |