Skip to content

Make target send correct io limits

Anastasia Kovaleva linux-scsi target-devel 4 versions – Applied

Status from this message: Applied to 6.2/scsi-queue, thanks!

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest3 patches 2 repliesApplied
  2. v2 posting 2/23 patches 0 repliesSuperseded
  3. v2 posting 1/23 patches 3 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v13 patches3 repliesSuperseded

Changes in v3 from the cover letter

Since the v2 patch series, a kernel bot found some issues with building a kernel for i386. The problem was that division 64 bit number make GCC generate __udivdi3 which is missing on i386.

Patches in v3 Applied

#Subject and filesSizeRepliesApplied
1/3target: core: Send mtl in blocksdrivers/target/target_core_configfs.c drivers/target/target_core_file.c drivers/target/target_core_spc.c +1 more+5 -50 replies
2/3target: core: make hw_max_sectors store the sectors amount in blocksdrivers/target/target_core_iblock.c+3 -10 replies
3/3target: core: Change the way target_xcopy_do_work sets restiction on max iodrivers/target/target_core_xcopy.c drivers/target/target_core_xcopy.h+54 -450 replies

Reviews trailers per patch

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

PatchKonstantin ShelekhinDmitriy BogdanovMike Christie
SeriesR-b
1/3R-b R-b
2/3R-b R-b
3/3R-b R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v3 thread

Cover letter [PATCH v3 0/3] Make target send correct io limits

Currently iblock always reports MAXIMUM TRANSFER LENGTH in 512b units regardless of the LU block size.

Target block size:
target:~ # fdisk -l /dev/nullb0
Disk /dev/nullb0: 250 GiB, 268435456000 bytes, 65536000 sectors
Units: sectors of 1 * 4096 = 4096 bytes
Sector size (logical/physical): 4096 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Initiator block size:
initiator:~ # fdisk -l /dev/sdc
Disk /dev/sdc: 250 GiB, 268435456000 bytes, 65536000 sectors Disk model: nullb0
Units: sectors of 1 * 4096 = 4096 bytes
Sector size (logical/physical): 4096 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 131072 bytes

target max transfer length limit:
target:~ # cat /sys/block/nullb0/queue/max_hw_sectors_kb 128

So the maximum transfer length should be 128 * 1024 / 4096 = 32 blocks But the target sends MTL in 512b units, so the initiators see 256 blocks instead.

initiator:~ # sg_inq -p 0xb0 /dev/sdc
VPD INQUIRY: Block limits page (SBC)
Maximum compare and write length: 1 blocks Optimal transfer length granularity: 1 blocks Maximum transfer length: 256 blocks
Optimal transfer length: 32 blocks
Maximum prefetch transfer length: 0 blocks [ignored]

This happens because MAXIMUM TRANSFER LENGTH field in VPD Block Limits page is derived from dev->dev_attrib.hw_max_sectors which happens to be in 512b units for iblock. This patch series fixes this issue and removes some special-casing for other backstores.

Changes since v1:
Sinse the v1 patch series, some variables was renamed, the checkpatch script was run and issues with debug logs was fixed, some refactoring was done.

Changes since v2:
Since the v2 patch series, a kernel bot found some issues with building a kernel for i386. The problem was that division 64 bit number make GCC generate __udivdi3 which is missing on i386.

Anastasia Kovaleva (3):
target: core: Send mtl in blocks
target: core: make hw_max_sectors store the sectors amount in blocks
target: core: Change the way target_xcopy_do_work sets restiction on
max io

 drivers/target/target_core_configfs.c |  2 -
 drivers/target/target_core_file.c     |  1 -
 drivers/target/target_core_iblock.c   |  4 +-
 drivers/target/target_core_spc.c      |  6 +-
 drivers/target/target_core_xcopy.c    | 97 +++++++++++++++------------
 drivers/target/target_core_xcopy.h    |  2 +-
 include/target/target_core_base.h     |  1 -
 7 files changed, 62 insertions(+), 51 deletions(-)
Signature · 1 line
2.38.1