From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1583 invoked by alias); 9 Apr 2008 09:46:29 -0000 Received: (qmail 1572 invoked by uid 22791); 9 Apr 2008 09:46:28 -0000 X-Spam-Check-By: sourceware.org Received: from d5152C2DE.access.telenet.be (HELO lx-dmz.televic.com) (81.82.194.222) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 09 Apr 2008 09:45:51 +0000 Received: (qmail 17966 invoked from network); 9 Apr 2008 09:45:48 -0000 Received: from nt-email.televic.com (10.0.0.9) by lx-dmz.televic.com with SMTP; 9 Apr 2008 09:45:48 -0000 Received: from [10.0.56.4] ([10.0.56.4]) by nt-email.TELEVIC.COM with Microsoft SMTPSVC(6.0.3790.1830); Wed, 9 Apr 2008 11:45:48 +0200 Message-ID: <47FC904C.7050809@televic.com> Date: Wed, 09 Apr 2008 11:42:00 -0000 From: =?ISO-8859-1?Q?J=FCrgen_Lambrecht?= User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.13) Gecko/20060414 MIME-Version: 1.0 To: Andrew Lunn , Gary Thomas , ecos-discuss@ecos.sourceware.org References: <47FA32AC.4070705@televic.com> <47FAAC06.9010509@telenet.be> <20080408061431.GA11287@lunn.ch> <47FB2E87.4010607@televic.com> <20080408090553.GA8077@lunn.ch> In-Reply-To: <20080408090553.GA8077@lunn.ch> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-IsSubscribed: yes Mailing-List: contact ecos-discuss-help@ecos.sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: ecos-discuss-owner@ecos.sourceware.org Subject: Re: [ECOS] Re: FTP runs out of JFFS2 nodes and trashes the file system X-SW-Source: 2008-04/txt/msg00148.txt.bz2 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