This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: JFFS2 "eating memory" when creating files


Oyvind Harboe wrote:
> My preferred behaviour would be if JFFS2 freed up all caches once all
> files where closed(the least amount of code impact), but if there is no
> way to modify JFFS2 to do this, I plan to mount/unmount before/after the
> JFFS2 session.

I once tried this, but it did not work for me, for the following reason:
JFFS2 is the only file system I am using; it is mounted on /flash. I use
the chdir() function to set up a current directory. This marks the file
system as busy, and it refuses the umount request. And I cannot chdir()
to a directory outside the flash file system, because no such directory exists.
chdir() to '/' does not work, because '/' is not a real directory.

> After making the attached changes to fs-ecos.c, things are looking much
> better, but JFFS2 still "eats" 24 bytes every time I open, write and
> close a file.

That is most likely because a new node has to be created in the log, which
is represented in RMA  as a struct raw_node_ref. You probably have configured
with the memory pool size (CYGNUM_FS_JFFS2_RAW_NODE_REF_CACHE_POOL_SIZE) set
to zero. It then uses malloc() to allocated new nodes, which as a granularity
of 24 bytes (if using the standard dlmalloc implementation). Using a an
allocation pool saves some memory, because the node size is actually only
16 bytes. Of course, you will have to estimate the maximum number of nodes
you will ever use. This figure depeds on the size of your file system, and
how your files are written (buffer size). Increasing the page size in the
Linux compatibility package tends to reduce the number of nodes required,
because you can write bigger, and hence fewer, data nodes at the expense
of the file system allocating larger static buffers.

tk
-- 
--------------------------------------------------

Thomas Koeller, Software Development

Basler Vision Technologies
An der Strusbek 60-62
22926 Ahrensburg
Germany

Tel +49 (4102) 463-162
Fax +49 (4102) 463-239

mailto:thomas.koeller@baslerweb.com
http://www.baslerweb.com

==============================


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]