Discussion:
model based compressor support
Ferenc Havasi
2004-10-07 12:40:44 UTC
Permalink
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
David Woodhouse
2004-10-07 14:36:11 UTC
Permalink
Post by Ferenc Havasi
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)
Looks good in general. I was just psyching myself up to send an update
to Linus though -- can we hold off for just a little while until that's
done?
--
dwmw2


To unsubscribe from this list: send the line "unsubscribe jffs-dev" in
the body of a message to ***@axis.com
Ferenc Havasi
2004-10-07 14:55:52 UTC
Permalink
Post by David Woodhouse
Post by Ferenc Havasi
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)
Looks good in general. I was just psyching myself up to send an update
to Linus though -- can we hold off for just a little while until that's
done?
Yes, of course. Write me if you are ready. Thanks.

But maybe the nodemgmt.c bug should be fixed before the update for
Linus. (Shall I do it?)

Ferenc

To unsubscribe from this list: send the line "unsubscribe jffs-dev" in
the body of a message to ***@axis.com
David Woodhouse
2004-10-07 14:59:05 UTC
Permalink
Post by Ferenc Havasi
But maybe the nodemgmt.c bug should be fixed before the update for
Linus. (Shall I do it?)
Yes please. Thanks for testing.
--
dwmw2


To unsubscribe from this list: send the line "unsubscribe jffs-dev" in
the body of a message to ***@axis.com
Joakim Tjernlund
2004-10-07 15:31:46 UTC
Permalink
Post by Ferenc Havasi
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
-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".
Is it possible to specify that all files in a specific directory should
be uncompressed? How?

Jocke

To unsubscribe from this list: send the line "unsubscribe jffs-dev" in
the body of a message to ***@axis.com
Ferenc Havasi
2004-10-07 20:30:26 UTC
Permalink
Post by Joakim Tjernlund
Is it possible to specify that all files in a specific directory should
be uncompressed? How?
In this version you can specify compressor configuration only for files
not for subdirectories.

But it is good idea! I will extend this possiblity for subdirectories
(not too much work).

If it is urgent I can send a patch for you soon (with an example how to
use it).

Ferenc

To unsubscribe from this list: send the line "unsubscribe jffs-dev" in
the body of a message to ***@axis.com
Joakim Tjernlund
2004-10-07 20:39:33 UTC
Permalink
Post by Ferenc Havasi
Post by Joakim Tjernlund
Is it possible to specify that all files in a specific directory should
be uncompressed? How?
In this version you can specify compressor configuration only for files
not for subdirectories.
But it is good idea! I will extend this possiblity for subdirectories
(not too much work).
OK, thanks.
Post by Ferenc Havasi
If it is urgent I can send a patch for you soon (with an example how to
use it).
No, it is not urgent. I just wanted to make sure that when I do upgrade to 2.6,
there would be something like this avalible. We download packages which
are already gzipped and it make little sense to try to compress them again.
By marking a directory in JFFS2 as "do not try to compress" we can avoid that
and hopefully the download will be quicker.

Jocke


To unsubscribe from this list: send the line "unsubscribe jffs-dev" in
the body of a message to ***@axis.com
Ferenc Havasi
2004-10-07 21:34:56 UTC
Permalink
Hi Jocke,
Post by Joakim Tjernlund
No, it is not urgent. I just wanted to make sure that when I do upgrade to 2.6,
there would be something like this avalible. We download packages which
are already gzipped and it make little sense to try to compress them again.
By marking a directory in JFFS2 as "do not try to compress" we can avoid that
and hopefully the download will be quicker.
Maybe I misunderstood you. Do you need this feature when the filesystem
is already mounted? Now this support will available only for mkfs time.
It means mkfs will not compress files in that directory but there is an
other thing after mounting it.

If it helps you I can provide an unofficial proc interface support.
Using it you will be able to change the compression mode - but not only
for a directory but globally. When you download already compressed files
you can set it to "none" and if the downloading is completed you can set
back to "priority" or "size" compression mode. (I know this is not the
nicest solution but now there is no better implemented yet - maybe later)

Bye,
Ferenc

To unsubscribe from this list: send the line "unsubscribe jffs-dev" in
the body of a message to ***@axis.com
Joakim Tjernlund
2004-10-08 06:50:25 UTC
Permalink
Hi Ferenc
Post by Ferenc Havasi
Hi Jocke,
Post by Joakim Tjernlund
No, it is not urgent. I just wanted to make sure that when I do upgrade to 2.6,
there would be something like this avalible. We download packages which
are already gzipped and it make little sense to try to compress them again.
By marking a directory in JFFS2 as "do not try to compress" we can avoid that
and hopefully the download will be quicker.
Maybe I misunderstood you. Do you need this feature when the filesystem
is already mounted? Now this support will available only for mkfs time.
It means mkfs will not compress files in that directory but there is an
other thing after mounting it.
You didn't. I did :( I thought runtime support was there also, my mistake.
But it would be nice to be able to control compression in run time.
I think there is some preparation already in place for that via chattr?)
Perhaps it would be enough to be able to mark selected directories at
mkfs time.
Post by Ferenc Havasi
If it helps you I can provide an unofficial proc interface support.
Using it you will be able to change the compression mode - but not only
for a directory but globally. When you download already compressed files
you can set it to "none" and if the downloading is completed you can set
back to "priority" or "size" compression mode. (I know this is not the
nicest solution but now there is no better implemented yet - maybe later)
I don't think this will work for me.

Jocke

To unsubscribe from this list: send the line "unsubscribe jffs-dev" in
the body of a message to ***@axis.com
Ferenc Havasi
2004-10-08 08:59:03 UTC
Permalink
Hi Jocke,
Post by Joakim Tjernlund
You didn't. I did :( I thought runtime support was there also, my mistake.
But it would be nice to be able to control compression in run time.
I think there is some preparation already in place for that via chattr?)
I've found a comment in jffs2_ioctl()...

There are two fields in jffs2_raw_inode called 'compr' and 'usercompr'.
I think if we use them well we can solve your problem not only the
support of model based compressors. I think it over util David finishes
his patch for Linus.

Bye,
Ferenc

To unsubscribe from this list: send the line "unsubscribe jffs-dev" in
the body of a message to ***@axis.com
David Woodhouse
2004-10-08 10:00:35 UTC
Permalink
Post by Ferenc Havasi
There are two fields in jffs2_raw_inode called 'compr' and 'usercompr'.
I think if we use them well we can solve your problem not only the
support of model based compressors. I think it over util David finishes
his patch for Linus.
That's what usercompr was designed for.... but didn't you already steal
it?
--
dwmw2


To unsubscribe from this list: send the line "unsubscribe jffs-dev" in
the body of a message to ***@axis.com
Ferenc Havasi
2004-10-08 10:32:12 UTC
Permalink
Post by David Woodhouse
That's what usercompr was designed for.... but didn't you already steal
it?
Now in in CVS there are only preparations for stealing it :)

I planed to store model serial on it (in the patch I sent), but it is
too big for that. 3-4 bits is enough, and we can use the other 4-5 bits
to store this information - let's call this bits as userconf.

My suggestion:
-if userconf is 0 then everything works as before.
-if it is 1 then a predefinied compressor configuration 'none' will be
used. (what means: do not compress)
-otherwise it can a really user definied compressor configuration. This
compressor configurations will be stored in a new node type, and will be
set using mkfs or runtime. But it is only in long term - not now.

To process this userconf should be also only an option in Kconfig.

What do you think?

Bye,
Ferenc

To unsubscribe from this list: send the line "unsubscribe jffs-dev" in
the body of a message to ***@axis.com

Loading...