Re: [Yaffs] power cycle during rm

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Babrian Viktor
Date:  
To: yaffs
Subject: Re: [Yaffs] power cycle during rm
> * Can you plesae redo this using "ls -ial" rather than "ls -l". That will
> show extra useful info.

details at the end

> * Can you please see if there is anything in lost+found

it is empty all the time.

> * Please show /proc/yaffs before the rm and after the reboot

details at the end

> * Does the problem get cleared up by umount and mount?

no. However, if I make an unclean reboot after dding the second file, the
mount after the reboot makes it consistent again.
Please find details at the end.


I tried to find the cause of the decreasing of free space and I found the
following:

in yaffs_guts.c, around line 3010, in function
yaffs_GarbageCollectBlock():
...
dev->nFreeChunks -= bi->softDeletions;
...

the sum of these during the dd after reboot approx equals the 'lost'
space. Strangely (for me), I found that this function is called with the
same block number several times. I made lots of traces (does not fit into
the serial terminal) and whenever I stop it I see that
yaffs_GarbageCollectBlock() is called with many different block arguments
(ranging from ~800 to ~2000) and every number is printed out 7 times.
I used to trace this printout:
"Collecting block %d, in use %d, shrink %d, wholeBlock %d, soft del %d"

Hope it helps, thanks for the help anyway,
Viktor Babrian

details of commands performed:

/ $ ls -ial /mnt/
       1 drw-rw-rw-    1 root     root         2048 Jan  1 00:02 .
       1 drwxr-xr-x   20 root     root            0 Jan  1 00:00 ..
       2 drw-rw-rw-    1 root     root         2048 Jan  1 00:02 lost+found
/ $ ls -ial /mnt/lost\+found/
       2 drw-rw-rw-    1 root     root         2048 Jan  1 00:02 .
       1 drw-rw-rw-    1 root     root         2048 Jan  1 00:02 ..
/ $ df
Filesystem           1k-blocks      Used Available Use% Mounted on
/dev/mtdblock5           32768     18176     14592  55% /
tmpfs                    63956         0     63956   0% /var/tmp
/dev/mtdblock13        2097152      3840   2093312   0% /mnt
/ $ dd if=/dev/zero of=/mnt/file bs=1M count=100
100+0 records in
100+0 records out
/ $ ls -ial /mnt/
       1 drw-rw-rw-    1 root     root         2048 Jan  1 00:02 .
       1 drwxr-xr-x   20 root     root            0 Jan  1 00:00 ..
     261 -rw-r--r--    1 root     root    104857600 Jan  1 00:03 file
       2 drw-rw-rw-    1 root     root         2048 Jan  1 00:02 lost+found
/ $ ls -ial /mnt/lost\+found/
       2 drw-rw-rw-    1 root     root         2048 Jan  1 00:02 .
       1 drw-rw-rw-    1 root     root         2048 Jan  1 00:02 ..
/ $ df
Filesystem           1k-blocks      Used Available Use% Mounted on
/dev/mtdblock5           32768     18176     14592  55% /
tmpfs                    63956         0     63956   0% /var/tmp
/dev/mtdblock13        2097152    106372   1990780   5% /mnt
/ $
/ $ cat /proc/yaffs
YAFFS built:May 19 2009 05:24:47
$Id: yaffs_fs.c,v 1.79 2009/03/17 01:12:00 wookey Exp $
$Id: yaffs_guts.c,v 1.82 2009/03/09 04:24:17 charles Exp $


Device 0 "MAP"
startBlock......... 0
endBlock........... 16383
totalBytesPerChunk. 2048
nDataBytesPerChunk. 2048
chunkGroupBits..... 0
chunkGroupSize..... 1
nErasedBlocks...... 15564
nReservedBlocks.... 5
blocksInCheckpoint. 0
nTnodesCreated..... 3700
nFreeTnodes........ 39
nObjectsCreated.... 200
nFreeObjects....... 95
nFreeChunks........ 996159
nPageWrites........ 0
nPageReads......... 0
nBlockErasures..... 0
nGCCopies.......... 0
garbageCollections. 0
passiveGCs......... 0
nRetriedWrites..... 0
nShortOpCaches..... 10
nRetireBlocks...... 0
eccFixed........... 0
eccUnfixed......... 0
tagsEccFixed....... 0
tagsEccUnfixed..... 0
cacheHits.......... 0
nDeletedFiles...... 0
nUnlinkedFiles..... 0
nBackgroudDeletions 0
useNANDECC......... 1
isYaffs2........... 1
inbandTags......... 0
/ $ rm /mnt/file

**** power cycle


/ $ mount -t yaffs2 /dev/mtdblock13 /mnt/
/ $ cat /proc/yaffs
YAFFS built:May 19 2009 05:24:47
$Id: yaffs_fs.c,v 1.79 2009/03/17 01:12:00 wookey Exp $
$Id: yaffs_guts.c,v 1.82 2009/03/09 04:24:17 charles Exp $

Device 0 "MAP"
startBlock......... 0
endBlock........... 16383
totalBytesPerChunk. 2048
nDataBytesPerChunk. 2048
chunkGroupBits..... 0
chunkGroupSize..... 1
nErasedBlocks...... 15736
nReservedBlocks.... 5
blocksInCheckpoint. 0
nTnodesCreated..... 2900
nFreeTnodes........ 2899
nObjectsCreated.... 200
nFreeObjects....... 95
nFreeChunks........ 1047359
nPageWrites........ 0
nPageReads......... 0
nBlockErasures..... 0
nGCCopies.......... 0
garbageCollections. 0
passiveGCs......... 0
nRetriedWrites..... 0
nShortOpCaches..... 10
nRetireBlocks...... 0
eccFixed........... 0
eccUnfixed......... 0
tagsEccFixed....... 0
tagsEccUnfixed..... 0
cacheHits.......... 0
nDeletedFiles...... 1
nUnlinkedFiles..... 1
nBackgroudDeletions 0
useNANDECC......... 1
isYaffs2........... 1
inbandTags......... 0
/ $
/ $ ls -ial /mnt/
       1 drw-rw-rw-    1 root     root         2048 Jan  1 00:00 .
       1 drwxr-xr-x   20 root     root            0 Jan  1 00:00 ..
       2 drw-rw-rw-    1 root     root         2048 Jan  1 00:00 lost+found
