Linux 2.1.126 kernel smbfs SMBwrite 2x speed improvement

Jan Kratochvil short at ucw.cz
Sat Oct 31 01:03:30 GMT 1998


Hi

  GNU command 'cp' normally looks for the block size of the destination and
then uses such buffer to copy the file.
  Unfortunately you are settings block size for smbfs filesystems as 512
and using 'cp' then wastefully generates a lot of small (for ethernet) packets.
I was surprised that using 'cat a >/net/b' is almost TWICE as fast than
the traditional 'cp a /net/b' method.
  I changed this constant in smbfs tree and I don't yet see any disadvantages
of such solution.
  All these test were on Linux 2.1.126 copying ->TO-> M$ Windows 98 machine
on 100MBit dedicated full-duplex ethernet. The original rate was ~730KB/s,
now is ~1300KB/s which is still very poor, I'll have to find some further
improvements.
  Also you don't support WriteRaw in kernel smbfs - wouldn't it have slightly
better results?


                                Thanks for a great piece of code,
                                        Jan Kratochvil

CCed to samba at samba.anu.edu.au list.
-------------- next part --------------
--- /tmp/linux/fs/smbfs/proc.c	Mon Oct 26 01:44:37 1998
+++ linux/fs/smbfs/proc.c	Sat Oct 31 02:48:31 1998
@@ -25,6 +25,9 @@
 
 #include <asm/string.h>
 
+#include <asm/page.h>
+#define SMB_ST_BLKSIZE (PAGE_SIZE)
+
 #define SMBFS_PARANOIA 1
 /* #define SMBFS_DEBUG_TIMESTAMP 1 */
 /* #define SMBFS_DEBUG_VERBOSE 1 */
@@ -1224,7 +1227,7 @@
 	fattr->f_nlink = 1;
 	fattr->f_uid = server->mnt->uid;
 	fattr->f_gid = server->mnt->gid;
-	fattr->f_blksize = 512;
+	fattr->f_blksize = SMB_ST_BLKSIZE;
 }
 
 static void
@@ -1234,7 +1237,7 @@
 	if (fattr->attr & aDIR)
 	{
 		fattr->f_mode = server->mnt->dir_mode;
-		fattr->f_size = 512;
+		fattr->f_size = SMB_ST_BLKSIZE;
 	}
 	/* Check the read-only flag */
 	if (fattr->attr & aRONLY)


More information about the samba mailing list