[PATCH] mkfs.ubifs: Only require 17 LEBs

Romain Izard romain.izard.pro at gmail.com
Thu Jul 6 00:57:44 PDT 2017


2017-07-06 8:46 GMT+02:00 Artem Bityutskiy <dedekind1 at gmail.com>:
>
> If this change is done in userspace, it should also be done in the
> kernel, which also can "format" the media.
>
> I cannot remember now, but very small volumes were very problematic.
> May be it was very inprecise free space estimation. Or something like
> -ENOSPC when trying to remove a file.
>
> The point is, make sure to test the tiny volumes very thoroughly before
> this is merged.
>

The algorithm used to determine the size of a UBIFS volume is not
exactly the same in mkfs.ubifs and in the kernel. mkfs.ubifs lets the
user tune more parameters, by specifying the number of log LEBs or
orphan LEBs, whereas the kernel calculates all these values by itself.

As a result, the kernel already accepts such small file systems, and
creates them when trying to mount an empty UBI volume of 17 LEBs. If the
empty volume has 16 or less LEBs, mounting fails with the following
error message:

[66897.450000] UBIFS error (ubi0:12 pid 12977): ubifs_mount: too few
LEBs (16), min. is 17

I modified mkfs.ubifs to be able to generate offline an image matching
the exact setup of an existing device. In this device, there is a small
volume with a tiny 17 LEBs UBIFS. I did not notice anything special
about it, but your comment worries me a little as I do not really have
the means to test "very thoroughly" this configuration.

Should I do something about it ?

Best regards,
-- 
Romain Izard



More information about the linux-mtd mailing list