On 5/21/19 1:01 AM, Christoph Hellwig wrote: > Hi all, > > we have had a problem for a while where the number of segments that > the bvec iterators will iterate over don't match the value in > req->nr_phys_segments, causing problems for anyone looking at > nr_phys_segments and iterating over bvec directly instead of using > blk_rq_map_sg. The first patch in this series fixes this by > making sure nr_phys_segments matches the actual number of segments. > Drivers using blk_rq_map_sg will still get the lower number returned > from function eventually, but the fact that we don't reduce the > value earlier will not allow some merges that we might otherwise > allow. > > With that in place I also noticed that we do not properly account > segements sizes on devices with a virt_boundary, but it turns out that > segment sizes fundamentally don't make sense for such devices, as their > "segment" is a fixed size "device page", and not a variable sized > scatter/gather elements as in the block layer, so we make that fact > formal. > > Once all that is sorted out it is pretty clear that there is no > good reason to have the front/back segement accounting to start > with. Applied, thanks. -- Jens Axboe