Re: [PATCH v9 6/6] block: loop: support DIO & AIO

Ming Lei
2015-08-07T08:26:01Z

On Fri, Aug 7, 2015 at 3:43 AM, Christoph Hellwig <hch@infradead.org> wrote:
> I really disagree with the per-cmd use_dio tracking.

Could you explain it in a bit?

>
> If we know at setup time that the loop device sector size is smaller
> than the sector size of the underlying device we should never allow
> dio, and othewise it should always work for data.

Yes, that is just what I did in v7, and we can only do dio in case
of 512 byte sector size of backing device(not considering the
following patches from Hannes).

When sector size of backing device isn't 512, most of transfer(buffered I/O
and normal dio) is still 4k aligned, that is why I suggest to use per-cmd
use_dio tracking.

The patch avoids the race between buffered io and dio, doesn't it?
The introduced cost is trivial and most of times it needn't to wait for
completion of pending dio.

>
> The ->transfer check also is one to be done at setup time, and there

OK.

> is no need for draining or mode checking for an fsync - FLUSH is always
> only guranteed to flush out I/O that has completed by the time it's
> issued.

Could you point it out in the patch?

Thanks,