io_uring registered files
io_uring registered files are file references held in a ring-local table and addressed by table index for supported requests.
Identity: IOSQE_FIXED_FILE makes the SQE fd field a registered-table index, not a process file descriptor. Registering process fd 17 in slot 0 therefore makes 0 the fixed-file selector; 17 is not the slot number. [1]
Lifetime: registration takes its own reference to the same open file description, not an independent open with a separate offset. Closing the original process descriptor does not remove that table entry. Requests already holding a resource retain it across replacement; a merely prepared SQE does not freeze the slot's identity. [3] [4]
Updates: the helper reports an updated-entry count or a negative errno. Check it against the requested count. Linux v6.16 removes an old slot before looking up its replacement; failure can leave that slot empty, so an update is not an all-or-nothing transaction. IORING_REGISTER_FILES_SKIP advances the processed count without changing that slot; a positive count is not the number of changed references. [2] [3]
Notifications: replacing a nonzero-tagged resource can produce a CQE carrying its old tag after outstanding uses finish. This is a resource-retirement notification, not the byte count or synchronization result of an I/O request. [1]
Relations
Advantages
- Reduces repeated file-reference management for operations using the registered table.
Limitations
- A direct descriptor selects a ring-local file reference; it does not itself enable O_DIRECT or bypass the page cache. [5]
Citations
- liburing 2.8: io_uring_register(2), registered files and resource tags
- liburing 2.8: io_uring_register_files(3), registration and update return values
- Linux v6.16: io_sqe_files_register, __io_sqe_files_update and io_free_rsrc_node
- Linux v6.16: io_assign_file and io_file_get_fixed
- liburing 2.8: io_uring_prep_openat(3), direct descriptors and ordinary descriptors
Further reading
Sources & caveats
- API and pinned implementation review; no kernel execution, throughput benchmark or persistence experiment was performed.