Skip to content

Support io_uring for file I/O #7266

@mox692

Description

@mox692

This proposal suggests adding support for io_uring in Tokio's file API. The following provides the details of this proposal.

Proposal: https://hackmd.io/@ScaowLCjTCGW9slfxHgVHw/SkRCb0zCkx

Summary

  • This proposal suggests adding support for io_uring in Tokio's file API.
  • Initially, the goal is to transparently replace the file API backend with io_uring from a thread pool. Advanced features such as registered fds or registered buffers will probably be addressed in separate proposal.
  • The application of io_uring to network I/O is outside the scope of this proposal.
  • The implementation will happen incrementally.

Current Status

  • Add initial infrastructure code (Changes to the driver, add cfg, Op future, etc)

  • Implementing actual io_uring operations

    comprehensive list of tokio::fs APIs

    Tier 1: Important APIs that are also used by other APIs, or frequently used

    • OpenOptions::open()
      • Internally used by File::open() and File::create()
    • File::open(), File::create()
      • Internally used by fs::read() and fs::write()
    • statx(2) (Hard to implement Metadada, see fs: support io_uring in fs::metadata (statx) #7616)
      • Required for determining buffer size in fs::read() and for the fs::metadata() API
    • fs::write()
      • Frequently used API
      • Can be supported once open is implemented
    • fs::read()
      • Frequently used API
      • Can be implemented once open and fstat are supported

    Tier 2: APIs that depend on Tier 1 APIs or are considered less frequently used

    • fs::copy()
    • Directory-related APIs (Unlike files, all directory operations seem to go through DirBuilder)
      • DirBuilder
      • create_dir()
      • create_dir_all()
      • fs::read_dir()
    • fs::set_permissions()
    • ... and other APIs
  • Further improvements, such as:

    • Sharding rings in the multi-threaded runtime
    • Smarter batching logic for submission
    • Exploring the possibilities of using advanced features, such as registered buffers or registered files

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-tokioArea: The main tokio crateC-feature-requestCategory: A feature request.M-fsModule: tokio/fs

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions