Correctly calculate the initial number of fragments in a filesystem

so that fsck does not complain with `SUMMARY BLK COUNT(S) WRONG IN
SUPERBLK' the first time it is run on a new filesystem.

Reported by:	Poul-Henning Kamp <phk@freebsd.org>
Sponsored by:   DARPA & NAI Labs.
This commit is contained in:
Kirk McKusick 2002-12-02 19:31:53 +00:00
parent f033309fcd
commit 33493b1820
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=107519

View File

@ -403,8 +403,8 @@ mkfs(struct partition *pp, char *fsys)
howmany(csfrags, sblock.fs_frag);
sblock.fs_cstotal.cs_nffree =
fragnum(&sblock, sblock.fs_size) +
(numfrags(&sblock, csfrags) > 0 ?
sblock.fs_frag - numfrags(&sblock, csfrags) : 0);
(fragnum(&sblock, csfrags) > 0 ?
sblock.fs_frag - fragnum(&sblock, csfrags) : 0);
sblock.fs_cstotal.cs_nifree = sblock.fs_ncg * sblock.fs_ipg - ROOTINO;
sblock.fs_cstotal.cs_ndir = 0;
sblock.fs_dsize -= csfrags;