Skip to content

nvme/util: don't chain a PRP list page that isn't actually needed - #67

Merged
minwooim merged 1 commit into
SamsungDS:mainfrom
minwooim:fix/prplist-overlap
Jul 30, 2026
Merged

nvme/util: don't chain a PRP list page that isn't actually needed#67
minwooim merged 1 commit into
SamsungDS:mainfrom
minwooim:fix/prplist-overlap

Conversation

@minwooim

Copy link
Copy Markdown
Collaborator

nvme_map_prp()/nvme_mapv_prp() build the PRP list through a cursor that chains onto the next page as soon as it reaches a page's last slot and another entry follows. It can't tell whether that next entry is really the last one overall, so whenever the transfer size lands exactly on a page boundary (e.g. a 2047K transfer at a 512B LBA size, which needs almost exactly one page's worth of PRP entries) and the caller provides more than one prplist page as a safety margin, the cursor spills the final entry onto the second page even though the first page had room for it.

Thread through whether the entry being appended is truly the last one, so the cursor can place it directly instead of reserving a chain link that turns out to be unnecessary.

nvme_map_prp()/nvme_mapv_prp() build the PRP list through a cursor that
chains onto the next page as soon as it reaches a page's last slot and
another entry follows. It can't tell whether that next entry is really
the last one overall, so whenever the transfer size lands exactly on a
page boundary (e.g. a 2047K transfer at a 512B LBA size, which needs
almost exactly one page's worth of PRP entries) and the caller provides
more than one prplist page as a safety margin, the cursor spills the
final entry onto the second page even though the first page had room
for it.

Thread through whether the entry being appended is truly the last one,
so the cursor can place it directly instead of reserving a chain link
that turns out to be unnecessary.

Signed-off-by: Minwoo Im <minwoo.im@samsung.com>

@lsgunth lsgunth left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I've reviewed the patch and it looks correct to me. Thanks!

@minwooim
minwooim merged commit c2acee3 into SamsungDS:main Jul 30, 2026
24 of 25 checks passed
iomartin pushed a commit to Eideticom/libvfn-pub that referenced this pull request Aug 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants