Patch for Win95 speed problems
turnerjh at pattern.net
Sat May 29 22:44:02 GMT 1999
Recently I installed Samba at my workplace in order to, what else,
communicate with the Windows boxes there. Like many shops, we're a
linux-for-the-programmers, windows-for-everyone-else shop, so I found
it common that I would both serve files with smbd, and occasionally
upload or download with smbclient. smbd worked perfectly, but when I
used smbclient, the speed was cripplingly slow -- 9k/sec versus
upwards of 1meg/sec downloads from the same machine. Similarly, smbd,
when sending a file to a Win95 machine, had 900k-1meg/sec throughput.
So the problem existed only in smbclient<=>Win95 combinations.
So I checked dejanews and found a large number of reports of the same
or similar problems. I upgraded to linux 2.2.9, samba 2.0.4b
(previously I ran 2.0.3), but to no avail. So I began doing some
straces and found that the writes to the network attempted to write
65520 byte chunks only succeeded in writing about 2100 of those
bytes. So after more testing and pondering, I created the following
patch that solves the problem. Basically it adds a "-b" switch to
smbclient that lets you decide the blocksize used for file transfer
reads and writes.
Not knowing the SMB protocol, I can't say why it's a problem (I assume
it's a problem inside of Win95, as I've not been able to reproduce it
with Win98 or WinNT). Nor can I say veyr well why smbd works but
smbclient doesn't. This patch is very crude; perhaps a better
approach would be to adaptively change the blocksize, and to separate
the network block size from the disk block size (the current do_put
and do_get read from the local drive with the same blocksize as they
transmit over the network).
So, without further adieu, here is a patch that solved the problem.
By using approximately 1008 byte blocks, I achive about 400-450k/sec.
(A quick binary search shows that a blocksize of 1397 bytes gets
450k/sec, while a blocksize of 1398 gets 6.2k/sec, and a blocksize of
65520 gets 9.1k/sec).
The patch is relative to 2.0.4b.
Chip Turner chip at ZFx.com
Programmer, ZFx, Inc. www.zfx.com
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 1600 bytes
Desc: Patch for samba 2.0.4b tp fix Win95 throughput problems
Url : http://lists.samba.org/archive/samba-technical/attachments/19990529/0c61aab6/samba-patch.obj
More information about the samba-technical