diff options
author | James Bottomley <James.Bottomley@HansenPartnership.com> | 2008-11-30 11:36:26 -0500 |
---|---|---|
committer | James Bottomley <James.Bottomley@HansenPartnership.com> | 2008-12-29 12:24:19 -0500 |
commit | a02488ed73488f316aa00eb973407f4229c6c2bf (patch) | |
tree | 559fee1932847df8017f5f6c7ef3382a51fad96d | |
parent | da244654c66e78e03668863974ec74c981934c38 (diff) |
[SCSI] st: update to use block timeout
Since we're trying to eliminate struct scsi_device timeout, the tape
driver has to be updated to use the block queue timeout instead. The
tape use of scsi_device timeout looks to be self consistent, so I don't
think this necessarily fixes any bug, but it has to be done to allow me
to remove the timeout parameter from struct scsi_device.
Acked-by: Kai Makisara <Kai.Makisara@kolumbus.fi>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
-rw-r--r-- | drivers/scsi/st.c | 47 |
1 files changed, 28 insertions, 19 deletions
diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c index c959bdc55f4f..d60be83ba78b 100644 --- a/drivers/scsi/st.c +++ b/drivers/scsi/st.c | |||
@@ -613,7 +613,8 @@ static int cross_eof(struct scsi_tape * STp, int forward) | |||
613 | tape_name(STp), forward ? "forward" : "backward")); | 613 | tape_name(STp), forward ? "forward" : "backward")); |
614 | 614 | ||
615 | SRpnt = st_do_scsi(NULL, STp, cmd, 0, DMA_NONE, | 615 | SRpnt = st_do_scsi(NULL, STp, cmd, 0, DMA_NONE, |
616 | STp->device->timeout, MAX_RETRIES, 1); | 616 | STp->device->request_queue->rq_timeout, |
617 | MAX_RETRIES, 1); | ||
617 | if (!SRpnt) | 618 | if (!SRpnt) |
618 | return (STp->buffer)->syscall_result; | 619 | return (STp->buffer)->syscall_result; |
619 | 620 | ||
@@ -657,7 +658,8 @@ static int st_flush_write_buffer(struct scsi_tape * STp) | |||
657 | cmd[4] = blks; | 658 | cmd[4] = blks; |
658 | 659 | ||
659 | SRpnt = st_do_scsi(NULL, STp, cmd, transfer, DMA_TO_DEVICE, | 660 | SRpnt = st_do_scsi(NULL, STp, cmd, transfer, DMA_TO_DEVICE, |
660 | STp->device->timeout, MAX_WRITE_RETRIES, 1); | 661 | STp->device->request_queue->rq_timeout, |
662 | MAX_WRITE_RETRIES, 1); | ||
661 | if (!SRpnt) | 663 | if (!SRpnt) |
662 | return (STp->buffer)->syscall_result; | 664 | return (STp->buffer)->syscall_result; |
663 | 665 | ||
@@ -987,7 +989,8 @@ static int check_tape(struct scsi_tape *STp, struct file *filp) | |||
987 | cmd[0] = READ_BLOCK_LIMITS; | 989 | cmd[0] = READ_BLOCK_LIMITS; |
988 | 990 | ||
989 | SRpnt = st_do_scsi(SRpnt, STp, cmd, 6, DMA_FROM_DEVICE, | 991 | SRpnt = st_do_scsi(SRpnt, STp, cmd, 6, DMA_FROM_DEVICE, |
990 | STp->device->timeout, MAX_READY_RETRIES, 1); | 992 | STp->device->request_queue->rq_timeout, |
993 | MAX_READY_RETRIES, 1); | ||
991 | if (!SRpnt) { | 994 | if (!SRpnt) { |
992 | retval = (STp->buffer)->syscall_result; | 995 | retval = (STp->buffer)->syscall_result; |
993 | goto err_out; | 996 | goto err_out; |
@@ -1014,7 +1017,8 @@ static int check_tape(struct scsi_tape *STp, struct file *filp) | |||
1014 | cmd[4] = 12; | 1017 | cmd[4] = 12; |
1015 | 1018 | ||
1016 | SRpnt = st_do_scsi(SRpnt, STp, cmd, 12, DMA_FROM_DEVICE, | 1019 | SRpnt = st_do_scsi(SRpnt, STp, cmd, 12, DMA_FROM_DEVICE, |
1017 | STp->device->timeout, MAX_READY_RETRIES, 1); | 1020 | STp->device->request_queue->rq_timeout, |
1021 | MAX_READY_RETRIES, 1); | ||
1018 | if (!SRpnt) { | 1022 | if (!SRpnt) { |
1019 | retval = (STp->buffer)->syscall_result; | 1023 | retval = (STp->buffer)->syscall_result; |
1020 | goto err_out; | 1024 | goto err_out; |
@@ -1247,7 +1251,8 @@ static int st_flush(struct file *filp, fl_owner_t id) | |||
1247 | cmd[4] = 1 + STp->two_fm; | 1251 | cmd[4] = 1 + STp->two_fm; |
1248 | 1252 | ||
1249 | SRpnt = st_do_scsi(NULL, STp, cmd, 0, DMA_NONE, | 1253 | SRpnt = st_do_scsi(NULL, STp, cmd, 0, DMA_NONE, |
1250 | STp->device->timeout, MAX_WRITE_RETRIES, 1); | 1254 | STp->device->request_queue->rq_timeout, |
1255 | MAX_WRITE_RETRIES, 1); | ||
1251 | if (!SRpnt) { | 1256 | if (!SRpnt) { |
1252 | result = (STp->buffer)->syscall_result; | 1257 | result = (STp->buffer)->syscall_result; |
1253 | goto out; | 1258 | goto out; |
@@ -1634,7 +1639,8 @@ st_write(struct file *filp, const char __user *buf, size_t count, loff_t * ppos) | |||
1634 | cmd[4] = blks; | 1639 | cmd[4] = blks; |
1635 | 1640 | ||
1636 | SRpnt = st_do_scsi(SRpnt, STp, cmd, transfer, DMA_TO_DEVICE, | 1641 | SRpnt = st_do_scsi(SRpnt, STp, cmd, transfer, DMA_TO_DEVICE, |
1637 | STp->device->timeout, MAX_WRITE_RETRIES, !async_write); | 1642 | STp->device->request_queue->rq_timeout, |
1643 | MAX_WRITE_RETRIES, !async_write); | ||
1638 | if (!SRpnt) { | 1644 | if (!SRpnt) { |
1639 | retval = STbp->syscall_result; | 1645 | retval = STbp->syscall_result; |
1640 | goto out; | 1646 | goto out; |
@@ -1804,7 +1810,8 @@ static long read_tape(struct scsi_tape *STp, long count, | |||
1804 | 1810 | ||
1805 | SRpnt = *aSRpnt; | 1811 | SRpnt = *aSRpnt; |
1806 | SRpnt = st_do_scsi(SRpnt, STp, cmd, bytes, DMA_FROM_DEVICE, | 1812 | SRpnt = st_do_scsi(SRpnt, STp, cmd, bytes, DMA_FROM_DEVICE, |
1807 | STp->device->timeout, MAX_RETRIES, 1); | 1813 | STp->device->request_queue->rq_timeout, |
1814 | MAX_RETRIES, 1); | ||
1808 | release_buffering(STp, 1); | 1815 | release_buffering(STp, 1); |
1809 | *aSRpnt = SRpnt; | 1816 | *aSRpnt = SRpnt; |
1810 | if (!SRpnt) | 1817 | if (!SRpnt) |
@@ -2213,7 +2220,8 @@ static int st_set_options(struct scsi_tape *STp, long options) | |||
2213 | DEBC( printk(KERN_INFO "%s: Long timeout set to %d seconds.\n", name, | 2220 | DEBC( printk(KERN_INFO "%s: Long timeout set to %d seconds.\n", name, |
2214 | (value & ~MT_ST_SET_LONG_TIMEOUT))); | 2221 | (value & ~MT_ST_SET_LONG_TIMEOUT))); |
2215 | } else { | 2222 | } else { |
2216 | STp->device->timeout = value * HZ; | 2223 | blk_queue_rq_timeout(STp->device->request_queue, |
2224 | value * HZ); | ||
2217 | DEBC( printk(KERN_INFO "%s: Normal timeout set to %d seconds.\n", | 2225 | DEBC( printk(KERN_INFO "%s: Normal timeout set to %d seconds.\n", |
2218 | name, value) ); | 2226 | name, value) ); |
2219 | } | 2227 | } |
@@ -2321,7 +2329,7 @@ static int read_mode_page(struct scsi_tape *STp, int page, int omit_block_descs) | |||
2321 | cmd[4] = 255; | 2329 | cmd[4] = 255; |
2322 | 2330 | ||
2323 | SRpnt = st_do_scsi(SRpnt, STp, cmd, cmd[4], DMA_FROM_DEVICE, | 2331 | SRpnt = st_do_scsi(SRpnt, STp, cmd, cmd[4], DMA_FROM_DEVICE, |
2324 | STp->device->timeout, 0, 1); | 2332 | STp->device->request_queue->rq_timeout, 0, 1); |
2325 | if (SRpnt == NULL) | 2333 | if (SRpnt == NULL) |
2326 | return (STp->buffer)->syscall_result; | 2334 | return (STp->buffer)->syscall_result; |
2327 | 2335 | ||
@@ -2352,7 +2360,7 @@ static int write_mode_page(struct scsi_tape *STp, int page, int slow) | |||
2352 | (STp->buffer)->b_data[pgo + MP_OFF_PAGE_NBR] &= MP_MSK_PAGE_NBR; | 2360 | (STp->buffer)->b_data[pgo + MP_OFF_PAGE_NBR] &= MP_MSK_PAGE_NBR; |
2353 | 2361 | ||
2354 | SRpnt = st_do_scsi(SRpnt, STp, cmd, cmd[4], DMA_TO_DEVICE, | 2362 | SRpnt = st_do_scsi(SRpnt, STp, cmd, cmd[4], DMA_TO_DEVICE, |
2355 | (slow ? STp->long_timeout : STp->device->timeout), 0, 1); | 2363 | (slow ? STp->long_timeout : STp->device->request_queue->rq_timeout), 0, 1); |
2356 | if (SRpnt == NULL) | 2364 | if (SRpnt == NULL) |
2357 | return (STp->buffer)->syscall_result; | 2365 | return (STp->buffer)->syscall_result; |
2358 | 2366 | ||
@@ -2464,7 +2472,7 @@ static int do_load_unload(struct scsi_tape *STp, struct file *filp, int load_cod | |||
2464 | } | 2472 | } |
2465 | if (STp->immediate) { | 2473 | if (STp->immediate) { |
2466 | cmd[1] = 1; /* Don't wait for completion */ | 2474 | cmd[1] = 1; /* Don't wait for completion */ |
2467 | timeout = STp->device->timeout; | 2475 | timeout = STp->device->request_queue->rq_timeout; |
2468 | } | 2476 | } |
2469 | else | 2477 | else |
2470 | timeout = STp->long_timeout; | 2478 | timeout = STp->long_timeout; |
@@ -2638,7 +2646,7 @@ static int st_int_ioctl(struct scsi_tape *STp, unsigned int cmd_in, unsigned lon | |||
2638 | cmd[2] = (arg >> 16); | 2646 | cmd[2] = (arg >> 16); |
2639 | cmd[3] = (arg >> 8); | 2647 | cmd[3] = (arg >> 8); |
2640 | cmd[4] = arg; | 2648 | cmd[4] = arg; |
2641 | timeout = STp->device->timeout; | 2649 | timeout = STp->device->request_queue->rq_timeout; |
2642 | DEBC( | 2650 | DEBC( |
2643 | if (cmd_in == MTWEOF) | 2651 | if (cmd_in == MTWEOF) |
2644 | printk(ST_DEB_MSG "%s: Writing %d filemarks.\n", name, | 2652 | printk(ST_DEB_MSG "%s: Writing %d filemarks.\n", name, |
@@ -2656,7 +2664,7 @@ static int st_int_ioctl(struct scsi_tape *STp, unsigned int cmd_in, unsigned lon | |||
2656 | cmd[0] = REZERO_UNIT; | 2664 | cmd[0] = REZERO_UNIT; |
2657 | if (STp->immediate) { | 2665 | if (STp->immediate) { |
2658 | cmd[1] = 1; /* Don't wait for completion */ | 2666 | cmd[1] = 1; /* Don't wait for completion */ |
2659 | timeout = STp->device->timeout; | 2667 | timeout = STp->device->request_queue->rq_timeout; |
2660 | } | 2668 | } |
2661 | DEBC(printk(ST_DEB_MSG "%s: Rewinding tape.\n", name)); | 2669 | DEBC(printk(ST_DEB_MSG "%s: Rewinding tape.\n", name)); |
2662 | fileno = blkno = at_sm = 0; | 2670 | fileno = blkno = at_sm = 0; |
@@ -2669,7 +2677,7 @@ static int st_int_ioctl(struct scsi_tape *STp, unsigned int cmd_in, unsigned lon | |||
2669 | cmd[0] = START_STOP; | 2677 | cmd[0] = START_STOP; |
2670 | if (STp->immediate) { | 2678 | if (STp->immediate) { |
2671 | cmd[1] = 1; /* Don't wait for completion */ | 2679 | cmd[1] = 1; /* Don't wait for completion */ |
2672 | timeout = STp->device->timeout; | 2680 | timeout = STp->device->request_queue->rq_timeout; |
2673 | } | 2681 | } |
2674 | cmd[4] = 3; | 2682 | cmd[4] = 3; |
2675 | DEBC(printk(ST_DEB_MSG "%s: Retensioning tape.\n", name)); | 2683 | DEBC(printk(ST_DEB_MSG "%s: Retensioning tape.\n", name)); |
@@ -2702,7 +2710,7 @@ static int st_int_ioctl(struct scsi_tape *STp, unsigned int cmd_in, unsigned lon | |||
2702 | cmd[1] = (arg ? 1 : 0); /* Long erase with non-zero argument */ | 2710 | cmd[1] = (arg ? 1 : 0); /* Long erase with non-zero argument */ |
2703 | if (STp->immediate) { | 2711 | if (STp->immediate) { |
2704 | cmd[1] |= 2; /* Don't wait for completion */ | 2712 | cmd[1] |= 2; /* Don't wait for completion */ |
2705 | timeout = STp->device->timeout; | 2713 | timeout = STp->device->request_queue->rq_timeout; |
2706 | } | 2714 | } |
2707 | else | 2715 | else |
2708 | timeout = STp->long_timeout * 8; | 2716 | timeout = STp->long_timeout * 8; |
@@ -2754,7 +2762,7 @@ static int st_int_ioctl(struct scsi_tape *STp, unsigned int cmd_in, unsigned lon | |||
2754 | (STp->buffer)->b_data[9] = (ltmp >> 16); | 2762 | (STp->buffer)->b_data[9] = (ltmp >> 16); |
2755 | (STp->buffer)->b_data[10] = (ltmp >> 8); | 2763 | (STp->buffer)->b_data[10] = (ltmp >> 8); |
2756 | (STp->buffer)->b_data[11] = ltmp; | 2764 | (STp->buffer)->b_data[11] = ltmp; |
2757 | timeout = STp->device->timeout; | 2765 | timeout = STp->device->request_queue->rq_timeout; |
2758 | DEBC( | 2766 | DEBC( |
2759 | if (cmd_in == MTSETBLK || cmd_in == SET_DENS_AND_BLK) | 2767 | if (cmd_in == MTSETBLK || cmd_in == SET_DENS_AND_BLK) |
2760 | printk(ST_DEB_MSG | 2768 | printk(ST_DEB_MSG |
@@ -2944,7 +2952,8 @@ static int get_location(struct scsi_tape *STp, unsigned int *block, int *partiti | |||
2944 | scmd[1] = 1; | 2952 | scmd[1] = 1; |
2945 | } | 2953 | } |
2946 | SRpnt = st_do_scsi(NULL, STp, scmd, 20, DMA_FROM_DEVICE, | 2954 | SRpnt = st_do_scsi(NULL, STp, scmd, 20, DMA_FROM_DEVICE, |
2947 | STp->device->timeout, MAX_READY_RETRIES, 1); | 2955 | STp->device->request_queue->rq_timeout, |
2956 | MAX_READY_RETRIES, 1); | ||
2948 | if (!SRpnt) | 2957 | if (!SRpnt) |
2949 | return (STp->buffer)->syscall_result; | 2958 | return (STp->buffer)->syscall_result; |
2950 | 2959 | ||
@@ -3045,7 +3054,7 @@ static int set_location(struct scsi_tape *STp, unsigned int block, int partition | |||
3045 | } | 3054 | } |
3046 | if (STp->immediate) { | 3055 | if (STp->immediate) { |
3047 | scmd[1] |= 1; /* Don't wait for completion */ | 3056 | scmd[1] |= 1; /* Don't wait for completion */ |
3048 | timeout = STp->device->timeout; | 3057 | timeout = STp->device->request_queue->rq_timeout; |
3049 | } | 3058 | } |
3050 | 3059 | ||
3051 | SRpnt = st_do_scsi(NULL, STp, scmd, 0, DMA_NONE, | 3060 | SRpnt = st_do_scsi(NULL, STp, scmd, 0, DMA_NONE, |
@@ -4029,7 +4038,7 @@ static int st_probe(struct device *dev) | |||
4029 | tpnt->partition = 0; | 4038 | tpnt->partition = 0; |
4030 | tpnt->new_partition = 0; | 4039 | tpnt->new_partition = 0; |
4031 | tpnt->nbr_partitions = 0; | 4040 | tpnt->nbr_partitions = 0; |
4032 | tpnt->device->timeout = ST_TIMEOUT; | 4041 | blk_queue_rq_timeout(tpnt->device->request_queue, ST_TIMEOUT); |
4033 | tpnt->long_timeout = ST_LONG_TIMEOUT; | 4042 | tpnt->long_timeout = ST_LONG_TIMEOUT; |
4034 | tpnt->try_dio = try_direct_io && !SDp->host->unchecked_isa_dma; | 4043 | tpnt->try_dio = try_direct_io && !SDp->host->unchecked_isa_dma; |
4035 | 4044 | ||