public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* Powerfail-tests and jffs2-sync-mount
@ 2008-03-06 16:41 Schlägl Manfred jun.
  2008-03-07  6:10 ` Artem Bityutskiy
  0 siblings, 1 reply; 5+ messages in thread
From: Schlägl Manfred jun. @ 2008-03-06 16:41 UTC (permalink / raw)
  To: linux-mtd

Hi!

I did some powerfail-testing of jffs2. 

Short overview (Contact me for details):
Arch: ARM926EJ-S with 40MB rw jffs2 part on Samsung NAND-Flash
Kernel: linux-2.6.12 (a little bit out of date, i know ;-))
Test: 
 * Target-Loop
   * filesystem-consistency:
     * create dir
     * copy data(> eraseblock-size) to new file
     * delete a file
   * file-consistency:
     * logfile on jffs-part (simply appending text with echo)
 * External random-time reset:
   * external uC
   * generates reset every 120+rand(0..30) seconds
 * Run until no more space on filesystem
Results:
 * test with sync-mounted jffs2 (mount -o sync):
   * duration 4:40 hours
   * 131 generated resets
   * consistent FS
   * consistent logfile
 * test with async mounted jffs2:
   * duration 4:10 hours
   * 118 generated resets
   * consistent FS
   * corrupted logfile (bad-chars, etc.)

Now my question: Are there any non-obvious disadvantages, mounting jffs2
synchronal, except lower speed and a little(depends on usage) decreased
flash-life-time (wear-out), or is this anyway the default approach?

Best regards,
	Manfred Schlaegl

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Powerfail-tests and jffs2-sync-mount
  2008-03-06 16:41 Powerfail-tests and jffs2-sync-mount Schlägl Manfred jun.
@ 2008-03-07  6:10 ` Artem Bityutskiy
  2008-03-07  7:45   ` Schlaegl Manfred jun.
  0 siblings, 1 reply; 5+ messages in thread
From: Artem Bityutskiy @ 2008-03-07  6:10 UTC (permalink / raw)
  To: Schlägl Manfred jun.; +Cc: linux-mtd

On Thu, 2008-03-06 at 17:41 +0100, Schlägl Manfred jun. wrote:
> Hi!
> 
> I did some powerfail-testing of jffs2. 
> 
> Short overview (Contact me for details):
> Arch: ARM926EJ-S with 40MB rw jffs2 part on Samsung NAND-Flash
> Kernel: linux-2.6.12 (a little bit out of date, i know ;-))
> Test: 
>  * Target-Loop
>    * filesystem-consistency:
>      * create dir
>      * copy data(> eraseblock-size) to new file
>      * delete a file
>    * file-consistency:
>      * logfile on jffs-part (simply appending text with echo)
>  * External random-time reset:
>    * external uC
>    * generates reset every 120+rand(0..30) seconds
>  * Run until no more space on filesystem
> Results:
>  * test with sync-mounted jffs2 (mount -o sync):
>    * duration 4:40 hours
>    * 131 generated resets
>    * consistent FS
>    * consistent logfile
>  * test with async mounted jffs2:
>    * duration 4:10 hours
>    * 118 generated resets
>    * consistent FS
>    * corrupted logfile (bad-chars, etc.)
> 
> Now my question: Are there any non-obvious disadvantages, mounting jffs2
> synchronal, except lower speed and a little(depends on usage) decreased
> flash-life-time (wear-out), or is this anyway the default approach?

My understanding of the things is that this should not really matter. I
thought if you have some corruption in asynchronous mode, you should
have them in synchronous too, may its worth trying more synchronous mode
testing?

-- 
Best regards,
Artem Bityutskiy (Битюцкий Артём)

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Powerfail-tests and jffs2-sync-mount
  2008-03-07  6:10 ` Artem Bityutskiy
@ 2008-03-07  7:45   ` Schlaegl Manfred jun.
  2008-03-07  8:09     ` Artem Bityutskiy
  0 siblings, 1 reply; 5+ messages in thread
