diff options
Diffstat (limited to 'drivers/scsi/scsi_debug.c')
| -rw-r--r-- | drivers/scsi/scsi_debug.c | 136 |
1 files changed, 70 insertions, 66 deletions
diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c index d19c0e3c7f48..2b6d447ad6d6 100644 --- a/drivers/scsi/scsi_debug.c +++ b/drivers/scsi/scsi_debug.c | |||
| @@ -123,7 +123,7 @@ static const char *scsi_debug_version_date = "20140706"; | |||
| 123 | #define DEF_PHYSBLK_EXP 0 | 123 | #define DEF_PHYSBLK_EXP 0 |
| 124 | #define DEF_PTYPE 0 | 124 | #define DEF_PTYPE 0 |
| 125 | #define DEF_REMOVABLE false | 125 | #define DEF_REMOVABLE false |
| 126 | #define DEF_SCSI_LEVEL 5 /* INQUIRY, byte2 [5->SPC-3] */ | 126 | #define DEF_SCSI_LEVEL 6 /* INQUIRY, byte2 [6->SPC-4] */ |
| 127 | #define DEF_SECTOR_SIZE 512 | 127 | #define DEF_SECTOR_SIZE 512 |
| 128 | #define DEF_TAGGED_QUEUING 0 /* 0 | MSG_SIMPLE_TAG | MSG_ORDERED_TAG */ | 128 | #define DEF_TAGGED_QUEUING 0 /* 0 | MSG_SIMPLE_TAG | MSG_ORDERED_TAG */ |
| 129 | #define DEF_UNMAP_ALIGNMENT 0 | 129 | #define DEF_UNMAP_ALIGNMENT 0 |
| @@ -929,7 +929,7 @@ static int resp_inquiry(struct scsi_cmnd *scp, int target, | |||
| 929 | { | 929 | { |
| 930 | unsigned char pq_pdt; | 930 | unsigned char pq_pdt; |
| 931 | unsigned char * arr; | 931 | unsigned char * arr; |
| 932 | unsigned char *cmd = (unsigned char *)scp->cmnd; | 932 | unsigned char *cmd = scp->cmnd; |
| 933 | int alloc_len, n, ret; | 933 | int alloc_len, n, ret; |
| 934 | 934 | ||
| 935 | alloc_len = (cmd[3] << 8) + cmd[4]; | 935 | alloc_len = (cmd[3] << 8) + cmd[4]; |
| @@ -1056,15 +1056,15 @@ static int resp_inquiry(struct scsi_cmnd *scp, int target, | |||
| 1056 | memcpy(&arr[16], inq_product_id, 16); | 1056 | memcpy(&arr[16], inq_product_id, 16); |
| 1057 | memcpy(&arr[32], inq_product_rev, 4); | 1057 | memcpy(&arr[32], inq_product_rev, 4); |
| 1058 | /* version descriptors (2 bytes each) follow */ | 1058 | /* version descriptors (2 bytes each) follow */ |
| 1059 | arr[58] = 0x0; arr[59] = 0x77; /* SAM-3 ANSI */ | 1059 | arr[58] = 0x0; arr[59] = 0xa2; /* SAM-5 rev 4 */ |
| 1060 | arr[60] = 0x3; arr[61] = 0x14; /* SPC-3 ANSI */ | 1060 | arr[60] = 0x4; arr[61] = 0x68; /* SPC-4 rev 37 */ |
| 1061 | n = 62; | 1061 | n = 62; |
| 1062 | if (scsi_debug_ptype == 0) { | 1062 | if (scsi_debug_ptype == 0) { |
| 1063 | arr[n++] = 0x3; arr[n++] = 0x3d; /* SBC-2 ANSI */ | 1063 | arr[n++] = 0x4; arr[n++] = 0xc5; /* SBC-4 rev 36 */ |
| 1064 | } else if (scsi_debug_ptype == 1) { | 1064 | } else if (scsi_debug_ptype == 1) { |
| 1065 | arr[n++] = 0x3; arr[n++] = 0x60; /* SSC-2 no version */ | 1065 | arr[n++] = 0x5; arr[n++] = 0x25; /* SSC-4 rev 3 */ |
| 1066 | } | 1066 | } |
| 1067 | arr[n++] = 0xc; arr[n++] = 0xf; /* SAS-1.1 rev 10 */ | 1067 | arr[n++] = 0x20; arr[n++] = 0xe6; /* SPL-3 rev 7 */ |
| 1068 | ret = fill_from_dev_buffer(scp, arr, | 1068 | ret = fill_from_dev_buffer(scp, arr, |
| 1069 | min(alloc_len, SDEBUG_LONG_INQ_SZ)); | 1069 | min(alloc_len, SDEBUG_LONG_INQ_SZ)); |
| 1070 | kfree(arr); | 1070 | kfree(arr); |
| @@ -1075,7 +1075,7 @@ static int resp_requests(struct scsi_cmnd * scp, | |||
| 1075 | struct sdebug_dev_info * devip) | 1075 | struct sdebug_dev_info * devip) |
| 1076 | { | 1076 | { |
| 1077 | unsigned char * sbuff; | 1077 | unsigned char * sbuff; |
| 1078 | unsigned char *cmd = (unsigned char *)scp->cmnd; | 1078 | unsigned char *cmd = scp->cmnd; |
| 1079 | unsigned char arr[SCSI_SENSE_BUFFERSIZE]; | 1079 | unsigned char arr[SCSI_SENSE_BUFFERSIZE]; |
| 1080 | int want_dsense; | 1080 | int want_dsense; |
| 1081 | int len = 18; | 1081 | int len = 18; |
| @@ -1115,7 +1115,7 @@ static int resp_requests(struct scsi_cmnd * scp, | |||
| 1115 | static int resp_start_stop(struct scsi_cmnd * scp, | 1115 | static int resp_start_stop(struct scsi_cmnd * scp, |
| 1116 | struct sdebug_dev_info * devip) | 1116 | struct sdebug_dev_info * devip) |
| 1117 | { | 1117 | { |
| 1118 | unsigned char *cmd = (unsigned char *)scp->cmnd; | 1118 | unsigned char *cmd = scp->cmnd; |
| 1119 | int power_cond, errsts, start; | 1119 | int power_cond, errsts, start; |
| 1120 | 1120 | ||
| 1121 | errsts = check_readiness(scp, UAS_ONLY, devip); | 1121 | errsts = check_readiness(scp, UAS_ONLY, devip); |
| @@ -1177,7 +1177,7 @@ static int resp_readcap(struct scsi_cmnd * scp, | |||
| 1177 | static int resp_readcap16(struct scsi_cmnd * scp, | 1177 | static int resp_readcap16(struct scsi_cmnd * scp, |
| 1178 | struct sdebug_dev_info * devip) | 1178 | struct sdebug_dev_info * devip) |
| 1179 | { | 1179 | { |
| 1180 | unsigned char *cmd = (unsigned char *)scp->cmnd; | 1180 | unsigned char *cmd = scp->cmnd; |
| 1181 | unsigned char arr[SDEBUG_READCAP16_ARR_SZ]; | 1181 | unsigned char arr[SDEBUG_READCAP16_ARR_SZ]; |
| 1182 | unsigned long long capac; | 1182 | unsigned long long capac; |
| 1183 | int errsts, k, alloc_len; | 1183 | int errsts, k, alloc_len; |
| @@ -1222,7 +1222,7 @@ static int resp_readcap16(struct scsi_cmnd * scp, | |||
| 1222 | static int resp_report_tgtpgs(struct scsi_cmnd * scp, | 1222 | static int resp_report_tgtpgs(struct scsi_cmnd * scp, |
| 1223 | struct sdebug_dev_info * devip) | 1223 | struct sdebug_dev_info * devip) |
| 1224 | { | 1224 | { |
| 1225 | unsigned char *cmd = (unsigned char *)scp->cmnd; | 1225 | unsigned char *cmd = scp->cmnd; |
| 1226 | unsigned char * arr; | 1226 | unsigned char * arr; |
| 1227 | int host_no = devip->sdbg_host->shost->host_no; | 1227 | int host_no = devip->sdbg_host->shost->host_no; |
| 1228 | int n, ret, alen, rlen; | 1228 | int n, ret, alen, rlen; |
| @@ -1468,7 +1468,7 @@ static int resp_mode_sense(struct scsi_cmnd * scp, int target, | |||
| 1468 | int k, alloc_len, msense_6, offset, len, errsts, target_dev_id; | 1468 | int k, alloc_len, msense_6, offset, len, errsts, target_dev_id; |
| 1469 | unsigned char * ap; | 1469 | unsigned char * ap; |
| 1470 | unsigned char arr[SDEBUG_MAX_MSENSE_SZ]; | 1470 | unsigned char arr[SDEBUG_MAX_MSENSE_SZ]; |
| 1471 | unsigned char *cmd = (unsigned char *)scp->cmnd; | 1471 | unsigned char *cmd = scp->cmnd; |
| 1472 | 1472 | ||
| 1473 | errsts = check_readiness(scp, UAS_ONLY, devip); | 1473 | errsts = check_readiness(scp, UAS_ONLY, devip); |
| 1474 | if (errsts) | 1474 | if (errsts) |
| @@ -1630,7 +1630,7 @@ static int resp_mode_select(struct scsi_cmnd * scp, int mselect6, | |||
| 1630 | int pf, sp, ps, md_len, bd_len, off, spf, pg_len; | 1630 | int pf, sp, ps, md_len, bd_len, off, spf, pg_len; |
| 1631 | int param_len, res, errsts, mpage; | 1631 | int param_len, res, errsts, mpage; |
| 1632 | unsigned char arr[SDEBUG_MAX_MSELECT_SZ]; | 1632 | unsigned char arr[SDEBUG_MAX_MSELECT_SZ]; |
| 1633 | unsigned char *cmd = (unsigned char *)scp->cmnd; | 1633 | unsigned char *cmd = scp->cmnd; |
| 1634 | 1634 | ||
| 1635 | errsts = check_readiness(scp, UAS_ONLY, devip); | 1635 | errsts = check_readiness(scp, UAS_ONLY, devip); |
| 1636 | if (errsts) | 1636 | if (errsts) |
| @@ -1739,7 +1739,7 @@ static int resp_log_sense(struct scsi_cmnd * scp, | |||
| 1739 | { | 1739 | { |
| 1740 | int ppc, sp, pcontrol, pcode, subpcode, alloc_len, errsts, len, n; | 1740 | int ppc, sp, pcontrol, pcode, subpcode, alloc_len, errsts, len, n; |
| 1741 | unsigned char arr[SDEBUG_MAX_LSENSE_SZ]; | 1741 | unsigned char arr[SDEBUG_MAX_LSENSE_SZ]; |
| 1742 | unsigned char *cmd = (unsigned char *)scp->cmnd; | 1742 | unsigned char *cmd = scp->cmnd; |
| 1743 | 1743 | ||
| 1744 | errsts = check_readiness(scp, UAS_ONLY, devip); | 1744 | errsts = check_readiness(scp, UAS_ONLY, devip); |
| 1745 | if (errsts) | 1745 | if (errsts) |
| @@ -2414,7 +2414,7 @@ static int resp_report_luns(struct scsi_cmnd * scp, | |||
| 2414 | unsigned int alloc_len; | 2414 | unsigned int alloc_len; |
| 2415 | int lun_cnt, i, upper, num, n; | 2415 | int lun_cnt, i, upper, num, n; |
| 2416 | u64 wlun, lun; | 2416 | u64 wlun, lun; |
| 2417 | unsigned char *cmd = (unsigned char *)scp->cmnd; | 2417 | unsigned char *cmd = scp->cmnd; |
| 2418 | int select_report = (int)cmd[2]; | 2418 | int select_report = (int)cmd[2]; |
| 2419 | struct scsi_lun *one_lun; | 2419 | struct scsi_lun *one_lun; |
| 2420 | unsigned char arr[SDEBUG_RLUN_ARR_SZ]; | 2420 | unsigned char arr[SDEBUG_RLUN_ARR_SZ]; |
| @@ -2743,6 +2743,13 @@ static int stop_queued_cmnd(struct scsi_cmnd *cmnd) | |||
| 2743 | if (test_bit(k, queued_in_use_bm)) { | 2743 | if (test_bit(k, queued_in_use_bm)) { |
| 2744 | sqcp = &queued_arr[k]; | 2744 | sqcp = &queued_arr[k]; |
| 2745 | if (cmnd == sqcp->a_cmnd) { | 2745 | if (cmnd == sqcp->a_cmnd) { |
| 2746 | devip = (struct sdebug_dev_info *) | ||
| 2747 | cmnd->device->hostdata; | ||
| 2748 | if (devip) | ||
| 2749 | atomic_dec(&devip->num_in_q); | ||
| 2750 | sqcp->a_cmnd = NULL; | ||
| 2751 | spin_unlock_irqrestore(&queued_arr_lock, | ||
| 2752 | iflags); | ||
| 2746 | if (scsi_debug_ndelay > 0) { | 2753 | if (scsi_debug_ndelay > 0) { |
| 2747 | if (sqcp->sd_hrtp) | 2754 | if (sqcp->sd_hrtp) |
| 2748 | hrtimer_cancel( | 2755 | hrtimer_cancel( |
| @@ -2755,18 +2762,13 @@ static int stop_queued_cmnd(struct scsi_cmnd *cmnd) | |||
| 2755 | if (sqcp->tletp) | 2762 | if (sqcp->tletp) |
| 2756 | tasklet_kill(sqcp->tletp); | 2763 | tasklet_kill(sqcp->tletp); |
| 2757 | } | 2764 | } |
| 2758 | __clear_bit(k, queued_in_use_bm); | 2765 | clear_bit(k, queued_in_use_bm); |
| 2759 | devip = (struct sdebug_dev_info *) | 2766 | return 1; |
| 2760 | cmnd->device->hostdata; | ||
| 2761 | if (devip) | ||
| 2762 | atomic_dec(&devip->num_in_q); | ||
| 2763 | sqcp->a_cmnd = NULL; | ||
| 2764 | break; | ||
| 2765 | } | 2767 | } |
| 2766 | } | 2768 | } |
| 2767 | } | 2769 | } |
| 2768 | spin_unlock_irqrestore(&queued_arr_lock, iflags); | 2770 | spin_unlock_irqrestore(&queued_arr_lock, iflags); |
| 2769 | return (k < qmax) ? 1 : 0; | 2771 | return 0; |
| 2770 | } | 2772 | } |
| 2771 | 2773 | ||
| 2772 | /* Deletes (stops) timers or tasklets of all queued commands */ | 2774 | /* Deletes (stops) timers or tasklets of all queued commands */ |
| @@ -2782,6 +2784,13 @@ static void stop_all_queued(void) | |||
| 2782 | if (test_bit(k, queued_in_use_bm)) { | 2784 | if (test_bit(k, queued_in_use_bm)) { |
| 2783 | sqcp = &queued_arr[k]; | 2785 | sqcp = &queued_arr[k]; |
| 2784 | if (sqcp->a_cmnd) { | 2786 | if (sqcp->a_cmnd) { |
| 2787 | devip = (struct sdebug_dev_info *) | ||
| 2788 | sqcp->a_cmnd->device->hostdata; | ||
| 2789 | if (devip) | ||
| 2790 | atomic_dec(&devip->num_in_q); | ||
| 2791 | sqcp->a_cmnd = NULL; | ||
| 2792 | spin_unlock_irqrestore(&queued_arr_lock, | ||
| 2793 | iflags); | ||
| 2785 | if (scsi_debug_ndelay > 0) { | 2794 | if (scsi_debug_ndelay > 0) { |
| 2786 | if (sqcp->sd_hrtp) | 2795 | if (sqcp->sd_hrtp) |
| 2787 | hrtimer_cancel( | 2796 | hrtimer_cancel( |
| @@ -2794,12 +2803,8 @@ static void stop_all_queued(void) | |||
| 2794 | if (sqcp->tletp) | 2803 | if (sqcp->tletp) |
| 2795 | tasklet_kill(sqcp->tletp); | 2804 | tasklet_kill(sqcp->tletp); |
| 2796 | } | 2805 | } |
| 2797 | __clear_bit(k, queued_in_use_bm); | 2806 | clear_bit(k, queued_in_use_bm); |
| 2798 | devip = (struct sdebug_dev_info *) | 2807 | spin_lock_irqsave(&queued_arr_lock, iflags); |
| 2799 | sqcp->a_cmnd->device->hostdata; | ||
| 2800 | if (devip) | ||
| 2801 | atomic_dec(&devip->num_in_q); | ||
| 2802 | sqcp->a_cmnd = NULL; | ||
| 2803 | } | 2808 | } |
| 2804 | } | 2809 | } |
| 2805 | } | 2810 | } |
| @@ -3006,7 +3011,7 @@ schedule_resp(struct scsi_cmnd *cmnd, struct sdebug_dev_info *devip, | |||
| 3006 | int scsi_result, int delta_jiff) | 3011 | int scsi_result, int delta_jiff) |
| 3007 | { | 3012 | { |
| 3008 | unsigned long iflags; | 3013 | unsigned long iflags; |
| 3009 | int k, num_in_q, tsf, qdepth, inject; | 3014 | int k, num_in_q, qdepth, inject; |
| 3010 | struct sdebug_queued_cmd *sqcp = NULL; | 3015 | struct sdebug_queued_cmd *sqcp = NULL; |
| 3011 | struct scsi_device *sdp = cmnd->device; | 3016 | struct scsi_device *sdp = cmnd->device; |
| 3012 | 3017 | ||
| @@ -3019,55 +3024,48 @@ schedule_resp(struct scsi_cmnd *cmnd, struct sdebug_dev_info *devip, | |||
| 3019 | if ((scsi_result) && (SCSI_DEBUG_OPT_NOISE & scsi_debug_opts)) | 3024 | if ((scsi_result) && (SCSI_DEBUG_OPT_NOISE & scsi_debug_opts)) |
| 3020 | sdev_printk(KERN_INFO, sdp, "%s: non-zero result=0x%x\n", | 3025 | sdev_printk(KERN_INFO, sdp, "%s: non-zero result=0x%x\n", |
| 3021 | __func__, scsi_result); | 3026 | __func__, scsi_result); |
| 3022 | if (delta_jiff == 0) { | 3027 | if (delta_jiff == 0) |
| 3023 | /* using same thread to call back mid-layer */ | 3028 | goto respond_in_thread; |
| 3024 | cmnd->result = scsi_result; | ||
| 3025 | cmnd->scsi_done(cmnd); | ||
| 3026 | return 0; | ||
| 3027 | } | ||
| 3028 | 3029 | ||
| 3029 | /* deferred response cases */ | 3030 | /* schedule the response at a later time if resources permit */ |
| 3030 | spin_lock_irqsave(&queued_arr_lock, iflags); | 3031 | spin_lock_irqsave(&queued_arr_lock, iflags); |
| 3031 | num_in_q = atomic_read(&devip->num_in_q); | 3032 | num_in_q = atomic_read(&devip->num_in_q); |
| 3032 | qdepth = cmnd->device->queue_depth; | 3033 | qdepth = cmnd->device->queue_depth; |
| 3033 | k = find_first_zero_bit(queued_in_use_bm, scsi_debug_max_queue); | ||
| 3034 | tsf = 0; | ||
| 3035 | inject = 0; | 3034 | inject = 0; |
| 3036 | if ((qdepth > 0) && (num_in_q >= qdepth)) | 3035 | if ((qdepth > 0) && (num_in_q >= qdepth)) { |
| 3037 | tsf = 1; | 3036 | if (scsi_result) { |
| 3038 | else if ((scsi_debug_every_nth != 0) && | 3037 | spin_unlock_irqrestore(&queued_arr_lock, iflags); |
| 3039 | (SCSI_DEBUG_OPT_RARE_TSF & scsi_debug_opts)) { | 3038 | goto respond_in_thread; |
| 3039 | } else | ||
| 3040 | scsi_result = device_qfull_result; | ||
| 3041 | } else if ((scsi_debug_every_nth != 0) && | ||
| 3042 | (SCSI_DEBUG_OPT_RARE_TSF & scsi_debug_opts) && | ||
| 3043 | (scsi_result == 0)) { | ||
| 3040 | if ((num_in_q == (qdepth - 1)) && | 3044 | if ((num_in_q == (qdepth - 1)) && |
| 3041 | (atomic_inc_return(&sdebug_a_tsf) >= | 3045 | (atomic_inc_return(&sdebug_a_tsf) >= |
| 3042 | abs(scsi_debug_every_nth))) { | 3046 | abs(scsi_debug_every_nth))) { |
| 3043 | atomic_set(&sdebug_a_tsf, 0); | 3047 | atomic_set(&sdebug_a_tsf, 0); |
| 3044 | inject = 1; | 3048 | inject = 1; |
| 3045 | tsf = 1; | 3049 | scsi_result = device_qfull_result; |
| 3046 | } | 3050 | } |
| 3047 | } | 3051 | } |
| 3048 | 3052 | ||
| 3049 | /* if (tsf) simulate device reporting SCSI status of TASK SET FULL. | 3053 | k = find_first_zero_bit(queued_in_use_bm, scsi_debug_max_queue); |
| 3050 | * Might override existing CHECK CONDITION. */ | ||
| 3051 | if (tsf) | ||
| 3052 | scsi_result = device_qfull_result; | ||
| 3053 | if (k >= scsi_debug_max_queue) { | 3054 | if (k >= scsi_debug_max_queue) { |
| 3054 | if (SCSI_DEBUG_OPT_ALL_TSF & scsi_debug_opts) | ||
| 3055 | tsf = 1; | ||
| 3056 | spin_unlock_irqrestore(&queued_arr_lock, iflags); | 3055 | spin_unlock_irqrestore(&queued_arr_lock, iflags); |
| 3056 | if (scsi_result) | ||
| 3057 | goto respond_in_thread; | ||
| 3058 | else if (SCSI_DEBUG_OPT_ALL_TSF & scsi_debug_opts) | ||
| 3059 | scsi_result = device_qfull_result; | ||
| 3057 | if (SCSI_DEBUG_OPT_Q_NOISE & scsi_debug_opts) | 3060 | if (SCSI_DEBUG_OPT_Q_NOISE & scsi_debug_opts) |
| 3058 | sdev_printk(KERN_INFO, sdp, | 3061 | sdev_printk(KERN_INFO, sdp, |
| 3059 | "%s: num_in_q=%d, bypass q, %s%s\n", | 3062 | "%s: max_queue=%d exceeded, %s\n", |
| 3060 | __func__, num_in_q, | 3063 | __func__, scsi_debug_max_queue, |
| 3061 | (inject ? "<inject> " : ""), | 3064 | (scsi_result ? "status: TASK SET FULL" : |
| 3062 | (tsf ? "status: TASK SET FULL" : | 3065 | "report: host busy")); |
| 3063 | "report: host busy")); | 3066 | if (scsi_result) |
| 3064 | if (tsf) { | 3067 | goto respond_in_thread; |
| 3065 | /* queued_arr full so respond in same thread */ | 3068 | else |
| 3066 | cmnd->result = scsi_result; | ||
| 3067 | cmnd->scsi_done(cmnd); | ||
| 3068 | /* As scsi_done() is called "inline" must return 0 */ | ||
| 3069 | return 0; | ||
| 3070 | } else | ||
| 3071 | return SCSI_MLQUEUE_HOST_BUSY; | 3069 | return SCSI_MLQUEUE_HOST_BUSY; |
| 3072 | } | 3070 | } |
| 3073 | __set_bit(k, queued_in_use_bm); | 3071 | __set_bit(k, queued_in_use_bm); |
| @@ -3117,12 +3115,18 @@ schedule_resp(struct scsi_cmnd *cmnd, struct sdebug_dev_info *devip, | |||
| 3117 | else | 3115 | else |
| 3118 | tasklet_schedule(sqcp->tletp); | 3116 | tasklet_schedule(sqcp->tletp); |
| 3119 | } | 3117 | } |
| 3120 | if (tsf && (SCSI_DEBUG_OPT_Q_NOISE & scsi_debug_opts)) | 3118 | if ((SCSI_DEBUG_OPT_Q_NOISE & scsi_debug_opts) && |
| 3119 | (scsi_result == device_qfull_result)) | ||
| 3121 | sdev_printk(KERN_INFO, sdp, | 3120 | sdev_printk(KERN_INFO, sdp, |
| 3122 | "%s: num_in_q=%d +1, %s%s\n", __func__, | 3121 | "%s: num_in_q=%d +1, %s%s\n", __func__, |
| 3123 | num_in_q, (inject ? "<inject> " : ""), | 3122 | num_in_q, (inject ? "<inject> " : ""), |
| 3124 | "status: TASK SET FULL"); | 3123 | "status: TASK SET FULL"); |
| 3125 | return 0; | 3124 | return 0; |
| 3125 | |||
| 3126 | respond_in_thread: /* call back to mid-layer using invocation thread */ | ||
| 3127 | cmnd->result = scsi_result; | ||
| 3128 | cmnd->scsi_done(cmnd); | ||
| 3129 | return 0; | ||
| 3126 | } | 3130 | } |
| 3127 | 3131 | ||
| 3128 | /* Note: The following macros create attribute files in the | 3132 | /* Note: The following macros create attribute files in the |
| @@ -3206,7 +3210,7 @@ MODULE_PARM_DESC(opts, "1->noise, 2->medium_err, 4->timeout, 8->recovered_err... | |||
| 3206 | MODULE_PARM_DESC(physblk_exp, "physical block exponent (def=0)"); | 3210 | MODULE_PARM_DESC(physblk_exp, "physical block exponent (def=0)"); |
| 3207 | MODULE_PARM_DESC(ptype, "SCSI peripheral type(def=0[disk])"); | 3211 | MODULE_PARM_DESC(ptype, "SCSI peripheral type(def=0[disk])"); |
| 3208 | MODULE_PARM_DESC(removable, "claim to have removable media (def=0)"); | 3212 | MODULE_PARM_DESC(removable, "claim to have removable media (def=0)"); |
| 3209 | MODULE_PARM_DESC(scsi_level, "SCSI level to simulate(def=5[SPC-3])"); | 3213 | MODULE_PARM_DESC(scsi_level, "SCSI level to simulate(def=6[SPC-4])"); |
| 3210 | MODULE_PARM_DESC(sector_size, "logical block size in bytes (def=512)"); | 3214 | MODULE_PARM_DESC(sector_size, "logical block size in bytes (def=512)"); |
| 3211 | MODULE_PARM_DESC(unmap_alignment, "lowest aligned thin provisioning lba (def=0)"); | 3215 | MODULE_PARM_DESC(unmap_alignment, "lowest aligned thin provisioning lba (def=0)"); |
| 3212 | MODULE_PARM_DESC(unmap_granularity, "thin provisioning granularity in blocks (def=1)"); | 3216 | MODULE_PARM_DESC(unmap_granularity, "thin provisioning granularity in blocks (def=1)"); |
| @@ -4085,7 +4089,7 @@ static void sdebug_remove_adapter(void) | |||
| 4085 | static int | 4089 | static int |
| 4086 | scsi_debug_queuecommand(struct scsi_cmnd *SCpnt) | 4090 | scsi_debug_queuecommand(struct scsi_cmnd *SCpnt) |
| 4087 | { | 4091 | { |
| 4088 | unsigned char *cmd = (unsigned char *) SCpnt->cmnd; | 4092 | unsigned char *cmd = SCpnt->cmnd; |
| 4089 | int len, k; | 4093 | int len, k; |
| 4090 | unsigned int num; | 4094 | unsigned int num; |
| 4091 | unsigned long long lba; | 4095 | unsigned long long lba; |
| @@ -4103,7 +4107,7 @@ scsi_debug_queuecommand(struct scsi_cmnd *SCpnt) | |||
| 4103 | 4107 | ||
| 4104 | scsi_set_resid(SCpnt, 0); | 4108 | scsi_set_resid(SCpnt, 0); |
| 4105 | if ((SCSI_DEBUG_OPT_NOISE & scsi_debug_opts) && | 4109 | if ((SCSI_DEBUG_OPT_NOISE & scsi_debug_opts) && |
| 4106 | !(SCSI_DEBUG_OPT_NO_CDB_NOISE & scsi_debug_opts) && cmd) { | 4110 | !(SCSI_DEBUG_OPT_NO_CDB_NOISE & scsi_debug_opts)) { |
| 4107 | char b[120]; | 4111 | char b[120]; |
| 4108 | int n; | 4112 | int n; |
| 4109 | 4113 | ||
