summaryrefslogtreecommitdiff
path: root/yaffs_summary.c
diff options
context:
space:
mode:
authorCharles Manning <cdhmanning@gmail.com>2011-03-31 17:04:09 +1300
committerCharles Manning <cdhmanning@gmail.com>2011-03-31 17:04:09 +1300
commit130d318b84dbf1556cfec92e3546960ba6a8d7a3 (patch)
tree6cd20aaa29a058dfa29da51f502676678d14fbdd /yaffs_summary.c
parent7cf801a7e52bba91529fbc9f29be50bec808a545 (diff)
yaffs: Fix free space tracking of summary during gc.
Signed-off-by: Charles Manning <cdhmanning@gmail.com>
Diffstat (limited to 'yaffs_summary.c')
-rw-r--r--yaffs_summary.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/yaffs_summary.c b/yaffs_summary.c
index 31d443a..2768f16 100644
--- a/yaffs_summary.c
+++ b/yaffs_summary.c
@@ -11,18 +11,16 @@
* published by the Free Software Foundation.
*/
-/* Summaries write all the tags for the chunks in a block into packed tags
- * (just the tags part - no ECC) in the last n chunks of the block.
+/* Summaries write the useful part of the tags for the chunks in a block into an
+ * an array which is written to the last n chunks of the block.
* Reading the summaries gives all the tags for the block in one read. Much
* faster.
*
* Chunks holding summaries are marked with tags making it look like
* they are part of a fake file.
*
- * The chunks that hold the summary are removed from free space and are marked
- * as being in use.
+ * The summary could also be used during gc.
*
- * THa above might need to be revisited.
*/
#include "yaffs_summary.h"
@@ -245,6 +243,12 @@ void yaffs_summary_gc(struct yaffs_dev *dev, int blk)
if (!bi->has_summary)
return;
- for (i = dev->chunks_per_summary; i < dev->param.chunks_per_block; i++)
- yaffs_clear_chunk_bit(dev, blk, i);
+ for (i = dev->chunks_per_summary; i < dev->param.chunks_per_block; i++) {
+ if( yaffs_check_chunk_bit(dev, blk, i)) {
+ yaffs_clear_chunk_bit(dev, blk, i);
+ bi->pages_in_use--;
+ dev->n_free_chunks++;
+ }
+ }
+
}