Re: [Yaffs] Yaffs Direct problem

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Charles Manning
Date:  
To: yaffs
Subject: Re: [Yaffs] Yaffs Direct problem
On Tuesday 20 November 2007 21:42:58 Zavi wrote:
> thank you for your quick reply.
> But I'm afraid that didn't help at all.


I had a bit deeper look at this and see that there are a few other changes
that are needed.

I expect that all or most of this problem is due to the way the tnodes work.
tnodes are variable length structures that hold either:
* 8 pointers to other tnodes
* 16 bitfields (minimum width 16 bits) holding chunkIds.

With 32-bit pointers, the pointer variant is never bigger than the bit field
variant so all allocations and zeroing can be done using the size of the
bitfield variant. However with 64-bit pointers this is no longer the case and
the allocations and clearing will not work properly because the tnode variant
is larger.

The patch I flicked out yesterday will fix the allocation part, but the memset
in yaffs_GetTnode() will also need to be fixed to fully zero out the
pointers. eg something like:

       if(tn){
                memset(tn, 0, (dev->tnodeWidth * YAFFS_NTNODES_LEVEL0)/8);
                memset(tn, 0, sizeof(yaffs_Tnode));
       }




>
> When I tried running the non-patched version on a 32-bit machine it worked
> fine. Well "fine" is an exaggeration. Some of the tests produce unclear
> outputs, some of the tests must be reconfigured to flash/flash path
> instead of /flash. But in general it works ok, on a 32-bit machine.


The list of tests, and their configuration have changed as the tests have
evolved. Each new test was added to test certain things. Directory names etc
have changed and older tests will not run unless tweaked.

I am off for a few days and cannot look into this more right now. Try fixing
yaffs_GetTnode() and see if that fixes things.

>
> On Nov 18, 2007 9:59 PM, Charles Manning <> wrote:
> > On Monday 19 November 2007 05:40:01 Zavi wrote:
> > > I'm trying to compile Yaffs direct on a 64-bit linux machine in the
> > > emulation mode, using the Makefile in the direct sub-directory.
> > >
> > > 1. When I tried to run the default test in direct/dtest.c-
> > > resize_stress_test_no_grow("/flash/flash",20);
> > >
> > > I got an error message: "yaffs_Tnode should be 32 but is 64."
> > > When I change the following line
> > > #define YAFFS_NTNODES_INTERNAL                (YAFFS_NTNODES_LEVEL0 /
> > > 2) to
> > > #define YAFFS_NTNODES_INTERNAL                (YAFFS_NTNODES_LEVEL0 /
> > > 4) the test executes fine. Could the problem have something to do with
> > > the fact my machine is 64-bit?

> >
> > I expect so. I don't think you should try to fix it like this though.
> >
> > The problem is most likely due to the tnode allocations not being wide
> > enough to hold 64-bit pointers. Try this patch instead.
> >
> > --- yaffs_guts.c.old       2007-11-19 08:48:44.000000000 +1300
> > +++ yaffs_guts.c        2007-11-19 08:48:44.000000000 +1300
> > @@ -1146,6 +1146,10 @@
> >          * Must be a multiple of 32-bits  */
> >         tnodeSize = (dev->tnodeWidth * YAFFS_NTNODES_LEVEL0)/8;

> >
> > +       if(tnodeSize < sizeof(yaffs_Tnode))
> > +               tnodeSize = sizeof(yaffs_Tnode);
> > +
> > +
> >         /* make these things */

> >
> >         newTnodes = YMALLOC(nTnodes * tnodeSize);

> >
> > > 2. Even after this I'm still having problems with all the following
> > > tests (last tests in dtest.c) -
> > > long_test_on_path("/ram2k");
> > > long_test_on_path("/flash");
> > > simple_rw_test("/flash/flash");
> > > fill_disk_test("/flash/flash");
> > > rename_over_test("/flash");
> > > ...
> > >
> > > I keep getting a segmentation fault, and trying to trace it led me to
> > > the return statement of yaffs_write for no apparent reason.
> > > What could be the reason? can it be it's again related to the 64-bit
> > > issue?
> >
> > I think it was most likely caused by the way you tried to fix it.
> >
> > Try the above patch instead. Please get back to me as to how this works.
> >
> > -- CHarles
> >
> > _______________________________________________
> > yaffs mailing list
> >
> > http://lists.aleph1.co.uk/cgi-bin/mailman/listinfo/yaffs
>
> _______________________________________________
> yaffs mailing list
>
> http://lists.aleph1.co.uk/cgi-bin/mailman/listinfo/yaffs