On Fri, Aug 07, 2020 at 12:02:30PM -0700, Bart Van Assche wrote: > On 2020-08-07 10:10, Keith Busch wrote: > > On Fri, Aug 07, 2020 at 07:18:49AM -0700, Bart Van Assche wrote: > >> Hi Keith, > >> > >> How about replacing your patch with the (untested) patch below? > > > > > > I believe that should be fine, but I broke the kernel last time I did > > something like that. I still think it was from incorrect queue_limits, > > but Linus disagreed. > > > > * http://lkml.iu.edu/hypermail/linux/kernel/1601.2/03994.html > > Hi Keith, > > Thanks for the interesting link. Regarding Linus' comments about bio > splitting: if the last return statement in get_max_io_size() is reached > then it is guaranteed that sectors < pbs (physical block size). So I think > that Linus' comment applies to the previous return statement instead of to > the last ("return max_sectors - start_offset;"). However, I think it is > already guaranteed that that value is a multiple of the logical block size > because start_offset is a multiple of the logical block size and because > of the following statement: "max_sectors &= ~(pbs - 1);". This breaks if limits.max_sectors is not a multiple of the queue's logical block size and the physical block size is larger than max_sectors.