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:
mckusick 2002-12-02 19:31:53 +00:00
parent 87d881b0fa
commit 09074e8080

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;