Skip to content

Commit 5b94e23

Browse files
martinkpetersenJames Bottomley
authored andcommitted
[SCSI] scsi_debug: Logical Block Provisioning (SBC3r26)
Update scsi_debug to support the Logical Block Provisioning commands and bits as defined in SBC3r26. The old tp* parameters have been transitioned to the new lbp* scheme found in the draft standard. The old tpu option to enable UNMAP is now called lbpu. tpws to signal support for WRITE SAME(16) with the UNMAP bit set is now lbpws. Support for WRITE SAME(10) with the UNMAP bit set is also available using the lpuws10 parameter. Limiting the maximum number of blocks per WRITE SAME command has been implemented and is available via the write_same_length module parameter. As part of the renaming process the parameter lists have been sorted alphabetically (request from Doug). Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> Acked-by: Douglas Gilbert <dgilbert@interlog.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
1 parent c98a0eb commit 5b94e23

1 file changed

Lines changed: 105 additions & 78 deletions

File tree

‎drivers/scsi/scsi_debug.c‎

Lines changed: 105 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -89,32 +89,34 @@ static const char * scsi_debug_version_date = "20100324";
8989
/* With these defaults, this driver will make 1 host with 1 target
9090
* (id 0) containing 1 logical unit (lun 0). That is 1 device.
9191
*/
92+
#define DEF_ATO 1
9293
#define DEF_DELAY 1
9394
#define DEF_DEV_SIZE_MB 8
94-
#define DEF_EVERY_NTH 0
95-
#define DEF_NUM_PARTS 0
96-
#define DEF_OPTS 0
97-
#define DEF_SCSI_LEVEL 5 /* INQUIRY, byte2 [5->SPC-3] */
98-
#define DEF_PTYPE 0
95+
#define DEF_DIF 0
96+
#define DEF_DIX 0
9997
#define DEF_D_SENSE 0
100-
#define DEF_NO_LUN_0 0
101-
#define DEF_VIRTUAL_GB 0
98+
#define DEF_EVERY_NTH 0
10299
#define DEF_FAKE_RW 0
103-
#define DEF_VPD_USE_HOSTNO 1
104-
#define DEF_SECTOR_SIZE 512
105-
#define DEF_DIX 0
106-
#define DEF_DIF 0
107100
#define DEF_GUARD 0
108-
#define DEF_ATO 1
109-
#define DEF_PHYSBLK_EXP 0
101+
#define DEF_LBPU 0
102+
#define DEF_LBPWS 0
103+
#define DEF_LBPWS10 0
110104
#define DEF_LOWEST_ALIGNED 0
105+
#define DEF_NO_LUN_0 0
106+
#define DEF_NUM_PARTS 0
107+
#define DEF_OPTS 0
111108
#define DEF_OPT_BLKS 64
109+
#define DEF_PHYSBLK_EXP 0
110+
#define DEF_PTYPE 0
111+
#define DEF_SCSI_LEVEL 5 /* INQUIRY, byte2 [5->SPC-3] */
112+
#define DEF_SECTOR_SIZE 512
113+
#define DEF_UNMAP_ALIGNMENT 0
114+
#define DEF_UNMAP_GRANULARITY 1
112115
#define DEF_UNMAP_MAX_BLOCKS 0xFFFFFFFF
113116
#define DEF_UNMAP_MAX_DESC 256
114-
#define DEF_UNMAP_GRANULARITY 1
115-
#define DEF_UNMAP_ALIGNMENT 0
116-
#define DEF_TPWS 0
117-
#define DEF_TPU 0
117+
#define DEF_VIRTUAL_GB 0
118+
#define DEF_VPD_USE_HOSTNO 1
119+
#define DEF_WRITESAME_LENGTH 0xFFFF
118120

119121
/* bit mask values for scsi_debug_opts */
120122
#define SCSI_DEBUG_OPT_NOISE 1
@@ -155,36 +157,38 @@ static const char * scsi_debug_version_date = "20100324";
155157
#define SCSI_DEBUG_CANQUEUE 255
156158

