smbclient calls x_fread which in turn does calls x_getc, copying each byte one at a time. This limits write performance, even on a fast Opteron 2.4 GHz. The forthcoming patch accelerates writing to a NetApp FAS 2020 from 36 MB/s with 25% CPU usage to 44 MB/s with 8% CPU usage. Applies cleanly against 3.2.6 and 3.3.0rc1.
Created attachment 3812 [details]
optimize smbclient write performance
Sometimes it's really funny... Right now I'm optimizing smbclient put as well, but more on the network side. Thanks for your patch, I'll look at it v soon!
Pushed a slightly different patch to v3-3-test and v3-2-test. I had already fixed this in the master branch, and for clarity I used that slightly different patch. Also, your patch would not compile on standard C compilers, it contains a variable declaration inside a statement block.
Can you check if http://git.samba.org/?p=samba.git;a=commitdiff;h=e504256f849 also fixes your problem?
Thanks for pinging me :-)