X-Git-Url: https://yaffs.net/gitweb/?a=blobdiff_plain;f=yaffs_guts.c;h=35440d28aed074bcbc26e7ae61e18dd16cd4be7c;hb=dba051c0183a6ce9f1af61f9ec2b0f09419e48da;hp=1c0ae71320a52fc5645e09fd76e5203c348ab8c7;hpb=7e5cf0fa1b694f835cdc184a8395b229fa29f9ae;p=yaffs2.git diff --git a/yaffs_guts.c b/yaffs_guts.c index 1c0ae71..35440d2 100644 --- a/yaffs_guts.c +++ b/yaffs_guts.c @@ -211,11 +211,18 @@ static void yaffs_handle_chunk_update(struct yaffs_dev *dev, int nand_chunk, } void yaffs_handle_chunk_error(struct yaffs_dev *dev, - struct yaffs_block_info *bi) + struct yaffs_block_info *bi, + enum yaffs_ecc_result err_type) { - if (!bi->gc_prioritise) { - bi->gc_prioritise = 1; - dev->has_pending_prioritised_gc = 1; + if (bi->gc_prioritise) + return; + + /* We need to refresh this data by gc'ing the block soon. */ + bi->gc_prioritise = 1; + dev->has_pending_prioritised_gc = 1; + + /* If it was more than just refresh request then consider retirement. */ + if (err_type > YAFFS_ECC_RESULT_REFRESH) { bi->chunk_error_strikes++; if (bi->chunk_error_strikes > 3) { @@ -233,7 +240,7 @@ static void yaffs_handle_chunk_wr_error(struct yaffs_dev *dev, int nand_chunk, int flash_block = nand_chunk / dev->param.chunks_per_block; struct yaffs_block_info *bi = yaffs_get_block_info(dev, flash_block); - yaffs_handle_chunk_error(dev, bi); + yaffs_handle_chunk_error(dev, bi, YAFFS_ECC_RESULT_FIXED); if (erased_ok) { /* Was an actual write failure,