Re: [PATCH 3/3] xfs: alignment check bio buffers

Ming Lei
2019-08-23T01:19:34Z

On Thu, Aug 22, 2019 at 05:14:40PM -0700, Christoph Hellwig wrote:
> On Thu, Aug 22, 2019 at 06:20:00PM +0800, Ming Lei wrote:
> > In theory, fs bio shouldn't care any DMA limits, which should have been done
> > on splitted bio for doing IO to device.
> >
> > Also .dma_alignment isn't considered in blk_stack_limits(), so in case
> > of DM, MD or other stacking drivers, fs code won't know the accurate
> > .dma_alignment of underlying queues at all, and the stacking driver's
> > queue dma alignment is still 512.
>
> Trying to handling alignment lower down means bounce buffering, so I
> don't think trying to hndle it is a sane idea. I'd be much happier to
> say non-passthrough bios need 512 byte alignment, period. That should
> cover all the sane cases and we can easily check for it. The occasional
> device that would need larger alignment just needs to deal with it.

Yeah, I agree we need to avoid bounce buffer, and it is fine to check
512 simply.

Also we should consider the interface/protocol between fs and block layer,
it could make both sides happy to always align offset & length with logical
block size. And that is reasonable for fs bio.

Thanks,
Ming