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
diff options
context:
space:
mode:
authorChristopher Haster <chaster@utexas.edu>2018-05-20 02:25:47 +0300
committerChristopher Haster <chaster@utexas.edu>2018-10-13 21:22:53 +0300
commit8070abec34594c2fe9c8dc9bb4f8a9a2a250a79c (patch)
tree00ec85e84031674900e025f9b26f5e0fc936134f /lfs_util.h
parent61f454b008e8c8a7208e8b74095da8501d62c621 (diff)
Added rudimentary framework for journaling metadata pairs
This is a big change stemming from the fact that resizable entries were surprisingly complicated to implement and came in with a sizable code cost. The theory is that the journalling has a comparable cost to resizable entries. Both need to handle overflowing blocks, and managing offsets is comparable to managing attribute IDs. But by jumping all the way to full journaling, we can statically wear-level the metadata written to metadata pairs. The idea of journaling littlefs's metadata has been mentioned several times in discussions and fits well into how littlefs works. You could even view the existing metadata log as a log of size 2. The downside of this approach is that changing the metadata in this way would break compatibility from the existing layout on disk. Something that resizable entries does not do. That being said, adopting journaling at the metadata layer offers a big improvement to littlefs's performance and wear-leveling, with very little cost (maybe even none or negative after resizable entries?).
Diffstat (limited to 'lfs_util.h')
-rw-r--r--lfs_util.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/lfs_util.h b/lfs_util.h
index 3527ce6..ecd5dd3 100644
--- a/lfs_util.h
+++ b/lfs_util.h
@@ -161,6 +161,11 @@ static inline uint32_t lfs_tole32(uint32_t a) {
return lfs_fromle32(a);
}
+// Align to nearest multiple of a size
+static inline uint32_t lfs_alignup(uint32_t a, uint32_t alignment) {
+ return (a + alignment-1) - ((a + alignment-1) % alignment);
+}
+
// Calculate CRC-32 with polynomial = 0x04c11db7
void lfs_crc(uint32_t *crc, const void *buffer, size_t size);