libublk: add UblkQueue::complete_io_cmd_with_auto_buf_reg() and ::sub…#23
Merged
libublk: add UblkQueue::complete_io_cmd_with_auto_buf_reg() and ::sub…#23
Conversation
…mit_fetch_commands_with_auto_buf_reg() Added Methods 1. UblkQueue::complete_io_cmd_with_auto_buf_reg() This method provides zero-copy IO completion for non-async/await cases when UBLK_F_AUTO_BUF_REG is enabled. Key features: - Takes tag, buf_reg_data: &sys::ublk_auto_buf_reg, and res: Result<UblkIORes, UblkError> - Supports all the same result types as the regular complete_io_cmd() method - Handles fat completion features (batch and zoned append) - Uses auto buffer registration data to avoid manual buffer management 2. UblkQueue::submit_fetch_commands_with_auto_buf_reg() Location: src/io.rs:1023-1049 This method initializes the queue with auto buffer registration for zero-copy operations. Key features: - Takes buf_reg_data_list: &[sys::ublk_auto_buf_reg] for each queue depth slot - Validates that auto buffer registration is supported - Ensures the provided list has enough entries for all queue slots - Uses the internal __queue_io_cmd() method with auto buffer address encoding Implementation Details Both methods: - Use the existing bindings::ublk_auto_buf_reg_to_sqe_addr() function to encode buffer registration data - Leverage the existing __queue_io_cmd() infrastructure with the sqe_addr parameter - Follow the same patterns as the async versions (submit_io_cmd_with_auto_buf_reg) - Include proper documentation and safety assertions Also add test case for covering the added APIs. Signed-off-by: Ming Lei <tom.leiming@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…mit_fetch_commands_with_auto_buf_reg()
Added Methods
This method provides zero-copy IO completion for non-async/await cases when UBLK_F_AUTO_BUF_REG is enabled. Key features:
Location: src/io.rs:1023-1049
This method initializes the queue with auto buffer registration for zero-copy operations. Key features:
Implementation Details
Both methods:
Also add test case for covering the added APIs.