Native Linux AIO in Samba4
davec-b at rogers.com
Sat Jan 13 17:26:14 GMT 2007
tridge at samba.org wrote:
> I have only rarely used a HFS, but as I understand it they usually
> work like this:
> - read can block, as it may need to fetch data from the backend
And always will block for reads greater than some size X,
where X is the size of the "file head" kept on disk.
X may be 0 for some disk-based HSMs, but is often non-zero
and greater than 257 so that "file" works on a tape-based HSM.
This is almost always too little for Windows files which
happen to have an icon identifying their file-type buried
somewhere after the file header. Windows explorer tends
to want to read these, and drives at least one HSM into
blocking while it refreshes the disk copy, every time
the directory containing the file is displayed (;-()
> 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, [...] 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.
If my leaky memory serves, two HSMs I looked at both had
some method of enquiring if a read was going to block,
albeit I don't think they followed any standard.
David Collier-Brown, | Always do right. This will gratify
System Programmer and Author | some people and astonish the rest
davecb at spamcop.net | -- Mark Twain
More information about the samba-technical