Conversation
Collaborator
ming1
commented
Sep 21, 2025
- deprecate uring_op(), uring_op_mut() and get_inflight_nr_io()
- support UblkFlags::UBLK_DEV_F_NO_IO_STAT
- optimize: cache dev.dev_info.flags in UblkQueue for performance
- simplify wait_and_handle_io using flush_and_wake_io_tasks
Align with `cargo fmt`, otherwise it often causes big unnecessary diff. Signed-off-by: Ming Lei <tom.leiming@gmail.com>
- Change flush_and_wake_io_tasks closure type from Fn to FnMut for flexibility - Implement wait_and_handle_io using flush_and_wake_io_tasks with mutable closure variable to track first CQE - Remove process_ios and reap_one_event functions (no longer needed) - Remove individual state update logic from handle_cqe (batch updates are handled by flush_and_wake_io_tasks) - Remove unused dec_cmd_inflight and update_state methods This simplifies the code by eliminating duplicate state management and improving code reuse while maintaining backward compatibility. Signed-off-by: Ming Lei <tom.leiming@gmail.com>
Split __queue_io_cmd into __queue_io_cmd_no_state and __queue_io_cmd to improve code organization and reduce state access in the core I/O command queueing logic. Signed-off-by: Ming Lei <tom.leiming@gmail.com>
Target code can more easily track inflight IOs themselves rather than relying on this library function. 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>
Simplify device_handler_async() implementation by accepting UblkFlags directly instead of a boolean mlock_fail parameter. This eliminates conditional flag construction logic and makes the interface cleaner. Changes: - Change function signature from device_handler_async(mlock_fail: bool) to device_handler_async(dev_flags: UblkFlags) - Remove conditional flag construction in UblkCtrlBuilder - Update mlock failure check to use dev_flags.contains() - Update all callers to pass appropriate UblkFlags combinations Signed-off-by: Ming Lei <tom.leiming@gmail.com>
Create a shared test_helpers module to eliminate code duplication of async test functions across different test modules. This enables better code reuse and consistency in async device testing. Changes: - Add src/test_helpers.rs with shared async test utilities: * io_async_fn() - async I/O function for null device testing * q_async_fn() - queue async function for spawning I/O tasks * device_handler_async() - complete async device handler * ublk_join_tasks() - utility for managing task execution - Update lib.rs to include test_helpers module with cfg(test) - Refactor ctrl_async.rs to use shared functions instead of local copies - Add example usage in io.rs demonstrating cross-module sharing - All existing tests continue to work unchanged Benefits: - Eliminates duplication of complex async test logic - Provides consistent test patterns across modules - Enables easy addition of new shared test utilities - Improves maintainability with single source of truth Signed-off-by: Ming Lei <tom.leiming@gmail.com>
Add UblkQueue::need_update_state() helper method to determine when queue state updates are required. Only update state when UBLK_DEV_F_MLOCK_IO_BUFFER is set or when zero copy/user copy modes are enabled. Changes: - Add always-inline need_update_state() helper method - Conditionally call inc_cmd_inflight() in __queue_io_cmd() - Conditionally call mark_stopping() in update_state_batch() This optimization reduces mutex contention and improves performance in scenarios where queue state tracking is not necessary. Signed-off-by: Ming Lei <tom.leiming@gmail.com>
Cache dev.dev_info.flags as UblkQueue::dev_flags (u64) and use cached value in UblkQueue methods instead of repeatedly accessing dev.dev_info.flags. Changes: - Add dev_flags: u64 field to UblkQueue struct - Initialize dev_flags in UblkQueue::new() - Replace self.dev.dev_info.flags with self.dev_flags in queue methods - Improves performance by eliminating repeated pointer dereferencing 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.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.