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

Christoph Hellwig
2019-08-23T00:14:43Z

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.

> Also suppose the check is added, I am a bit curious how fs code handles the
> failure, so could you explain a bit about the failure handling?

Even just an assert is a a start. But a bio_add_page variant with
saner return value semantic would be helpful, and I have some ideas
there that I need to try out first.