Skip to contentSkip to conversation

Changing the number of JFFS2 erasblocks?

DISCUSSION Steven Scholz 3 participants 7 messages Apr 8, 2004 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

Hi there,

I have 320KB of unused flash in our embedded systems. Now I want to make use of them using an read/write filesystem by updating the kernel.

Since it's flash I need some fs that's aware of the flash wearing problem. So I guess that leaves only JFFS2.

My problem is that the 5 erase blocks set by default will eat up the whole 320KB and leaves no free space. And IIRC there's no way to pass the number of eraseblocks during mount.

Could I hardcode the number of eraseblocks to 1 in my new (but still old 2.4.20) kernel? Where is it defined? And what happens to my root fs which is JFFS2 when I change that?

Thanks a million,

Steven

#1 lore raw
Quoted 10 lines · Steven Scholz

Hi there,

I have 320KB of unused flash in our embedded systems. Now I want to make use of them using an read/write filesystem by updating the kernel.

Since it's flash I need some fs that's aware of the flash wearing problem. So I guess that leaves only JFFS2.

My problem is that the 5 erase blocks set by default will eat up the whole 320KB and leaves no free space. And IIRC there's no way to pass the number of eraseblocks during mount.

Could I hardcode the number of eraseblocks to 1 in my new (but still old 2.4.20) kernel? Where is it defined? And what happens to my root fs which is JFFS2 when I change that?

Is it enough and ok to just change the

/* Number of free blocks there must be before we... */ #define JFFS2_RESERVED_BLOCKS_BASE 3

in fs/jffs2/nodelist.h ???

Steven

#2 lore raw
Quoted 13 lines · Steven Scholz
Quoted 12 lines · Steven Scholz

Hi there,

I have 320KB of unused flash in our embedded systems. Now I want to make use of them using an read/write filesystem by updating the kernel.

Since it's flash I need some fs that's aware of the flash wearing problem. So I guess that leaves only JFFS2.

My problem is that the 5 erase blocks set by default will eat up the whole 320KB and leaves no free space. And IIRC there's no way to pass the number of eraseblocks during mount.

Quoted 8 lines
Quoted 3 lines

Could I hardcode the number of eraseblocks to 1 in my new (but still old 2.4.20) kernel? Where is it defined?
And what happens to my root fs which is JFFS2 when I change that?

Is it enough and ok to just change the

/* Number of free blocks there must be before we... */ #define JFFS2_RESERVED_BLOCKS_BASE 3

You can do this, but it will break and it will break your root jffs2 too, as there is no way to have this per partition. This all is related to garbage collection and the neccecarity to have spare blocks for writing / deleting /modifying files. In a read only fs this would not hurt.

320K is not really useful for a filesystem IMHO.
What do you want to do with it ?

Signature · 8 lines
Thomas
________________________________________________________________________
"Free software" is a matter of liberty, not price. To understand the concept,
you should think of "free" as in "free speech,'' not as in "free beer".
________________________________________________________________________
linutronix - competence in embedded & realtime linux
http://www.linutronix.de
mail: [email protected]
#3 lore raw
Quoted 10 lines · Thomas Gleixner
Quoted 8 lines
Quoted 3 lines

Could I hardcode the number of eraseblocks to 1 in my new (but still old 2.4.20) kernel? Where is it defined?
And what happens to my root fs which is JFFS2 when I change that?

Is it enough and ok to just change the

/* Number of free blocks there must be before we... */ #define JFFS2_RESERVED_BLOCKS_BASE 3

You can do this, but it will break and it will break your root jffs2 too, as there is no way to have this per partition...

:-(

Quoted 1 line

320K is not really useful for a filesystem IMHO. What do you want to do with it ?

We need some place to store a few configuration files (ca. 50KB compressed each) for our application. These 320KB are unused so I thought we could use it for this dedicated purpose instead of wasting space (and poluting) on our root fs...

Steven

#4 lore raw
Quoted 6 lines · Steven Scholz

We need some place to store a few configuration files (ca. 50KB compressed each) for our application. These 320KB are unused so I thought we could use it for this dedicated purpose instead of wasting space (and poluting) on our root fs...

Is this data which changes a lot ? Do you really need a r/w filesystem ?

Signature · 8 lines
Thomas
________________________________________________________________________
"Free software" is a matter of liberty, not price. To understand the concept,
you should think of "free" as in "free speech,'' not as in "free beer".
________________________________________________________________________
linutronix - competence in embedded & realtime linux
http://www.linutronix.de
mail: [email protected]
#5 lore raw
Quoted 9 lines · Thomas Gleixner
Quoted 5 lines · Steven Scholz

We need some place to store a few configuration files (ca. 50KB compressed each) for our application. These 320KB are unused so I thought we could use it for this dedicated purpose instead of wasting space (and poluting) on our root fs...

Is this data which changes a lot ? Do you really need a r/w filesystem ?

I assumed we'll store up to 5 files. And change them at maximum once everyday. But this might be worst case. Maybe we (our costumers) change them once a week...

I think I need a r/w filesystem because we need easy random access. CRAMFS or ramdisk is no option.

Signature · 6 lines
Steven Scholz

imc Measurement & Control               imc Meßsysteme GmbH
Voltastr. 5                             Voltastr. 5
13355 Berlin                            13355 Berlin
Germany                                 Deutschland
#6 lore raw
In reply to Thomas Gleixner
Quoted 8 lines · Thomas Gleixner

You can do this, but it will break and it will break your root jffs2 too, as there is no way to have this per partition. This all is related to garbage collection and the neccecarity to have spare blocks for writing / deleting /modifying files. In a read only fs this would not hurt.

320K is not really useful for a filesystem IMHO.
What do you want to do with it ?

Here we go again...

2 Eraseblocks (in words: two) are enough to put a jffs2 filesystem on it. One eraseblock plus a few bytes have to be reserved for garbage collection, but not two, much less five.

Jffs2 should:
- Switch from free blocks to free bytes.
- Make this per-mountpoint.
- Make the numbers depend on number and size of erase blocks.

Maybe I will even do this one day, but not before Redhat lawyers and myself sort out some things. Don't tell me "Show me the code.", since it wouldn't get included anyway.

Jörn

Signature · 2 lines
Don't patch bad code, rewrite it.
-- Kernigham and Pike, according to Rusty