yaffs_find_gc_block is used to find a suitable block to gc,but the first ¡°for¡± loop that finding a prioritised block may have error.

 

for (i = dev->internal_start_block;

      i <= dev->internal_end_block && !selected; i++) {

 

     if (bi->gc_prioritise) {

         prioritised_exist = 1;

         if (bi->block_state == YAFFS_BLOCK_STATE_FULL &&

             yaffs_block_ok_for_gc(dev, bi)) {

             selected = i;

             prioritised = 1;

         }

     }

 

 For dev->internal_start_block may start from 0 and if block 0 could be gc .then select=0  so  loop continues and passed block. As a result block 0 may seldom be gc or never be.

If I¡¯m not right please correct me.

 

 

 

 

---

Regards,

Ezio