Skip to content

Support non-contiguous multi-extent files on the CPU/P2P read path - #11

Merged
karlowich merged 2 commits into
xnvme:mainfrom
karlowich:fix/cpu-noncontiguous-extents
Jul 8, 2026
Merged

Support non-contiguous multi-extent files on the CPU/P2P read path#11
karlowich merged 2 commits into
xnvme:mainfrom
karlowich:fix/cpu-noncontiguous-extents

Conversation

@karlowich

Copy link
Copy Markdown
Collaborator

Reworks the CPU/P2P read path so it can read files whose extents are not physically contiguous, instead of bailing out with ENOTSUP. Also hardens the path against a misconfigured iosize that previously caused a hang and a divide-by-zero.

karlowich added 2 commits July 8, 2026 12:51
Rework the CPU/P2P read path to read files whose extents are not
physically contiguous, instead of bailing out with ENOTSUP.

For each file, coalesce physically-adjacent extents into runs and submit
each run in iosize-sized commands (_submit_run), advancing the buffer
pointer across runs so the file lands contiguously in memory. A tail
command shorter than iosize is now handled, dropping the old
divisibility requirement.

This also simplifies the path: the _work/_range cooperative state
machine and the per-device slbas/elbas arrays (struct fil_cpu_io) are
gone. The completion callback (fil_io_cb) is now a plain reaper that
tallies errors into device->io_errors, registered once per queue in
_xnvme_setup rather than on every batch.

_submit_device always drains the queue before returning, including on
the error path, so no outstanding command is left referencing a buffer.

Note: prep_time is no longer reported for CPU/P2P; extent resolution is
now interleaved into submission and folded into io_time.

Signed-off-by: Karl Bonde Torp <k.torp@samsung.com>
The CPU/P2P submit path computed io_nblocks = iosize / blocksize without
checking that iosize is a multiple of the device LBA size, as the GPU
path already does. A misconfigured iosize smaller than the LBA size
yields io_nblocks == 0, hanging _submit_run and dividing by zero in
_flush_run. Reject it up front with EINVAL, mirroring fil_gpu_submit.

Signed-off-by: Karl Bonde Torp <k.torp@samsung.com>
@karlowich
karlowich requested a review from naddinadja July 8, 2026 12:42

@naddinadja naddinadja left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good :)

@karlowich
karlowich merged commit bff4e42 into xnvme:main Jul 8, 2026
1 check passed
@karlowich
karlowich deleted the fix/cpu-noncontiguous-extents branch July 8, 2026 13:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants