FreeBSD/sbin/fsck_ffs/pass5.c
/*
 * Compare the original cylinder group inode and block bitmaps with the
 * updated cylinder group inode and block bitmaps. Free inodes and blocks
 * that have been added. Complain if any previously freed inodes blocks
 * are now allocated.
 */
Compare the original cylinder group inode and block bitmaps with the
updated cylinder group inode and block bitmaps. Free inodes and blocks
that have been added. Complain if any previously freed inodes blocks
are now allocated.
Compare the original cylinder group inode and block bitmaps with the updated cylinder group inode and block bitmaps . Free inodes and blocks that have been added . Complain if any previously freed inodes blocks are now allocated .
void
update_maps(
	struct cg *oldcg,	
	struct cg *newcg,	
	int usesysctl)		
{
	int inomapsize, excessdirs;
	struct fs *fs = &sblock;
	inomapsize = howmany(fs->fs_ipg, CHAR_BIT);
	excessdirs = oldcg->cg_cs.cs_ndir - newcg->cg_cs.cs_ndir;
	if (excessdirs < 0) {
		pfatal("LOST %d DIRECTORIES\n", -excessdirs);
		excessdirs = 0;
	}
	if (excessdirs > 0)
		check_maps(cg_inosused(newcg), cg_inosused(oldcg), inomapsize,
		    oldcg->cg_cgx * (ufs2_daddr_t)fs->fs_ipg, "DIR", freedirs,
		    0, excessdirs, usesysctl);
	check_maps(cg_inosused(newcg), cg_inosused(oldcg), inomapsize,
	    oldcg->cg_cgx * (ufs2_daddr_t)fs->fs_ipg, "FILE", freefiles,
	    excessdirs, fs->fs_ipg, usesysctl);
	check_maps(cg_blksfree(oldcg), cg_blksfree(newcg),
	    howmany(fs->fs_fpg, CHAR_BIT),
	    oldcg->cg_cgx * (ufs2_daddr_t)fs->fs_fpg, "FRAG",
	    freeblks, 0, fs->fs_fpg, usesysctl);
}
void update_maps ( struct cg * oldcg , struct cg * newcg , int usesysctl ) { int inomapsize , excessdirs ; struct fs * fs = & sblock ; inomapsize = howmany ( fs -> fs_ipg , CHAR_BIT ) ; excessdirs = oldcg -> cg_cs . cs_ndir - newcg -> cg_cs . cs_ndir ; if ( excessdirs < 0 ) { pfatal ( " \n " , - excessdirs ) ; excessdirs = 0 ; } if ( excessdirs > 0 ) check_maps ( cg_inosused ( newcg ) , cg_inosused ( oldcg ) , inomapsize , oldcg -> cg_cgx * ( ufs2_daddr_t ) fs -> fs_ipg , " " , freedirs , 0 , excessdirs , usesysctl ) ; check_maps ( cg_inosused ( newcg ) , cg_inosused ( oldcg ) , inomapsize , oldcg -> cg_cgx * ( ufs2_daddr_t ) fs -> fs_ipg , " " , freefiles , excessdirs , fs -> fs_ipg , usesysctl ) ; check_maps ( cg_blksfree ( oldcg ) , cg_blksfree ( newcg ) , howmany ( fs -> fs_fpg , CHAR_BIT ) , oldcg -> cg_cgx * ( ufs2_daddr_t ) fs -> fs_fpg , " " , freeblks , 0 , fs -> fs_fpg , usesysctl ) ; }
Compare the original cylinder group inode and block bitmaps with the
 updated cylinder group inode and block bitmaps.
Compare the original cylinder group inode and block bitmaps with the updated cylinder group inode and block bitmaps .
/* cylinder group of claimed allocations */ /* cylinder group of determined allocations */ /* 1 => use sysctl interface to update maps */