On Mon, Jan 05, 2026 at 05:57:41PM -0700, Caleb Sander Mateos wrote: > From: Stanley Zhang <[email protected]> > > Add a function ublk_copy_user_integrity() to copy integrity information > between a request and a user iov_iter. This mirrors the existing > ublk_copy_user_pages() but operates on request integrity data instead of > regular data. Check UBLKSRV_IO_INTEGRITY_FLAG in iocb->ki_pos in > ublk_user_copy() to choose between copying data or integrity data. > > Signed-off-by: Stanley Zhang <[email protected]> > [csander: change offset units from data bytes to integrity data bytes, > test UBLKSRV_IO_INTEGRITY_FLAG after subtracting UBLKSRV_IO_BUF_OFFSET, > fix CONFIG_BLK_DEV_INTEGRITY=n build, > rebase on ublk user copy refactor] > Signed-off-by: Caleb Sander Mateos <[email protected]> > --- > drivers/block/ublk_drv.c | 52 +++++++++++++++++++++++++++++++++-- > include/uapi/linux/ublk_cmd.h | 4 +++ > 2 files changed, 53 insertions(+), 3 deletions(-) >
... > diff --git a/include/uapi/linux/ublk_cmd.h b/include/uapi/linux/ublk_cmd.h > index c1103ad5925b..3af7e3684834 100644 > --- a/include/uapi/linux/ublk_cmd.h > +++ b/include/uapi/linux/ublk_cmd.h > @@ -132,10 +132,14 @@ > #define UBLK_MAX_NR_QUEUES (1U << UBLK_QID_BITS) > > #define UBLKSRV_IO_BUF_TOTAL_BITS (UBLK_QID_OFF + UBLK_QID_BITS) > #define UBLKSRV_IO_BUF_TOTAL_SIZE (1ULL << UBLKSRV_IO_BUF_TOTAL_BITS) > > +/* Copy to/from request integrity buffer instead of data buffer */ > +#define UBLK_INTEGRITY_FLAG_OFF UBLKSRV_IO_BUF_TOTAL_BITS > +#define UBLKSRV_IO_INTEGRITY_FLAG (1ULL << UBLK_INTEGRITY_FLAG_OFF) UBLKSRV_IO_INTEGRITY_FLAG is actually one flag, not same with other encoded fields, maybe it is better to define it from top bit(62) and not mix with others? Then it can be helpful to extend in future. Thanks, Ming
