Re: [Qemu-devel] [PATCH][RFC] Linux AIO support when using O_DIRECT

Avi Kivity
2009-03-23T19:35:18Z

Christoph Hellwig wrote:
> On Mon, Mar 23, 2009 at 01:10:30PM -0500, Anthony Liguori wrote:
>
>> I really dislike having so many APIs. I'd rather have an aio API that
>> took byte accesses or have pread/pwrite always be emulated with a full
>> sector read/write
>>
>
> I had patches to change the aio API to byte based access, and get rid
> of the read/write methods to only have the byte based pread/pwrite
> APIs, but thay got obsoleted by Avi's patch to kill the pread/pwrite
> ops. We could put in byte-based AIO without byte-based read/write,
> though. In my patches I put a flag into BlockDriverState whether we
> allow byte-based access to this instance or otherwise emulated it in
> the block layer.

I like this approach. An additional flag could tell us what buffer
alignment the format driver wants, so we can eliminate the alignment
bounce from format driver code. Oh, and a flag to indicate we don't
support vectors, so the generic layer will bounce and send us a length
one iovec.

Note the align flag is in the device state, not the format driver, as it
depends on the cache= settings.

--
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.