[jcifs] Large Read/Write Patch

Dmytro Polivenok polivenok at yandex.ru
Tue Jul 19 04:40:50 MDT 2011

Hi Guys,

We have noticed that on Windows 7 we experience low transfer rate for read/write operations (4x slower than using native client) and using wireshark we found jcifs used 4K buffer even when we set snd/rcv buffer sizes and windows client used 64K. The reason of low 4K buffer was that it is default value for MaxBufferSize on windows samba server.

For normal SMB_COM_READ and SMB_COM_WRITE requests, the maximum buffer size is always equal to MaxBufferSize. But if CAP_LARGE_READX  or CAP_LARGE_WRITEX  capability is enabled on the SMB Negotiate Server Response,he maximum buffer size  used  is  61440 (60K)  for large read( SMB_COM_ READ_ANDX )  and 65535 (64K) for large write (SMB_COM_WRITE_ANDX) , regardless of MaxBufferSize.

More info can be found here:

With old LargeReadWrite.patch we had an issue with checking large/read write capability on linux samba server 3.5.4 so code for this check was modified a bit.

Below you can find some result for smb server with enabled large read/write:
jcifs-1.3.16                    ~2.5 M/s
jcifs-1.3.16 with patch    ~9M/s
Native client read/write  ~9.5M/s

Modified patch for 1.3.16 is attached. Hope it will be helpful,

Best Regards,
Dmytro Polivenok
-------------- next part --------------
A non-text attachment was scrubbed...
Name: LargeReadWrite.patch
Type: application/octet-stream
Size: 6182 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/jcifs/attachments/20110719/e4ee0c90/attachment.obj>

More information about the jCIFS mailing list