From: Schlaegl Manfred jun. @ 2008-03-07  7:45 UTC (permalink / raw)
  To: dedekind; +Cc: linux-mtd

Hi!

Am Freitag, den 07.03.2008, 08:10 +0200 schrieb Artem Bityutskiy:
> On Thu, 2008-03-06 at 17:41 +0100, Schlägl Manfred jun. wrote:
> > Hi!
> > 
> > I did some powerfail-testing of jffs2. 
> > 
> > Short overview (Contact me for details):
> > Arch: ARM926EJ-S with 40MB rw jffs2 part on Samsung NAND-Flash
> > Kernel: linux-2.6.12 (a little bit out of date, i know ;-))
> > Test: 
> >  * Target-Loop
> >    * filesystem-consistency:
> >      * create dir
> >      * copy data(> eraseblock-size) to new file
> >      * delete a file
> >    * file-consistency:
> >      * logfile on jffs-part (simply appending text with echo)
> >  * External random-time reset:
> >    * external uC
> >    * generates reset every 120+rand(0..30) seconds
> >  * Run until no more space on filesystem
> > Results:
> >  * test with sync-mounted jffs2 (mount -o sync):
> >    * duration 4:40 hours
> >    * 131 generated resets
> >    * consistent FS
> >    * consistent logfile
> >  * test with async mounted jffs2:
> >    * duration 4:10 hours
> >    * 118 generated resets
> >    * consistent FS
> >    * corrupted logfile (bad-chars, etc.)
> > 
> > Now my question: Are there any non-obvious disadvantages, mounting jffs2
> > synchronal, except lower speed and a little(depends on usage) decreased
> > flash-life-time (wear-out), or is this anyway the default approach?
> 
> My understanding of the things is that this should not really matter. I
> thought if you have some corruption in asynchronous mode, you should
> have them in synchronous too, may its worth trying more synchronous mode
> testing?
> 
I thought it's a matter of file-buffers between the file-operations and
jffs2, but these buffer should be flushed on close of the file, so there
should be no problem with echo.
I think i've to take a look on vfs, perhaps there is some buffering, or
(even worst) some reodering of actions.

Currently i've to do some other tests (bootloader bad-block-handling).
After that I will work on some methodes to keep different
files-types(config-files, log-files, ...) conistent in case of
powerfail. So I will do some further tests on saturday or thursday.

Best regards,
        Manfred Schlaegl

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Powerfail-tests and jffs2-sync-mount
  2008-03-07  7:45   ` Schlaegl Manfred jun.
@ 2008-03-07  8:09     ` Artem Bityutskiy
  2008-03-25  6:50       ` Schlaegl Manfred jun.
  0 siblings, 1 reply; 5+ messages in thread
From: Artem Bityutskiy @ 2008-03-07  8:09 UTC (permalink / raw)
  To: Schlaegl Manfred jun.; +Cc: linux-mtd


On Fri, 2008-03-07 at 08:45 +0100, Schlaegl Manfred jun. wrote:
> > > Now my question: Are there any non-obvious disadvantages, mounting jffs2
> > > synchronal, except lower speed and a little(depends on usage) decreased
> > > flash-life-time (wear-out), or is this anyway the default approach?
> > 
> > My understanding of the things is that this should not really matter. I
> > thought if you have some corruption in asynchronous mode, you should
> > have them in synchronous too, may its worth trying more synchronous mode
> > testing?
> > 
> I thought it's a matter of file-buffers between the file-operations and
> jffs2, but these buffer should be flushed on close of the file, so there
> should be no problem with echo.
> I think i've to take a look on vfs, perhaps there is some buffering, or
> (even worst) some reodering of actions.

Actually JFFS2 is synchronous from VFS's point of view. It does not have
write back for pages and inodes, and every time VFS asks to write
something, JFFS2 just writes straight away, without any postponing.

But, JFFS2 has its small internal buffer. Design-wise, it sits somewhere
at the bottom level of JFFS2, just before the I/O level.

The buffer (so-called write-buffrer) has size equivalent to NAND page
size. I think it is 2048 bytes in your case. All writes go to this
buffer, and when it becomes full, it is flushed to the flash. This is a
optimization which makes sure JFFS2 does not waste too much space,
because without the buffer it would waste space up to the next NAND page
on each write.

Thus, when you mount the FS with -a sync, it should flush the write
buffer every time before returning to user-space.

So, basically, returning to your original question - there should not be
too much difference, but I'd expect synchronous mode to be slower. E.g.,
compare:

time dd if=/dev/zero of=file
time tar -xf many_small_files_inside.tar

on sync and async mounts.

-- 
Best regards,
Artem Bityutskiy (Битюцкий Артём)

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Powerfail-tests and jffs2-sync-mount
  2008-03-07  8:09     ` Artem Bityutskiy
