From patchwork Fri Sep 16 20:46:57 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Pringlemeir X-Patchwork-Id: 115031 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from merlin.infradead.org (merlin.infradead.org [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 C6C1DB6F97 for ; Sat, 17 Sep 2011 06:49:15 +1000 (EST) Received: from canuck.infradead.org ([2001:4978:20e::1]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1R4fLB-00027t-P7; Fri, 16 Sep 2011 20:48:53 +0000 Received: from localhost ([127.0.0.1] helo=canuck.infradead.org) by canuck.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1R4fLB-00062n-4i; Fri, 16 Sep 2011 20:48:53 +0000 Received: from blu0-omc1-s5.blu0.hotmail.com ([65.55.116.16]) by canuck.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1R4fL8-00062U-OX for linux-mtd@lists.infradead.org; Fri, 16 Sep 2011 20:48:51 +0000 Received: from BLU0-SMTP39 ([65.55.116.8]) by blu0-omc1-s5.blu0.hotmail.com with Microsoft SMTPSVC(6.0.3790.4675); Fri, 16 Sep 2011 13:48:38 -0700 X-Originating-IP: [64.229.136.29] X-Originating-Email: [bpringle@sympatico.ca] Message-ID: Received: from DeadDuck ([64.229.136.29]) by BLU0-SMTP39.phx.gbl over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Fri, 16 Sep 2011 13:48:36 -0700 From: Bill Pringlemeir To: linux-mtd@lists.infradead.org Subject: RomFS MTD and NAND Flash with ECC (EUCLEAN). Date: Fri, 16 Sep 2011 16:46:57 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) MIME-Version: 1.0 X-OriginalArrivalTime: 16 Sep 2011 20:48:37.0078 (UTC) FILETIME=[01D72760:01CC74B2] X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20110916_164850_885557_6CD919F7 X-CRM114-Status: GOOD ( 12.42 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.3.1 on canuck.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [65.55.116.16 listed in list.dnswl.org] 0.0 MSGID_FROM_MTA_HEADER Message-Id was added by a relay X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.12 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 The macro ROMFS_MTD_READ seems to be passing on 'EUCLEAN' to the main RomFs code which doesn't deal with this error code. I think that the 'EUCLEAN' means that my 'mxc_nand' flash driver has performed error correction. I also see that most of the mtd tests change this error code to mean zero. So I think the RomFs MTD code needs something like attached. A large file allows md5sum, cp, etc with this patch. Without, strace shows 'cp' getting an 'EIO' error and giving up. Signed-off-by: Bill Pringlemeir From 349cf90c20c7eabb6a9b215d68ea9c064e55460e Mon Sep 17 00:00:00 2001 From: Bill Pringlemeir Date: Fri, 16 Sep 2011 16:29:41 -0400 Subject: [PATCH] Fix romfs when using an NAND flash MTD. The code '-EUCLEAN' is returned when an NAND mtd has used ECC to correct data. This is fine for the reader of the RomFs and their data is correct. --- fs/romfs/storage.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/fs/romfs/storage.c b/fs/romfs/storage.c index 71e2b4d..4105d1c 100644 --- a/fs/romfs/storage.c +++ b/fs/romfs/storage.c @@ -19,8 +19,10 @@ #endif #ifdef CONFIG_ROMFS_ON_MTD -#define ROMFS_MTD_READ(sb, ...) ((sb)->s_mtd->read((sb)->s_mtd, ##__VA_ARGS__)) - +#define ROMFS_MTD_READ(sb, ...) \ + ({ int res; \ + res = ((sb)->s_mtd->read((sb)->s_mtd, ##__VA_ARGS__)) == -EUCLEAN ? \ + 0 : res; }) /* * read data from an romfs image on an MTD device */ -- 1.7.0.4