[Yaffs] [PATCH 1/1] yaffs2: Check for bad blocks earlier whe…

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Ross Younger
Date:  
To: 'YAFFS'
Subject: [Yaffs] [PATCH 1/1] yaffs2: Check for bad blocks earlier when scanning for checkpoint.
This patch provides cleaner behaviour during the checkpoint scan by
trapping bad blocks earlier. (Previous behaviour was to unconditionally
read each chunk's tags before checking whether it was bad.)

Signed-off-by: Ross Younger <>
---
yaffs_checkptrw.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/yaffs_checkptrw.c b/yaffs_checkptrw.c
index e739fb4..97d238c 100644
--- a/yaffs_checkptrw.c
+++ b/yaffs_checkptrw.c
@@ -159,6 +159,12 @@ static void yaffs2_checkpt_find_block(struct 
yaffs_dev *dev)
              enum yaffs_block_state state;
              u32 seq;


+            dev->tagger.query_block_fn(dev,
+                        apply_block_offset(dev, i),
+                        &state, &seq);
+            if (state == YAFFS_BLOCK_STATE_DEAD)
+                continue;
+
              dev->tagger.read_chunk_tags_fn(dev,
                      apply_chunk_offset(dev, chunk),
                      NULL, &tags);
@@ -171,12 +177,6 @@ static void yaffs2_checkpt_find_block(struct 
yaffs_dev *dev)
              if (tags.seq_number != YAFFS_SEQUENCE_CHECKPOINT_DATA)
                  continue;


-            dev->tagger.query_block_fn(dev,
-                        apply_block_offset(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;
-- 
1.9.1