public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH] nandbase performance
@ 2005-09-23 23:29 Peter Grayson
  0 siblings, 0 replies; only message in thread
From: Peter Grayson @ 2005-09-23 23:29 UTC (permalink / raw)
  To: linux-mtd

[-- Attachment #1: Type: text/plain, Size: 215 bytes --]

Here is a patch against nand_base.c that improves partial page read
performance. The patch simply replaces a byte-by-byte copy in a for-loop
with a memcpy() call. Jffs2 does a lot of these partial page reads.

Pete

[-- Attachment #2: mtd-nandbase-performance.patch --]
[-- Type: text/x-patch, Size: 638 bytes --]

diff -uNr mtd/drivers/mtd/nand/nand_base.c mtd-nandbase/drivers/mtd/nand/nand_base.c
--- mtd/drivers/mtd/nand/nand_base.c	2005-09-16 15:30:32.000000000 -0600
+++ mtd-nandbase/drivers/mtd/nand/nand_base.c	2005-09-23 17:21:38.032055488 -0600
@@ -1311,8 +1311,9 @@
 	readdata:
 		/* Partial page read, transfer data into fs buffer */
 		if (!aligned) { 
-			for (j = col; j < end && read < len; j++)
-				buf[read++] = data_poi[j];
+			int bytes_to_copy = min(end - col, (int)len - read);
+			memcpy(&buf[read], &data_poi[col], bytes_to_copy);
+			read += bytes_to_copy;
 			this->pagebuf = realpage;	
 		} else		
 			read += mtd->oobblock;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-09-23 23:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-09-23 23:29 [PATCH] nandbase performance Peter Grayson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox