[PATCHv2 2/2] nvme: remove virtual boundary for sgl capable devices
Christoph Hellwig
hch at lst.de
Sun Aug 10 07:59:47 PDT 2025
> + lim->max_segment_size = UINT_MAX;
> + if (!nvme_ctrl_sgl_supported(ctrl) || admin ||
> + ctrl->ops->flags & NVME_F_FABRICS)
> + lim->virt_boundary_mask = NVME_CTRL_PAGE_SIZE - 1;
> + else
> + lim->virt_boundary_mask = 0;
We start out with a virt_boundary_mask by default, so the else branch
here can go away. This would also benefit from a comment explaining that
we only need the virt_boundary_mask for PRPs, and that as soon as SGLs
are supported for a given queue we don't set it because we don't want to
pay for the overhead it generates.
> if (nvmeq->qid && nvme_ctrl_sgl_supported(&dev->ctrl)) {
> - if (nvme_req(req)->flags & NVME_REQ_USERCMD)
> - return SGL_FORCED;
> - if (req->nr_integrity_segments > 1)
> + if (blk_rq_page_gaps(req) & (NVME_CTRL_PAGE_SIZE - 1) ||
> + nvme_req(req)->flags & NVME_REQ_USERCMD ||
> + req->nr_integrity_segments > 1)
And this would also really benefit from a comment explaining the high
level rationale behind the checks.
More information about the Linux-nvme
mailing list