Re: [Yaffs] Why tags->sequenceNumber is not 0xffffffff when …

Startseite
Anhänge:
Nachricht
+ (text/plain)
Nachricht löschen
Nachricht beantworten
Autor: Charles Manning
Datum:  
To: yaffs
Betreff: Re: [Yaffs] Why tags->sequenceNumber is not 0xffffffff when the chunk is deleted ???
On Tuesday 27 September 2005 13:21, Zhen Feng wrote:
> I operated my nand flash(128Mb,2k bytes * 64 pages = 128Kb/block) as
> follows:
>
> [root@PMPBoard /]# flash_eraseall /dev/mtd/4
> Erasing 128 Kibyte @ xxxxx -- xx % complete
> .....
>
> [root@PMPBoard /]# mount -t yaffs2 /dev/mtdblock/4 /mnt
> yaffs: dev is 7940 name is "1f:04"
> yaffs: Attempting MTD mount on 31.4, "1f:04"
> yaffs: yaffs_GutsInitialise()
> yaffs: yaffs_GutsInitialise() done.
>
> [root@PMPBoard /mnt]# df
> Filesystem           1k-blocks      Used Available Use% Mounted on
> ...
> /dev/mtdblock/4          80384       768     79616   1% /mnt

>
> [root@PMPBoard /mnt]# cp /zImage ./


Hmmm

I would expect that the deleted file space would show up immediately as free
space.

What I would like to see is the following (without the extra debugging stuff).

# eraseall
# mount
# cat /proc/yaffs  <--- show pre-writing state.
#df
# cp file to yaffs
# cat /proc/yaffs  <--- show post-writing state.
#df
# umount
#mount              
#cat /proc/yaffs  <--- shows that the state in flash is good.
#df
# rm file
# cat /proc/yaffs <--- shows post rm state.
#df
# umount
#mount
#cat /proc/yaffs <--- shows whether scan state is good after rm.
#df




> Comparing to the avaialbe space after copying a file to the flash, the
> number of used space is the same, but now there are no files in the flash!
> If I repeated cp, rm, umount, mount again and again, my available space
> becomes lower.

The actual space is not necessarily cleaned up in the flash immediately, but
the space should show up as available.

> why no block could became dirty and be erased???


The "soft delete" mechanism defers the actual clean up to garbage collection
time. The block only becomes dirty when the garbage collection process
changes the state of soft deleted pages to dirty pages so that the flash can
be erased.

Garbage collections only happen as the result of write operations (write,
close, flush...) so the rm'ed file's delete will be pending until a gc is
triggered.

If the flash is relatively empty, then the garbage collection is far more lazy
and the actual gc might be defered for quite a while.

> When does these deleted block become avaialable again??


The actual space is only writable after garbage collection and a flash erase.
However, the soft deleted space should show up as being available in df since
it is available for gc and reuse.

-- Charles