Skip to contentSkip to conversation

jffs2

DISCUSSION Kornel Masłowski 2 participants 4 messages Sep 27, 2004 – Sep 28, 2004 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

I'm not sure how jffs2 works.
I have jffs2 on 8bit NAND flash (page 512 B).
I want to append record 32B to the file on flash which current size is 10kB. Flash device is almost empty.
How many pages will be written by jffs2?

#1 lore raw
Quoted 7 lines · Kornel Masłowski

I'm not sure how jffs2 works.
I have jffs2 on 8bit NAND flash (page 512 B).
I want to append record 32B to the file on flash which current size is 10kB. Flash device is almost empty.
How many pages will be written by jffs2?

It is hard to calculate because of compression. Moreover, if your file was created by seek to "nowhere" it will cosist of only one "hole" node and fit into one NAND page only.

If there is no compression, the exact number of pages also depends on how your file was created. Also, there is some platform dependency - does you platform has 4K RAM pages? - but this is minor since most platforms have 4K RAM pages.

If your 10K file was created by one go and there is no compression, the file will consist of 3 JFFS2 nodes (4K + 4K + 2K) and fit into 9 + 9 + 5 = 23 NAND pages (4K data = 4 NAND pages and one is needed for node header; the rest of page won't be used since the next node isn't fit to it).

When you append 32 bytes, one more page will be used (24 total). But if your append just after 10K file creation (i.e, the JFFS2 write buffer hasn't yet been written to the NAND flash media), the 32B appendix node will be added to the 23-th page and there will be only 23 used pages.

If the compression is on, there ought to be fewer used NAND pages.

Ok, this is theory (I didn't check) and my own understanding of how JFFS2 works. I might make mistakes :-)

You may check this by creating/appending your file and then calculating the numbur of used pages. The nanddump utility may be used.

Signature · 3 lines
Best Regards,
Artem B. Bityuckiy,
St.-Petersburg, Russia.
#2 lore raw
Quoted 10 lines · Artem B. Bityuckiy
Quoted 5 lines · Kornel Masłowski

I'm not sure how jffs2 works.
I have jffs2 on 8bit NAND flash (page 512 B).
I want to append record 32B to the file on flash which current size is 10kB. Flash device is almost empty.
How many pages will be written by jffs2?

If your 10K file was created by one go and there is no compression, the file will consist of 3 JFFS2 nodes (4K + 4K + 2K) and fit into 9 + 9 + 5 = 23 NAND pageg (4K data = 4 NAND pages and one is needed for node

Ops, 4K data = 8 NAND pages.

Quoted 2 lines

header; the rest of page won't be used since the next node isn't fit to it).

Signature · 3 lines
Best Regards,
Artem B. Bityuckiy,
St.-Petersburg, Russia.
#3 lore raw
In reply to Artem B. Bityuckiy

Also, the direntry node and probably the root directory inode node will also add 1-2 NAND pages. Thus, 24-27 pages if compression is disabled...

Quoted 24 lines · Artem B. Bityuckiy
Quoted 7 lines · Kornel Masłowski

I'm not sure how jffs2 works.
I have jffs2 on 8bit NAND flash (page 512 B).
I want to append record 32B to the file on flash which current size is 10kB. Flash device is almost empty.
How many pages will be written by jffs2?

It is hard to calculate because of compression. Moreover, if your file was created by seek to "nowhere" it will cosist of only one "hole" node and fit into one NAND page only.

If there is no compression, the exact number of pages also depends on how your file was created. Also, there is some platform dependency - does you platform has 4K RAM pages? - but this is minor since most platforms have 4K RAM pages.

If your 10K file was created by one go and there is no compression, the file will consist of 3 JFFS2 nodes (4K + 4K + 2K) and fit into 9 + 9 + 5 = 23 NAND pages (4K data = 4 NAND pages and one is needed for node header; the rest of page won't be used since the next node isn't fit to it).

When you append 32 bytes, one more page will be used (24 total). But if your append just after 10K file creation (i.e, the JFFS2 write buffer hasn't yet been written to the NAND flash media), the 32B appendix node will be added to the 23-th page and there will be only 23 used pages.

If the compression is on, there ought to be fewer used NAND pages.

Ok, this is theory (I didn't check) and my own understanding of how JFFS2 works. I might make mistakes :-)

You may check this by creating/appending your file and then calculating the numbur of used pages. The nanddump utility may be used.

Signature · 3 lines
Best Regards,
Artem B. Bityuckiy,
St.-Petersburg, Russia.