Hi Alex,

I have some 'rough' idea how the algorithm for calculating nbpi
might look like.

In general (and according to newfs(1M) man page), nbpi represents
expected average size of file in the UFS filesystem:

...
         -i nbpi

             The number of bytes per inode, which  specifies  the
             density  of inodes in the file system. The number is
             divided into the total size of the  file  system  to
             determine the number of inodes to create.

             This value should reflect the expected average  size
             of  files  in  the  file system. If fewer inodes are
             desired, a larger number should be used.  To  create
             more  inodes,  a smaller number should be given. The
...

So it seems to me like initial nbpi value can be calculated
in following way:

nbpi = BOOT_ARCHIVE_SIZE/NUMBER_OF_ENTITIES

where

BOOT_ARCHIVE_SIZE - size of boot archive calculated in
  boot_archive_archive.py

NUMBER_OF_ENTITIES - total number of inodes needed
  (files, dirs, symlinks, ...). Hardlinks might be excluded
  as they don't consume inodes.

It seems that it is expected that nbpi is power of 2, so it would
be rounded down to the nearest power of 2 (number of available inodes
would increase), for instance if nbpi is calculated as 10000,
it would be rounded to 8192.

Of course there are some mechanisms to be investigated :-) e.g.

* how to calculate NUMBER_OF_ENTITIES (maybe we could use just
  something like 'find . | wc -l' if it turns out that hard links
  can be neglected).

* which BOOT_ARCHIVE_SIZE to use - 'rough' (calculated as
  dir_size(BA_BUILD)) or padded or other ?

Hope this might help as a starting point :-)
Jan



Alexander Eremin wrote:
> On Wed, 2009-11-25 at 10:34 +0100, Jan Damborsky wrote:
>> Alexander Eremin wrote:
>>> On Wed, 2009-11-25 at 10:24 +0100, Jan Damborsky wrote:
>>>> That sounds reasonable. Do you happen to consider addressing
>>>> this problem as part of fix for bug 8205 ? It seems it could
>>>> fall under this bug, just checking. 
>>> Yes, shure.
>> Thank you very much for working on this !
>> If you need any help, feel free to ping me.
>>
>> Jan
> Thanks Jan,
> I just thinking about calculation, how doing this having 
> only BA directory with files.
>
> For x86 LiveCD BA directory contains (find . |wc -l)
>    16036 files, required nbpi=8162
> sparc AI BA directory contains 7222 files,
> required nbpi=16384.
>
> Have you any ideas?;)
>
>
>


Reply via email to