Subject: Re: Solution(?) to kern/28804: quotacheck crashes on FFSv2
To: None <tech-kern@netbsd.org>
From: Edgar =?iso-8859-1?B?RnXf?= <efnbl06@bn2.maus.net>
List: tech-kern
Date: 02/15/2007 20:06:38
> The issue, though, is that more of our fs expertise hangs 
> on tech-kern, so this is a good list to use.
Good.
Anyone in a position to comment on the changes made to the FreeBSD version by McKusick?

Anyone familiar enough with softdeps?
/*
 * If we are using soft updates, then we can trust the
 * cylinder group inode allocation maps to tell us which
 * inodes are allocated. We will scan the used inode map
 * to find the inodes that are really in use, and then
 * read only those inodes in from disk.
 */
if (sblock.fs_flags & FS_DOSOFTDEP) {
	if (!cg_chkmagic(&cgblk))
		errx(1, "CG %d: BAD MAGIC NUMBER\n", cg);
	cp = &cg_inosused(&cgblk)[(inosused - 1) / CHAR_BIT];
	for ( ; inosused > 0; inosused -= CHAR_BIT, cp--) {
		if (*cp == 0)
			continue;
		for (i = 1 << (CHAR_BIT - 1); i > 0; i >>= 1) {
			if (*cp & i)
				break;
			inosused--;
		}
		break;
	}
	if (inosused <= 0)
		continue;
}

And with snapshots?
/* 
 * Do not account for file system snapshot files
 * or the actual quota data files to be consistent
 * with how they are handled inside the kernel.
 */
#ifdef	SF_SNAPSHOT
	if (DIP(dp, di_flags) & SF_SNAPSHOT)
		continue;
#endif
	if (ino == userino || ino == groupino)
		continue;
	if (qnp->flags & HASGRP) {
		fup = addid((u_long)DIP(dp, di_gid), GRPQUOTA,
		    (char *)0, mntpt);
		fup->fu_curinodes++;
		if (mode == IFREG || mode == IFDIR ||
		    mode == IFLNK)
			fup->fu_curblocks += DIP(dp, di_blocks);
	}
	if (qnp->flags & HASUSR) {
		fup = addid((u_long)DIP(dp, di_uid), USRQUOTA,
		    (char *)0, mntpt);
		fup->fu_curinodes++;
		if (mode == IFREG || mode == IFDIR ||
		    mode == IFLNK)
			fup->fu_curblocks += DIP(dp, di_blocks);
	}


May it be a better idea to put all this inode enumeration into the kernel?