debugging strategies for jffs2
Adam Wozniak
adam.wozniak at comdev.cc
Fri Feb 1 18:18:30 EST 2002
David Woodhouse wrote:
>
> adam.wozniak at comdev.cc said:
> > > The interesting bit to me is that the csize is 0x0000c000
> > > and the dsize is 0x00000000. Is this perhaps causing problems?
> >
> > At fs/jffs2/gc.c,v 1.52, line 460:
> > fill:
> > ri.magic = JFFS2_MAGIC_BITMASK;
> > ri.nodetype = JFFS2_NODETYPE_INODE;
> > ri.totlen = sizeof(ri);
> > ri.hdr_crc = crc32(0, &ri, sizeof(struct jffs2_unknown_node)-4);
> > ri.ino = inode->i_ino;
> > ri.version = ++f->highest_version;
> > ri.offset = start;
> > ri.csize = end - start;
> > ri.dsize = 0;
> > ri.compr = JFFS2_COMPR_ZERO;
>
> > This seems backwards to me. Shouldn't ri.dsize = end-start and
> > ri.csize = 0 ???
>
> Eep, yes that would probably do it. Well spotted. That obviously wasn't one
> of my more coherent days :)
>
> I've fixed it in v1.61 and v1.52.2.1 (on jffs2-2_4-branch) now - don't chuck
> your filesystem away though, I'll implement a workaround and ask you to test
> it.
Here's the workaround I came up with:
in scan.c:
/* FIXME: Why do we believe totlen? */
DIRTY_SPACE(4);
*ofs += 4;
return 0;
}
// TODO WOZ FIXED
/* older code confused dsize and csize in some cases, fix that
here */
if (ri.dsize == 0 && ri.compr == JFFS2_COMPR_ZERO)
{
ri.dsize = ri.csize;
ri.csize = 0;
ri.node_crc = crc32(0, &ri, sizeof(ri)-8);
}
if (ri.csize) {
/* Check data CRC too */
unsigned char *dbuf;
__u32 crc;
--Adam
--
Adam Wozniak (KG6GZR) COM DEV Wireless - Digital and Software Systems
awozniak at comdev.cc 3450 Broad St. 107, San Luis Obispo, CA 93401
http://www.comdev.cc
Voice: (805) 544-1089 Fax: (805) 544-2055
More information about the linux-mtd
mailing list