Am 25.02.2016 um 11:10 hat Alex Pyrgiotis geschrieben: > > I think the first step is understanding what to do about the weird "& > > ~BDRV_SECTOR_MASK" case, then. > > We can discuss about this case in the "dma-helpers: Do not truncate > small qiovs" thread. I'm all for the removal of this check, but I was > hoping that Kevin would clarify if it's still relevant.
I think all of dma-helpers.c is currently sector based, and as long as it is, this code needs to stay. You need to look at it in relation to the divisions by 512 that the same function performs - the block layer simply expects that if you have an I/O request for one sector, your qiov is 512 bytes in length and not 527. So whenever the integer division rounds down, the qiov needs to be trimmed, too. As soon as you convert the whole function to byte granularity (and the block layer does have byte granularity APIs, so that shouldn't be a lot of work), you don't have any implied rounding by integer divisions any more and the qiov trimming can go away as well. Kevin