smartfs improvements #66

Author: Alan Carvalho de Assis <acassis@gmail.com>

    Run nxstyle on all .c and .h and fix all issues

Author: Alin Jerpelea <alin.jerpelea@sony.com>

    drivers: mtd: smart: Add smartfs fsck feature

    Support fsck to check and repair the smartfs file system. If the power
    loss occurs during writing into the flash, the dead space are created
    in flash after the next power cycle. To avoid this problem, introduce
    fsck and keep the consistency of file system in initializing smartfs.

    Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>

commit 60927c5fb6a353994341601f55071c618e97682b
Author: Alin Jerpelea <alin.jerpelea@sony.com>
Date:   Thu Dec 28 18:27:21 2017 +0900

    drivers: mtd: smart: Fix duplicate sector selection in SmartFS

    Add care for 16-bit sequence without CRC.

    drivers: mtd: smart: Check CRC of duplicate sectors

    In the illegal case by power-loss, when the multiple logical sectors are
    duplicated, we compare the sequence number of each sector and select the newer
    sector. Just in case, add CRC check for the newer sector. If the newer sector
    has CRC error, then we use the older sector.

    drivers: mtd: smart: SPI-Flash recovery from the initial error state

    The FLASH may be not erased in the initial delivery state.
    Just in case for the recovery of this fatal situation,
    after once erasing the sector, return the sector as a free sector.

    drivers: mtd: smart: Fix error handling in smartfs mtd driver

    Add error handling in relocate sector.

    drivers: mtd: smart: Fix initialize sector sequence value in smartfs

    Fix initialization of sequence value into sector header and also avoid
    unaligned memory access when CONFIG_MTD_SMART_ENABLE_CRC=n.

    drivers: mtd: smart: Fix handling of duplicate sector in smartfs

    In smartfs scan, if duplicate logical sector is found on the device,
    then smartfs selects the winner sector by comparing sequence number,
    and the loser sector is soon released. Fix a bug this loser sector
    is registered into logical-to-physical sector mapping table.
This commit is contained in:
Alin Jerpelea
2020-01-09 10:14:39 -03:00
committed by Alan Carvalho de Assis
parent 255f3008cf
commit ecfdd6e056
2 changed files with 646 additions and 15 deletions
+15
View File
@@ -775,6 +775,21 @@ config SMART_CRC_16
endchoice # CRC level selection
config MTD_SMART_FSCK
bool "Enable SMART file system check"
default n
depends on FS_WRITABLE
---help---
Enables fsck to check and repair the SMART file system.
config MTD_SMART_FSCK_ENABLE_CRC
bool "Enable SMART file system CRC check during fsck"
default n
depends on MTD_SMART_FSCK && MTD_SMART_ENABLE_CRC
---help---
Enables CRC check during fsck. It's possible to check the file
system strictly, but it takes long time to do fsck.
config MTD_SMART_MINIMIZE_RAM
bool "Minimize SMART RAM usage using logical sector cache"
depends on MTD_SMART
+631 -15
View File
File diff suppressed because it is too large Load Diff