diff options
Diffstat (limited to 'drivers/message/i2o/i2o_block.c')
-rw-r--r-- | drivers/message/i2o/i2o_block.c | 43 |
1 files changed, 20 insertions, 23 deletions
diff --git a/drivers/message/i2o/i2o_block.c b/drivers/message/i2o/i2o_block.c index a443e136dc41..335d4c78a775 100644 --- a/drivers/message/i2o/i2o_block.c +++ b/drivers/message/i2o/i2o_block.c | |||
@@ -426,15 +426,9 @@ static void i2o_block_end_request(struct request *req, int error, | |||
426 | struct request_queue *q = req->q; | 426 | struct request_queue *q = req->q; |
427 | unsigned long flags; | 427 | unsigned long flags; |
428 | 428 | ||
429 | if (blk_end_request(req, error, nr_bytes)) { | 429 | if (blk_end_request(req, error, nr_bytes)) |
430 | int leftover = (req->hard_nr_sectors << KERNEL_SECTOR_SHIFT); | ||
431 | |||
432 | if (blk_pc_request(req)) | ||
433 | leftover = req->data_len; | ||
434 | |||
435 | if (error) | 430 | if (error) |
436 | blk_end_request(req, -EIO, leftover); | 431 | blk_end_request_all(req, -EIO); |
437 | } | ||
438 | 432 | ||
439 | spin_lock_irqsave(q->queue_lock, flags); | 433 | spin_lock_irqsave(q->queue_lock, flags); |
440 | 434 | ||
@@ -761,7 +755,7 @@ static int i2o_block_transfer(struct request *req) | |||
761 | break; | 755 | break; |
762 | 756 | ||
763 | case CACHE_SMARTFETCH: | 757 | case CACHE_SMARTFETCH: |
764 | if (req->nr_sectors > 16) | 758 | if (blk_rq_sectors(req) > 16) |
765 | ctl_flags = 0x201F0008; | 759 | ctl_flags = 0x201F0008; |
766 | else | 760 | else |
767 | ctl_flags = 0x001F0000; | 761 | ctl_flags = 0x001F0000; |
@@ -781,13 +775,13 @@ static int i2o_block_transfer(struct request *req) | |||
781 | ctl_flags = 0x001F0010; | 775 | ctl_flags = 0x001F0010; |
782 | break; | 776 | break; |
783 | case CACHE_SMARTBACK: | 777 | case CACHE_SMARTBACK: |
784 | if (req->nr_sectors > 16) | 778 | if (blk_rq_sectors(req) > 16) |
785 | ctl_flags = 0x001F0004; | 779 | ctl_flags = 0x001F0004; |
786 | else | 780 | else |
787 | ctl_flags = 0x001F0010; | 781 | ctl_flags = 0x001F0010; |
788 | break; | 782 | break; |
789 | case CACHE_SMARTTHROUGH: | 783 | case CACHE_SMARTTHROUGH: |
790 | if (req->nr_sectors > 16) | 784 | if (blk_rq_sectors(req) > 16) |
791 | ctl_flags = 0x001F0004; | 785 | ctl_flags = 0x001F0004; |
792 | else | 786 | else |
793 | ctl_flags = 0x001F0010; | 787 | ctl_flags = 0x001F0010; |
@@ -800,8 +794,9 @@ static int i2o_block_transfer(struct request *req) | |||
800 | if (c->adaptec) { | 794 | if (c->adaptec) { |
801 | u8 cmd[10]; | 795 | u8 cmd[10]; |
802 | u32 scsi_flags; | 796 | u32 scsi_flags; |
803 | u16 hwsec = queue_hardsect_size(req->q) >> KERNEL_SECTOR_SHIFT; | 797 | u16 hwsec; |
804 | 798 | ||
799 | hwsec = queue_logical_block_size(req->q) >> KERNEL_SECTOR_SHIFT; | ||
805 | memset(cmd, 0, 10); | 800 | memset(cmd, 0, 10); |
806 | 801 | ||
807 | sgl_offset = SGL_OFFSET_12; | 802 | sgl_offset = SGL_OFFSET_12; |
@@ -827,22 +822,22 @@ static int i2o_block_transfer(struct request *req) | |||
827 | 822 | ||
828 | *mptr++ = cpu_to_le32(scsi_flags); | 823 | *mptr++ = cpu_to_le32(scsi_flags); |
829 | 824 | ||
830 | *((u32 *) & cmd[2]) = cpu_to_be32(req->sector * hwsec); | 825 | *((u32 *) & cmd[2]) = cpu_to_be32(blk_rq_pos(req) * hwsec); |
831 | *((u16 *) & cmd[7]) = cpu_to_be16(req->nr_sectors * hwsec); | 826 | *((u16 *) & cmd[7]) = cpu_to_be16(blk_rq_sectors(req) * hwsec); |
832 | 827 | ||
833 | memcpy(mptr, cmd, 10); | 828 | memcpy(mptr, cmd, 10); |
834 | mptr += 4; | 829 | mptr += 4; |
835 | *mptr++ = cpu_to_le32(req->nr_sectors << KERNEL_SECTOR_SHIFT); | 830 | *mptr++ = cpu_to_le32(blk_rq_bytes(req)); |
836 | } else | 831 | } else |
837 | #endif | 832 | #endif |
838 | { | 833 | { |
839 | msg->u.head[1] = cpu_to_le32(cmd | HOST_TID << 12 | tid); | 834 | msg->u.head[1] = cpu_to_le32(cmd | HOST_TID << 12 | tid); |
840 | *mptr++ = cpu_to_le32(ctl_flags); | 835 | *mptr++ = cpu_to_le32(ctl_flags); |
841 | *mptr++ = cpu_to_le32(req->nr_sectors << KERNEL_SECTOR_SHIFT); | 836 | *mptr++ = cpu_to_le32(blk_rq_bytes(req)); |
842 | *mptr++ = | 837 | *mptr++ = |
843 | cpu_to_le32((u32) (req->sector << KERNEL_SECTOR_SHIFT)); | 838 | cpu_to_le32((u32) (blk_rq_pos(req) << KERNEL_SECTOR_SHIFT)); |
844 | *mptr++ = | 839 | *mptr++ = |
845 | cpu_to_le32(req->sector >> (32 - KERNEL_SECTOR_SHIFT)); | 840 | cpu_to_le32(blk_rq_pos(req) >> (32 - KERNEL_SECTOR_SHIFT)); |
846 | } | 841 | } |
847 | 842 | ||
848 | if (!i2o_block_sglist_alloc(c, ireq, &mptr)) { | 843 | if (!i2o_block_sglist_alloc(c, ireq, &mptr)) { |
@@ -883,7 +878,7 @@ static void i2o_block_request_fn(struct request_queue *q) | |||
883 | struct request *req; | 878 | struct request *req; |
884 | 879 | ||
885 | while (!blk_queue_plugged(q)) { | 880 | while (!blk_queue_plugged(q)) { |
886 | req = elv_next_request(q); | 881 | req = blk_peek_request(q); |
887 | if (!req) | 882 | if (!req) |
888 | break; | 883 | break; |
889 | 884 | ||
@@ -896,7 +891,7 @@ static void i2o_block_request_fn(struct request_queue *q) | |||
896 | 891 | ||
897 | if (queue_depth < I2O_BLOCK_MAX_OPEN_REQUESTS) { | 892 | if (queue_depth < I2O_BLOCK_MAX_OPEN_REQUESTS) { |
898 | if (!i2o_block_transfer(req)) { | 893 | if (!i2o_block_transfer(req)) { |
899 | blkdev_dequeue_request(req); | 894 | blk_start_request(req); |
900 | continue; | 895 | continue; |
901 | } else | 896 | } else |
902 | osm_info("transfer error\n"); | 897 | osm_info("transfer error\n"); |
@@ -922,8 +917,10 @@ static void i2o_block_request_fn(struct request_queue *q) | |||
922 | blk_stop_queue(q); | 917 | blk_stop_queue(q); |
923 | break; | 918 | break; |
924 | } | 919 | } |
925 | } else | 920 | } else { |
926 | end_request(req, 0); | 921 | blk_start_request(req); |
922 | __blk_end_request_all(req, -EIO); | ||
923 | } | ||
927 | } | 924 | } |
928 | }; | 925 | }; |
929 | 926 | ||
@@ -1082,7 +1079,7 @@ static int i2o_block_probe(struct device *dev) | |||
1082 | */ | 1079 | */ |
1083 | if (!i2o_parm_field_get(i2o_dev, 0x0004, 1, &blocksize, 4) || | 1080 | if (!i2o_parm_field_get(i2o_dev, 0x0004, 1, &blocksize, 4) || |
1084 | !i2o_parm_field_get(i2o_dev, 0x0000, 3, &blocksize, 4)) { | 1081 | !i2o_parm_field_get(i2o_dev, 0x0000, 3, &blocksize, 4)) { |
1085 | blk_queue_hardsect_size(queue, le32_to_cpu(blocksize)); | 1082 | blk_queue_logical_block_size(queue, le32_to_cpu(blocksize)); |
1086 | } else | 1083 | } else |
1087 | osm_warn("unable to get blocksize of %s\n", gd->disk_name); | 1084 | osm_warn("unable to get blocksize of %s\n", gd->disk_name); |
1088 | 1085 | ||