157159
static int scsi_debug_add_host = DEF_NUM_HOST;
160+
static int scsi_debug_ato = DEF_ATO;
158161
static int scsi_debug_delay = DEF_DELAY;
159162
static int scsi_debug_dev_size_mb = DEF_DEV_SIZE_MB;
163+
static int scsi_debug_dif = DEF_DIF;
164+
static int scsi_debug_dix = DEF_DIX;
165+
static int scsi_debug_dsense = DEF_D_SENSE;
160166
static int scsi_debug_every_nth = DEF_EVERY_NTH;
167+
static int scsi_debug_fake_rw = DEF_FAKE_RW;
168+
static int scsi_debug_guard = DEF_GUARD;
169+
static int scsi_debug_lowest_aligned = DEF_LOWEST_ALIGNED;
161170
static int scsi_debug_max_luns = DEF_MAX_LUNS;
162171
static int scsi_debug_max_queue = SCSI_DEBUG_CANQUEUE;
163-
static int scsi_debug_num_parts = DEF_NUM_PARTS;
172+
static int scsi_debug_no_lun_0 = DEF_NO_LUN_0;
164173
static int scsi_debug_no_uld = 0;
174+
static int scsi_debug_num_parts = DEF_NUM_PARTS;
165175
static int scsi_debug_num_tgts = DEF_NUM_TGTS; /* targets per host */
176+
static int scsi_debug_opt_blks = DEF_OPT_BLKS;
166177
static int scsi_debug_opts = DEF_OPTS;
167-
static int scsi_debug_scsi_level = DEF_SCSI_LEVEL;
178+
static int scsi_debug_physblk_exp = DEF_PHYSBLK_EXP;
168179
static int scsi_debug_ptype = DEF_PTYPE; /* SCSI peripheral type (0==disk) */
169-
static int scsi_debug_dsense = DEF_D_SENSE;
170-
static int scsi_debug_no_lun_0 = DEF_NO_LUN_0;
180+
static int scsi_debug_scsi_level = DEF_SCSI_LEVEL;
181+
static int scsi_debug_sector_size = DEF_SECTOR_SIZE;
171182
static int scsi_debug_virtual_gb = DEF_VIRTUAL_GB;
172-
static int scsi_debug_fake_rw = DEF_FAKE_RW;
173183
static int scsi_debug_vpd_use_hostno = DEF_VPD_USE_HOSTNO;
174-
static int scsi_debug_sector_size = DEF_SECTOR_SIZE;
175-
static int scsi_debug_dix = DEF_DIX;
176-
static int scsi_debug_dif = DEF_DIF;
177-
static int scsi_debug_guard = DEF_GUARD;
178-
static int scsi_debug_ato = DEF_ATO;
179-
static int scsi_debug_physblk_exp = DEF_PHYSBLK_EXP;
180-
static int scsi_debug_lowest_aligned = DEF_LOWEST_ALIGNED;
181-
static int scsi_debug_opt_blks = DEF_OPT_BLKS;
182-
static unsigned int scsi_debug_unmap_max_desc = DEF_UNMAP_MAX_DESC;
183-
static unsigned int scsi_debug_unmap_max_blocks = DEF_UNMAP_MAX_BLOCKS;
184-
static unsigned int scsi_debug_unmap_granularity = DEF_UNMAP_GRANULARITY;
184+
static unsigned int scsi_debug_lbpu = DEF_LBPU;
185+
static unsigned int scsi_debug_lbpws = DEF_LBPWS;
186+
static unsigned int scsi_debug_lbpws10 = DEF_LBPWS10;
185187
static unsigned int scsi_debug_unmap_alignment = DEF_UNMAP_ALIGNMENT;
186-
static unsigned int scsi_debug_tpws = DEF_TPWS;
187-
static unsigned int scsi_debug_tpu = DEF_TPU;
188+
static unsigned int scsi_debug_unmap_granularity = DEF_UNMAP_GRANULARITY;
189+
static unsigned int scsi_debug_unmap_max_blocks = DEF_UNMAP_MAX_BLOCKS;
190+
static unsigned int scsi_debug_unmap_max_desc = DEF_UNMAP_MAX_DESC;
191+
static unsigned int scsi_debug_write_same_length = DEF_WRITESAME_LENGTH;
188192

