Hi Charles, We have some NAND currently running a old YAFFS driver (with YAFFS_CHECKPOINT_VERSION 4), and we would like to upgrade to the latest (with YAFFS_CHECKPOINT_VERSION 7). Will there be any compatible problem and is there any procedure needs to be taken? thanks, Peter On Tue, May 22, 2012 at 11:36 AM, peterlingoal wrote: > Thanks Charles, the patch works. > > > On Tue, May 22, 2012 at 7:25 AM, Charles Manning wrote: > >> On Tuesday 22 May 2012 10:12:35 Charles Manning wrote: >> > On Tuesday 22 May 2012 00:31:25 peterlingoal wrote: >> > > Hi Charles: >> > > >> > > following is a proposed patch that check for block state after >> > > discovering a check point block, and continues search if the block >> state >> > > is DEAD: From b08b8c5fc21c2820f66454968be3a5115477fc96 Mon Sep 17 >> > > 00:00:00 2001 From: Peter Lin >> > > Date: Mon, 21 May 2012 20:25:55 +0800 >> > > Subject: [PATCH] yaffs: ignore checkpt if it is in bad block >> > > >> > > --- >> > > yaffs_checkptrw.c | 11 +++++++++++ >> > > 1 files changed, 11 insertions(+), 0 deletions(-) >> > > >> > > diff --git a/yaffs_checkptrw.c b/yaffs_checkptrw.c >> > > index 997a618..0d63e74 100644 >> > > --- a/yaffs_checkptrw.c >> > > +++ b/yaffs_checkptrw.c >> > > @@ -13,6 +13,8 @@ >> > > >> > > #include "yaffs_checkptrw.h" >> > > #include "yaffs_getblockinfo.h" >> > > +#include "yaffs_nand.h" >> > > +#include "yaffs_guts.h" >> > > >> > > static int yaffs2_checkpt_space_ok(struct yaffs_dev *dev) >> > > { >> > > @@ -117,6 +119,15 @@ static void yaffs2_checkpt_find_block(struct >> > > yaffs_dev *dev) >> > > tags.ecc_result); >> > > >> > > if (tags.seq_number == YAFFS_SEQUENCE_CHECKPOINT_DATA) { >> > > + enum yaffs_block_state state = 0; >> > > + u32 seq_number = 0; >> > > + yaffs_query_init_block_state(dev, i, &state, &seq_number); >> > > + if( YAFFS_BLOCK_STATE_DEAD == state ) >> > > + { >> > > + yaffs_trace(YAFFS_TRACE_CHECKPOINT, >> > > + "ignore bad checkpt block %d", i); >> > > + continue; >> > > + } >> > >> > This approach won't always work >> > yaffs_querey_init_block_state() applies a block offset which is not set >> up >> > properly yet. Instead you need to use the raw functions during >> checkpoint >> > reading: >> > >> > + dev->param.query_block_fn(dev, i, &state, &seq); >> > + if (state == YAFFS_BLOCK_STATE_DEAD) >> > + continue; >> > >> > > /* Right kind of block */ >> > > dev->checkpt_next_block = tags.obj_id; >> > > dev->checkpt_cur_block = i; >> > >> > I have a fix for this that should be pushed to yaffs2 git today. >> >> Pushed. >> >> >> http://yaffs.net/gitweb?p=yaffs2.git;a=commitdiff;h=d9cae0a277c62c660e4802d3b8745500583273da >> >> > >> > I am also adding a further check to the checkpointing. >> > >> > Currently the checkpoint data has various checks in it, but none that >> > checks for dropped or stale data during the reading. Each checkpoint >> record >> > is framed and there is a checksum at the end which do provide a level of >> > checking. >> > >> > I have written some code, now under test, which does further checks on a >> > chunk-by-chunk basis. This should be checked in today. >> > >> >> This has also been pushed. >> >> >> -- CHarles >> >> >> _______________________________________________ >> yaffs mailing list >> yaffs@lists.aleph1.co.uk >> http://lists.aleph1.co.uk/cgi-bin/mailman/listinfo/yaffs >> > >