flash: use rewritten blocks when allocating a new one

This commit is contained in:
Flyinghead 2019-08-30 13:59:15 +02:00
parent e173b83574
commit cc6190f261
1 changed files with 3 additions and 0 deletions

View File

@ -643,6 +643,9 @@ private:
if (!is_allocated(bitmap, phys_id)) {
break;
}
// if the current block has been rewritten, use it
if (lookup_block(offset, size, *(u16*)&this->data[offset + phys_id * FLASH_BLOCK_SIZE]) != phys_id)
break;
phys_id++;
}