diff options
author | Tejun Heo <tj@kernel.org> | 2009-05-19 05:33:04 -0400 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2009-05-19 05:36:08 -0400 |
commit | 3755100dd5f66761aaaa7ae44c70b319a7c78a56 (patch) | |
tree | cd7206012aa4af29666b1f84191f690c2bd2e939 | |
parent | f831cc03490c78a76e2d35ad77ec2292d0323728 (diff) |
ub: use __blk_end_request_all()
ub_end_rq() always tries to complete full request. The @cmd_len
parameter was there because rq->data_len used to be overwritten with
residue count. Drop @cmd_len and use __blk_end_request_all().
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Pete Zaitcev <zaitcev@redhat.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
-rw-r--r-- | drivers/block/ub.c | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/drivers/block/ub.c b/drivers/block/ub.c index 178f459a50ed..f32781cff456 100644 --- a/drivers/block/ub.c +++ b/drivers/block/ub.c | |||
@@ -360,8 +360,7 @@ static void ub_cmd_build_block(struct ub_dev *sc, struct ub_lun *lun, | |||
360 | static void ub_cmd_build_packet(struct ub_dev *sc, struct ub_lun *lun, | 360 | static void ub_cmd_build_packet(struct ub_dev *sc, struct ub_lun *lun, |
361 | struct ub_scsi_cmd *cmd, struct ub_request *urq); | 361 | struct ub_scsi_cmd *cmd, struct ub_request *urq); |
362 | static void ub_rw_cmd_done(struct ub_dev *sc, struct ub_scsi_cmd *cmd); | 362 | static void ub_rw_cmd_done(struct ub_dev *sc, struct ub_scsi_cmd *cmd); |
363 | static void ub_end_rq(struct request *rq, unsigned int status, | 363 | static void ub_end_rq(struct request *rq, unsigned int status); |
364 | unsigned int cmd_len); | ||
365 | static int ub_rw_cmd_retry(struct ub_dev *sc, struct ub_lun *lun, | 364 | static int ub_rw_cmd_retry(struct ub_dev *sc, struct ub_lun *lun, |
366 | struct ub_request *urq, struct ub_scsi_cmd *cmd); | 365 | struct ub_request *urq, struct ub_scsi_cmd *cmd); |
367 | static int ub_submit_scsi(struct ub_dev *sc, struct ub_scsi_cmd *cmd); | 366 | static int ub_submit_scsi(struct ub_dev *sc, struct ub_scsi_cmd *cmd); |
@@ -644,13 +643,13 @@ static int ub_request_fn_1(struct ub_lun *lun, struct request *rq) | |||
644 | 643 | ||
645 | if (atomic_read(&sc->poison)) { | 644 | if (atomic_read(&sc->poison)) { |
646 | blk_start_request(rq); | 645 | blk_start_request(rq); |
647 | ub_end_rq(rq, DID_NO_CONNECT << 16, blk_rq_bytes(rq)); | 646 | ub_end_rq(rq, DID_NO_CONNECT << 16); |
648 | return 0; | 647 | return 0; |
649 | } | 648 | } |
650 | 649 | ||
651 | if (lun->changed && !blk_pc_request(rq)) { | 650 | if (lun->changed && !blk_pc_request(rq)) { |
652 | blk_start_request(rq); | 651 | blk_start_request(rq); |
653 | ub_end_rq(rq, SAM_STAT_CHECK_CONDITION, blk_rq_bytes(rq)); | 652 | ub_end_rq(rq, SAM_STAT_CHECK_CONDITION); |
654 | return 0; | 653 | return 0; |
655 | } | 654 | } |
656 | 655 | ||
@@ -702,7 +701,7 @@ static int ub_request_fn_1(struct ub_lun *lun, struct request *rq) | |||
702 | 701 | ||
703 | drop: | 702 | drop: |
704 | ub_put_cmd(lun, cmd); | 703 | ub_put_cmd(lun, cmd); |
705 | ub_end_rq(rq, DID_ERROR << 16, blk_rq_bytes(rq)); | 704 | ub_end_rq(rq, DID_ERROR << 16); |
706 | return 0; | 705 | return 0; |
707 | } | 706 | } |
708 | 707 | ||
@@ -777,7 +776,6 @@ static void ub_rw_cmd_done(struct ub_dev *sc, struct ub_scsi_cmd *cmd) | |||
777 | struct ub_request *urq = cmd->back; | 776 | struct ub_request *urq = cmd->back; |
778 | struct request *rq; | 777 | struct request *rq; |
779 | unsigned int scsi_status; | 778 | unsigned int scsi_status; |
780 | unsigned int cmd_len; | ||
781 | 779 | ||
782 | rq = urq->rq; | 780 | rq = urq->rq; |
783 | 781 | ||
@@ -816,17 +814,14 @@ static void ub_rw_cmd_done(struct ub_dev *sc, struct ub_scsi_cmd *cmd) | |||
816 | 814 | ||
817 | urq->rq = NULL; | 815 | urq->rq = NULL; |
818 | 816 | ||
819 | cmd_len = cmd->len; | ||
820 | ub_put_cmd(lun, cmd); | 817 | ub_put_cmd(lun, cmd); |
821 | ub_end_rq(rq, scsi_status, cmd_len); | 818 | ub_end_rq(rq, scsi_status); |
822 | blk_start_queue(lun->disk->queue); | 819 | blk_start_queue(lun->disk->queue); |
823 | } | 820 | } |
824 | 821 | ||
825 | static void ub_end_rq(struct request *rq, unsigned int scsi_status, | 822 | static void ub_end_rq(struct request *rq, unsigned int scsi_status) |
826 | unsigned int cmd_len) | ||
827 | { | 823 | { |
828 | int error; | 824 | int error; |
829 | long rqlen; | ||
830 | 825 | ||
831 | if (scsi_status == 0) { | 826 | if (scsi_status == 0) { |
832 | error = 0; | 827 | error = 0; |
@@ -834,12 +829,7 @@ static void ub_end_rq(struct request *rq, unsigned int scsi_status, | |||
834 | error = -EIO; | 829 | error = -EIO; |
835 | rq->errors = scsi_status; | 830 | rq->errors = scsi_status; |
836 | } | 831 | } |
837 | rqlen = blk_rq_bytes(rq); /* Oddly enough, this is the residue. */ | 832 | __blk_end_request_all(rq, error); |
838 | if (__blk_end_request(rq, error, cmd_len)) { | ||
839 | printk(KERN_WARNING DRV_NAME | ||
840 | ": __blk_end_request blew, %s-cmd total %u rqlen %ld\n", | ||
841 | blk_pc_request(rq)? "pc": "fs", cmd_len, rqlen); | ||
842 | } | ||
843 | } | 833 | } |
844 | 834 | ||
845 | static int ub_rw_cmd_retry(struct ub_dev *sc, struct ub_lun *lun, | 835 | static int ub_rw_cmd_retry(struct ub_dev *sc, struct ub_lun *lun, |