commit af180c0880f9df14be31807f0bb0fa6f0d34a943 Author: Bart Van Assche Date: Tue Jan 30 13:48:45 2024 -0800 scsi: scsi_debug: Maintain write statistics per group number Track per GROUP NUMBER how many write commands have been processed. Make this information available in sysfs. Reset these statistics if any data is written into the sysfs attribute. Note: SCSI devices should only interpret the information in the GROUP NUMBER field as a stream identifier if the ST_ENBLE bit has been set to one. This patch follows a simpler approach: count the number of writes per GROUP NUMBER whether or not the group number represents a stream identifier. Cc: Martin K. Petersen Cc: Douglas Gilbert Tested-by: Douglas Gilbert Signed-off-by: Bart Van Assche Link: https://lore.kernel.org/r/20240130214911.1863909-20-bvanassche@acm.org Signed-off-by: Martin K. Petersen commit ad620becda436fc02e50e5f6fe01de1d1f3794c9 Author: Bart Van Assche Date: Tue Jan 30 13:48:44 2024 -0800 scsi: scsi_debug: Implement GET STREAM STATUS Implement the GET STREAM STATUS SCSI command. Report that the first five stream indexes correspond to permanent streams. Cc: Martin K. Petersen Cc: Douglas Gilbert Tested-by: Douglas Gilbert Signed-off-by: Bart Van Assche Link: https://lore.kernel.org/r/20240130214911.1863909-19-bvanassche@acm.org Signed-off-by: Martin K. Petersen commit f8ab2710177a762ce0f9b8426f9fc292394949df Author: Bart Van Assche Date: Tue Jan 30 13:48:43 2024 -0800 scsi: scsi_debug: Implement the IO Advice Hints Grouping mode page Implement an IO Advice Hints Grouping mode page with three permanent streams. A permanent stream is a stream for which the device server does not allow closing or otherwise modifying the configuration of that stream. The stream identifier enable (ST_ENBLE) bit specifies whether the stream identifier may be used in the GROUP NUMBER field of SCSI WRITE commands. Cc: Martin K. Petersen Cc: Douglas Gilbert Tested-by: Douglas Gilbert Signed-off-by: Bart Van Assche Link: https://lore.kernel.org/r/20240130214911.1863909-18-bvanassche@acm.org Signed-off-by: Martin K. Petersen commit b952eb270df38bc0d930a1ef965666ecf54a2097 Author: Bart Van Assche Date: Tue Jan 30 13:48:42 2024 -0800 scsi: scsi_debug: Allocate the MODE SENSE response from the heap Make the MODE SENSE response buffer larger and allocate it from the heap. This patch prepares for adding support for the IO Advice Hints Grouping mode page. Suggested-by: Douglas Gilbert Cc: Douglas Gilbert Tested-by: Douglas Gilbert Signed-off-by: Bart Van Assche Link: https://lore.kernel.org/r/20240130214911.1863909-17-bvanassche@acm.org Signed-off-by: Martin K. Petersen commit f19c3e4fe2542d7b145d294386666958c9fabe17 Author: Bart Van Assche Date: Tue Jan 30 13:48:41 2024 -0800 scsi: scsi_debug: Rework subpage code error handling Move the subpage code checks into the switch statement to make it easier to add support for new page code / subpage code combinations. Cc: Martin K. Petersen Cc: Douglas Gilbert Tested-by: Douglas Gilbert Signed-off-by: Bart Van Assche Link: https://lore.kernel.org/r/20240130214911.1863909-16-bvanassche@acm.org Signed-off-by: Martin K. Petersen commit b2f860903fe9774f755a917edc674ba6e879fa55 Author: Bart Van Assche Date: Tue Jan 30 13:48:40 2024 -0800 scsi: scsi_debug: Rework page code error handling Instead of tracking whether or not the page code is valid in a boolean variable, jump to error handling code if an unsupported page code is encountered. Cc: Martin K. Petersen Cc: Douglas Gilbert Tested-by: Douglas Gilbert Signed-off-by: Bart Van Assche Link: https://lore.kernel.org/r/20240130214911.1863909-15-bvanassche@acm.org Signed-off-by: Martin K. Petersen commit b1e5c0b34db8e7dac04af618e53c64e70c86aac8 Author: Bart Van Assche Date: Tue Jan 30 13:48:39 2024 -0800 scsi: scsi_debug: Support the block limits extension VPD page >From SBC-5 r05: "Reduced stream control: a) reduces the maximum number of streams that the device server supports; and b) increases the number of write commands that are able to specify a stream to be written in any write command that contains the GROUP NUMBER field in its CDB. If the RSCS bit (see 6.6.5) is set to one, then the device server shall: a) support per group stream identifier usage as described in 4.32.2; b) support the IO Advice Hints Grouping mode page (see 6.5.7); and c) set the MAXIMUM NUMBER OF STREAMS field (see 6.6.5) to a value that is less than 64. Device servers that set the RSCS bit to one may support other features (e.g., permanent streams (see 4.32.4)). 4.32.4 Permanent streams A permanent stream is a stream for which the device server does not allow closing or otherwise modifying the configuration of that stream. The PERM bit (see 5.9.2.3) indicates whether a stream is a permanent stream. If a STREAM CONTROL command (see 5.32) specifies the closing of a permanent stream, the device server terminates that command with CHECK CONDITION status instead of closing the specified stream. A permanent stream is always an open stream. Device severs should assign the lowest numbered stream identifiers to permanent streams." Report that reduced stream control is supported. Cc: Martin K. Petersen Cc: Douglas Gilbert Tested-by: Douglas Gilbert Signed-off-by: Bart Van Assche Link: https://lore.kernel.org/r/20240130214911.1863909-14-bvanassche@acm.org Signed-off-by: Martin K. Petersen commit a5fe98eb8f630f3ad3d1d5c16374621e8c0cd702 Author: Bart Van Assche Date: Tue Jan 30 13:48:38 2024 -0800 scsi: scsi_debug: Reduce code duplication All VPD pages have the page code in byte one. Reduce code duplication by storing the VPD page code once. Reviewed-by: Avri Altman Cc: Martin K. Petersen Cc: Douglas Gilbert Tested-by: Douglas Gilbert Signed-off-by: Bart Van Assche Link: https://lore.kernel.org/r/20240130214911.1863909-13-bvanassche@acm.org Signed-off-by: Martin K. Petersen commit 4f53138fffc2b18396859aa4ff3e7ef2b0839c2b Author: Bart Van Assche Date: Tue Jan 30 13:48:37 2024 -0800 scsi: sd: Translate data lifetime information Recently T10 standardized SBC constrained streams. This mechanism allows to pass data lifetime information to SCSI devices in the group number field. Add support for translating write hint information into a permanent stream number in the sd driver. Use WRITE(10) instead of WRITE(6) if data lifetime information is present because the WRITE(6) command does not have a GROUP NUMBER field. Cc: Martin K. Petersen Cc: Christoph Hellwig Cc: Damien Le Moal Signed-off-by: Bart Van Assche Link: https://lore.kernel.org/r/20240130214911.1863909-12-bvanassche@acm.org Signed-off-by: Martin K. Petersen commit 4977c0f4523e1d6c87df4eedceb33d38f055c5fb Author: Bart Van Assche Date: Tue Jan 30 13:48:36 2024 -0800 scsi: scsi_proto: Add structures and constants related to I/O groups and streams Prepare for adding code that will query the I/O advice hints group descriptors and for adding code that will retrieve the stream status. Cc: Martin K. Petersen Signed-off-by: Bart Van Assche Link: https://lore.kernel.org/r/20240130214911.1863909-11-bvanassche@acm.org Signed-off-by: Martin K. Petersen commit 96b171d6dba6a66c63312f35e3ac6465b2c2ca94 Author: Bart Van Assche Date: Tue Jan 30 13:48:35 2024 -0800 scsi: core: Query the Block Limits Extension VPD page Parse the Reduced Stream Control Supported (RSCS) bit from the block limits extension VPD page. The RSCS bit is defined in SBC-5 r05 (https://www.t10.org/cgi-bin/ac.pl?t=f&f=sbc5r05.pdf). Reviewed-by: Avri Altman Reviewed-by: Daejun Park Cc: Martin K. Petersen Signed-off-by: Bart Van Assche Link: https://lore.kernel.org/r/20240130214911.1863909-10-bvanassche@acm.org Signed-off-by: Martin K. Petersen