>Hi >I have review the yaffs2 source code and have a doubt. See the follow >In Yaffs2 the read interface is yaffs_rd_chunk_tags_nand int yaffs_rd_chunk_tags_nand(struct yaffs_dev *dev, int nand_chunk, > u8 *buffer, struct yaffs_ext_tags *tags) { > ......... > result = dev->tagger.read_chunk_tags_fn(dev, flash_chunk, buffer, tags); > if (tags && tags->ecc_result > YAFFS_ECC_RESULT_NO_ERROR) { > > struct yaffs_block_info *bi; > bi = yaffs_get_block_info(dev, > nand_chunk / > dev->param.chunks_per_block); > yaffs_handle_chunk_error(dev, bi); > } > return result; >} > >The yaffs_rd_chunk_tags_nand will call the mtd interface mtd_read_oob >int mtd_read_oob(struct mtd_info *mtd, loff_t from, struct mtd_oob_ops *ops) { > int ret_code; > ops->retlen = ops->oobretlen = 0; > if (!mtd->_read_oob) > return -EOPNOTSUPP; > /* > * In cases where ops->datbuf != NULL, mtd->_read_oob() has semantics > * similar to mtd->_read(), returning a non-negative integer > * representing max bitflips. In other cases, mtd->_read_oob() may > * return -EUCLEAN. In all cases, perform similar logic to mtd_read(). > */ > ret_code = mtd->_read_oob(mtd, from, ops); > if (unlikely(ret_code < 0)) > return ret_code; > if (mtd->ecc_strength == 0) > return 0; /* device lacks ecc */ > return ret_code >= mtd->bitflip_threshold ? -EUCLEAN : 0; } >So if the bitflips num over mtd->bitflip_threshold the mtd_read_oob will return -EUCLEAN and tags->ecc_result > YAFFS_ECC_RESULT_NO_ERROR.> >Then we will call yaffs_handle_chunk_error. >void yaffs_handle_chunk_error(struct yaffs_dev *dev, > struct yaffs_block_info *bi) >{ > if (!bi->gc_prioritise) { > bi->gc_prioritise = 1; > dev->has_pending_prioritised_gc = 1; > bi->chunk_error_strikes++; > > if (bi->chunk_error_strikes > 3) { > bi->needs_retiring = 1; /* Too many stikes, so retire */ > yaffs_trace(YAFFS_TRACE_ALWAYS, > "yaffs: Block struck out"); > > } > } >} >From the code we can see if bitflips num over mtd->bitflip_threshold we will mark this block as gc if bitflips num over mtd->bitflip_threshold over three times we will mark this block as bad block. >We define bad block is if erase or program failed we can mark this block as bad block. >So is it reasonable just according to the bitflips over mtd->bitflip_threshold over three times to judge the block as bad block? >What's your opinion about my doubts? Hi clarles, Do you have any proposal about this? Br White Ding ____________________________ EBU APAC Application Engineering Tel:86-21-38997078 Mobile: 86-13761729112 Address: No 601 Fasai Rd, Waigaoqiao Free Trade Zone Pudong, Shanghai, China