public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: linux-mtd@lists.infradead.org
Cc: David Woodhouse <dwmw2@infradead.org>, Jon Smirl <jonsmirl@gmail.com>
Subject: jffs2 and unaligned access
Date: Wed, 7 May 2008 12:27:24 +0200	[thread overview]
Message-ID: <20080507102724.GE4326@pengutronix.de> (raw)

Hi,

memcpy_from/to_io() use word aligned accesses on the io side of memory.
The MPC5200 local plus bus where our flashes are connected does not
allow unaligned accesses, so we have to use the io versions of memcpy.

I have the suspicion that this is not the correct fix to our problem,
but maybe someone can have a look at it and point me in the right
direction.

Thanks,
  Sascha

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>

---
 fs/jffs2/scan.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Index: linux-2.6/fs/jffs2/scan.c
===================================================================
--- linux-2.6.orig/fs/jffs2/scan.c
+++ linux-2.6/fs/jffs2/scan.c
@@ -16,6 +16,7 @@
 #include <linux/pagemap.h>
 #include <linux/crc32.h>
 #include <linux/compiler.h>
+#include <linux/io.h>
 #include "nodelist.h"
 #include "summary.h"
 #include "debug.h"
@@ -506,7 +507,7 @@ static int jffs2_scan_eraseblock (struct
 					sumptr = kmalloc(sumlen, GFP_KERNEL);
 					if (!sumptr)
 						return -ENOMEM;
-					memcpy(sumptr + sumlen - buf_len, buf + buf_size - buf_len, buf_len);
+					memcpy_fromio(sumptr + sumlen - buf_len, buf + buf_size - buf_len, buf_len);
 				}
 				if (buf_len < sumlen) {
 					/* Need to read more so that the entire summary node is present */
@@ -1036,7 +1037,7 @@ static int jffs2_scan_dirent_node(struct
 	if (!fd) {
 		return -ENOMEM;
 	}
-	memcpy(&fd->name, rd->name, checkedlen);
+	memcpy_fromio(&fd->name, rd->name, checkedlen);
 	fd->name[checkedlen] = 0;
 
 	crc = crc32(0, fd->name, rd->nsize);
-- 
Pengutronix e.K. - Linux Solutions for Science and Industry
-----------------------------------------------------------
Kontakt-Informationen finden Sie im Header dieser Mail oder
auf der Webseite -> http://www.pengutronix.de/impressum/ <-

             reply	other threads:[~2008-05-07 10:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-07 10:27 Sascha Hauer [this message]
2008-05-07 10:53 ` jffs2 and unaligned access David Woodhouse
2008-05-07 13:25   ` Sascha Hauer
2008-06-05 21:38     ` Jon Smirl
2008-05-07 20:42   ` Segher Boessenkool
2008-05-08 13:19     ` Detlev Zundel

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=20080507102724.GE4326@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=dwmw2@infradead.org \
    --cc=jonsmirl@gmail.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