Skip to content

Commit 4e18403

Browse files
old-memoriesaxboe
authored andcommitted
ublk_cmd.h: add one new ublk command: UBLK_IO_NEED_GET_DATA
Add one new ublk command: UBLK_IO_NEED_GET_DATA. It is prepared for a new feature designed for a user application who wants to allocate IO buffer and set IO buffer address only after it receives an IO request from ublksrv. Reviewed-by: Ming Lei <[email protected]> Signed-off-by: ZiyangZhang <[email protected]> Link: https://lore.kernel.org/r/c8a64b6b51c78340da7daa9e1054608695e79619.1659011443.git.ZiyangZhang@linux.alibaba.com Signed-off-by: Jens Axboe <[email protected]>
1 parent 4bf9cbf commit 4e18403

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

include/uapi/linux/ublk_cmd.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,21 @@
3030
* this IO request, request's handling result is committed to ublk
3131
* driver, meantime FETCH_REQ is piggyback, and FETCH_REQ has to be
3232
* handled before completing io request.
33+
*
34+
* NEED_GET_DATA: only used for write requests to set io addr and copy data
35+
* When NEED_GET_DATA is set, ublksrv has to issue UBLK_IO_NEED_GET_DATA
36+
* command after ublk driver returns UBLK_IO_RES_NEED_GET_DATA.
37+
*
38+
* It is only used if ublksrv set UBLK_F_NEED_GET_DATA flag
39+
* while starting a ublk device.
3340
*/
3441
#define UBLK_IO_FETCH_REQ 0x20
3542
#define UBLK_IO_COMMIT_AND_FETCH_REQ 0x21
43+
#define UBLK_IO_NEED_GET_DATA 0x22
3644

3745
/* only ABORT means that no re-fetch */
3846
#define UBLK_IO_RES_OK 0
47+
#define UBLK_IO_RES_NEED_GET_DATA 1
3948
#define UBLK_IO_RES_ABORT (-ENODEV)
4049

4150
#define UBLKSRV_CMD_BUF_OFFSET 0
@@ -56,6 +65,15 @@
5665
*/
5766
#define UBLK_F_URING_CMD_COMP_IN_TASK (1ULL << 1)
5867

68+
/*
69+
* User should issue io cmd again for write requests to
70+
* set io buffer address and copy data from bio vectors
71+
* to the userspace io buffer.
72+
*
73+
* In this mode, task_work is not used.
74+
*/
75+
#define UBLK_F_NEED_GET_DATA (1UL << 2)
76+
5977
/* device state */
6078
#define UBLK_S_DEV_DEAD 0
6179
#define UBLK_S_DEV_LIVE 1

0 commit comments

Comments
 (0)