[Yaffs] Unexpected erase behavior when rewriting a file on a…

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Peter Barada
Date:  
To: Yaffs
Subject: [Yaffs] Unexpected erase behavior when rewriting a file on a nearly empty YAFFS

I've got YAFFS working on a NOR-based system, and I'm doing some testing
on it. If I start with an erased YAFFS, mount it on /mnt/yaffs, and
then:

# cp /bin/bash /mnt/yaffs
# cp /bin/bash /mnt/yaffs

I see that calls are made to erase the block(s). I'm wondering why? I
thought that when chunks are overwritten, that they are marked as
available for recycling and leave it to the garbage collector to do it.

The callback from yaffs_EraseBlockInNand looks like:

(gdb) where 5
#0  yaffs_EraseBlockInNAND (dev=0xc06a7000, blockInNAND=13)
    at yaffs_guts.c:352
#1  0xc010ee16 in yaffs_BlockBecameDirty (dev=0xc06a7000, blockNo=13)
    at yaffs_guts.c:2118
#2  0xc010fa56 in yaffs_DeleteChunk (dev=0xc06a7000, chunkId=0,
markNAND=1)
    at yaffs_guts.c:2935
#3  0xc01103e4 in yaffs_ResizeFile (in=0xc037c132, newSize=0)
    at yaffs_guts.c:3695
#4  0xc0111374 in yaffs_SetAttributes (obj=0xc037c132, attr=0xc06a7000)
    at yaffs_guts.c:4627
(More stack frames follow...)


I think the issue is the test:

        if(bi->pagesInUse == 0 &&
           bi->blockState == YAFFS_BLOCK_STATE_FULL)
        {
            yaffs_BlockBecameDirty(dev,block);
        }


in yaffs_DeleteChunk. I *think*(but amd not sure) that if this test is
disabled, the block with all its chunks marked dirty will be left alone
until *all* the chunks are written and a garbage collection is forced.

I also think this will spread out writes even more in the filesystem.

Thoughts?

--
Peter Barada <>