ironport/shrapnel — pull request #54 by amitdev (2013-11-04 09:46:13+00:00)
Title: Add asynchronous disk io support on Linux (aio_read/aio_write) through libaio

For most of the cases one can live with blocking io on Linux since it is buffered and
this is useful only if you need direct control of disk io and have your own cache etc.

Asynchronous disk io support in Linux is not as good as in FreeBSD. There are bunch of
options (posix aio, libeio) which uses threads to mimic it. This module uses
libaio which does not need such dependencies and ties the event handling with epoll with
an eventfd.

libaio asynchronous APIs need the offset and size of reads and writes to be
block-aligned (512 bytes on 2.6+ kernels). Consequently this works best when
the caller takes this into consideration. Currently aio_read() supports any
offset/size, but aio_write() needs the offset to be aligned.