Zero Copy writes for Samba

Kuhn, Steven skuhn at qca.qualcomm.com
Wed Feb 26 14:22:30 MST 2014


Hello All,

I have some questions regarding zero copy writes using splice for recvfile for Samba writes.
I am using kernel version OpenWrt 3.4.0 and Samba version 3.6.5.

Has anyone been able to make this work?
Is there a patch that exists to allow splice to be used for recvfile for Samba Writes?

I would like to use zero copy writes for Samba to improve performance.
But it does not seem to work, as I never see any calls to splice happen.

While looking into this, I see that in function sys_recvfile() in file ./lib/recvfile.c,
there exists logic to try to use splice but fall back for older kernels.  For reference,
the following comment:

    /*
     * Older Linux kernels have splice for sendfile,
     * but it fails for recvfile. Ensure we only try
     * this once and always fall back to the userspace
     * implementation if recvfile splice fails. JRA.
     */

This logic is implemented by means of a static bool try_splice_call flag,
that is meant to be set false upon error while using the splice.

But, first issue I see is this flag try_splice_call  is initially set false and so no attempt is ever made to use splice for writes from recvfile.

Second issue I see is if I try to set this flag try_splice_call true initially, the TCP socket is filled and never emptied (the receiver sets it's TCP Window size to 0) before any of the error conditions that exist in the code that set the flag false according to the above mentioned error logic.

Any help or pointers to more info is greatly appreciated.

Thanks and Regards,
Steve




More information about the samba-technical mailing list