[Yaffs] [PATCH] Fix slow mounts on 512 nand in 2.6.18+ kerne…

Top Page
Attachments:
Message as email
+ (text/plain)
+ yaffs-fix512mounts.patch (text/x-patch)
Delete this message
Reply to this message
Author: Frank Mandarino
Date:  
To: yaffs
Subject: [Yaffs] [PATCH] Fix slow mounts on 512 nand in 2.6.18+ kernels
Hi,

I noticed that mounts slowed down considerably on my system which uses
512 byte NAND last week when I upgraded to Linux 2.6.19-rc6.

I believe the attached patch fixes the situation. The yaffs_mtdif.c
translate_oob2spare() function was added to deal with recent MTD rework,
but it doesn't modify the spare ecc1 and ecc2 fields, so they end up
with garbage values when the structure is returned to
yaffs_TagsCompatabilityReadChunkWithTagsFromNAND().

yaffs_TagsCompatabilityReadChunkWithTagsFromNAND() then compares spare
to a buffer of 0xff's to see if the chunk is used, and the comparison
always indicates that the chunk is in use, even if the nand flash was
just erased.

I'm not sure if this fix has any side-effects (I haven't noticed any) or
if it is the most efficient way to deal with this, but it does reduce
the mount time of a freshly erased 58MB partition from over a minute to
around 2 seconds.

Regards,
../fam
-- 
Frank Mandarino                                fmandarino(a)endrelia.com
Endrelia Technologies Inc.
Toronto, Ontario, Canada

Index: yaffs_mtdif.c
===================================================================
RCS file: /home/aleph1/cvs/yaffs2/yaffs_mtdif.c,v
retrieving revision 1.16
diff -u -r1.16 yaffs_mtdif.c
--- yaffs_mtdif.c    8 Nov 2006 06:24:34 -0000    1.16
+++ yaffs_mtdif.c    29 Nov 2006 14:24:40 -0000
@@ -64,8 +64,10 @@
     spare->tagByte5 = oob[5] == 0xff ? 0xff : oob[5] & 0x3f;
     spare->blockStatus = oob[5] & 0x80 ? 0xff : 'Y';
     spare->pageStatus = oob[5] & 0x40 ? 0xff : 0;
+    spare->ecc1[0] = spare->ecc1[1] = spare->ecc1[2] = 0xff;
     spare->tagByte6 = oob[6];
     spare->tagByte7 = oob[7];
+    spare->ecc2[0] = spare->ecc2[1] = spare->ecc2[2] = 0xff;


     nspare->eccres1 = nspare->eccres2 = 0; /* FIXME */
 }