fixed an erase count log bug

This commit is contained in:
Peter Andersson
2013-07-26 19:59:25 +02:00
parent 921880f34a
commit 7f0ef5851f
6 changed files with 21 additions and 5 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
+1 -1
View File
@@ -20,7 +20,7 @@ static s32_t spiffs_gc_erase_block(
fs->free_blocks++;
// register erase count for this block
res = _spiffs_wr(fs, SPIFFS_OP_C_UPDT | SPIFFS_OP_T_OBJ_LU2, 0,
res = _spiffs_wr(fs, SPIFFS_OP_C_WRTHRU | SPIFFS_OP_T_OBJ_LU2, 0,
SPIFFS_ERASE_COUNT_PADDR(fs, bix),
sizeof(spiffs_obj_id), (u8_t *)&fs->max_erase_count);
SPIFFS_CHECK_RES(res);
+18 -2
View File
@@ -693,13 +693,29 @@ s32_t SPIFFS_vis(spiffs *fs) {
} // per entry
obj_lookup_page++;
} // per object lookup page
if ((cur_entry & 0x1f) != 0) {
spiffs_printf("\n");
spiffs_obj_id erase_count;
res = _spiffs_rd(fs, SPIFFS_OP_C_READ | SPIFFS_OP_T_OBJ_LU2, 0,
SPIFFS_ERASE_COUNT_PADDR(fs, bix),
sizeof(spiffs_obj_id), (u8_t *)&erase_count);
SPIFFS_CHECK_RES(res);
if (erase_count != (spiffs_obj_id)-1) {
spiffs_printf("\tera_cnt: %i\n", erase_count);
} else {
spiffs_printf("\tera_cnt: N/A\n");
}
bix++;
} // per block
spiffs_printf("era_cnt_max: %i\n", fs->max_erase_count);
spiffs_printf("last_errno: %i\n", fs->errno);
spiffs_printf("blocks: %i\n", fs->block_count);
spiffs_printf("free_blocks: %i\n", fs->free_blocks);
spiffs_printf("page_alloc: %i\n", fs->stats_p_allocated);
spiffs_printf("page_delet: %i\n", fs->stats_p_deleted);
SPIFFS_UNLOCK(fs);
return res;
}
+2 -2
View File
@@ -255,8 +255,8 @@ s32_t spiffs_obj_lu_scan(
bix = 0;
spiffs_obj_id erase_count_final;
spiffs_obj_id erase_count_min = 0;
spiffs_obj_id erase_count_max = SPIFFS_OBJ_ID_FREE;
spiffs_obj_id erase_count_min = SPIFFS_OBJ_ID_FREE;
spiffs_obj_id erase_count_max = 0;
while (bix < fs->block_count) {
spiffs_obj_id erase_count;
res = _spiffs_rd(fs,