Skip to content
Commit b6319569 authored by Steffen Maier's avatar Steffen Maier Committed by Martin K. Petersen
Browse files

scsi: zfcp: fix sysfs block queue limit output for max_segment_size

Since v2.6.35 commit 68322984 ("[SCSI] zfcp: Report scatter-gather
limits to SCSI and block layer"), zfcp set dma_parms.max_segment_size ==
PAGE_SIZE (but without using the setter dma_set_max_seg_size()) and
scsi_host_template.dma_boundary == PAGE_SIZE - 1.

v5.0-rc1 commit 50c2e910 ("scsi: introduce a max_segment_size
host_template parameters") introduced a new field
scsi_host_template.max_segment_size. If an LLDD such as zfcp does not set
it, scsi_host_alloc() uses BLK_MAX_SEGMENT_SIZE = 65536 for
Scsi_Host.max_segment_size. __scsi_init_queue() announced the minimum of
Scsi_Host.max_segment_size and dma_parms.max_segment_size to the block
layer. For zfcp: min(65536, 4096) == 4096 which was still good.

v5.0 commit a8cf59a6 ("scsi: communicate max segment size to the DMA
mapping code") announces Scsi_Host.max_segment_size to the block layer and
overwrites dma_parms.max_segment_size with Scsi_Host.max_segment_size.  For
zfcp dma_parms.max_segment_size == Scsi_Host.max_segment_size == 65536
which is also reflected in block queue limits.

$ cd /sys/bus/ccw/drivers/zfcp
$ cd 0.0.3c40/host5/rport-5:0-4/target5:0:4/5:0:4:10/block/sdi/queue
$ cat max_segment_size
65536

Zfcp I/O still works because dma_boundary implicitly still keeps the
effective max segment size <= PAGE_SIZE.  However, dma_boundary does not
seem visible to user space, but max_segment_size is visible and shows a
misleading wrong value.  Fix it and inherit the stable tag of a8cf59a6

.

Devices on our bus ccw support DMA but no DMA mapping. Of multiple device
types on the ccw bus, only zfcp needs dma_parms for SCSI limits.  So, leave
dma_parms setup in zfcp and do not move it to the bus.

Signed-off-by: default avatarSteffen Maier <maier@linux.ibm.com>
Fixes: 50c2e910

 ("scsi: introduce a max_segment_size host_template parameters")
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent d6724756
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