Skip to content

Commit

Permalink
scsi_debug: change store from vmalloc to sgl
Browse files Browse the repository at this point in the history
A long time ago this driver's store was allocated by kmalloc() or
alloc_pages(). When this was switched to vmalloc() the author
noticed slower ramdisk access times and more variability in repeated
tests. So try going back with sgl_alloc_order() to get uniformly
sized allocations in a sometimes large scatter gather _array_. That
array is the basis of keeping O(1) access to the store.

Using sgl_alloc_order() and friends requires CONFIG_SGL_ALLOC
so add a 'select' to the Kconfig file.

Remove kcalloc() in resp_verify() as sgl_s can now be compared
directly without forming an intermediate buffer. This is a
performance win for the SCSI VERIFY command implementation.

Make the SCSI COMPARE AND WRITE command yield the offset of the
first miscompared byte when the compare fails (as required by
T10).

This patch depends on: "[PATCH v4 0/4] scatterlist: add new
capabilities".

Signed-off-by: Douglas Gilbert <dgilbert@interlog.com>
  • Loading branch information
doug-gilbert authored and intel-lab-lkp committed Nov 6, 2020
1 parent d63f644 commit 210cfb2
Show file tree
Hide file tree
Showing 2 changed files with 297 additions and 144 deletions.
3 changes: 2 additions & 1 deletion drivers/scsi/Kconfig
Expand Up @@ -1233,13 +1233,14 @@ config SCSI_DEBUG
tristate "SCSI debugging host and device simulator"
depends on SCSI
select CRC_T10DIF
select SGL_ALLOC
help
This pseudo driver simulates one or more hosts (SCSI initiators),
each with one or more targets, each with one or more logical units.
Defaults to one of each, creating a small RAM disk device. Many
parameters found in the /sys/bus/pseudo/drivers/scsi_debug
directory can be tweaked at run time.
See <http://sg.danny.cz/sg/sdebug26.html> for more information.
See <http://sg.danny.cz/sg/scsi_debug.html> for more information.
Mainly used for testing and best as a module. If unsure, say N.

config SCSI_MESH
Expand Down

0 comments on commit 210cfb2

Please sign in to comment.