public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Peter Grayson <pgrayson@realmsys.com>
To: linux-mtd@lists.infradead.org
Subject: [PATCH] nandbase performance
Date: Fri, 23 Sep 2005 17:29:14 -0600	[thread overview]
Message-ID: <1127518154.6937.42.camel@localhost.localdomain> (raw)

[-- 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;

                 reply	other threads:[~2005-09-23 23:29 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1127518154.6937.42.camel@localhost.localdomain \
    --to=pgrayson@realmsys.com \
    --cc=linux-mtd@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox