Arm Mbed and Pelion Device Management support forum

FileSystemStore on LittleFs with QSPIF-BD

Hi,

I am using the FileSystemStore on LittleFs with QSPIF-BD and I am writing a circular-logger.
The circular-logger has i.e. 1000 entries and if the 1000th entry is written, the oldest entry will be overwritten. Works similar to a circular buffer:

Therefor I am asking if it is faster with the FileSystemStore to overwrite the content of a Key-Value-Pair (entry), or delete the oldest entry and write a new entry?

I already implemented this feature long ago based on file-pointer (FILE*), speed is ok, as long as it does not wrap around (overwrite).

To clarify how it works and what I want to do I added the documentation:

@brief The CyclicFile Class

This file defines the CyclicFile class which is basically a file with max entries.
If data is written beyond the max length, the write position will wrap around and
writing continues at the start of the file. The same will be done for reading.

Cyclic File will be seen as a normal file.
From File-Start to File-End, but this is an abstract view on it.
Therefore we have a real memory position and an abstract postion.
The abstract postion order depends on the last added and first (available) added entry.

Cyclic File example:

  • MP = Memory Position
  • AP = Abstract postion (Content)
  • FS = File-Start Pointer
  • FE = File-End Pointer

No Wrap Around

MP AP
0 00 < FS
1 01
2 02
3 03
4 04
5 05
6 06
7 07
8 08
9 09 < FE

With Wrap Around

MP AP
0 0A
1 0B
2 0C
3 0D
4 0E < FE
5 05 < FS
6 06
7 07
8 08
9 09

Cyclic File will be seen as:

MP AP
5 05 < FS
6 06
7 07
8 08
9 09
0 0A
1 0B
2 0C
3 0D
4 0E < FE

kr
DBS06

Closed - I tested FileSystemStore excessively and it seems slower than my current solution

I would expect overwriting to be faster. Also have you tried FileSystemStore with LittleFS v2? It handles small files better (which is what backs KV-pairs):

This is currently the most efficient log implementing with LittleFS I’m aware of, however it uses files directly and would need to use the LittleFileSystem class: