public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
From: "Jürgen Lambrecht" <J.Lambrecht@televic.com>
To: Andrew Lunn <andrew@lunn.ch>, Gary Thomas <gary@mlbassoc.com>,
	  ecos-discuss@ecos.sourceware.org
Subject: Re: [ECOS] Re: FTP runs out of JFFS2 nodes and trashes the file	system
Date: Wed, 09 Apr 2008 11:42:00 -0000	[thread overview]
Message-ID: <47FC904C.7050809@televic.com> (raw)
In-Reply-To: <20080408090553.GA8077@lunn.ch>

Cause of error found! See below.

Andrew Lunn wrote:

>>But Gary says  
>>(http://ecos.sourceware.org/ml/ecos-discuss/2008-04/msg00102.html) that  
>>jffs2 automatically buffers data to fill a node, and I read yesterday  
>>something about that on infradead.org ???
>>    
>>
>
>I don't think that is correct for eCos. On Linux the VFS maybe
>blocking together writes, but for eCos there is no VFS. Writes go
>directly to the filesystem. Enabling debugging may prove this.
>
>         Andrew
>
>  
>
Here are my debug results:

- *jffs2 mount* debug output:
   I see there are nodes with a huge number of versions: 326, 628... . 
Each time of size 0x100 or 256B. The smallest versions are 100!
- *FTP* debug output:
   I see the buffer size is 2kB, and fwrite() is called per 2kB (untill 
the file is finished)
   Solution: I need to set the buffer size to 4kB to fit the jffs2 node 
size. I  guess this is a TCP/IP stack buffer size I have to set with ioctl()?
- *libc fwrite*:
   I see the data is written per 256B!! OK: the default value of 
CYGNUM_LIBC_STDIO_BUFSIZE is 256.
   Solution: set buffer size with setbuf() to 4kB
- *jffs2_fo_write*
   Gets a request to allocate 256B, request a minimum of 196B, and gets 
much more.
   Writes a dnode of 256B.
   So indeed, jffs2 does not buffer to have the optimal node size.
   So this way, my 16000 raw nodes (costing 250kB RAM) can only store 4MB 
instead of 62.5MB!! This explains my problem with FTP.

Conclusion:
To use a flash with jffs2 efficiently
- users should be aware they must call write with the jffs2 buffer size
- users should be aware they must set the stream libc buffer size to the 
jffs2 buffer size before using fwrite!
   -> even better: the default value of CYGNUM_LIBC_STDIO_BUFSIZE should 
be set to the jffs2 buffer size if jffs2 is used. OK, if you use 2 
different file systems this is not valid anymore...

Anyhow, ecos misses a good jffs2 usage manual.
If I want to write one, how should I do that? I don't know sgml.. OK, my 
xemacs knows it ;-).

Thanks for your help!,
Jürgen


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

      parent reply	other threads:[~2008-04-09  9:46 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
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 [this message]

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=47FC904C.7050809@televic.com \
    --to=j.lambrecht@televic.com \
    --cc=andrew@lunn.ch \
    --cc=ecos-discuss@ecos.sourceware.org \
    --cc=gary@mlbassoc.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).