Skip to contentSkip to conversation

Data loss during power off

DISCUSSION Henrique Faria 4 participants 6 messages Jun 25, 2002 – Jun 27, 2002

lore
Share & tools
lore
#0 lore raw

Hello!
We're using reiserfs 3.6.25 and linux 2.4.18, in a 256 MB flash memory card, to develop a game. Data is written all the time, in local files, by the main process. The "power off" test has to be done, for the machines will be turned off with no shutdown process.
What's happening: pressing the power off button (during data writing) makes data to be lost. Is it possible to force the data to be written in the file system? I tried to change the JOURNAL_MAX_TRANS_AGE and the JOURNAL_MAX_COMMIT_AGE consts. Less data is lost, but I still get some loss. Thanks,

Henrique R. Faria

#1 lore raw

What you're probably looking for, then, is battery-backed RAM or non-volatile memory. No journalling file system is going to be able to commit *every* single byte to a journal, at least not on an instruction-by-instruction basis during disk writes (even the kernel itself has write buffers that won't be saved if you shut off the power on a normal system).

Okay. It's hot here. I just pulled that out of my butt. I could be entirely wrong.

Michael

Quoted 13 lines · Henrique Faria

Hello!
We're using reiserfs 3.6.25 and linux 2.4.18, in a 256 MB flash memory card, to develop a game. Data is written all the time, in local files, by the main process. The "power off" test has to be done, for the machines will be turned off with no shutdown process.
What's happening: pressing the power off button (during data writing) makes data to be lost. Is it possible to force the data to be written in the file system? I tried to change the JOURNAL_MAX_TRANS_AGE and the JOURNAL_MAX_COMMIT_AGE consts. Less data is lost, but I still get some loss. Thanks,

Henrique R. Faria

Signature · 11 lines
/* BEGIN SIG 
*
* "It might look like I'm doing nothing, but at the cellular level
* I'm really quite busy."
*  ---anonymous
*
*-----------------------------
* Michael Chang
* [email protected]
* http://www.syndetic.org/
*/
#2 lore raw
In reply to Henrique Faria

Hello!

This (almost) cannot be done. Of course you may resort to opening files with O_SYNC or issuing sync/fsync calls after each write, this way you'd lose even less data by the cost of speed of fs operations. At least with this approach you may be sure that after sync/fsync returned (or write in case of oepning with O_SYNC), data are safe on the media. (This is assuming that your flash memory card does not do any cheating
and does not report it have completed command before actual writing).

Bye,
Oleg

Quoted 12 lines · Henrique Faria

Hello!
We're using reiserfs 3.6.25 and linux 2.4.18, in a 256 MB flash memory card, to develop a game. Data is written all the time, in local files, by the main process. The "power off" test has to be done, for the machines will be turned off with no shutdown process.
What's happening: pressing the power off button (during data writing) makes data to be lost. Is it possible to force the data to be written in the file system? I tried to change the JOURNAL_MAX_TRANS_AGE and the JOURNAL_MAX_COMMIT_AGE consts. Less data is lost, but I still get some loss. Thanks,

Henrique R. Faria

#3 lore raw
In reply to Henrique Faria
Quoted 10 lines · Henrique Faria

Hello!
We're using reiserfs 3.6.25 and linux 2.4.18, in a 256 MB flash memory card, to develop a game. Data is written all the time, in local files, by the main process. The "power off" test has to be done, for the machines will be turned off with no shutdown process.
What's happening: pressing the power off button (during data writing) makes data to be lost. Is it possible to force the data to be written in the file system? I tried to change the JOURNAL_MAX_TRANS_AGE and the JOURNAL_MAX_COMMIT_AGE consts. Less data is lost, but I still get some loss. Thanks,

The data logging patches also include data=ordered mode. Using that, plus setting the max trans age (or max batch count), will flush data blocks right away.

I'm waiting for a tester to confirm I've fixed the page locking problem w/writepage in the current data logging patch, then I'll do a new release.

-chris

#4 lore raw

I'll try the patch! Can JOURNAL_MAX_TRANS_AGE be zero? Do I need to set up JOURNAL_MAX_COMMIT_AGE too?

On 27 Jun 2002 10:53:37 -0400, Chris Mason <[email protected]> escreveu :

Quoted 8 lines

De: Chris Mason <[email protected]>
Data: 27 Jun 2002 10:53:37 -0400
Para: Henrique Faria <[email protected]>
Assunto: Re: [reiserfs-list] Data loss during power off

Quoted 2 lines · Henrique Faria

Hello!
We're using reiserfs 3.6.25 and linux 2.4.18, in a 256 MB flash memory

card,

Quoted 1 line
Quoted 1 line

to develop a game. Data is written all the time, in local files, by the

main

Quoted 3 lines
Quoted 3 lines

process. The "power off" test has to be done, for the machines will be turned off with no shutdown process.
What's happening: pressing the power off button (during data writing)

makes

Quoted 1 line
Quoted 1 line

data to be lost. Is it possible to force the data to be written in the

file

Quoted 2 lines
Quoted 2 lines

system? I tried to change the JOURNAL_MAX_TRANS_AGE and the JOURNAL_MAX_COMMIT_AGE consts. Less data is lost, but I still get some

loss.

Quoted 16 lines
Quoted 1 line

Thanks,

The data logging patches also include data=ordered mode. Using that, plus setting the max trans age (or max batch count), will flush data blocks right away.

I'm waiting for a tester to confirm I've fixed the page locking problem w/writepage in the current data logging patch, then I'll do a new release.

-chris

#5 lore raw
Quoted 2 lines · Henrique Faria

I'll try the patch! Can JOURNAL_MAX_TRANS_AGE be zero? Do I need to set up JOURNAL_MAX_COMMIT_AGE too?

No, the best way to do it is to set JOURNAL_MAX_BATCH to 1. That way it is size dependent instead of age dependent. The namesys journal relocation patch (which my data logging stuff is against), includes the ability to set these parameters on a per FS basis without recompiling.

-chris