/ $ ls -ial /mnt/lost\+found/
       2 drw-rw-rw-    1 root     root         2048 Jan  1 00:00 .
       1 drw-rw-rw-    1 root     root         2048 Jan  1 00:00 ..
/ $ df
Filesystem           1k-blocks      Used Available Use% Mounted on
/dev/mtdblock5           32768     18176     14592  55% /
tmpfs                    63956         0     63956   0% /var/tmp
/dev/mtdblock13        2097152      3840   2093312   0% /mnt
/ $
/ $ dd if=/dev/zero of=/mnt/file bs=1M count=100
100+0 records in
100+0 records out
/ $ ls -ial /mnt/lost\+found/
       2 drw-rw-rw-    1 root     root         2048 Jan  1 00:00 .
       1 drw-rw-rw-    1 root     root         2048 Jan  1 00:00 ..
/ $ ls -ial /mnt/
       1 drw-rw-rw-    1 root     root         2048 Jan  1 00:00 .
       1 drwxr-xr-x   20 root     root            0 Jan  1 00:00 ..
     262 -rw-r--r--    1 root     root    104857600 Jan  1 00:03 file
       2 drw-rw-rw-    1 root     root         2048 Jan  1 00:00 lost+found
/ $ df
Filesystem           1k-blocks      Used Available Use% Mounted on
/dev/mtdblock5           32768     18176     14592  55% /
tmpfs                    63956         0     63956   0% /var/tmp
/dev/mtdblock13        2097152    588664   1508488  28% /mnt
/ $
/ $ cat /proc/yaffs
YAFFS built:May 19 2009 05:24:47
$Id: yaffs_fs.c,v 1.79 2009/03/17 01:12:00 wookey Exp $
$Id: yaffs_guts.c,v 1.82 2009/03/09 04:24:17 charles Exp $


Device 0 "MAP"
startBlock......... 0
endBlock........... 16383
totalBytesPerChunk. 2048
nDataBytesPerChunk. 2048
chunkGroupBits..... 0
chunkGroupSize..... 1
nErasedBlocks...... 15564
nReservedBlocks.... 5
blocksInCheckpoint. 0
nTnodesCreated..... 3700
nFreeTnodes........ 38
nObjectsCreated.... 200
nFreeObjects....... 94
nFreeChunks........ 755012
nPageWrites........ 0
nPageReads......... 0
nBlockErasures..... 628
nGCCopies.......... 0
garbageCollections. 4396
passiveGCs......... 4396
nRetriedWrites..... 0
nShortOpCaches..... 10
nRetireBlocks...... 0
eccFixed........... 0
eccUnfixed......... 0
tagsEccFixed....... 0
tagsEccUnfixed..... 0
cacheHits.......... 0
nDeletedFiles...... 1
nUnlinkedFiles..... 1
nBackgroudDeletions 0
useNANDECC......... 1
isYaffs2........... 1
inbandTags......... 0

/ $ umount /mnt/
save exit: isCheckpointed 1
save exit: isCheckpointed 1
/ $ mount -t yaffs2 /dev/mtdblock13 /mnt/
/ $ df
Filesystem           1k-blocks      Used Available Use% Mounted on
/dev/mtdblock5           32768     18176     14592  55% /
tmpfs                    63956         0     63956   0% /var/tmp
/dev/mtdblock13        2097152    588664   1508488  28% /mnt
/ $ ls -ial /mnt/
       1 drw-rw-rw-    1 root     root         2048 Jan  1 00:16 .
       1 drwxr-xr-x   20 root     root            0 Jan  1 00:00 ..
     262 -rw-r--r--    1 root     root    104857600 Jan  1 00:03 file
       2 drw-rw-rw-    1 root     root         2048 Jan  1 00:16 lost+found
/ $ ls -ial /mnt/lost\+found/
       2 drw-rw-rw-    1 root     root         2048 Jan  1 00:16 .
       1 drw-rw-rw-    1 root     root         2048 Jan  1 00:16 ..
/ $


** to force an unclean remount, I change the fs:
/ $ touch /mnt/dummy

** reboot without umount

/ $ mount -t yaffs2 /dev/mtdblock13 /mnt
/ $ ls -ial /mnt/
       1 drw-rw-rw-    1 root     root         2048 Jan  1 00:00 .
       1 drwxr-xr-x   20 root     root            0 Jan  1 00:00 ..
     263 -rw-r--r--    1 root     root            0 Jan  1 00:00 dummy
     262 -rw-r--r--    1 root     root    104857600 Jan  1 00:03 file
       2 drw-rw-rw-    1 root     root         2048 Jan  1 00:00 lost+found
/ $ ls -ial /mnt/lost\+found/
       2 drw-rw-rw-    1 root     root         2048 Jan  1 00:00 .
       1 drw-rw-rw-    1 root     root         2048 Jan  1 00:00 ..
/ $ df
Filesystem           1k-blocks      Used Available Use% Mounted on
/dev/mtdblock5           32768     18180     14588  55% /
tmpfs                    63956         0     63956   0% /var/tmp
/dev/mtdblock13        2097152    106372   1990780   5% /mnt
/ $