[Samba] sendfile

Volker Lendecke Volker.Lendecke at SerNet.DE
Thu Jan 7 14:23:04 MST 2010


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20100107/7e4cef43/attachment.pgp>


More information about the samba-technical mailing list