Skip to content

scsi_debug: fix logical block provisioning support

Akinobu Mita linux-scsi 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest6 patches 8 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6scsi_debug: call map_region() and unmap_region() only when neededdrivers/scsi/scsi_debug.c+3 -31 reply
2/6scsi_debug: prohibit scsi_debug_unmap_granularity == scsi_debug_unmap_alignmentdrivers/scsi/scsi_debug.c+3 -21 reply
3/6scsi_debug: clear correct memory region when LBPRZ is enableddrivers/scsi/scsi_debug.c+3 -21 reply
4/6scsi_debug: add translation functions between LBA and index of provisioning mapdrivers/scsi/scsi_debug.c+17 -02 replies
5/6scsi_debug: fix initialization of provisioning mapdrivers/scsi/scsi_debug.c+3 -61 reply
6/6scsi_debug: fix logical block provisioning supportdrivers/scsi/scsi_debug.c+21 -341 reply

Reviews trailers per patch

All 6 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchDouglas GilbertMartin K. Petersen
SeriesA-b
1/6A-b
2/6A-b
3/6A-b
4/6A-b
5/6A-b
6/6A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/6] scsi_debug: fix logical block provisioning support

I tried testing the logical block provisioning support in scsi_debug, but it didn't work as I expected.

For example, load scsi_debug module with UNMAP command supported and fill the storage with random data.

	# modprobe scsi_debug lbpu=1
	# dd if=/dev/urandom of=/dev/sdb

Then, try to unmap LBA 0, but Get LBA status reports:

	# sg_unmap --lba=0 --num=1 /dev/sdb
	# sg_get_lba_status --lba=0 /dev/sdb
	descriptor LBA: 0x0000000000000000  blocks: 16384  mapped

This is unexpected result. Because UNMAP command to LBA 0 finished without any errors, but Get LBA status shows that LBA 0 is still mapped.

I looked around the logical block provisioning support in scsi_debug, and I found several problems there. This patch series tries to fix these problems and it is broken into small patches as much as possible for ease of review.

Cc "James E.J. Bottomley" <[email protected]>
Cc Douglas Gilbert <[email protected]>
Cc "Martin K. Petersen" <[email protected]>

Akinobu Mita (6):
scsi_debug: call map_region() and unmap_region() only when needed
scsi_debug: prohibit scsi_debug_unmap_granularity ==
scsi_debug_unmap_alignment
scsi_debug: clear correct memory region when LBPRZ is enabled
scsi_debug: add translation functions between LBA and index of
provisioning map
scsi_debug: fix initialization of provisioning map
scsi_debug: fix logical block provisioning support

 drivers/scsi/scsi_debug.c | 97 ++++++++++++++++++++++++-----------------------
 1 file changed, 50 insertions(+), 47 deletions(-)
Signature · 1 line
1.8.1.4