Skip to content

Draft: Clean up aio-checksum event loop

Nir Soffer requested to merge hybrid-sources into master

Preparing for hybrid model, supporting sources that needs to monitor file descriptor (nbd) and sources providing completion file descriptor (liblkio).

We want to support these sources:

  • nbd: provide file descriptor for monitoring, need to be notified when the file descriptor become readable or writable to perform io. Starting requests requires a completion callback, and completions are reported via the callback.

  • file: no file descriptor. Starting requests requires a completion callback, and completions are reported via the callback.

  • libblkio: provide file descriptor for notifying completions. No completion callback used when starting requests.

The share behavior is:

  • source may use a completion callback when starting requests
  • source may provide file descriptor for the event loop
  • source may need the change the event on the file descriptor for each iteration
  • source need a callback when file descriptor has events

There are 2 callbacks:

  • notify callback - notify source about events, may trigger completion callbacks
  • complete callback - call source completion api to get completed requests and call completion callback for each request.

Possible unification:

  • keep completion callback in the request
  • send request when starting commands
    • nbd will pass the request completion callback and request as user_data to libnbd
    • blkio will pass the request as user_data
  • single notify callback when source fd has events
    • nbd notify libnbd which may trigger completion callbacks
    • blkio will call completion api and invoke completion callbacks

Current change makes the event loop more generic using poll callbacks. The src_callback is used to notify the source.

Merge request reports