Add new command UBLK_U_IO_PREP_IO_CMDS, which is the batch version of UBLK_IO_FETCH_REQ. Add new command UBLK_U_IO_COMMIT_IO_CMDS, which is for committing io command result only, still the batch version. The new command header type is `struct ublk_batch_io`. This patch doesn't actually implement these commands yet, just validates the SQE fields.
Showing the changes to include/uapi (1 of 2 files). Show all
Unified · Split
| @@ -103,6 +103,10 @@ · 102 unmodified lines | ||
| 103 | 103 | _IOWR('u', 0x23, struct ublksrv_io_cmd) |
| 104 | 104 | #define UBLK_U_IO_UNREGISTER_IO_BUF \ |
| 105 | 105 | _IOWR('u', 0x24, struct ublksrv_io_cmd) |
| 106 | +#define UBLK_U_IO_PREP_IO_CMDS \ | |
| 107 | + _IOWR('u', 0x25, struct ublk_batch_io) | |
| 108 | +#define UBLK_U_IO_COMMIT_IO_CMDS \ | |
| 109 | + _IOWR('u', 0x26, struct ublk_batch_io) | |
| 106 | 110 | |
| 107 | 111 | /* only ABORT means that no re-fetch */ |
| 108 | 112 | #define UBLK_IO_RES_OK 0 |
| @@ -544,6 +548,51 @@ struct ublksrv_io_cmd { · 435 unmodified lines | ||
| 544 | 548 | }; |
| 545 | 549 | }; |
| 546 | 550 | |
| 551 | +struct ublk_elem_header { | |
| 552 | + __u16 tag; /* IO tag */ | |
| 553 | + | |
| 554 | + /* | |
| 555 | + * Buffer index for incoming io command, only valid iff | |
| 556 | + * UBLK_F_AUTO_BUF_REG is set | |
| 557 | + */ | |
| 558 | + __u16 buf_index; | |
| 559 | + __s32 result; /* I/O completion result (commit only) */ | |
| 560 | +}; | |
| 561 | + | |
| 562 | +/* | |
| 563 | + * uring_cmd buffer structure for batch commands | |
| 564 | + * | |
| 565 | + * buffer includes multiple elements, which number is specified by | |
| 566 | + * `nr_elem`. Each element buffer is organized in the following order: | |
| 567 | + * | |
| 568 | + * struct ublk_elem_buffer { | |
| 569 | + * // Mandatory fields (8 bytes) | |
| 570 | + * struct ublk_elem_header header; | |
| 571 | + * | |
| 572 | + * // Optional fields (8 bytes each, included based on flags) | |
| 573 | + * | |
| 574 | + * // Buffer address (if UBLK_BATCH_F_HAS_BUF_ADDR) for copying data | |
| 575 | + * // between ublk request and ublk server buffer | |
| 576 | + * __u64 buf_addr; | |
| 577 | + * | |
| 578 | + * // returned Zone append LBA (if UBLK_BATCH_F_HAS_ZONE_LBA) | |
| 579 | + * __u64 zone_lba; | |
| 580 | + * } | |
| 581 | + * | |
| 582 | + * Used for `UBLK_U_IO_PREP_IO_CMDS` and `UBLK_U_IO_COMMIT_IO_CMDS` | |
| 583 | + */ | |
| 584 | +struct ublk_batch_io { | |
| 585 | + __u16 q_id; | |
| 586 | +#define UBLK_BATCH_F_HAS_ZONE_LBA (1 << 0) | |
| 587 | +#define UBLK_BATCH_F_HAS_BUF_ADDR (1 << 1) | |
| 588 | +#define UBLK_BATCH_F_AUTO_BUF_REG_FALLBACK (1 << 2) | |
| 589 | + __u16 flags; | |
| 590 | + __u16 nr_elem; | |
| 591 | + __u8 elem_bytes; | |
| 592 | + __u8 reserved; | |
| 593 | + __u64 reserved2; | |
| 594 | +}; | |
| 595 | + | |
| 547 | 596 | struct ublk_param_basic { |
| 548 | 597 | #define UBLK_ATTR_READ_ONLY (1 << 0) |
| 549 | 598 | #define UBLK_ATTR_ROTATIONAL (1 << 1) |