aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/scsi_debug.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/scsi_debug.c')
-rw-r--r--drivers/scsi/scsi_debug.c89
1 files changed, 73 insertions, 16 deletions
diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
index 3a5bfd10b2cb..136329b4027b 100644
--- a/drivers/scsi/scsi_debug.c
+++ b/drivers/scsi/scsi_debug.c
@@ -12,7 +12,7 @@
12 * SAS disks. 12 * SAS disks.
13 * 13 *
14 * 14 *
15 * For documentation see http://www.torque.net/sg/sdebug26.html 15 * For documentation see http://sg.danny.cz/sg/sdebug26.html
16 * 16 *
17 * D. Gilbert (dpg) work for Magneto-Optical device test [20010421] 17 * D. Gilbert (dpg) work for Magneto-Optical device test [20010421]
18 * dpg: work for devfs large number of disks [20010809] 18 * dpg: work for devfs large number of disks [20010809]
@@ -58,8 +58,8 @@
58#include "sd.h" 58#include "sd.h"
59#include "scsi_logging.h" 59#include "scsi_logging.h"
60 60
61#define SCSI_DEBUG_VERSION "1.81" 61#define SCSI_DEBUG_VERSION "1.82"
62static const char * scsi_debug_version_date = "20070104"; 62static const char * scsi_debug_version_date = "20100324";
63 63
64/* Additional Sense Code (ASC) */ 64/* Additional Sense Code (ASC) */
65#define NO_ADDITIONAL_SENSE 0x0 65#define NO_ADDITIONAL_SENSE 0x0
@@ -108,6 +108,7 @@ static const char * scsi_debug_version_date = "20070104";
108#define DEF_ATO 1 108#define DEF_ATO 1
109#define DEF_PHYSBLK_EXP 0 109#define DEF_PHYSBLK_EXP 0
110#define DEF_LOWEST_ALIGNED 0 110#define DEF_LOWEST_ALIGNED 0
111#define DEF_OPT_BLKS 64
111#define DEF_UNMAP_MAX_BLOCKS 0 112#define DEF_UNMAP_MAX_BLOCKS 0
112#define DEF_UNMAP_MAX_DESC 0 113#define DEF_UNMAP_MAX_DESC 0
113#define DEF_UNMAP_GRANULARITY 0 114#define DEF_UNMAP_GRANULARITY 0
@@ -147,12 +148,18 @@ static const char * scsi_debug_version_date = "20070104";
147#define SAM2_LUN_ADDRESS_METHOD 0 148#define SAM2_LUN_ADDRESS_METHOD 0
148#define SAM2_WLUN_REPORT_LUNS 0xc101 149#define SAM2_WLUN_REPORT_LUNS 0xc101
149 150
151/* Can queue up to this number of commands. Typically commands that
152 * that have a non-zero delay are queued. */
153#define SCSI_DEBUG_CANQUEUE 255
154
150static int scsi_debug_add_host = DEF_NUM_HOST; 155static int scsi_debug_add_host = DEF_NUM_HOST;
151static int scsi_debug_delay = DEF_DELAY; 156static int scsi_debug_delay = DEF_DELAY;
152static int scsi_debug_dev_size_mb = DEF_DEV_SIZE_MB; 157static int scsi_debug_dev_size_mb = DEF_DEV_SIZE_MB;
153static int scsi_debug_every_nth = DEF_EVERY_NTH; 158static int scsi_debug_every_nth = DEF_EVERY_NTH;
154static int scsi_debug_max_luns = DEF_MAX_LUNS; 159static int scsi_debug_max_luns = DEF_MAX_LUNS;
160static int scsi_debug_max_queue = SCSI_DEBUG_CANQUEUE;
155static int scsi_debug_num_parts = DEF_NUM_PARTS; 161static int scsi_debug_num_parts = DEF_NUM_PARTS;
162static int scsi_debug_no_uld = 0;
156static int scsi_debug_num_tgts = DEF_NUM_TGTS; /* targets per host */ 163static int scsi_debug_num_tgts = DEF_NUM_TGTS; /* targets per host */
157static int scsi_debug_opts = DEF_OPTS; 164static int scsi_debug_opts = DEF_OPTS;
158static int scsi_debug_scsi_level = DEF_SCSI_LEVEL; 165static int scsi_debug_scsi_level = DEF_SCSI_LEVEL;
@@ -169,6 +176,7 @@ static int scsi_debug_guard = DEF_GUARD;
169static int scsi_debug_ato = DEF_ATO; 176static int scsi_debug_ato = DEF_ATO;
170static int scsi_debug_physblk_exp = DEF_PHYSBLK_EXP; 177static int scsi_debug_physblk_exp = DEF_PHYSBLK_EXP;
171static int scsi_debug_lowest_aligned = DEF_LOWEST_ALIGNED; 178static int scsi_debug_lowest_aligned = DEF_LOWEST_ALIGNED;
179static int scsi_debug_opt_blks = DEF_OPT_BLKS;
172static int scsi_debug_unmap_max_desc = DEF_UNMAP_MAX_DESC; 180static int scsi_debug_unmap_max_desc = DEF_UNMAP_MAX_DESC;
173static int scsi_debug_unmap_max_blocks = DEF_UNMAP_MAX_BLOCKS; 181static int scsi_debug_unmap_max_blocks = DEF_UNMAP_MAX_BLOCKS;
174static int scsi_debug_unmap_granularity = DEF_UNMAP_GRANULARITY; 182static int scsi_debug_unmap_granularity = DEF_UNMAP_GRANULARITY;
@@ -192,7 +200,6 @@ static int sdebug_sectors_per; /* sectors per cylinder */
192 200
193#define SDEBUG_SENSE_LEN 32 201#define SDEBUG_SENSE_LEN 32
194 202
195#define SCSI_DEBUG_CANQUEUE 255
196#define SCSI_DEBUG_MAX_CMD_LEN 32 203#define SCSI_DEBUG_MAX_CMD_LEN 32
197 204
198struct sdebug_dev_info { 205struct sdebug_dev_info {
@@ -699,9 +706,13 @@ static int inquiry_evpd_b0(unsigned char * arr)
699 unsigned int gran; 706 unsigned int gran;
700 707
701 memcpy(arr, vpdb0_data, sizeof(vpdb0_data)); 708 memcpy(arr, vpdb0_data, sizeof(vpdb0_data));
709
710 /* Optimal transfer length granularity */
702 gran = 1 << scsi_debug_physblk_exp; 711 gran = 1 << scsi_debug_physblk_exp;
703 arr[2] = (gran >> 8) & 0xff; 712 arr[2] = (gran >> 8) & 0xff;
704 arr[3] = gran & 0xff; 713 arr[3] = gran & 0xff;
714
715 /* Maximum Transfer Length */
705 if (sdebug_store_sectors > 0x400) { 716 if (sdebug_store_sectors > 0x400) {
706 arr[4] = (sdebug_store_sectors >> 24) & 0xff; 717 arr[4] = (sdebug_store_sectors >> 24) & 0xff;
707 arr[5] = (sdebug_store_sectors >> 16) & 0xff; 718 arr[5] = (sdebug_store_sectors >> 16) & 0xff;
@@ -709,6 +720,9 @@ static int inquiry_evpd_b0(unsigned char * arr)
709 arr[7] = sdebug_store_sectors & 0xff; 720 arr[7] = sdebug_store_sectors & 0xff;
710 } 721 }
711 722
723 /* Optimal Transfer Length */
724 put_unaligned_be32(scsi_debug_opt_blks, &arr[8]);
725
712 if (scsi_debug_unmap_max_desc) { 726 if (scsi_debug_unmap_max_desc) {
713 unsigned int blocks; 727 unsigned int blocks;
714 728
@@ -717,15 +731,20 @@ static int inquiry_evpd_b0(unsigned char * arr)
717 else 731 else
718 blocks = 0xffffffff; 732 blocks = 0xffffffff;
719 733
734 /* Maximum Unmap LBA Count */
720 put_unaligned_be32(blocks, &arr[16]); 735 put_unaligned_be32(blocks, &arr[16]);
736
737 /* Maximum Unmap Block Descriptor Count */
721 put_unaligned_be32(scsi_debug_unmap_max_desc, &arr[20]); 738 put_unaligned_be32(scsi_debug_unmap_max_desc, &arr[20]);
722 } 739 }
723 740
741 /* Unmap Granularity Alignment */
724 if (scsi_debug_unmap_alignment) { 742 if (scsi_debug_unmap_alignment) {
725 put_unaligned_be32(scsi_debug_unmap_alignment, &arr[28]); 743 put_unaligned_be32(scsi_debug_unmap_alignment, &arr[28]);
726 arr[28] |= 0x80; /* UGAVALID */ 744 arr[28] |= 0x80; /* UGAVALID */
727 } 745 }
728 746
747 /* Optimal Unmap Granularity */
729 if (scsi_debug_unmap_granularity) { 748 if (scsi_debug_unmap_granularity) {
730 put_unaligned_be32(scsi_debug_unmap_granularity, &arr[24]); 749 put_unaligned_be32(scsi_debug_unmap_granularity, &arr[24]);
731 return 0x3c; /* Mandatory page length for thin provisioning */ 750 return 0x3c; /* Mandatory page length for thin provisioning */
@@ -2266,7 +2285,7 @@ static void timer_intr_handler(unsigned long indx)
2266 struct sdebug_queued_cmd * sqcp; 2285 struct sdebug_queued_cmd * sqcp;
2267 unsigned long iflags; 2286 unsigned long iflags;
2268 2287
2269 if (indx >= SCSI_DEBUG_CANQUEUE) { 2288 if (indx >= scsi_debug_max_queue) {
2270 printk(KERN_ERR "scsi_debug:timer_intr_handler: indx too " 2289 printk(KERN_ERR "scsi_debug:timer_intr_handler: indx too "
2271 "large\n"); 2290 "large\n");
2272 return; 2291 return;
@@ -2380,6 +2399,8 @@ static int scsi_debug_slave_configure(struct scsi_device *sdp)
2380 scsi_adjust_queue_depth(sdp, SDEBUG_TAGGED_QUEUING, 2399 scsi_adjust_queue_depth(sdp, SDEBUG_TAGGED_QUEUING,
2381 sdp->host->cmd_per_lun); 2400 sdp->host->cmd_per_lun);
2382 blk_queue_max_segment_size(sdp->request_queue, 256 * 1024); 2401 blk_queue_max_segment_size(sdp->request_queue, 256 * 1024);
2402 if (scsi_debug_no_uld)
2403 sdp->no_uld_attach = 1;
2383 return 0; 2404 return 0;
2384} 2405}
2385 2406
@@ -2406,7 +2427,7 @@ static int stop_queued_cmnd(struct scsi_cmnd *cmnd)
2406 struct sdebug_queued_cmd *sqcp; 2427 struct sdebug_queued_cmd *sqcp;
2407 2428
2408 spin_lock_irqsave(&queued_arr_lock, iflags); 2429 spin_lock_irqsave(&queued_arr_lock, iflags);
2409 for (k = 0; k < SCSI_DEBUG_CANQUEUE; ++k) { 2430 for (k = 0; k < scsi_debug_max_queue; ++k) {
2410 sqcp = &queued_arr[k]; 2431 sqcp = &queued_arr[k];
2411 if (sqcp->in_use && (cmnd == sqcp->a_cmnd)) { 2432 if (sqcp->in_use && (cmnd == sqcp->a_cmnd)) {
2412 del_timer_sync(&sqcp->cmnd_timer); 2433 del_timer_sync(&sqcp->cmnd_timer);
@@ -2416,7 +2437,7 @@ static int stop_queued_cmnd(struct scsi_cmnd *cmnd)
2416 } 2437 }
2417 } 2438 }
2418 spin_unlock_irqrestore(&queued_arr_lock, iflags); 2439 spin_unlock_irqrestore(&queued_arr_lock, iflags);
2419 return (k < SCSI_DEBUG_CANQUEUE) ? 1 : 0; 2440 return (k < scsi_debug_max_queue) ? 1 : 0;
2420} 2441}
2421 2442
2422/* Deletes (stops) timers of all queued commands */ 2443/* Deletes (stops) timers of all queued commands */
@@ -2427,7 +2448,7 @@ static void stop_all_queued(void)
2427 struct sdebug_queued_cmd *sqcp; 2448 struct sdebug_queued_cmd *sqcp;
2428 2449
2429 spin_lock_irqsave(&queued_arr_lock, iflags); 2450 spin_lock_irqsave(&queued_arr_lock, iflags);
2430 for (k = 0; k < SCSI_DEBUG_CANQUEUE; ++k) { 2451 for (k = 0; k < scsi_debug_max_queue; ++k) {
2431 sqcp = &queued_arr[k]; 2452 sqcp = &queued_arr[k];
2432 if (sqcp->in_use && sqcp->a_cmnd) { 2453 if (sqcp->in_use && sqcp->a_cmnd) {
2433 del_timer_sync(&sqcp->cmnd_timer); 2454 del_timer_sync(&sqcp->cmnd_timer);
@@ -2533,7 +2554,7 @@ static void __init init_all_queued(void)
2533 struct sdebug_queued_cmd * sqcp; 2554 struct sdebug_queued_cmd * sqcp;
2534 2555
2535 spin_lock_irqsave(&queued_arr_lock, iflags); 2556 spin_lock_irqsave(&queued_arr_lock, iflags);
2536 for (k = 0; k < SCSI_DEBUG_CANQUEUE; ++k) { 2557 for (k = 0; k < scsi_debug_max_queue; ++k) {
2537 sqcp = &queued_arr[k]; 2558 sqcp = &queued_arr[k];
2538 init_timer(&sqcp->cmnd_timer); 2559 init_timer(&sqcp->cmnd_timer);
2539 sqcp->in_use = 0; 2560 sqcp->in_use = 0;
@@ -2625,12 +2646,12 @@ static int schedule_resp(struct scsi_cmnd * cmnd,
2625 struct sdebug_queued_cmd * sqcp = NULL; 2646 struct sdebug_queued_cmd * sqcp = NULL;
2626 2647
2627 spin_lock_irqsave(&queued_arr_lock, iflags); 2648 spin_lock_irqsave(&queued_arr_lock, iflags);
2628 for (k = 0; k < SCSI_DEBUG_CANQUEUE; ++k) { 2649 for (k = 0; k < scsi_debug_max_queue; ++k) {
2629 sqcp = &queued_arr[k]; 2650 sqcp = &queued_arr[k];
2630 if (! sqcp->in_use) 2651 if (! sqcp->in_use)
2631 break; 2652 break;
2632 } 2653 }
2633 if (k >= SCSI_DEBUG_CANQUEUE) { 2654 if (k >= scsi_debug_max_queue) {
2634 spin_unlock_irqrestore(&queued_arr_lock, iflags); 2655 spin_unlock_irqrestore(&queued_arr_lock, iflags);
2635 printk(KERN_WARNING "scsi_debug: can_queue exceeded\n"); 2656 printk(KERN_WARNING "scsi_debug: can_queue exceeded\n");
2636 return 1; /* report busy to mid level */ 2657 return 1; /* report busy to mid level */
@@ -2662,7 +2683,9 @@ module_param_named(dsense, scsi_debug_dsense, int, S_IRUGO | S_IWUSR);
2662module_param_named(every_nth, scsi_debug_every_nth, int, S_IRUGO | S_IWUSR); 2683module_param_named(every_nth, scsi_debug_every_nth, int, S_IRUGO | S_IWUSR);
2663module_param_named(fake_rw, scsi_debug_fake_rw, int, S_IRUGO | S_IWUSR); 2684module_param_named(fake_rw, scsi_debug_fake_rw, int, S_IRUGO | S_IWUSR);
2664module_param_named(max_luns, scsi_debug_max_luns, int, S_IRUGO | S_IWUSR); 2685module_param_named(max_luns, scsi_debug_max_luns, int, S_IRUGO | S_IWUSR);
2686module_param_named(max_queue, scsi_debug_max_queue, int, S_IRUGO | S_IWUSR);
2665module_param_named(no_lun_0, scsi_debug_no_lun_0, int, S_IRUGO | S_IWUSR); 2687module_param_named(no_lun_0, scsi_debug_no_lun_0, int, S_IRUGO | S_IWUSR);
2688module_param_named(no_uld, scsi_debug_no_uld, int, S_IRUGO);
2666module_param_named(num_parts, scsi_debug_num_parts, int, S_IRUGO); 2689module_param_named(num_parts, scsi_debug_num_parts, int, S_IRUGO);
2667module_param_named(num_tgts, scsi_debug_num_tgts, int, S_IRUGO | S_IWUSR); 2690module_param_named(num_tgts, scsi_debug_num_tgts, int, S_IRUGO | S_IWUSR);
2668module_param_named(opts, scsi_debug_opts, int, S_IRUGO | S_IWUSR); 2691module_param_named(opts, scsi_debug_opts, int, S_IRUGO | S_IWUSR);
@@ -2677,6 +2700,7 @@ module_param_named(dif, scsi_debug_dif, int, S_IRUGO);
2677module_param_named(guard, scsi_debug_guard, int, S_IRUGO); 2700module_param_named(guard, scsi_debug_guard, int, S_IRUGO);
2678module_param_named(ato, scsi_debug_ato, int, S_IRUGO); 2701module_param_named(ato, scsi_debug_ato, int, S_IRUGO);
2679module_param_named(physblk_exp, scsi_debug_physblk_exp, int, S_IRUGO); 2702module_param_named(physblk_exp, scsi_debug_physblk_exp, int, S_IRUGO);
2703module_param_named(opt_blks, scsi_debug_opt_blks, int, S_IRUGO);
2680module_param_named(lowest_aligned, scsi_debug_lowest_aligned, int, S_IRUGO); 2704module_param_named(lowest_aligned, scsi_debug_lowest_aligned, int, S_IRUGO);
2681module_param_named(unmap_max_blocks, scsi_debug_unmap_max_blocks, int, S_IRUGO); 2705module_param_named(unmap_max_blocks, scsi_debug_unmap_max_blocks, int, S_IRUGO);
2682module_param_named(unmap_max_desc, scsi_debug_unmap_max_desc, int, S_IRUGO); 2706module_param_named(unmap_max_desc, scsi_debug_unmap_max_desc, int, S_IRUGO);
@@ -2695,7 +2719,9 @@ MODULE_PARM_DESC(dsense, "use descriptor sense format(def=0 -> fixed)");
2695MODULE_PARM_DESC(every_nth, "timeout every nth command(def=0)"); 2719MODULE_PARM_DESC(every_nth, "timeout every nth command(def=0)");
2696MODULE_PARM_DESC(fake_rw, "fake reads/writes instead of copying (def=0)"); 2720MODULE_PARM_DESC(fake_rw, "fake reads/writes instead of copying (def=0)");
2697MODULE_PARM_DESC(max_luns, "number of LUNs per target to simulate(def=1)"); 2721MODULE_PARM_DESC(max_luns, "number of LUNs per target to simulate(def=1)");
2722MODULE_PARM_DESC(max_queue, "max number of queued commands (1 to 255(def))");
2698MODULE_PARM_DESC(no_lun_0, "no LU number 0 (def=0 -> have lun 0)"); 2723MODULE_PARM_DESC(no_lun_0, "no LU number 0 (def=0 -> have lun 0)");
2724MODULE_PARM_DESC(no_uld, "stop ULD (e.g. sd driver) attaching (def=0))");
2699MODULE_PARM_DESC(num_parts, "number of partitions(def=0)"); 2725MODULE_PARM_DESC(num_parts, "number of partitions(def=0)");
2700MODULE_PARM_DESC(num_tgts, "number of targets per host to simulate(def=1)"); 2726MODULE_PARM_DESC(num_tgts, "number of targets per host to simulate(def=1)");
2701MODULE_PARM_DESC(opts, "1->noise, 2->medium_err, 4->timeout, 8->recovered_err... (def=0)"); 2727MODULE_PARM_DESC(opts, "1->noise, 2->medium_err, 4->timeout, 8->recovered_err... (def=0)");
@@ -2705,6 +2731,7 @@ MODULE_PARM_DESC(virtual_gb, "virtual gigabyte size (def=0 -> use dev_size_mb)")
2705MODULE_PARM_DESC(vpd_use_hostno, "0 -> dev ids ignore hostno (def=1 -> unique dev ids)"); 2731MODULE_PARM_DESC(vpd_use_hostno, "0 -> dev ids ignore hostno (def=1 -> unique dev ids)");
2706MODULE_PARM_DESC(sector_size, "logical block size in bytes (def=512)"); 2732MODULE_PARM_DESC(sector_size, "logical block size in bytes (def=512)");
2707MODULE_PARM_DESC(physblk_exp, "physical block exponent (def=0)"); 2733MODULE_PARM_DESC(physblk_exp, "physical block exponent (def=0)");
2734MODULE_PARM_DESC(opt_blks, "optimal transfer length in block (def=64)");
2708MODULE_PARM_DESC(lowest_aligned, "lowest aligned lba (def=0)"); 2735MODULE_PARM_DESC(lowest_aligned, "lowest aligned lba (def=0)");
2709MODULE_PARM_DESC(dix, "data integrity extensions mask (def=0)"); 2736MODULE_PARM_DESC(dix, "data integrity extensions mask (def=0)");
2710MODULE_PARM_DESC(dif, "data integrity field type: 0-3 (def=0)"); 2737MODULE_PARM_DESC(dif, "data integrity field type: 0-3 (def=0)");
@@ -2970,6 +2997,31 @@ static ssize_t sdebug_max_luns_store(struct device_driver * ddp,
2970DRIVER_ATTR(max_luns, S_IRUGO | S_IWUSR, sdebug_max_luns_show, 2997DRIVER_ATTR(max_luns, S_IRUGO | S_IWUSR, sdebug_max_luns_show,
2971 sdebug_max_luns_store); 2998 sdebug_max_luns_store);
2972 2999
3000static ssize_t sdebug_max_queue_show(struct device_driver * ddp, char * buf)
3001{
3002 return scnprintf(buf, PAGE_SIZE, "%d\n", scsi_debug_max_queue);
3003}
3004static ssize_t sdebug_max_queue_store(struct device_driver * ddp,
3005 const char * buf, size_t count)
3006{
3007 int n;
3008
3009 if ((count > 0) && (1 == sscanf(buf, "%d", &n)) && (n > 0) &&
3010 (n <= SCSI_DEBUG_CANQUEUE)) {
3011 scsi_debug_max_queue = n;
3012 return count;
3013 }
3014 return -EINVAL;
3015}
3016DRIVER_ATTR(max_queue, S_IRUGO | S_IWUSR, sdebug_max_queue_show,
3017 sdebug_max_queue_store);
3018
3019static ssize_t sdebug_no_uld_show(struct device_driver * ddp, char * buf)
3020{
3021 return scnprintf(buf, PAGE_SIZE, "%d\n", scsi_debug_no_uld);
3022}
3023DRIVER_ATTR(no_uld, S_IRUGO, sdebug_no_uld_show, NULL);
3024
2973static ssize_t sdebug_scsi_level_show(struct device_driver * ddp, char * buf) 3025static ssize_t sdebug_scsi_level_show(struct device_driver * ddp, char * buf)
2974{ 3026{
2975 return scnprintf(buf, PAGE_SIZE, "%d\n", scsi_debug_scsi_level); 3027 return scnprintf(buf, PAGE_SIZE, "%d\n", scsi_debug_scsi_level);
@@ -3107,7 +3159,9 @@ static int do_create_driverfs_files(void)
3107 ret |= driver_create_file(&sdebug_driverfs_driver, &driver_attr_every_nth); 3159 ret |= driver_create_file(&sdebug_driverfs_driver, &driver_attr_every_nth);
3108 ret |= driver_create_file(&sdebug_driverfs_driver, &driver_attr_fake_rw); 3160 ret |= driver_create_file(&sdebug_driverfs_driver, &driver_attr_fake_rw);
3109 ret |= driver_create_file(&sdebug_driverfs_driver, &driver_attr_max_luns); 3161 ret |= driver_create_file(&sdebug_driverfs_driver, &driver_attr_max_luns);
3162 ret |= driver_create_file(&sdebug_driverfs_driver, &driver_attr_max_queue);
3110 ret |= driver_create_file(&sdebug_driverfs_driver, &driver_attr_no_lun_0); 3163 ret |= driver_create_file(&sdebug_driverfs_driver, &driver_attr_no_lun_0);
3164 ret |= driver_create_file(&sdebug_driverfs_driver, &driver_attr_no_uld);
3111 ret |= driver_create_file(&sdebug_driverfs_driver, &driver_attr_num_parts); 3165 ret |= driver_create_file(&sdebug_driverfs_driver, &driver_attr_num_parts);
3112 ret |= driver_create_file(&sdebug_driverfs_driver, &driver_attr_num_tgts); 3166 ret |= driver_create_file(&sdebug_driverfs_driver, &driver_attr_num_tgts);
3113 ret |= driver_create_file(&sdebug_driverfs_driver, &driver_attr_ptype); 3167 ret |= driver_create_file(&sdebug_driverfs_driver, &driver_attr_ptype);
@@ -3139,7 +3193,9 @@ static void do_remove_driverfs_files(void)
3139 driver_remove_file(&sdebug_driverfs_driver, &driver_attr_ptype); 3193 driver_remove_file(&sdebug_driverfs_driver, &driver_attr_ptype);
3140 driver_remove_file(&sdebug_driverfs_driver, &driver_attr_num_tgts); 3194 driver_remove_file(&sdebug_driverfs_driver, &driver_attr_num_tgts);
3141 driver_remove_file(&sdebug_driverfs_driver, &driver_attr_num_parts); 3195 driver_remove_file(&sdebug_driverfs_driver, &driver_attr_num_parts);
3196 driver_remove_file(&sdebug_driverfs_driver, &driver_attr_no_uld);
3142 driver_remove_file(&sdebug_driverfs_driver, &driver_attr_no_lun_0); 3197 driver_remove_file(&sdebug_driverfs_driver, &driver_attr_no_lun_0);
3198 driver_remove_file(&sdebug_driverfs_driver, &driver_attr_max_queue);
3143 driver_remove_file(&sdebug_driverfs_driver, &driver_attr_max_luns); 3199 driver_remove_file(&sdebug_driverfs_driver, &driver_attr_max_luns);
3144 driver_remove_file(&sdebug_driverfs_driver, &driver_attr_fake_rw); 3200 driver_remove_file(&sdebug_driverfs_driver, &driver_attr_fake_rw);
3145 driver_remove_file(&sdebug_driverfs_driver, &driver_attr_every_nth); 3201 driver_remove_file(&sdebug_driverfs_driver, &driver_attr_every_nth);
@@ -3830,12 +3886,13 @@ static int sdebug_driver_probe(struct device * dev)
3830 3886
3831 sdbg_host = to_sdebug_host(dev); 3887 sdbg_host = to_sdebug_host(dev);
3832 3888
3833 hpnt = scsi_host_alloc(&sdebug_driver_template, sizeof(sdbg_host)); 3889 sdebug_driver_template.can_queue = scsi_debug_max_queue;
3834 if (NULL == hpnt) { 3890 hpnt = scsi_host_alloc(&sdebug_driver_template, sizeof(sdbg_host));
3835 printk(KERN_ERR "%s: scsi_register failed\n", __func__); 3891 if (NULL == hpnt) {
3836 error = -ENODEV; 3892 printk(KERN_ERR "%s: scsi_register failed\n", __func__);
3893 error = -ENODEV;
3837 return error; 3894 return error;
3838 } 3895 }
3839 3896
3840 sdbg_host->shost = hpnt; 3897 sdbg_host->shost = hpnt;
3841 *((struct sdebug_host_info **)hpnt->hostdata) = sdbg_host; 3898 *((struct sdebug_host_info **)hpnt->hostdata) = sdbg_host;