Re: [PATCH] xfs: allocate sector sized IO buffer via page_frag_alloc

Matthew Wilcox
2019-02-26T13:04:17Z

On Tue, Feb 26, 2019 at 08:35:46PM +0800, Ming Lei wrote:
> On Tue, Feb 26, 2019 at 04:12:09AM -0800, Matthew Wilcox wrote:
> > On Tue, Feb 26, 2019 at 07:12:49PM +0800, Ming Lei wrote:
> > > The buffer needs to be device block size aligned for dio, and now the block
> > > size can be 512, 1024, 2048 and 4096.
> >
> > Why does the block size make a difference? This requirement is due to
> > some storage devices having shoddy DMA controllers. Are you saying there
> > are devices which can't even do 512-byte aligned I/O?
>
> Direct IO requires that, see do_blockdev_direct_IO().
>
> This issue can be triggered when running xfs over loop/dio. We could
> fallback to buffered IO under this situation, but not sure it is the
> only case.

Wait, we're imposing a ridiculous amount of complexity on XFS for no
reason at all? We should just change this to 512-byte alignment. Tying
it to the blocksize of the device never made any sense.