Skip to content

Comments

Compress async#12

Merged
ming1 merged 9 commits intomainfrom
compress-async
Sep 25, 2025
Merged

Compress async#12
ming1 merged 9 commits intomainfrom
compress-async

Conversation

@ming1
Copy link
Collaborator

@ming1 ming1 commented Sep 25, 2025

  • convert compress target into async/.await
  • use smol::unblock() for offloading compress io handling
  • remove offload module
  • convert to new polling & executor APIs
  • depend on libublk 0.4.4 and io-uring 0.7.9

Signed-off-by: Ming Lei <tom.leiming@gmail.com>
…vents

- Update src/null.rs, src/loop.rs, src/vram.rs, and src/zoned.rs
- Use new wait_and_handle_io_events() API for better async integration
- Adopt cleaner pattern with Rc<LocalExecutor> for better memory management
- Move async logic inside executor run block to eliminate borrow checker issues

Signed-off-by: Ming Lei <tom.leiming@gmail.com>
- Remove all offload handler dependencies and sync IO handling
- Convert all IO operations (read, write, flush, discard) to async functions
- Simplify buffer management to use only IoBuf allocation
- Remove support for user_copy, zero_copy, and AUTO_BUF_REG
- Use clean async/await pattern similar to other targets like null.rs
- Remove unused imports and simplify function signatures

Signed-off-by: Ming Lei <tom.leiming@gmail.com>
Signed-off-by: Ming Lei <tom.leiming@gmail.com>
Add CompressQueue struct that contains UblkQueue reference and eventfd
for cross-thread notification. Update handle_compress_io_cmd_async()
to use CompressQueue instead of direct UblkQueue parameter.

Signed-off-by: Ming Lei <tom.leiming@gmail.com>
Rename existing handle_read() to __handle_read() and implement new
async handle_read() that:
- Submits PollAdd SQE on eventfd for notification
- Uses smol::unblock() to offload __handle_read() to thread pool
- Writes to eventfd from closure to notify ublk queue thread

Signed-off-by: Ming Lei <tom.leiming@gmail.com>
Rename existing handle_flush() to __handle_flush() and implement new
async handle_flush() that:
- Submits PollAdd SQE on eventfd for notification
- Uses smol::unblock() to offload __handle_flush() to thread pool
- Writes to eventfd from closure to notify ublk queue thread

Signed-off-by: Ming Lei <tom.leiming@gmail.com>
Add notify_blocking_io_done() method to CompressQueue that encapsulates
the eventfd write operation with proper error handling using anyhow::Result.
Update handle_read() and handle_flush() to use the new method instead of
direct eventfd writes.

Signed-off-by: Ming Lei <tom.leiming@gmail.com>
Now smol::unblock() can work just fine, and not necessary to maintain
the invented wheel any more.

Signed-off-by: Ming Lei <tom.leiming@gmail.com>
@ming1 ming1 merged commit 04412d5 into main Sep 25, 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