Re: [PATCHv4 8/9] block: relax direct io memory alignment

Eric Biggers
2022-05-26T18:13:57Z

On Thu, May 26, 2022 at 07:50:45AM -0600, Keith Busch wrote:
> On Thu, May 26, 2022 at 12:29:41AM -0700, Eric Biggers wrote:
> > On Wed, May 25, 2022 at 06:06:12PM -0700, Keith Busch wrote:
> > > + /*
> > > + * Each segment in the iov is required to be a block size multiple.
> >
> > Where is this enforced?
>
> Right below the comment. If it isn't a block size multiple, then ALIGN_DOWN
> will eventually result in 0 and -EFAULT is returned.

That's interesting, I would have expected it to be checked in
blkdev_dio_aligned().

EFAULT isn't the correct error code for this case; it should be EINVAL as is
normally the case for bad alignment. See the man pages for read and write.

- Eric