From patchwork Sat Jun 30 20:09:43 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Albrecht_Dre=C3=9F?= X-Patchwork-Id: 168331 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from merlin.infradead.org (unknown [IPv6:2001:4978:20e::2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 8A4AE2C007A for ; Sun, 1 Jul 2012 06:43:42 +1000 (EST) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1Sl4Uh-0003FY-FB; Sat, 30 Jun 2012 20:42:15 +0000 Received: from mail-in-10.arcor-online.net ([151.189.21.50]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1Sl4Ue-0003FK-A1 for linux-mtd@lists.infradead.org; Sat, 30 Jun 2012 20:42:13 +0000 Received: from mail-in-17-z2.arcor-online.net (mail-in-17-z2.arcor-online.net [151.189.8.34]) by mx.arcor.de (Postfix) with ESMTP id 46DA02D6375; Sat, 30 Jun 2012 22:09:53 +0200 (CEST) Received: from mail-in-15.arcor-online.net (mail-in-15.arcor-online.net [151.189.21.55]) by mail-in-17-z2.arcor-online.net (Postfix) with ESMTP id 374B936609C; Sat, 30 Jun 2012 22:09:53 +0200 (CEST) Received: from antares (xdsl-89-0-88-121.netcologne.de [89.0.88.121]) (Authenticated sender: dralbrecht.dress@arcor.de) by mail-in-15.arcor-online.net (Postfix) with ESMTPSA id 2A2FA1AB329; Sat, 30 Jun 2012 22:09:53 +0200 (CEST) X-DKIM: Sendmail DKIM Filter v2.8.2 mail-in-15.arcor-online.net 2A2FA1AB329 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arcor.de; s=mail-in; t=1341086993; bh=Rv3SzNbVSyH0XbZDg3ctWYu45ahwnq41MwkWowDAuQs=; h=Date:From:Subject:To:Cc:In-Reply-To:Message-Id:MIME-Version: Content-Type; b=LVaJh/x+iACgu0sdL0P7egNerCxXKpm+ybMbRE2ixyHSzrXKRWQlBZ39RrE+5hzSb j8AhvxclvpJRyHCvku1qDRpLF63NlpSaIisidAfjW19FZ3brwVZXofJukNx1njnKa3 pi5u8Il5QHVUa3lkhaAb1/XLC0+pl8V4c9NtMugA= Received: from antares (antares [127.0.0.1]) by antares (Postfix) with ESMTPS id 18BC7B404B; Sat, 30 Jun 2012 22:09:51 +0200 (CEST) Date: Sat, 30 Jun 2012 22:09:43 +0200 From: Albrecht =?iso-8859-1?b?RHJl3w==?= Subject: Re: MPC5200b jffs2 memcpy alignment problem To: stephan@gatzka.org In-Reply-To: <4FEF5098.8070602@gatzka.org> (from stephan@gatzka.org on Sat Jun 30 21:16:40 2012) X-Mailer: Balsa 2.4.11 Message-Id: <1341086991.2252.0@antares> MIME-Version: 1.0 X-Spam-Note: CRM114 invocation failed X-Spam-Score: -2.0 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (albrecht.dress[at]arcor.de) -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [151.189.21.50 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Cc: linuxppc-dev@lists.ozlabs.org, linux-mtd@lists.infradead.org X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-mtd-bounces@lists.infradead.org Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Hi Stephan: Am 30.06.12 21:16 schrieb(en) Stephan Gatzka: > I have a problem running jffs2 on an MPC5200b board. I run kernel 3.4, but older kernels like 3.1.5 are also affected. Every time I mount jffs2, previously written content gets garbled. > > The problem was nailed down to memcpy(&fd->name, rd->name, checkedlen); in jffs2_scan_dirent_node in fs/jffs2/scan.c. [snip] > 2. use memcpy_fromio in the jffs2 code. memcpy_fromio behaves exactly in the way I described above. This could be also a good solution because flash access via LocalPlus bus is clearly IO. I don't recall who proposed this patch, but exactly this solution is around for a longer time (mayby you search archives...). On my board, I have a flash chip attached to the LocalBus in 16-bit mode. Based on 3.2.16, the patch is: ---8<---------------------------------------------------------------------------- ---8<---------------------------------------------------------------------------- Works perfectly with it... Hope this helps, Albrecht. --- linux-3.2.16-orig/fs/jffs2/scan.c 2012-04-23 00:31:32.000000000 +0200 +++ linux-3.2.16/fs/jffs2/scan.c 2012-04-27 13:23:06.000000000 +0200 @@ -509,7 +509,11 @@ sumptr = kmalloc(sumlen, GFP_KERNEL); if (!sumptr) return -ENOMEM; +#ifdef CONFIG_PPC_MPC52xx + memcpy_fromio(sumptr + sumlen - buf_len, buf + buf_size - buf_len, buf_len); +#else memcpy(sumptr + sumlen - buf_len, buf + buf_size - buf_len, buf_len); +#endif } if (buf_len < sumlen) { /* Need to read more so that the entire summary node is present */ @@ -1039,7 +1043,11 @@ if (!fd) { return -ENOMEM; } +#ifdef CONFIG_PPC_MPC52xx + memcpy_fromio(&fd->name, rd->name, checkedlen); +#else memcpy(&fd->name, rd->name, checkedlen); +#endif fd->name[checkedlen] = 0; crc = crc32(0, fd->name, rd->nsize);