@ 2008-03-25  6:50       ` Schlaegl Manfred jun.
  0 siblings, 0 replies; 5+ messages in thread
From: Schlaegl Manfred jun. @ 2008-03-25  6:50 UTC (permalink / raw)
  To: dedekind; +Cc: linux-mtd

Hi!

Little late, I know..

Am Freitag, den 07.03.2008, 10:09 +0200 schrieb Artem Bityutskiy:
> On Fri, 2008-03-07 at 08:45 +0100, Schlaegl Manfred jun. wrote:
> > > > Now my question: Are there any non-obvious disadvantages, mounting jffs2
> > > > synchronal, except lower speed and a little(depends on usage) decreased
> > > > flash-life-time (wear-out), or is this anyway the default approach?
> > > 
> > > My understanding of the things is that this should not really matter. I
> > > thought if you have some corruption in asynchronous mode, you should
> > > have them in synchronous too, may its worth trying more synchronous mode
> > > testing?
> > > 
> > I thought it's a matter of file-buffers between the file-operations and
> > jffs2, but these buffer should be flushed on close of the file, so there
> > should be no problem with echo.
> > I think i've to take a look on vfs, perhaps there is some buffering, or
> > (even worst) some reodering of actions.
I did similar tests again, and now I detected no more file-errors or
inconsistencies with async mount. The problem on my oppinion was, that I
analized the fs by taking an image of the real nand-flash(2.6.12), and
analized it with nandsim(2.6.18).
Now I analized the filesystem directly and there were no more errors &
inconsistencies. 

> 
> Actually JFFS2 is synchronous from VFS's point of view. It does not have
> write back for pages and inodes, and every time VFS asks to write
> something, JFFS2 just writes straight away, without any postponing.
> 
> But, JFFS2 has its small internal buffer. Design-wise, it sits somewhere
> at the bottom level of JFFS2, just before the I/O level.
> 
> The buffer (so-called write-buffrer) has size equivalent to NAND page
> size. I think it is 2048 bytes in your case. 
(I've 512 byte pages.)
> All writes go to this
> buffer, and when it becomes full, it is flushed to the flash. This is a
> optimization which makes sure JFFS2 does not waste too much space,
> because without the buffer it would waste space up to the next NAND page
> on each write.
> 
> Thus, when you mount the FS with -a sync, it should flush the write
> buffer every time before returning to user-space.
Instead of a sync-mount I will use a sync-open on critical logfiles. It
should keep the logfile without write-buffers, so that I'll get very
actual logfiles, in case of powerfail.
> 
> So, basically, returning to your original question - there should not be
> too much difference, but I'd expect synchronous mode to be slower. E.g.,
> compare:
> 
> time dd if=/dev/zero of=file
> time tar -xf many_small_files_inside.tar
> 
> on sync and async mounts.
yes, it's a bit slower in case of many "small" writes.

Thank you very much for your help.

Best regards
	Manfred

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-03-25  6:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-06 16:41 Powerfail-tests and jffs2-sync-mount Schlägl Manfred jun.
2008-03-07  6:10 ` Artem Bityutskiy
2008-03-07  7:45   ` Schlaegl Manfred jun.
2008-03-07  8:09     ` Artem Bityutskiy
2008-03-25  6:50       ` Schlaegl Manfred jun.

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox