Help Understanding Total Size of Blobs wrote to NVS ?

Ravenholem
Posts: 19
Joined: Wed Nov 10, 2021 7:13 pm

Help Understanding Total Size of Blobs wrote to NVS ?

Postby Ravenholem » Sun May 07, 2023 3:39 pm

Hello,
I have started the process of working with NVS and have a question related to BLOBS.
I have a Array of 140bytes that I write into NVS as a blob.
When I use nvs_get_stats() I expected to see 6 entries equalling around 192 bytes but instead I see 7 entries taking 224 bytes.
My Understanding after reading the NVS Structure Entry information https://docs.espressif.com/projects/esp ... flash.html is that I should have 1 entry that contains 32 bytes that has that info about the Variable Blob. Then I should have my 140 byte array wrote to 5 entries at 32byte each (160bytes of NVS).

Can someone help me understand why I am instead seeing 7 entries taking up 224bytes of NVS? Looking at the NVS documentation I concluded that Either the Page Header is being reported as a entry when i do the nvs_get_stats() or to write a blob it requires TWO key-value pairs.
Because in those two scenarios I get 64 bytes of data used for over head and that leaves me with the 160bytes I expected that my array would be put into.. IE 5 entries at 32bytes of NVS.

Appreciate any help thanks.

User avatar
corz.org
Posts: 80
Joined: Fri Feb 03, 2023 10:44 pm
Location: Aberdeen
Contact:

Re: Help Understanding Total Size of Blobs wrote to NVS ?

Postby corz.org » Mon May 08, 2023 9:58 pm

"Blobs are allowed to span over multiple pages by dividing them into smaller chunks. For tracking these chunks, an additional fixed length metadata entry is stored called “blob index”. "

Ravenholem
Posts: 19
Joined: Wed Nov 10, 2021 7:13 pm

Re: Help Understanding Total Size of Blobs wrote to NVS ?

Postby Ravenholem » Wed May 10, 2023 12:06 pm

corz.org wrote:
Mon May 08, 2023 9:58 pm
"Blobs are allowed to span over multiple pages by dividing them into smaller chunks. For tracking these chunks, an additional fixed length metadata entry is stored called “blob index”. "
I had read that in the Docs but thought it only added that header when it spans pages. Does it add that to every blob?
Because Every blob I write has 64bytes of data extra. Which would mean that all blobs get the second header even if they do not span pages?

User avatar
corz.org
Posts: 80
Joined: Fri Feb 03, 2023 10:44 pm
Location: Aberdeen
Contact:

Re: Help Understanding Total Size of Blobs wrote to NVS ?

Postby corz.org » Wed May 10, 2023 3:09 pm

That is my understanding, yes.

Who is online

Users browsing this forum: Google [Bot] and 59 guests