X-Git-Url: https://yaffs.net/gitweb/?a=blobdiff_plain;f=yaffs_guts.c;h=aee80de4e55c6d9a815e01e127dd8a3eee88608f;hb=refs%2Fheads%2Fblock-refreshing;hp=1c0ae71320a52fc5645e09fd76e5203c348ab8c7;hpb=319d4f76f0e10d1d6427120221237950e373d74b;p=yaffs2.git diff --git a/yaffs_guts.c b/yaffs_guts.c index 1c0ae71..aee80de 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, @@ -684,7 +691,7 @@ static void yaffs_load_oh_from_name(struct yaffs_dev *dev, YCHAR *oh_name, char *ascii_oh_name = (char *)oh_name; int n = YAFFS_MAX_NAME_LENGTH - 1; while (n > 0 && *name) { - *ascii_oh_name = *name; + *ascii_oh_name = (char)*name; name++; ascii_oh_name++; n--; @@ -864,7 +871,7 @@ u32 yaffs_get_group_base(struct yaffs_dev *dev, struct yaffs_tnode *tn, * in the tree. 0 means only the level 0 tnode is in the tree. */ -/* FindLevel0Tnode finds the level 0 tnode, if one exists. */ +/* yaffs_find_tnode_0 finds the level 0 tnode, if one exists. */ struct yaffs_tnode *yaffs_find_tnode_0(struct yaffs_dev *dev, struct yaffs_file_var *file_struct, u32 chunk_id) @@ -4816,7 +4823,7 @@ int yaffs_guts_initialise(struct yaffs_dev *dev) if (bits <= dev->tnode_width) dev->chunk_grp_bits = 0; else - dev->chunk_grp_bits = bits - dev->tnode_width; + dev->chunk_grp_bits = (u16)(bits - dev->tnode_width); dev->tnode_size = (dev->tnode_width * YAFFS_NTNODES_LEVEL0) / 8; if (dev->tnode_size < sizeof(struct yaffs_tnode))