On Thu, May 16, 2019 at 09:17:04PM +0800, Ming Lei wrote: > ll_merge_requests_fn() is only called from attempt_merge() in case > that ELEVATOR_BACK_MERGE is returned from blk_try_req_merge(). However, > for discard merge of both virtio_blk and nvme, ELEVATOR_DISCARD_MERGE is > always returned from blk_try_req_merge() in attempt_merge(), so looks > ll_merge_requests_fn() shouldn't be called for virtio_blk/nvme's discard > request. Just wondering if you may explain a bit how the change on > ll_merge_requests_fn() in this patch makes a difference on the above > two commits? Good question. I've seen virtio overwriting its range, but I think this might have been been with a series to actually decrement nr_phys_segments for all cases where we can merge the tail and front bvecs. So mainline probably doesn't see it unless someone calls blk_recalc_rq_segments due to a partial completion or when using dm-multipath. Thinking of it at least the latter seems like a real possibily, although a rather unlikely use case. > > Fixes: 297910571f08 ("nvme-pci: optimize mapping single segment requests using SGLs") > > I guess it should be dff824b2aadb ("nvme-pci: optimize mapping of small > single segment requests"). Indeed.