[PATCH 0/3] ubifs: add lz4hc compression

Richard Weinberger richard at nod.at
Fri Mar 3 04:07:44 PST 2017


Artem,

Am 03.03.2017 um 13:00 schrieb Artem Bityutskiy:
> 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.

We don't need to change the on-flash format.
I'd vote to add a new super block flag.

See: commit fc4b891bbefa73b496bb44b076bb5274b6bfba68
Author: Richard Weinberger <richard at nod.at>
Date:   Wed Oct 19 23:46:39 2016 +0200

    ubifs: Raise write version to 5

    Starting with version 5 the following properties change:
     - UBIFS_FLG_DOUBLE_HASH is mandatory
     - UBIFS_FLG_ENCRYPTION is optional but depdens on UBIFS_FLG_DOUBLE_HASH
     - Filesystems with unknown super block flags will be rejected, this
       allows us in future to add new features without raising the UBIFS
       write version.

    Signed-off-by: Richard Weinberger <richard at nod.at>

Thanks,
//richard



More information about the linux-mtd mailing list