[PATCH] mkfs.ubifs: support --squash-uids

Artem Bityutskiy dedekind at infradead.org
Thu May 8 02:34:59 EDT 2008


On Thu, 2008-05-08 at 10:16 +1000, Hamish Moffatt wrote:
> On Tue, May 06, 2008 at 01:23:12PM +0300, Artem Bityutskiy wrote:
> > Fundamentally, mkfs.ubifs has to know FS size because UBIFS maintains
> > and stores per-LEB information (like amount of dirty and free space in
> > each LEB) in so-called LPT area on the media. So obviously, the size of
> > this area depends on the total amount of LEBs, i.e. on the volume size.
> 
> OK (and thanks for adding this information to the web site also.)
> 
> In my case I am preparing images with mkfs.ubifs, and mounting them
> read-only on my embedded target. In that case, could the max LEB count
> be calculated automatically to fit the files and the LPT area?
> 
> I added support for ubifs images into buildroot. The user must configure
> their LEB size, max I/O size, and max LEB count as these are all
> required for mkfs.ubifs. Is there a formula to calculate an approximate 
> max LEB count from the volume size and LEB size?

Err, max LEB count = count of LEBs in the volume = volume size in
bytes / LEB size. If you know volume size is the same on each device,
just stick with this formula. If you are not 100% sure about volume
size, or you want the FS to automatically re-size when you put it on
larger volumes, then max LEB count = maximum possible volume size in
LEBs.

E.g., you you know your flash is 512MiB, which is 4096 128KiB PEBs, then
you may safely use max LEB count = 4096, because it is absolutely
maximum number. Well, actually UBI will reserve some amount of PEBs for
its own use in any case, so it is better to use 4095.

4095 is better because power of 2 numbers are "boundaries". The larger
max. LEB count is, the more UBIFS reserves for LPT area, the more levels
the LPT tree have, the more bits UBIFS uses for keys and pointers in the
LPT tree. So specifying max LEB count 3000 or 4000 makes few difference
in terms of amount of resources you spend, but 4095 and 4096 do make
slight difference.

But it does not hurt much if you use 4096, that's fine too and you'll
unlikely notice any difference.

>  I will need to improve
> the documentation for these parameters shown to the buildroot users
> (although probably I'm the only one using the ubifs target so far!).

Cool. Feel free to ask for help.

Thanks.

-- 
Best regards,
Artem Bityutskiy (Битюцкий Артём)




More information about the linux-mtd mailing list