From: Charles Manning Date: Thu, 31 Mar 2011 04:04:09 +0000 (+1300) Subject: yaffs: Fix free space tracking of summary during gc. X-Git-Tag: pre-driver-refactoring~41^2~10^2~5 X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs2.git;a=commitdiff_plain;h=130d318b84dbf1556cfec92e3546960ba6a8d7a3;ds=inline yaffs: Fix free space tracking of summary during gc. Signed-off-by: Charles Manning --- 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++; + } + } + }