aio_read template.

James Peach jpeach at sgi.com
Wed Jun 8 01:20:37 GMT 2005


On Tue, Jun 07, 2005 at 07:56:07AM -0400, David Collier-Brown wrote:
> Jeremy Allison wrote:
> >Volker,
> >
> >	Here is a template for the way we'd use aio_read within Samba3.
> >Seems to work well on 2.6 kernels. It's a standalone program that will
> >copy a file using aio_read. The one thing I haven't coped with is a 
> >short read from aio_read (not an EOF read, but just reading less bytes
> >than we asked for). I'm not sure if this is possible with the aio_read
> >interface but thought I'd just warn you....
> 
> 	Solaris carefully avoids guaranteeing no short reads,
> 	but tries to ensure they can't happen.
> 
> 	POSIX says If the aiocb is invalid or if no asynchronous 
> 	I/O operation is enqueued for the aiocb, aio_return() 
> 	returns -1 and errno is set to indicate the error. Otherwise, 
> 	aio_return() returns the error status of the referenced aiocb. 
> 
> 	The POSIX error status appear to be errno values, specifically 
> 	including EINPROGRESS, so it looks like POSIX guarantees no 
> 	short reads, and both Linus and the Solarii try to follow 
> 	that standard. A "can't happen" message might be good
> 	for systems that don't follow the standard, though.

Once the IO is successfully queued, it's a not quite clear whether you
can get an arbitrary read(2) return value without errno being set. On
IRIX, aio_read(3) flat our states that the result can be any read(2)
return value. So, I'd hesitate at saying that no short reads are
guaranteed.

Jeremy, do you have a specific workload where using aio would help?

-- 
James Peach | jpeach at sgi.com | SGI Australian Software Group
I don't speak for SGI.


More information about the samba-technical mailing list