[Samba] sendfile

Learner Study learner.study at gmail.com
Thu Jan 7 14:05:35 MST 2010

Hi Volker:

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).

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?

Thanks a lot!

On Wed, Dec 23, 2009 at 4:33 AM, Volker Lendecke
<Volker.Lendecke at sernet.de> wrote:
> On Tue, Dec 22, 2009 at 06:19:52PM -0800, Learner Study wrote:
>> I understand from the samba code (3.0.25) that we use sendfile during
>> client's Read operation. Is there a reason for not using the same for
>> write operation? Is it to do with header processing etc.
> Under Linux, I have not yet found a recvfile function. There
> is splice, but at least until recently this was only usable
> in multi-threaded applications which Samba is not. In
> current Samba there is code to use recvfile when it is
> available, and a not-used version of splice code.
> Volker
> Version: GnuPG v1.4.9 (GNU/Linux)
> =GyRP

More information about the samba-technical mailing list