189193
static int scsi_debug_cmnd_count = 0;
190194

@@ -206,6 +210,11 @@ static int sdebug_sectors_per; /* sectors per cylinder */
206210

207211
#define SCSI_DEBUG_MAX_CMD_LEN 32
208212

213+
static unsigned int scsi_debug_lbp(void)
214+
{
215+
return scsi_debug_lbpu | scsi_debug_lbpws | scsi_debug_lbpws10;
216+
}
217+
209218
struct sdebug_dev_info {
210219
struct list_head dev_list;
211220
unsigned char sense_buff[SDEBUG_SENSE_LEN]; /* weak nexus */
@@ -727,7 +736,7 @@ static int inquiry_evpd_b0(unsigned char * arr)
727736
/* Optimal Transfer Length */
728737
put_unaligned_be32(scsi_debug_opt_blks, &arr[8]);
729738

730-
if (scsi_debug_tpu) {
739+
if (scsi_debug_lbpu) {
731740
/* Maximum Unmap LBA Count */
732741
put_unaligned_be32(scsi_debug_unmap_max_blocks, &arr[16]);
733742

@@ -744,7 +753,10 @@ static int inquiry_evpd_b0(unsigned char * arr)
744753
/* Optimal Unmap Granularity */
745754
put_unaligned_be32(scsi_debug_unmap_granularity, &arr[24]);
746755

747-
return 0x3c; /* Mandatory page length for thin provisioning */
756+
/* Maximum WRITE SAME Length */
757+
put_unaligned_be64(scsi_debug_write_same_length, &arr[32]);
758+
759+
return 0x3c; /* Mandatory page length for Logical Block Provisioning */
748760

749761
return sizeof(vpdb0_data);
750762
}
@@ -767,12 +779,15 @@ static int inquiry_evpd_b2(unsigned char *arr)
767779
memset(arr, 0, 0x8);
768780
arr[0] = 0; /* threshold exponent */
769781

770-
if (scsi_debug_tpu)
782+
if (scsi_debug_lbpu)
771783
arr[1] = 1 << 7;
772784

773-
if (scsi_debug_tpws)
785+
if (scsi_debug_lbpws)
774786
arr[1] |= 1 << 6;
775787

788+
if (scsi_debug_lbpws10)
789+
arr[1] |= 1 << 5;
790+
776791
return 0x8;
777792
}
778793

@@ -831,7 +846,8 @@ static int resp_inquiry(struct scsi_cmnd * scp, int target,
831846
arr[n++] = 0x89; /* ATA information */
832847
arr[n++] = 0xb0; /* Block limits (SBC) */
833848
arr[n++] = 0xb1; /* Block characteristics (SBC) */
834-
arr[n++] = 0xb2; /* Thin provisioning (SBC) */
849+
if (scsi_debug_lbp()) /* Logical Block Prov. (SBC) */
850+
arr[n++] = 0xb2;
835851
arr[3] = n - 4; /* number of supported VPD pages */
836852
} else if (0x80 == cmd[2]) { /* unit serial number */
837853
arr[1] = cmd[2]; /*sanity */
@@ -879,7 +895,7 @@ static int resp_inquiry(struct scsi_cmnd * scp, int target,
879895
} else if (0xb1 == cmd[2]) { /* Block characteristics (SBC) */
880896
arr[1] = cmd[2]; /*sanity */
881897
arr[3] = inquiry_evpd_b1(&arr[4]);
882-
} else if (0xb2 == cmd[2]) { /* Thin provisioning (SBC) */
898+
} else if (0xb2 == cmd[2]) { /* Logical Block Prov. (SBC) */
883899
arr[1] = cmd[2]; /*sanity */
884900
arr[3] = inquiry_evpd_b2(&arr[4]);
885901
} else {
@@ -1053,8 +1069,8 @@ static int resp_readcap16(struct scsi_cmnd * scp,
10531069
arr[13] = scsi_debug_physblk_exp & 0xf;
10541070
arr[14] = (scsi_debug_lowest_aligned >> 8) & 0x3f;
10551071

1056-
if (scsi_debug_tpu || scsi_debug_tpws)
1057-
arr[14] |= 0x80; /* TPE */
1072+
if (scsi_debug_lbp())
1073+
arr[14] |= 0x80; /* LBPME */
10581074

10591075
arr[15] = scsi_debug_lowest_aligned & 0xff;
10601076

@@ -2084,6 +2100,12 @@ static int resp_write_same(struct scsi_cmnd *scmd, unsigned long long lba,
20842100
if (ret)
20852101
return ret;
20862102

2103+
if (num > scsi_debug_write_same_length) {
2104+
mk_sense_buffer(devip, ILLEGAL_REQUEST, INVALID_FIELD_IN_CDB,
2105+
0);
2106+
return check_condition_result;
2107+
}
2108+
20872109
write_lock_irqsave(&atomic_rw, iflags);
20882110

20892111
if (unmap && scsi_debug_unmap_granularity) {
@@ -2695,74 +2717,79 @@ static int schedule_resp(struct scsi_cmnd * cmnd,
26952717
/sys/bus/pseudo/drivers/scsi_debug directory is changed.
26962718
*/
26972719
module_param_named(add_host, scsi_debug_add_host, int, S_IRUGO | S_IWUSR);
2720+
module_param_named(ato, scsi_debug_ato, int, S_IRUGO);
26982721
module_param_named(delay, scsi_debug_delay, int, S_IRUGO | S_IWUSR);
26992722
module_param_named(dev_size_mb, scsi_debug_dev_size_mb, int, S_IRUGO);
2723+
module_param_named(dif, scsi_debug_dif, int, S_IRUGO);
2724+
module_param_named(dix, scsi_debug_dix, int, S_IRUGO);
27002725
module_param_named(dsense, scsi_debug_dsense, int, S_IRUGO | S_IWUSR);
27012726
module_param_named(every_nth, scsi_debug_every_nth, int, S_IRUGO | S_IWUSR);
27022727
module_param_named(fake_rw, scsi_debug_fake_rw, int, S_IRUGO | S_IWUSR);
2728+
module_param_named(guard, scsi_debug_guard, int, S_IRUGO);
2729+
module_param_named(lbpu, scsi_debug_lbpu, int, S_IRUGO);
2730+
module_param_named(lbpws, scsi_debug_lbpws, int, S_IRUGO);
2731+
module_param_named(lbpws10, scsi_debug_lbpws10, int, S_IRUGO);
2732+
module_param_named(lowest_aligned, scsi_debug_lowest_aligned, int, S_IRUGO);
27032733
module_param_named(max_luns, scsi_debug_max_luns, int, S_IRUGO | S_IWUSR);
27042734
module_param_named(max_queue, scsi_debug_max_queue, int, S_IRUGO | S_IWUSR);
27052735
module_param_named(no_lun_0, scsi_debug_no_lun_0, int, S_IRUGO | S_IWUSR);
27062736
module_param_named(no_uld, scsi_debug_no_uld, int, S_IRUGO);
27072737
module_param_named(num_parts, scsi_debug_num_parts, int, S_IRUGO);
27082738
module_param_named(num_tgts, scsi_debug_num_tgts, int, S_IRUGO | S_IWUSR);
2739+
module_param_named(opt_blks, scsi_debug_opt_blks, int, S_IRUGO);
27092740
module_param_named(opts, scsi_debug_opts, int, S_IRUGO | S_IWUSR);
2741+
module_param_named(physblk_exp, scsi_debug_physblk_exp, int, S_IRUGO);
27102742
module_param_named(ptype, scsi_debug_ptype, int, S_IRUGO | S_IWUSR);
27112743
module_param_named(scsi_level, scsi_debug_scsi_level, int, S_IRUGO);
2712-
module_param_named(virtual_gb, scsi_debug_virtual_gb, int, S_IRUGO | S_IWUSR);
2713-
module_param_named(vpd_use_hostno, scsi_debug_vpd_use_hostno, int,
2714-
S_IRUGO | S_IWUSR);
27152744
module_param_named(sector_size, scsi_debug_sector_size, int, S_IRUGO);
2716-
module_param_named(dix, scsi_debug_dix, int, S_IRUGO);
2717-
module_param_named(dif, scsi_debug_dif, int, S_IRUGO);
2718-
module_param_named(guard, scsi_debug_guard, int, S_IRUGO);
2719-
module_param_named(ato, scsi_debug_ato, int, S_IRUGO);
2720-
module_param_named(physblk_exp, scsi_debug_physblk_exp, int, S_IRUGO);
2721-
module_param_named(opt_blks, scsi_debug_opt_blks, int, S_IRUGO);
2722-
module_param_named(lowest_aligned, scsi_debug_lowest_aligned, int, S_IRUGO);
2745+
module_param_named(unmap_alignment, scsi_debug_unmap_alignment, int, S_IRUGO);
2746+
module_param_named(unmap_granularity, scsi_debug_unmap_granularity, int, S_IRUGO);
27232747
module_param_named(unmap_max_blocks, scsi_debug_unmap_max_blocks, int, S_IRUGO);
27242748
module_param_named(unmap_max_desc, scsi_debug_unmap_max_desc, int, S_IRUGO);
2725-
module_param_named(unmap_granularity, scsi_debug_unmap_granularity, int, S_IRUGO);
2726-
module_param_named(unmap_alignment, scsi_debug_unmap_alignment, int, S_IRUGO);
2727-
module_param_named(tpu, scsi_debug_tpu, int, S_IRUGO);
2728-
module_param_named(tpws, scsi_debug_tpws, int, S_IRUGO);
2749+
module_param_named(virtual_gb, scsi_debug_virtual_gb, int, S_IRUGO | S_IWUSR);
2750+
module_param_named(vpd_use_hostno, scsi_debug_vpd_use_hostno, int,
2751+
S_IRUGO | S_IWUSR);
2752+
module_param_named(write_same_length, scsi_debug_write_same_length, int,
2753+
S_IRUGO | S_IWUSR);
27292754

27302755
MODULE_AUTHOR("Eric Youngdale + Douglas Gilbert");
27312756
MODULE_DESCRIPTION("SCSI debug adapter driver");
27322757
MODULE_LICENSE("GPL");
27332758
MODULE_VERSION(SCSI_DEBUG_VERSION);
27342759

27352760
MODULE_PARM_DESC(add_host, "0..127 hosts allowed(def=1)");
2761+
MODULE_PARM_DESC(ato, "application tag ownership: 0=disk 1=host (def=1)");
27362762
MODULE_PARM_DESC(delay, "# of jiffies to delay response(def=1)");
27372763
MODULE_PARM_DESC(dev_size_mb, "size in MB of ram shared by devs(def=8)");
2764+
MODULE_PARM_DESC(dif, "data integrity field type: 0-3 (def=0)");
2765+
MODULE_PARM_DESC(dix, "data integrity extensions mask (def=0)");
27382766
MODULE_PARM_DESC(dsense, "use descriptor sense format(def=0 -> fixed)");
27392767
MODULE_PARM_DESC(every_nth, "timeout every nth command(def=0)");
27402768
MODULE_PARM_DESC(fake_rw, "fake reads/writes instead of copying (def=0)");
2769+
MODULE_PARM_DESC(guard, "protection checksum: 0=crc, 1=ip (def=0)");
2770+
MODULE_PARM_DESC(lbpu, "enable LBP, support UNMAP command (def=0)");
2771+
MODULE_PARM_DESC(lbpws, "enable LBP, support WRITE SAME(16) with UNMAP bit (def=0)");
2772+
MODULE_PARM_DESC(lbpws10, "enable LBP, support WRITE SAME(10) with UNMAP bit (def=0)");
2773+
MODULE_PARM_DESC(lowest_aligned, "lowest aligned lba (def=0)");
27412774
MODULE_PARM_DESC(max_luns, "number of LUNs per target to simulate(def=1)");
27422775
MODULE_PARM_DESC(max_queue, "max number of queued commands (1 to 255(def))");
27432776
MODULE_PARM_DESC(no_lun_0, "no LU number 0 (def=0 -> have lun 0)");
27442777
MODULE_PARM_DESC(no_uld, "stop ULD (e.g. sd driver) attaching (def=0))");
27452778
MODULE_PARM_DESC(num_parts, "number of partitions(def=0)");
27462779
MODULE_PARM_DESC(num_tgts, "number of targets per host to simulate(def=1)");
2780+
MODULE_PARM_DESC(opt_blks, "optimal transfer length in block (def=64)");
27472781
MODULE_PARM_DESC(opts, "1->noise, 2->medium_err, 4->timeout, 8->recovered_err... (def=0)");
2782+
MODULE_PARM_DESC(physblk_exp, "physical block exponent (def=0)");
27482783
MODULE_PARM_DESC(ptype, "SCSI peripheral type(def=0[disk])");
27492784
MODULE_PARM_DESC(scsi_level, "SCSI level to simulate(def=5[SPC-3])");
2750-
MODULE_PARM_DESC(virtual_gb, "virtual gigabyte size (def=0 -> use dev_size_mb)");
2751-
MODULE_PARM_DESC(vpd_use_hostno, "0 -> dev ids ignore hostno (def=1 -> unique dev ids)");
27522785
MODULE_PARM_DESC(sector_size, "logical block size in bytes (def=512)");
2753-
MODULE_PARM_DESC(physblk_exp, "physical block exponent (def=0)");
2754-
MODULE_PARM_DESC(opt_blks, "optimal transfer length in block (def=64)");
2755-
MODULE_PARM_DESC(lowest_aligned, "lowest aligned lba (def=0)");
2756-
MODULE_PARM_DESC(dix, "data integrity extensions mask (def=0)");
2757-
MODULE_PARM_DESC(dif, "data integrity field type: 0-3 (def=0)");
2758-
MODULE_PARM_DESC(guard, "protection checksum: 0=crc, 1=ip (def=0)");
2759-
MODULE_PARM_DESC(ato, "application tag ownership: 0=disk 1=host (def=1)");
2786+
MODULE_PARM_DESC(unmap_alignment, "lowest aligned thin provisioning lba (def=0)");
2787+
MODULE_PARM_DESC(unmap_granularity, "thin provisioning granularity in blocks (def=1)");
27602788
MODULE_PARM_DESC(unmap_max_blocks, "max # of blocks can be unmapped in one cmd (def=0xffffffff)");
27612789
MODULE_PARM_DESC(unmap_max_desc, "max # of ranges that can be unmapped in one cmd (def=256)");
2762-
MODULE_PARM_DESC(unmap_granularity, "thin provisioning granularity in blocks (def=1)");
2763-
MODULE_PARM_DESC(unmap_alignment, "lowest aligned thin provisioning lba (def=0)");
2764-
MODULE_PARM_DESC(tpu, "enable TP, support UNMAP command (def=0)");
2765-
MODULE_PARM_DESC(tpws, "enable TP, support WRITE SAME(16) with UNMAP bit (def=0)");
2790+
MODULE_PARM_DESC(virtual_gb, "virtual gigabyte size (def=0 -> use dev_size_mb)");
2791+
MODULE_PARM_DESC(vpd_use_hostno, "0 -> dev ids ignore hostno (def=1 -> unique dev ids)");
2792+
MODULE_PARM_DESC(write_same_length, "Maximum blocks per WRITE SAME cmd (def=0xffff)");
27662793

27672794
static char sdebug_info[256];
27682795

@@ -3150,7 +3177,7 @@ static ssize_t sdebug_map_show(struct device_driver *ddp, char *buf)
31503177
{
31513178
ssize_t count;
31523179

3153-
if (scsi_debug_tpu == 0 && scsi_debug_tpws == 0)
3180+
if (!scsi_debug_lbp())
31543181
return scnprintf(buf, PAGE_SIZE, "0-%u\n",
31553182
sdebug_store_sectors);
31563183

@@ -3333,8 +3360,8 @@ static int __init scsi_debug_init(void)
33333360
memset(dif_storep, 0xff, dif_size);
33343361
}
33353362

3336-
/* Thin Provisioning */
3337-
if (scsi_debug_tpu || scsi_debug_tpws) {
3363+
/* Logical Block Provisioning */
3364+
if (scsi_debug_lbp()) {
33383365
unsigned int map_bytes;
33393366

33403367
scsi_debug_unmap_max_blocks =
@@ -3664,7 +3691,7 @@ int scsi_debug_queuecommand_lck(struct scsi_cmnd *SCpnt, done_funct_t done)
36643691
errsts = resp_readcap16(SCpnt, devip);
36653692
else if (cmd[1] == SAI_GET_LBA_STATUS) {
36663693

3667-
if (scsi_debug_tpu == 0 && scsi_debug_tpws == 0) {
3694+
if (scsi_debug_lbp() == 0) {
36683695
mk_sense_buffer(devip, ILLEGAL_REQUEST,
36693696
INVALID_COMMAND_OPCODE, 0);
36703697
errsts = check_condition_result;
@@ -3775,8 +3802,10 @@ int scsi_debug_queuecommand_lck(struct scsi_cmnd *SCpnt, done_funct_t done)
37753802
}
37763803
break;
37773804
case WRITE_SAME_16:
3805+
case WRITE_SAME:
37783806
if (cmd[1] & 0x8) {
3779-
if (scsi_debug_tpws == 0) {
3807+
if ((*cmd == WRITE_SAME_16 && scsi_debug_lbpws == 0) ||
3808+
(*cmd == WRITE_SAME && scsi_debug_lbpws10 == 0)) {
37803809
mk_sense_buffer(devip, ILLEGAL_REQUEST,
37813810
INVALID_FIELD_IN_CDB, 0);
37823811
errsts = check_condition_result;
@@ -3785,8 +3814,6 @@ int scsi_debug_queuecommand_lck(struct scsi_cmnd *SCpnt, done_funct_t done)
37853814
}
37863815
if (errsts)
37873816
break;
3788-
/* fall through */
3789-
case WRITE_SAME:
37903817
errsts = check_readiness(SCpnt, 0, devip);
37913818
if (errsts)
37923819
break;
@@ -3798,7 +3825,7 @@ int scsi_debug_queuecommand_lck(struct scsi_cmnd *SCpnt, done_funct_t done)
37983825
if (errsts)
37993826
break;
38003827

3801-
if (scsi_debug_unmap_max_desc == 0 || scsi_debug_tpu == 0) {
3828+
if (scsi_debug_unmap_max_desc == 0 || scsi_debug_lbpu == 0) {
38023829
mk_sense_buffer(devip, ILLEGAL_REQUEST,
38033830
INVALID_COMMAND_OPCODE, 0);
38043831
errsts = check_condition_result;

0 commit comments

Comments
 (0)