This is an automated email from the ASF dual-hosted git repository. xiaoxiang pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit 2061ef5d2bea7b4de7b95276debbdf1566bfb373 Author: zhaoxingyu1 <[email protected]> AuthorDate: Sat Sep 13 20:10:30 2025 +0800 mtdconfig/nvs: clean up block without valid data during GC Invalid data is cleared during garbage collection rather than deleted during initialization, thus accelerating the initialization speed. Signed-off-by: zhaoxingyu1 <[email protected]> --- drivers/mtd/mtd_config_nvs.c | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/drivers/mtd/mtd_config_nvs.c b/drivers/mtd/mtd_config_nvs.c index 671e7f81b18..d163bf20641 100644 --- a/drivers/mtd/mtd_config_nvs.c +++ b/drivers/mtd/mtd_config_nvs.c @@ -1548,25 +1548,6 @@ static int nvs_startup(FAR struct nvs_fs *fs) fs->data_wra); } - /* If the ate_wra is pointing to the first ate write location in a - * block and data_wra is not 0, erase the block as it contains no - * valid data (this also avoids closing a block without any data). - */ - - if (((fs->ate_wra + 2 * ate_size) == fs->blocksize) && - (fs->data_wra != (fs->ate_wra & NVS_ADDR_BLOCK_MASK))) - { - rc = nvs_flash_erase_block(fs, fs->ate_wra); - if (rc) - { - return rc; - } - - fs->data_wra = fs->ate_wra & NVS_ADDR_BLOCK_MASK; - finfo("erase due to no data, data_wra=0x%" PRIx32 "\n", - fs->data_wra); - } - /* Check if there exists an old entry with the same id and key * as the newest entry. * If so, power loss occurred before writing the old entry id as expired.
