scsi: target: tcmu: Add new feature KEEP_BUF
authorBodo Stroesser <bostroesser@gmail.com>
Tue, 13 Jul 2021 17:50:21 +0000 (19:50 +0200)
committerMartin K. Petersen <martin.petersen@oracle.com>
Tue, 3 Aug 2021 11:27:42 +0000 (07:27 -0400)
commit018c14911dd7e2feedd96d440f12ea999e459fff
treefa060361779f78b25235cc4fc5ecba3f7720deb6
parentc11a1ae9b8f65ef7b82a5a1155581a6e6bafa375
scsi: target: tcmu: Add new feature KEEP_BUF

When running command pipelining for WRITE direction commands (e.g. tape
device write), userspace sends cmd completion to cmd ring before processing
write data. In that case userspace has to copy data before sending
completion, because cmd completion also implicitly releases the data buffer
in data area.

The new feature KEEP_BUF allows userspace to optionally keep the buffer
after completion by setting new bit TCMU_UFLAG_KEEP_BUF in
tcmu_cmd_entry_hdr->uflags. In that case buffer has to be released
explicitly by writing the cmd_id to new action item free_kept_buf.

All kept buffers are released during reset_ring and if userspace closes uio
device (tcmu_release).

Link: https://lore.kernel.org/r/20210713175021.20103-1-bostroesser@gmail.com
Reviewed-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Bodo Stroesser <bostroesser@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/target/target_core_user.c
include/uapi/linux/target_core_user.h