model based compressor support

Ferenc Havasi <[email protected]> Thu, 07 Oct 2004 14:40:44 +0200
Newsgroups gmane.linux.file-systems.jffs
Message-ID <[email protected]>
Hi David,

I finished the implementation of model based compressor support for JFFS2.

David, I would like to ask you: may I commit it to CVS? (certainly after 
it you can modify there anything you like/dont't like)

We had some discussion about it some month ago, I tried to follow that: 
model files now aren't "normal" files. They have no dentry only inode. I 
introduced a new kind of node:

#define JFFS2_NODETYPE_MODELINFO (JFFS2_FEATURE_INCOMPAT | 
JFFS2_NODE_ACCURATE | 5)

This node only stores an array with the inode numbers (and sizes) of the 
model files. After scaning of the flash the nlink of the inodes of model 
files are setted to 1. At the end of the mount process model files will 
be loaded "by hand". (the method is simililar the method of 
jffs2_read_dnode()).

Model files have an 8 bytes header: the first 4 is a magic 'J2MF', the 
next two is the compr and serial (usercompr), next two is reserved to 0. 
After loading the model file the corresponding compressor is called to 
initilize it (if that wants).

I modified gc to handle this MODELINFO correctly (just copy if 
neccesarry). I found a "FIXME" to handle JFFS2_NODETYPE_RWCOMPAT_COPY 
nodes, too, I implemented it in the same function.

I exended the Kconfig with the ability for users to set the priority of 
the compressor modules, too. Certainly this model support is also only 
an option, and if not enabled everything works as before.

I moved the JFFS2_COMPR_XXX defines from jffs2.h to compr.h. I think it 
is better place for them - if you not agree we can move back them.

In mkfs.jffs2 I intoduced a "compression configuration" concept. It is a 
string with comma separated words. Every word can be a name of the 
compressor (with priority, optoinally), or a compression mode. The 
default value of it is "priority,zlib:70,rtime:60". It equals the 
behavior of the original mkfs.jffs2. New switches of the mkfs.jffs2:

-C, --default-compr-config=CONFIG: Set the default compression 
configuration.

-F, --compressor-config-file=FILENAME: Specifies a compression config 
file. In this config  file  every line must be in format 
"FILENAME;TYPE;COMPRESSION_CONFIG", where FILENAME is a relative file 
name, TYPE can be only  one  of  the file  or  model keywords, and 
COMPRESSOIN_CONFIG must be a valid compression configuration. This 
specified  file will  be  compressed the specified compressor 
configuration. All of the non specified files will be  compressed  by 
the  default compression  configuration.   For  example a line of this 
config file can  be:  "boot/zImage;file;priority,zlib:60,rtime:50",  an 
other example: "model.armlib;model;zlib:60".

Certainly it is documented in its man page and if you don't use the new 
options mkfs.jffs2 will produce exactly the same image than the "old" 
mkfs.jffs2.

The attached patch contains the fix of the problem I wrote about 
yesterday but does not contains compr_armlib.c and modelgen_armlib.c 
(CVS will contain). Armlib is a special model based ARM code compressor 
designed by us.

I also modified jffs2dump.c to handle the new modelinfo node type.

Regards,
Ferenc
jffs2-bbc-model.patch (text/plain, 109.3 KB) - not displayed