Commit 6bb5e6e7 authored by Akinobu Mita's avatar Akinobu Mita Committed by Christoph Hellwig

scsi_debug: allow huge transfer length for read/write commands

This change enables to test read/write commands with huge transfer
length such as 1GB.  For example:

	# modprobe scsi_debug dev_size_mb=1024 clustering=1 opts=1
	# cat /sys/block/$DEV/queue/max_hw_sectors_kb > \
		/sys/block/$DEV/queue/max_sectors_kb
	# fio --name=test --rw=write --bs=1g --size=1g --filename=/dev/$DEV \
		--mem=mmaphuge  --direct=1

The data type of max_sectors in scsi_host_template has been extended
to unsigned int by the previous change.  So we can increase it from
0xffff to 0xffffffff to allow such huge transfer length.

Also, this increases sg_tablesize and max_segment_size, otherwise the
maximum transfer length is limited to 64MB.
(sg_tablesize * max_segment_size = 256 * 256KB)
Signed-off-by: default avatarAkinobu Mita <akinobu.mita@gmail.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
Acked by: Douglas Gilbert <dgilbert@interlog.com>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
parent 8ed5a4d2
......@@ -2484,7 +2484,7 @@ static int scsi_debug_slave_configure(struct scsi_device *sdp)
if (sdp->host->cmd_per_lun)
scsi_adjust_queue_depth(sdp, SDEBUG_TAGGED_QUEUING,
sdp->host->cmd_per_lun);
blk_queue_max_segment_size(sdp->request_queue, 256 * 1024);
blk_queue_max_segment_size(sdp->request_queue, -1U);
if (scsi_debug_no_uld)
sdp->no_uld_attach = 1;
return 0;
......@@ -3946,9 +3946,9 @@ static struct scsi_host_template sdebug_driver_template = {
.bios_param = scsi_debug_biosparam,
.can_queue = SCSI_DEBUG_CANQUEUE,
.this_id = 7,
.sg_tablesize = 256,
.sg_tablesize = SCSI_MAX_SG_CHAIN_SEGMENTS,
.cmd_per_lun = 16,
.max_sectors = 0xffff,
.max_sectors = -1U,
.use_clustering = DISABLE_CLUSTERING,
.module = THIS_MODULE,
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment