[Yaffs] data blocks lost between unmount and mount

Charles Manning manningc2 at actrix.gen.nz
Tue Oct 4 21:14:38 BST 2005


On Wednesday 05 October 2005 04:51, Blair Barnett wrote:

> The system has four partitions on the NAND (kernel image, root,
> application, spare). After booting up and mounting root, application and
> the spare partition, I create a file in the spare partition. Size
> doesn't matter in this case. :-) A df command reveals that indeed some
> blocks have been allocated to this file and all is well. Now if I remove
> the file, a df command shows that indeed the blocks have been returned
> to the free list (I know this is not exactly the case as the blocks have
> all been "soft deleted" and waiting for GC). Now if I create another
> file, the aforementioned blocks get GC'ed and df again shows that all is
> right with the file system. If, however, I remove a file, then unmount
> the file system, then mount it, df shows that the blocks the were "soft
> deleted" are now marked as used (never to be returned to the free list,
> as far as my tests show).

Someone reported something similar recently, but did not seem to have come 
back with the requested debug info.

I will do some investigation anyway.

After you have deleted a file (even if it is only soft deleted), this is free 
space from a user perspective and should show up as being available under df.
mount/unmount should not change df status.

ie
You should observe something like:

* df. Shows 5MB free
* dd to create a 1MB file
*df. Shows 4MB free
* rm file.
* df shows 5MB free.

The only valid reason for df showing something else is if blocks got lost due 
to being retired because they had ECC errors.

>
> My question is shouldn't the unmount or mount code path cause GC to run
> and return these "soft deleted" blocks back to the free list?

Mounting/unmounting does not cause GC to run. GC only runs as a side effect of 
when you do any writing operations.

Running gc at mount would only slow down mount time and would break the 
benefits of deferred GC.


>
> Am I missing something? This unmount/mount block lost is filling our
> application file system nightly.

Do you get any warnings from mtd? 

-- Charles




More information about the yaffs mailing list