JFFS2 SUMMARY nodes aren't working

Joakim Tjernlund joakim.tjernlund at transmode.se
Fri Mar 23 14:32:31 EDT 2007


On Fri, 2007-03-23 at 18:24 +0100, Joakim Tjernlund wrote:
> On Thu, 2007-03-22 at 14:52 +0100, Joakim Tjernlund wrote:
> > On Thu, 2007-03-22 at 16:36 +0300, Vitaly Wool wrote:
> > > Joakim Tjernlund wrote:
> > > 
> > > >On a fresh JFFS2 root FS image with summary nodes there is no
> > > >difference in mount time when enabling summary support in kernel(2.6.20,
> > > >powerpc).
> > > >  
> > > >
> > > Can you please elaborate on how you got the image with summary nodes?
> > 
> > >From my JFFS2 build script:
> > mkfs.jffs2 -e 0x20000 -b -d jffs2root -o "${JFFS2FILE}.tmp" || exit
> > sumtool -e 0x20000 -b -i "${JFFS2FILE}.tmp" -o "${JFFS2FILE}" || exit
> > 
> > 
> > sumtool --version
> > sumtool: revision 1.9
> > > 
> > > Vitaly
> > > 
> > > 
> 
> I found that an all empty FS took about the same time to mount
> which I find very strange.
> 
> Looking into the code in scan.c I found that even though I have
> cleanmarkers in all EB:s, JFFS2 still scans the whole EB. Do
> you really need to scan the whole area after the cleanmarker?
> Should be enough to only check a few words after the clean marker
> and if that is 0xffffffff then assume that the EB is clean
> since it had a valid clean marker at the beginning.
> 
> Below is the code in scan thats doing the scanning:
> 
>  	more_empty:
> 			inbuf_ofs = ofs - buf_ofs;
> 			(printk(KERN_CRIT "Found empty flash at 0x%08x  0x%08x 0x%08x \n", ofs, inbuf_ofs, buf_len));
> 			while (inbuf_ofs < buf_len) {
> 				if (*(uint32_t *)(&buf[inbuf_ofs]) != 0xffffffff) {
> 					printk(KERN_WARNING "Empty flash at 0x%08x ends at 0x%08x\n",
> 					       empty_start, ofs);
> 					if ((err = jffs2_scan_dirty_space(c, jeb, ofs-empty_start)))
> 						return err;
> 					goto scan_more;
> 				}
> 
> 				inbuf_ofs+=4;
> 				ofs += 4;
> 			}
> 			/* Ran off end. */
> 

This ugly hack makes mount extreamly fast(and I am not using SUMMARY
either):

diff --git a/fs/jffs2/scan.c b/fs/jffs2/scan.c
index b98661a..383fa2c 100644
--- a/fs/jffs2/scan.c
+++ b/fs/jffs2/scan.c
@@ -850,6 +850,9 @@ scan_more:
                                jffs2_link_node_ref(c, jeb, ofs | REF_NORMAL, c
 
                                ofs += PAD(c->cleanmarker_size);
+                               if (*(uint32_t *)(&buf[ofs-buf_ofs]) == 0xfffff
+                                       return BLK_STATE_CLEANMARKER;
+                               }
                        }
                        break;





More information about the linux-mtd mailing list