[PATCH 0/3] ubifs: add lz4hc compression

Artem Bityutskiy dedekind1 at gmail.com
Fri Mar 3 04:00:38 PST 2017


On Fri, 2017-03-03 at 20:07 +0900, Hyunchul Lee wrote:
> yes, ubifs detects this. but I mean that if another compression type
> except lz4hc
> is added, ubifs cannot. because ubifs_iget() assigns ubifs_ino_node's
> compr_type(16-bit) 
> to ubifs_inode's compr_type(2-bit).
> I guess that the disk format version should be incremented.

Let's say that some day in the future you add the new XYZ compression
support, and its type is 5. Let's say the new compressor is supported
in kernel version 5.0.

Now I get your device which is running kernel 5.0 and uses XYZ
compression. I downgrade the kernel to version 4.0 on this device, v4.0
does not support XYZ. What happens?

Well, not a very good thing. UBIFS will read the inode, truncate
compr_type in ubifs_iget():

        ui->compr_type  = le16_to_cpu(ino->compr_type);

and happily continue, and later on failing to decompress.

Is this ideal? No. But we can lessen the future problem by making
compr_type to be full u16 already today.

Should we change on-flash format? I think no, because UBIFS will still
fail when it tries to decompress.

Artem.



More information about the linux-mtd mailing list