git: usr.sbin/makefs: Fix calculation of file sizes

Tomohiro Kusumi tkusumi at crater.dragonflybsd.org
Tue Jul 5 23:58:06 PDT 2022


commit 214357ff39157c4bbd99df364ed6dd28c212b0c9
Author: Tomohiro Kusumi <tkusumi at netbsd.org>
Date:   Tue Jul 5 21:54:34 2022 -0700

    usr.sbin/makefs: Fix calculation of file sizes
    
    When a new FS image is created we need to calculate how much space each
    file is going to consume.
    Fix two bugs in that logic:
    
    1) Count the space needed for indirect blocks for large files.
    1) Normally the trailing data of a file is written to a block of frag
       size, 4 kB by default.
    
    However for files that use indirect blocks a full block is allocated,
    32kB by default.  Take that into account.
    
    Adjust size calculations to match what is done in ffs_mkfs routine:
    
    * Depending on the UFS version the superblock is stored at a different
      offset. Take that into account.
    * Add the cylinder group block size.
    * All of the above has to be aligned to the block size.
    
    Finally, Remove "ncg" variable. It's always 1 and it was used to
    multiply stuff.
    
    taken-from FreeBSD ecdc04d006de93eb343ce3b77208abd937d4f8ac

Summary of changes:
 usr.sbin/makefs/ffs.c | 50 ++++++++++++++++++++++++++++++--------------------
 1 file changed, 30 insertions(+), 20 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/214357ff39157c4bbd99df364ed6dd28c212b0c9


-- 
DragonFly BSD source repository


More information about the Commits mailing list