public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: j.lambrecht@televic.com
Cc: ecos-discuss@ecos.sourceware.org
Subject: Re: [ECOS] Re: FTP runs out of JFFS2 nodes and trashes the file 	system
Date: Tue, 08 Apr 2008 06:48:00 -0000	[thread overview]
Message-ID: <20080408061431.GA11287@lunn.ch> (raw)
In-Reply-To: <47FAAC06.9010509@telenet.be>

>  In this test, after FTP'ing 189 files with in total 3706kB, the file  
> system crashes, but in a "valid" way: indeed, as the counter proofs, the  
> raw node pool is empty, *but how is this possible?*

Jffs2 keeps an in memory copy of the FS meta information. Each write
to the FS results in the creating of a node. Smaller writes results in
more nodes/meta information and so greater RAM usage for the meta
information. Hence you can get into the state of being out of RAM for
meta information but still have space on the filesystem. So i would
suggest writing bigger blocks, use fwrite, not write and use setbuf to
set the buffering to 4K or similar. 

> Therefore my question about FTP in  
> http://ecos.sourceware.org/ml/ecos-discuss/2008-04/msg00110.html.
>  I have to unmount/mount or reboot to be able to delete files again. If  
> I then don't delete but add files instead, it fails with the same error  
> after a few files. When I repeat this cycle of reboot-add files a few  
> times (depending on previous state of the file system) *jffs2  
> "crashes"*: I cannot anymore delete or add any file - listing  
> directories still works, also the application still runs.
> I have to format the flash to solve the problem.

There are a couple of possibilities here. 

umount/mount causes it to rebuild its in RAM meta information which
allows it to remove old nodes which are no longer needed.

It has chance to do a garbage collect of the filesystem so freeing up
some meta information and blocks on the FS.

Note that JFFS2 has unusual behaviour when full. It needs 4 to 5 free
erase blocks in order to do garbage collection. So things like df will
say there is free space, but the filesystem may refuse to write
because garbage collection does not have enough blocks to be able to
run.

>  But I read this in the documentation: "However the library may not be  
> interrupt safe. An interrupt must not cause execution of code that is  
> resident in FLASH." If I understand it well, *this means the library is  
> thread safe on the condition that all code is always executed in RAM?*
> This is ok in my case.

Just watch out for redboot and the virtual vectors. If you are using a
ROM redboot, diag_printf can jump into the ROM redboot. Similar an
exception, or using the debugger could cause the gdb stub in the ROM
redboot to get called. 

        Andrew

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

  reply	other threads:[~2008-04-08  6:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <47FA32AC.4070705@televic.com>
2008-04-07 23:22 ` Jürgen Lambrecht
2008-04-08  6:48   ` Andrew Lunn [this message]
2008-04-08  8:41     ` Jürgen Lambrecht
2008-04-08 10:32       ` Andrew Lunn
2008-04-08 15:58         ` Jürgen Lambrecht
2008-04-09 11:42         ` Jürgen Lambrecht

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080408061431.GA11287@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=ecos-discuss@ecos.sourceware.org \
    --cc=j.lambrecht@televic.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).