Skip to content

Comments

Auto buf reg(UBLK_F_AUTO_BUF_REG) for supporting zero copy#19

Merged
ming1 merged 4 commits intomainfrom
auto-buf-reg
Aug 9, 2025
Merged

Auto buf reg(UBLK_F_AUTO_BUF_REG) for supporting zero copy#19
ming1 merged 4 commits intomainfrom
auto-buf-reg

Conversation

@ming1
Copy link
Collaborator

@ming1 ming1 commented Aug 9, 2025

No description provided.

ming1 and others added 4 commits August 9, 2025 13:24
Fix the following build warnings by making the elided lifetimes
explicit in function signatures, as suggested by the compiler:

warning: hiding a lifetime that's elided elsewhere is confusing
   --> src/ctrl.rs:960:18
warning: hiding a lifetime that's elided elsewhere is confusing
   --> src/ctrl.rs:964:22
warning: hiding a lifetime that's elided elsewhere is confusing
   --> src/io.rs:538:32

Signed-off-by: Ming Lei <tom.leiming@gmail.com>
Signed-off-by: Ming Lei <tom.leiming@gmail.com>
Signed-off-by: Ming Lei <tom.leiming@gmail.com>
This commit introduces support for the `UBLK_F_AUTO_BUF_REG` feature.
This allows for automatic registration and unregistration of I/O buffers
with the underlying `io_uring` instance, simplifying the implementation of
ublk server backends.

With this feature, the buffer registration information is encoded into the
`addr` field of the `io_uring` submission queue entry (SQE), avoiding
the need for separate commands to register and unregister buffers. This
can improve performance by reducing the number of `uring_cmd` calls.

Key changes include:
- A new `UBLK_F_AUTO_BUF_REG` device flag to enable the feature.
- `UBLK_U_IO_REGISTER_IO_BUF` and `UBLK_U_IO_UNREGISTER_IO_BUF` ioctls
  to support a fallback path for manual buffer registration.
- A new `submit_io_cmd_with_auto_buf_reg` method in `UblkQueue` to
  handle I/O submission with auto-registration data.
- A comprehensive test suite to validate the new zero-copy functionality,
  including success, failure, and fallback scenarios.

This simplifies the development of zero-copy ublk targets and provides
a more efficient data path.

Switch to reply on io-uring v0.7.4 which can provides
register_buffers_sparse() which is required for supporting auto buffer
registration.

Signed-off-by: Ming Lei <tom.leiming@gmail.com>
@ming1 ming1 merged commit 384c5e3 into main Aug 9, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant