alinux: block: don't decrement nr_phys_segments for physically contigous segments
fix #29327388 This patch is inspired by commit eded341c085b ("don't decrement nr_phys_segments for physically contigous segments"). Now the ll_merge_requests_fn() will reduces nr_phys_segments by one if the last segment of the previous, and the first segment of the next segment are contigous. But that will mismatch the segment numbers when handling discard request for virtio_block and nvme, moreover if nvme queue selects IO scheduler, that also will mistrigger the single segment optimization in the nvme-pci driver. Thus we should not decrement nr_phys_segments in ll_merge_requests_fn(). But in __blk_recalc_rq_segments(), if we re-calculate the segments of one request, we may get a different segment number, due to it will merge physically contigous segments here. Originally we should simply remove the bvec merging optimization under the assumption that most users already build good enough bvecs, but we do not want to touch so many core logics here, which may introduce more issues. So we can simply not allow to merge contigous segments between 2 bios to fix this issue, and this is not in the fast path, which will not affect the performance. Fixes: dff824b2aadb ("nvme-pci: optimize mapping of small single segment requests"). Signed-off-by: NBaolin Wang <baolin.wang@linux.alibaba.com> Acked-by: NJoseph Qi <joseph.qi@linux.alibaba.com>
Showing
想要评论请 注册 或 登录