From 0df8b9c1fb4c19e627b759e9a89300b1a9369a37 Mon Sep 17 00:00:00 2001 From: Tao Date: Wed, 15 Jan 2025 23:55:49 +0000 Subject: [PATCH] Rolling erase: comment fixes --- src/main/io/flashfs.c | 14 +++++++------- src/test/unit/flashfs_unittest.cc | 6 +++--- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/main/io/flashfs.c b/src/main/io/flashfs.c index b42fe5838..ee62bfafc 100644 --- a/src/main/io/flashfs.c +++ b/src/main/io/flashfs.c @@ -52,7 +52,7 @@ #include "pg/blackbox.h" /* - * How background erase works: + * How rolling erase works: * 1. When start programming (flush) a page, if erase is needed and can be * started, set FLASHFS_ROLLING_ERASE_PENDING. * 2. No more flush can be done when FLASHFS_ROLLING_ERASE_PENDING. @@ -298,13 +298,13 @@ static uint32_t flashfsWriteBuffers(uint8_t const **buffers, uint32_t *bufferSiz /* * Also bail out if we are running any of the erases. * There are a few cases: - * * FLASHFS_ARMING_ERASING: logging is running ("switch" mode) and - * arming erase has triggered or running. We can't write. - * * FLASHFS_ROLLING_ERASE_PENDING: background erase is pending. We + * * FLASHFS_INITIAL_ERASING: logging is running ("switch" mode) and + * initial erase has triggered or running. We can't write. + * * FLASHFS_ROLLING_ERASE_PENDING: rolling erase is pending. We * can't write. (If we write, those bytes will be discarded on * erase). * * FLASHFS_ROLLING_ERASING: technically we can write (under this - * state and flashIsReady()), because background erase erases only 1 + * state and flashIsReady()), because rolling erase erases only 1 * sector. For simplicity, we wait for the task to update the state. * * FLASHFS_ALL_ERASING: we can't write. We may land between erase * sectors. @@ -317,7 +317,7 @@ static uint32_t flashfsWriteBuffers(uint8_t const **buffers, uint32_t *bufferSiz // Are we at EOF already? Abort. if (flashfsIsEOF()) { #ifdef USE_FLASHFS_LOOP - // If EOF, request an background erase unconditionally + // If EOF, request an rolling erase unconditionally if (blackboxConfig()->rollingErase) { flashfsState = FLASHFS_ROLLING_ERASE_PENDING; } @@ -330,7 +330,7 @@ static uint32_t flashfsWriteBuffers(uint8_t const **buffers, uint32_t *bufferSiz #endif #ifdef USE_FLASHFS_LOOP - // Check if background erase is needed. Why here? Because we can only + // Check if rolling erase is needed. Why here? Because we can only // erase when a page (aligned) program is completed. const uint32_t freeSpace = flashfsSize - flashfsGetOffset(); if (blackboxConfig()->rollingErase && diff --git a/src/test/unit/flashfs_unittest.cc b/src/test/unit/flashfs_unittest.cc index a66db3841..00e9fb8c2 100644 --- a/src/test/unit/flashfs_unittest.cc +++ b/src/test/unit/flashfs_unittest.cc @@ -397,7 +397,7 @@ class FlashFSLoopInitialEraseTest : public FlashFSTestBase { TEST_F(FlashFSLoopInitialEraseTest, Normal) { - // Arming erase happens in the contiguous area. + // Initial erase happens in the contiguous area. const uint16_t kBoundarySector = 4; const uint32_t kEmptyStart = kBoundarySector * sector_size_ - page_size_; @@ -428,7 +428,7 @@ TEST_F(FlashFSLoopInitialEraseTest, Normal) TEST_F(FlashFSLoopInitialEraseTest, Wrapped) { - // Arming erase happens in the wrap boundary -- the last sector and the + // Initial erase happens in the wrap boundary -- the last sector and the // first sector. const uint16_t kBoundarySector = flash_emulator_->kFlashFSSizeInSectors - 1; const uint32_t kEmptyStart = kBoundarySector * sector_size_ - page_size_; @@ -549,7 +549,7 @@ TEST_F(FlashFSLoopRollingEraseTest, flashfsWriteOverFlashSize) } while (written <= flash_emulator_->kFlashFSSize * 2); // This test is non-deterministic. - // After writing the full flashfs space once, it will start background erasing, + // After writing the full flashfs space once, it will start rolling erasing, // where a lot of writes can be silently dropped (we are writing way faster // than the actual BBlog). In the end, we check if there's less than 2 // erased sector and call it success.