Native Linux AIO in Samba4

tridge at tridge at
Fri Jan 12 21:07:48 GMT 2007


 > What does HFS mean? I only know of an HP filesystem of that name (and an
 > Apple one, which I don't believe.)

I meant it as a generic term for hierarchical file systems. I should
have explained.

I have only rarely used a HFS, but as I understand it they usually
work like this:

 - have a slow and large backend store. Might be tape or disk.

 - have a smaller and fast frontend store. Holds meta-data and
   recently accessed files.

 - open usually doesn't block, as it can always be served from
   frontend disk.

 - read can block, as it may need to fetch data from the backend

 - write usually doesn't block. Data is staged via the front end (and

 - rename/unlink etc don't block

Compare this to NFS

 - read can block
 - open can block
 - close can block

So for people who, for whatever reason, use Samba on NFS, we need more
operations to be async. On the other hand, read() can take minutes on
a HFS system in extreme cases, so async read is really important.

One thing I've asked Suparna about is to have a way to ask the kernel
"would this read request be satisfied immediately, or will it block?"
so we can choose to only use AIO calls when needed. My preference is
to support the same method as sockets, which is:

 fcntl(fd, F_SETFL, O_NONBLOCK),

(or some other equivalent fcntl flag). So what smbd would do is:

 - when opening a file, set it as O_NONBLOCK
 - always use pread()
 - when pread returns -1/EWOULDBLOCK or -1/EAGAIN then fall back to
   AIO calls

I think that would give us an ideal setup, and we could even have AIO
turned on by default on systems that support it as we pay no overhead
when its not needed.

Cheers, Tridge

More information about the samba-technical mailing list