Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/littlefs-project/littlefs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lfs.c
diff options
context:
space:
mode:
authorChristopher Haster <chaster@utexas.edu>2018-08-13 22:20:40 +0300
committerChristopher Haster <chaster@utexas.edu>2018-10-18 18:00:48 +0300
commit4db96d4d44cf4d3eb6d0731a024e6620028c64ba (patch)
tree5cd9df73e677baa988815751baa54cc8eabaa9cf /lfs.c
parenta2532a34cdfc39657436dcbec86ba7350c515be7 (diff)
Changed unwritable superblock to ENOSPC for consistency
While ECORRUPT is not a wrong error code, it doesn't match other instances of hitting a corrupt block during write. During writes, if blocks are detected as corrupt their data is evicted and moved to a new clean block. This means that at the end of a disk's lifetime, exhaustion errors will be reported as ENOSPC when littlefs can't find any new block to store the data. This has the benefit of matching behaviour when a new file is written and no more blocks can be found, due to either a small disk or corrupted blocks on disk. To littlefs it's like the disk shrinks in size over time.
Diffstat (limited to 'lfs.c')
-rw-r--r--lfs.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lfs.c b/lfs.c
index 81a19f6..1649ae5 100644
--- a/lfs.c
+++ b/lfs.c
@@ -1237,7 +1237,7 @@ relocate:
// can't relocate superblock, filesystem is now frozen
if (lfs_pair_cmp(oldpair, (const lfs_block_t[2]){0, 1}) == 0) {
LFS_WARN("Superblock %"PRIu32" has become unwritable", oldpair[1]);
- return LFS_ERR_CORRUPT;
+ return LFS_ERR_NOSPC;
}
// relocate half of pair