On 17/09/20 15:16, Max Reitz wrote: > So is this path ever taken, or can we just replace it all with the ioctl? > > (Before 867eccfed84, this function was used for all host devices, which > might explain why the code even exists.)
Because 867eccfed84 is wrong. If you use /dev/sda* with SG_IO you do need to take into account the hardware max segment size/max segment count. Probably ->sg needs to be set by the front-end, not by the back-end. An even better way (but for which I'd leave the task to you and Kevin) could be to have a new permission BLK_PERM_WRITE_BYPASS and to reduce the limits to the hardware limits if anybody has requested that permission. I tried to implement that a couple years ago but I just couldn't wrap my mind around the permission code. Paolo
