mbox series

[v2,0/6] scsi: target: tcmu: Allow data block size greater than PAGE_SIZE

Message ID 20210324195758.2021-1-bostroesser@gmail.com (mailing list archive)
Headers show
Series scsi: target: tcmu: Allow data block size greater than PAGE_SIZE | expand

Message

Bodo Stroesser March 24, 2021, 7:57 p.m. UTC
I'm resending this series as v2, because the previous patches
partly contained my old email address. So please silently ignore
them.
Sorry for the noise.

V2:
   Changed From and Singed-off-by to contain proper
   email address bostroesser ... gmail

-----

This series is made on top of Martin's for-next branch.

The data area tcmu uses for data transfer to and from userspace
currently is assigned in data blocks of fixed size PAGE_SIZE.
For big data areas this means, that a big bitmap needs to be
searched for free data blocks. It also means, that the data
buffer for a single scsi cmd can consist of pages which are not
consecutive from userspace point of view.
In that case, userspace receives a long list of IO vecs in the
cmd ring, each vec pointing to another part of the cmd's buffer.

The following patches allow to configure data block size as a
multiple of PAGE_SIZE. For compatibility reasons the default
is 1 * PAGE_SIZE.

Memory allocation for the data area is still done in single
pages. So we do not depend on availability of bigger memory
chunks. Since memory is allocated only once and then re-used
for many commands, it does not cause performance issues.

Advantages of big data blocks:
 - bitmap for data block reservation smaller, search of free
   blocks faster and less blocks needed (less searches)
 - Fewer IO vecs in cmd ring
 - If data block size is enhanced to max data tranfer size,
   userspace always receives consecutive data buffers with
   one IO vec only.

Disadvantage:
 - If data block size is big compared to mean size of data
   transfers, memory allocation can be higher compared to
   data block size = PAGE_SIZE.

Remark:
If this patch set is accepted, I probably have to prepare
a change for rtslib-fb to support new UDEV/config param
data_pages_per_blk (UDEV/info: DataPagesPerBlk)

Bodo Stroesser (6):
  scsi: target: tcmu: Adjust names of variables and definitions
  scsi: target: tcmu: Prepare for PAGE_SIZE != DATA_BLOCK_SIZE
  scsi: target: tcmu: Support DATA_BLOCK_SIZE = N * PAGE_SIZE
  scsi: target: tcmu: Remove function tcmu_get_block_page
  scsi: target: tcmu: Replace block size definitions with new udev
    members
  scsi: target: tcmu: Make data_pages_per_blk changeable via configFS

 drivers/target/target_core_user.c | 383 +++++++++++++++++++++++---------------
 1 file changed, 234 insertions(+), 149 deletions(-)