In my understanding, the flow goes like: 1. call yaffs_AllocateChunk to get a chunk 2. Check if the allocated block is gcPrioritise if (bi->gcPrioritise) { yaffs_DeleteChunk(dev, chunk, 1, __LINE__); /* try another chunk */ continue; } I think if bi->gcPrioritise==1, the rest chunks of this block will be skipped during next loops of the chunks of this block. Maybe could change yaffs_AllocateChunk not to allocate blocks with gcPrioritise=1 to avoid unnecessary overhead. 3. Check if the allocated chunk is all 0xff if (!bi->skipErasedCheck) { erasedOk = yaffs_CheckChunkErased(dev, chunk); if (erasedOk != YAFFS_OK) { T(YAFFS_TRACE_ERROR, (TSTR("**>> yaffs chunk %d was not erased" TENDSTR), chunk)); /* try another chunk */ continue; } bi->skipErasedCheck = 1; } If the first chunk of a block fails the check, this means the sequence number in the chunk is 0xffffffff, otherwise this will not be scanned as an allocatable block, which is a weired status. And other chunks in this block may still be allocated and written into successfully. But the first chunk of the block remains the weired status, and during next mount, yaffs will ignore those written successfully chunks in this block. Maybe this case should be handled specifically, such as the whole block should be skipped to try another block. 4. if yaffs_WriteChunkWithTagsToNAND fails at a chunk, the block will be marked gcPrioritise and may try the next chunk of the same block. For the same reason as 3, if write fails at the first chunk of a block, I think the whole block should be skipped too. Although this sounds a little bit waste of space, but since the first chunk's status of a block is critical during yaffs mount, this deserve a further check. Maybe it's only a corner case or I mistook something. But I really want to know the answer. And thanks for yaffs guy's effort. -- Regards, Shizheng