aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorDouglas Gilbert <dgilbert@interlog.com>2016-04-25 12:16:31 -0400
committerMartin K. Petersen <martin.petersen@oracle.com>2016-04-29 19:26:43 -0400
commitc2206098972e8ca464040897c95bdf5b2f45ac32 (patch)
treece4ece60fb7a154f12baba2ccdec9c1edc5b3e27 /drivers/scsi
parentb333a819813c756804034c93b05e43ccdd4025a5 (diff)
scsi_debug: make jiffy delay name clearer
Add 'j' to delay names to make it clearer that its unit is jiffies and to differentiate it from sdebug_ndelay whose unit is nanoseconds. Signed-off-by: Douglas Gilbert <dgilbert@interlog.com> Reviewed-by: Hannes Reinicke <hare@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/scsi_debug.c46
1 files changed, 23 insertions, 23 deletions
diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
index 90cd62e03337..e2fbac3b32aa 100644
--- a/drivers/scsi/scsi_debug.c
+++ b/drivers/scsi/scsi_debug.c
@@ -104,7 +104,7 @@ static const char *sdebug_version_date = "20160422";
104 * (id 0) containing 1 logical unit (lun 0). That is 1 device. 104 * (id 0) containing 1 logical unit (lun 0). That is 1 device.
105 */ 105 */
106#define DEF_ATO 1 106#define DEF_ATO 1
107#define DEF_DELAY 1 /* if > 0 unit is a jiffy */ 107#define DEF_JDELAY 1 /* if > 0 unit is a jiffy */
108#define DEF_DEV_SIZE_MB 8 108#define DEF_DEV_SIZE_MB 8
109#define DEF_DIF 0 109#define DEF_DIF 0
110#define DEF_DIX 0 110#define DEF_DIX 0
@@ -136,7 +136,7 @@ static const char *sdebug_version_date = "20160422";
136#define DEF_VPD_USE_HOSTNO 1 136#define DEF_VPD_USE_HOSTNO 1
137#define DEF_WRITESAME_LENGTH 0xFFFF 137#define DEF_WRITESAME_LENGTH 0xFFFF
138#define DEF_STRICT 0 138#define DEF_STRICT 0
139#define DELAY_OVERRIDDEN -9999 139#define JDELAY_OVERRIDDEN -9999
140 140
141/* bit mask values for sdebug_opts */ 141/* bit mask values for sdebug_opts */
142#define SDEBUG_OPT_NOISE 1 142#define SDEBUG_OPT_NOISE 1
@@ -206,7 +206,7 @@ static const char *sdebug_version_date = "20160422";
206 206
207/* SCSI_DEBUG_CANQUEUE is the maximum number of commands that can be queued 207/* SCSI_DEBUG_CANQUEUE is the maximum number of commands that can be queued
208 * (for response) at one time. Can be reduced by max_queue option. Command 208 * (for response) at one time. Can be reduced by max_queue option. Command
209 * responses are not queued when delay=0 and ndelay=0. The per-device 209 * responses are not queued when jdelay=0 and ndelay=0. The per-device
210 * DEF_CMD_PER_LUN can be changed via sysfs: 210 * DEF_CMD_PER_LUN can be changed via sysfs:
211 * /sys/class/scsi_device/<h:c:t:l>/device/queue_depth but cannot exceed 211 * /sys/class/scsi_device/<h:c:t:l>/device/queue_depth but cannot exceed
212 * SCSI_DEBUG_CANQUEUE. */ 212 * SCSI_DEBUG_CANQUEUE. */
@@ -518,7 +518,7 @@ struct sdebug_scmd_extra_t {
518 518
519static int sdebug_add_host = DEF_NUM_HOST; 519static int sdebug_add_host = DEF_NUM_HOST;
520static int sdebug_ato = DEF_ATO; 520static int sdebug_ato = DEF_ATO;
521static int sdebug_delay = DEF_DELAY; /* in jiffies */ 521static int sdebug_jdelay = DEF_JDELAY; /* if > 0 then unit is jiffies */
522static int sdebug_dev_size_mb = DEF_DEV_SIZE_MB; 522static int sdebug_dev_size_mb = DEF_DEV_SIZE_MB;
523static int sdebug_dif = DEF_DIF; 523static int sdebug_dif = DEF_DIF;
524static int sdebug_dix = DEF_DIX; 524static int sdebug_dix = DEF_DIX;
@@ -530,7 +530,7 @@ static int sdebug_lowest_aligned = DEF_LOWEST_ALIGNED;
530static int sdebug_max_luns = DEF_MAX_LUNS; 530static int sdebug_max_luns = DEF_MAX_LUNS;
531static int sdebug_max_queue = SCSI_DEBUG_CANQUEUE; 531static int sdebug_max_queue = SCSI_DEBUG_CANQUEUE;
532static atomic_t retired_max_queue; /* if > 0 then was prior max_queue */ 532static atomic_t retired_max_queue; /* if > 0 then was prior max_queue */
533static int sdebug_ndelay = DEF_NDELAY; /* in nanoseconds */ 533static int sdebug_ndelay = DEF_NDELAY; /* if > 0 then unit is nanoseconds */
534static int sdebug_no_lun_0 = DEF_NO_LUN_0; 534static int sdebug_no_lun_0 = DEF_NO_LUN_0;
535static int sdebug_no_uld; 535static int sdebug_no_uld;
536static int sdebug_num_parts = DEF_NUM_PARTS; 536static int sdebug_num_parts = DEF_NUM_PARTS;
@@ -3591,12 +3591,12 @@ static int stop_queued_cmnd(struct scsi_cmnd *cmnd)
3591 sqcp->a_cmnd = NULL; 3591 sqcp->a_cmnd = NULL;
3592 spin_unlock_irqrestore(&queued_arr_lock, 3592 spin_unlock_irqrestore(&queued_arr_lock,
3593 iflags); 3593 iflags);
3594 if ((sdebug_delay > 0) || 3594 if ((sdebug_jdelay > 0) ||
3595 (sdebug_ndelay > 0)) { 3595 (sdebug_ndelay > 0)) {
3596 if (sqcp->sd_hrtp) 3596 if (sqcp->sd_hrtp)
3597 hrtimer_cancel( 3597 hrtimer_cancel(
3598 &sqcp->sd_hrtp->hrt); 3598 &sqcp->sd_hrtp->hrt);
3599 } else if (sdebug_delay < 0) { 3599 } else if (sdebug_jdelay < 0) {
3600 if (sqcp->tletp) 3600 if (sqcp->tletp)
3601 tasklet_kill(sqcp->tletp); 3601 tasklet_kill(sqcp->tletp);
3602 } 3602 }
@@ -3629,12 +3629,12 @@ static void stop_all_queued(void)
3629 sqcp->a_cmnd = NULL; 3629 sqcp->a_cmnd = NULL;
3630 spin_unlock_irqrestore(&queued_arr_lock, 3630 spin_unlock_irqrestore(&queued_arr_lock,
3631 iflags); 3631 iflags);
3632 if ((sdebug_delay > 0) || 3632 if ((sdebug_jdelay > 0) ||
3633 (sdebug_ndelay > 0)) { 3633 (sdebug_ndelay > 0)) {
3634 if (sqcp->sd_hrtp) 3634 if (sqcp->sd_hrtp)
3635 hrtimer_cancel( 3635 hrtimer_cancel(
3636 &sqcp->sd_hrtp->hrt); 3636 &sqcp->sd_hrtp->hrt);
3637 } else if (sdebug_delay < 0) { 3637 } else if (sdebug_jdelay < 0) {
3638 if (sqcp->tletp) 3638 if (sqcp->tletp)
3639 tasklet_kill(sqcp->tletp); 3639 tasklet_kill(sqcp->tletp);
3640 } 3640 }
@@ -3934,7 +3934,7 @@ schedule_resp(struct scsi_cmnd *cmnd, struct sdebug_dev_info *devip,
3934 sd_hp->qa_indx = k; 3934 sd_hp->qa_indx = k;
3935 } 3935 }
3936 hrtimer_start(&sd_hp->hrt, kt, HRTIMER_MODE_REL); 3936 hrtimer_start(&sd_hp->hrt, kt, HRTIMER_MODE_REL);
3937 } else { /* delay < 0 */ 3937 } else { /* jdelay < 0 */
3938 if (NULL == sqcp->tletp) { 3938 if (NULL == sqcp->tletp) {
3939 sqcp->tletp = kzalloc(sizeof(*sqcp->tletp), 3939 sqcp->tletp = kzalloc(sizeof(*sqcp->tletp),
3940 GFP_ATOMIC); 3940 GFP_ATOMIC);
@@ -3971,7 +3971,7 @@ respond_in_thread: /* call back to mid-layer using invocation thread */
3971module_param_named(add_host, sdebug_add_host, int, S_IRUGO | S_IWUSR); 3971module_param_named(add_host, sdebug_add_host, int, S_IRUGO | S_IWUSR);
3972module_param_named(ato, sdebug_ato, int, S_IRUGO); 3972module_param_named(ato, sdebug_ato, int, S_IRUGO);
3973module_param_named(clustering, sdebug_clustering, bool, S_IRUGO | S_IWUSR); 3973module_param_named(clustering, sdebug_clustering, bool, S_IRUGO | S_IWUSR);
3974module_param_named(delay, sdebug_delay, int, S_IRUGO | S_IWUSR); 3974module_param_named(delay, sdebug_jdelay, int, S_IRUGO | S_IWUSR);
3975module_param_named(dev_size_mb, sdebug_dev_size_mb, int, S_IRUGO); 3975module_param_named(dev_size_mb, sdebug_dev_size_mb, int, S_IRUGO);
3976module_param_named(dif, sdebug_dif, int, S_IRUGO); 3976module_param_named(dif, sdebug_dif, int, S_IRUGO);
3977module_param_named(dix, sdebug_dix, int, S_IRUGO); 3977module_param_named(dix, sdebug_dix, int, S_IRUGO);
@@ -4112,7 +4112,7 @@ static int scsi_debug_show_info(struct seq_file *m, struct Scsi_Host *host)
4112 "usec_in_jiffy=%lu\n", 4112 "usec_in_jiffy=%lu\n",
4113 SCSI_DEBUG_VERSION, sdebug_version_date, 4113 SCSI_DEBUG_VERSION, sdebug_version_date,
4114 sdebug_num_tgts, sdebug_dev_size_mb, sdebug_opts, 4114 sdebug_num_tgts, sdebug_dev_size_mb, sdebug_opts,
4115 sdebug_every_nth, b, sdebug_delay, sdebug_ndelay, 4115 sdebug_every_nth, b, sdebug_jdelay, sdebug_ndelay,
4116 sdebug_max_luns, atomic_read(&sdebug_completions), 4116 sdebug_max_luns, atomic_read(&sdebug_completions),
4117 sdebug_sector_size, sdebug_cylinders_per, sdebug_heads, 4117 sdebug_sector_size, sdebug_cylinders_per, sdebug_heads,
4118 sdebug_sectors_per, num_aborts, num_dev_resets, 4118 sdebug_sectors_per, num_aborts, num_dev_resets,
@@ -4130,17 +4130,17 @@ static int scsi_debug_show_info(struct seq_file *m, struct Scsi_Host *host)
4130 4130
4131static ssize_t delay_show(struct device_driver *ddp, char *buf) 4131static ssize_t delay_show(struct device_driver *ddp, char *buf)
4132{ 4132{
4133 return scnprintf(buf, PAGE_SIZE, "%d\n", sdebug_delay); 4133 return scnprintf(buf, PAGE_SIZE, "%d\n", sdebug_jdelay);
4134} 4134}
4135/* Returns -EBUSY if delay is being changed and commands are queued */ 4135/* Returns -EBUSY if jdelay is being changed and commands are queued */
4136static ssize_t delay_store(struct device_driver *ddp, const char *buf, 4136static ssize_t delay_store(struct device_driver *ddp, const char *buf,
4137 size_t count) 4137 size_t count)
4138{ 4138{
4139 int delay, res; 4139 int jdelay, res;
4140 4140
4141 if ((count > 0) && (1 == sscanf(buf, "%d", &delay))) { 4141 if ((count > 0) && (1 == sscanf(buf, "%d", &jdelay))) {
4142 res = count; 4142 res = count;
4143 if (sdebug_delay != delay) { 4143 if (sdebug_jdelay != jdelay) {
4144 unsigned long iflags; 4144 unsigned long iflags;
4145 int k; 4145 int k;
4146 4146
@@ -4149,7 +4149,7 @@ static ssize_t delay_store(struct device_driver *ddp, const char *buf,
4149 if (k != sdebug_max_queue) 4149 if (k != sdebug_max_queue)
4150 res = -EBUSY; /* have queued commands */ 4150 res = -EBUSY; /* have queued commands */
4151 else { 4151 else {
4152 sdebug_delay = delay; 4152 sdebug_jdelay = jdelay;
4153 sdebug_ndelay = 0; 4153 sdebug_ndelay = 0;
4154 } 4154 }
4155 spin_unlock_irqrestore(&queued_arr_lock, iflags); 4155 spin_unlock_irqrestore(&queued_arr_lock, iflags);
@@ -4165,7 +4165,7 @@ static ssize_t ndelay_show(struct device_driver *ddp, char *buf)
4165 return scnprintf(buf, PAGE_SIZE, "%d\n", sdebug_ndelay); 4165 return scnprintf(buf, PAGE_SIZE, "%d\n", sdebug_ndelay);
4166} 4166}
4167/* Returns -EBUSY if ndelay is being changed and commands are queued */ 4167/* Returns -EBUSY if ndelay is being changed and commands are queued */
4168/* If > 0 and accepted then sdebug_delay is set to DELAY_OVERRIDDEN */ 4168/* If > 0 and accepted then sdebug_jdelay is set to JDELAY_OVERRIDDEN */
4169static ssize_t ndelay_store(struct device_driver *ddp, const char *buf, 4169static ssize_t ndelay_store(struct device_driver *ddp, const char *buf,
4170 size_t count) 4170 size_t count)
4171{ 4171{
@@ -4182,8 +4182,8 @@ static ssize_t ndelay_store(struct device_driver *ddp, const char *buf,
4182 res = -EBUSY; /* have queued commands */ 4182 res = -EBUSY; /* have queued commands */
4183 else { 4183 else {
4184 sdebug_ndelay = ndelay; 4184 sdebug_ndelay = ndelay;
4185 sdebug_delay = ndelay ? DELAY_OVERRIDDEN 4185 sdebug_jdelay = ndelay ? JDELAY_OVERRIDDEN
4186 : DEF_DELAY; 4186 : DEF_JDELAY;
4187 } 4187 }
4188 spin_unlock_irqrestore(&queued_arr_lock, iflags); 4188 spin_unlock_irqrestore(&queued_arr_lock, iflags);
4189 } 4189 }
@@ -4666,7 +4666,7 @@ static int __init scsi_debug_init(void)
4666 pr_warn("ndelay must be less than 1 second, ignored\n"); 4666 pr_warn("ndelay must be less than 1 second, ignored\n");
4667 sdebug_ndelay = 0; 4667 sdebug_ndelay = 0;
4668 } else if (sdebug_ndelay > 0) 4668 } else if (sdebug_ndelay > 0)
4669 sdebug_delay = DELAY_OVERRIDDEN; 4669 sdebug_jdelay = JDELAY_OVERRIDDEN;
4670 4670
4671 switch (sdebug_sector_size) { 4671 switch (sdebug_sector_size) {
4672 case 512: 4672 case 512:
@@ -5136,7 +5136,7 @@ scsi_debug_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *scp)
5136 5136
5137fini: 5137fini:
5138 return schedule_resp(scp, devip, errsts, 5138 return schedule_resp(scp, devip, errsts,
5139 ((F_DELAY_OVERR & flags) ? 0 : sdebug_delay)); 5139 ((F_DELAY_OVERR & flags) ? 0 : sdebug_jdelay));
5140check_cond: 5140check_cond:
5141 return schedule_resp(scp, devip, check_condition_result, 0); 5141 return schedule_resp(scp, devip, check_condition_result, 0);
5142} 5142}