Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 11 Mar 2005 20:55:07 -0500
From:      Adam Gregoire <ebola@psychoholics.org>
To:        Nate Lawson <njl@FreeBSD.org>
Cc:        cvs-src@FreeBSD.org
Subject:   Re: cvs commit: src/sys/fs/msdosfs msdosfs_conv.c
Message-ID:  <1110592508.32553.5.camel@S0106066606660666.su.shawcable.net>
In-Reply-To: <200503112327.j2BNRkGq052260@repoman.freebsd.org>
References:  <200503112327.j2BNRkGq052260@repoman.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--=-9QKMRVx9Zn/sdhTvbKGi
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

On Fri, 2005-03-11 at 23:27 +0000, Nate Lawson wrote:
> njl         2005-03-11 23:27:46 UTC
> 
>   FreeBSD src repository
> 
>   Modified files:
>     sys/fs/msdosfs       msdosfs_conv.c 
>   Log:
>   The mbnambuf routines combine multiple substrings into a single
>   long filename.  Each substring is indexed by the windows ID, a
>   sequential one-based value.  The previous code was extremely slow,
>   doing a malloc/strcpy/free for each substring.
>   
>   This code optimizes these routines with this in mind, using the ID
>   to index into a single array and concatenating each WIN_CHARS chunk
>   at once.  (The last chunk is variable-length.)
>   
>   This code has been tested as working on an FS with difficult filename
>   sizes (255, 13, 26, etc.)  It gives a 77.1% decrease in profiled
>   time (total across all functions) and a 73.7% decrease in wall time.
>   Test was "ls -laR > /dev/null".
>   
>   Per-function time savings:
>   mbnambuf_init:  -90.7%
>   mbnambuf_write: -18.7%
>   mbnambuf_flush: -67.1%
>   
>   MFC after:      1 month
>   
>   Revision  Changes    Path
>   1.40      +42 -37    src/sys/fs/msdosfs/msdosfs_conv.c
> _______________________________________________
> cvs-src@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/cvs-src
> To unsubscribe, send any mail to "cvs-src-unsubscribe@freebsd.org"

Patch to unbreak compile on amd64, others? Not sure if this is 100%
correct here, yoy will know better then me.

--- /usr/src/sys/fs/msdosfs/msdosfs_conv.c.orig Fri Mar 11 20:47:35 2005
+++ /usr/src/sys/fs/msdosfs/msdosfs_conv.c      Fri Mar 11 20:34:18 2005
@@ -1223,9 +1223,9 @@
	count = WIN_CHARS;
	if (id > nambuf_max_id) {
		count = strlen(name);
-		nambuf_len = id * WIN_CHARS + count;
+		nambuf_len = (size_t)id * WIN_CHARS + count;
		if (nambuf_len > MAXNAMLEN) {
-			printf("msdosfs: file name %d too long\n", nambuf_len);
+			printf("msdosfs: file name %d too long\n", (int)nambuf_len);
			return;
		}
		nambuf_max_id = id;


--=-9QKMRVx9Zn/sdhTvbKGi
Content-Disposition: attachment; filename=patch
Content-Type: text/plain; name=patch; charset=UTF-8
Content-Transfer-Encoding: 7bit

--- /usr/src/sys/fs/msdosfs/msdosfs_conv.c.orig	Fri Mar 11 20:47:35 2005
+++ /usr/src/sys/fs/msdosfs/msdosfs_conv.c	Fri Mar 11 20:34:18 2005
@@ -1223,9 +1223,9 @@
 	count = WIN_CHARS;
 	if (id > nambuf_max_id) {
 		count = strlen(name);
-		nambuf_len = id * WIN_CHARS + count;
+		nambuf_len = (size_t)id * WIN_CHARS + count;
 		if (nambuf_len > MAXNAMLEN) {
-			printf("msdosfs: file name %d too long\n", nambuf_len);
+			printf("msdosfs: file name %d too long\n", (int)nambuf_len);
 			return;
 		}
 		nambuf_max_id = id;

--=-9QKMRVx9Zn/sdhTvbKGi--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1110592508.32553.5.camel>