}
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) {
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,
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--;
* 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)
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))