Skip to content

feat(driver,iour): expose IORING_CQE_F_BUF_MORE through Extra - #1142

Open
lexoliu wants to merge 3 commits into
compio-rs:masterfrom
lexoliu:buf-more
Open

lexoliu wants to merge 3 commits into
compio-rs:masterfrom
lexoliu:buf-more

Conversation

@lexoliu

@lexoliu lexoliu commented Nov 11, 2026 •

Copy link
Copy Markdown

On a buffer ring registered with IOU_PBUF_RING_INC (Linux 6.12), the kernel consumes provided buffers incrementally. When it keeps a buffer for more completions, it sets IORING_CQE_F_BUF_MORE (uapi, v6.12). Extra exposes buffer_id but not this flag (extra/mod.rs), so an op can't tell whether it may give the buffer back, or whether the next completion with the same id continues in it.

This adds Extra::buffer_more() next to buffer_id() and sock_nonempty().

BufferPool itself still assumes each completion uses up a whole buffer. With buffer_pool_flag(IOU_PBUF_RING_INC), the managed ops hand out every completion from the start of the buffer. They also put the buffer back in the ring on drop even while the kernel still holds it. Fixing that means tracking per-buffer offsets in the pool, which is a separate change. This one only makes the flag visible.

The tests receive 5 bytes into a single 4 KiB buffer: buffer_more() is set on an INC ring and clear on a plain one. Both pass on Linux 6.18 and skip where the INC ring can't be registered.

@github-actions github-actions Bot added driver: io-uring About the io-uring driver enhancement New feature or request package: driver Related to compio-driver labels Nov 11, 2026
@Berrysoft

Copy link
Copy Markdown
Member

It seems unsafe to set IOU_PBUF_RING_INC.

cc @George-Miao

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

driver: io-uring About the io-uring driver enhancement New feature or request package: driver Related to compio-driver

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants