[Samba] sendfile

Learner Study learner.study at gmail.com
Thu Jan 7 14:34:51 MST 2010

I just checked the manpage for 2.6.25 and it says the same. So, we are
out of luck ;-(

Ok, so read (i.e. reading from disk and sending to socket) uses
sendfile() but write involves two copies.

So, read performance should be way higher than write performance. What
I notice is read is same as write in my case (have tried 3.0.21 and
3.0.25). Any ideas what could be causing that?

Thanks for your time and help!

PS: I would study sendfile in later linux versions and let you know if
I find anything interesting.

On Thu, Jan 7, 2010 at 4:23 PM, Volker Lendecke
<Volker.Lendecke at sernet.de> wrote:
> On Thu, Jan 07, 2010 at 04:05:35PM -0500, Learner Study wrote:
>> 1. sendfile() takes a input-fd and out-fd so why can't that be used
>> for WRITE operation (i.e. reading from socket fd on network side and
>> writing to file fd towards the disk).
> The manpage for sendfile that I right now have at hand says:
>       Presently  (Linux  2.6.9):  in_fd, must correspond to a file which sup-
>       ports mmap(2)-like operations (i.e., it cannot be a socket); and out_fd
>       must refer to a socket.
> If you have any pointers that this has changed in recent
> versions of Linux or any other Unix, please give me a
> pointer to it!
>> 2. Without sendfile() (in WRITE operation), data is read from socket
>> in user space before being written back to the disk (kernel space).
>> So, there are two copies (one during socket read and second during
>> disk write).
>> Is that correct understanding?
> Yes. This is exactly what we have tried to tune away by
> using splice, but as Samba so far is a single-threaded
> daemon, this very quickly leads to a deadlock.
> Volker

More information about the samba-technical mailing list