Module Name: src Committed By: bouyer Date: Sat Feb 12 19:53:32 UTC 2011
Modified Files: src/sbin/fsck_ffs [bouyer-quota2]: inode.c pass1.c pass4.c Log Message: Snapshot inode doesn't count for block quotas. To generate a diff of this commit: cvs rdiff -u -r1.63.2.1 -r1.63.2.2 src/sbin/fsck_ffs/inode.c cvs rdiff -u -r1.46.14.1 -r1.46.14.2 src/sbin/fsck_ffs/pass1.c cvs rdiff -u -r1.25.14.1 -r1.25.14.2 src/sbin/fsck_ffs/pass4.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sbin/fsck_ffs/inode.c diff -u src/sbin/fsck_ffs/inode.c:1.63.2.1 src/sbin/fsck_ffs/inode.c:1.63.2.2 --- src/sbin/fsck_ffs/inode.c:1.63.2.1 Thu Jan 20 14:24:53 2011 +++ src/sbin/fsck_ffs/inode.c Sat Feb 12 19:53:32 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: inode.c,v 1.63.2.1 2011/01/20 14:24:53 bouyer Exp $ */ +/* $NetBSD: inode.c,v 1.63.2.2 2011/02/12 19:53:32 bouyer Exp $ */ /* * Copyright (c) 1980, 1986, 1993 @@ -34,12 +34,13 @@ #if 0 static char sccsid[] = "@(#)inode.c 8.8 (Berkeley) 4/28/95"; #else -__RCSID("$NetBSD: inode.c,v 1.63.2.1 2011/01/20 14:24:53 bouyer Exp $"); +__RCSID("$NetBSD: inode.c,v 1.63.2.2 2011/02/12 19:53:32 bouyer Exp $"); #endif #endif /* not lint */ #include <sys/param.h> #include <sys/time.h> +#include <sys/stat.h> #include <ufs/ufs/dinode.h> #include <ufs/ufs/dir.h> @@ -830,12 +831,15 @@ } memset(&idesc, 0, sizeof(struct inodesc)); - idesc.id_type = ADDR; idesc.id_func = pass4check; idesc.id_number = ino; dp = ginode(ino); idesc.id_uid = iswap32(DIP(dp, uid)); idesc.id_gid = iswap32(DIP(dp, gid)); + if (iswap32(DIP(dp, flags)) & SF_SNAPSHOT) + idesc.id_type = SNAP; + else + idesc.id_type = ADDR; (void)ckinode(dp, &idesc); clearinode(dp); inodirty(); Index: src/sbin/fsck_ffs/pass1.c diff -u src/sbin/fsck_ffs/pass1.c:1.46.14.1 src/sbin/fsck_ffs/pass1.c:1.46.14.2 --- src/sbin/fsck_ffs/pass1.c:1.46.14.1 Thu Jan 20 14:24:53 2011 +++ src/sbin/fsck_ffs/pass1.c Sat Feb 12 19:53:32 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: pass1.c,v 1.46.14.1 2011/01/20 14:24:53 bouyer Exp $ */ +/* $NetBSD: pass1.c,v 1.46.14.2 2011/02/12 19:53:32 bouyer Exp $ */ /* * Copyright (c) 1980, 1986, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)pass1.c 8.6 (Berkeley) 4/28/95"; #else -__RCSID("$NetBSD: pass1.c,v 1.46.14.1 2011/01/20 14:24:53 bouyer Exp $"); +__RCSID("$NetBSD: pass1.c,v 1.46.14.2 2011/02/12 19:53:32 bouyer Exp $"); #endif #endif /* not lint */ @@ -467,7 +467,7 @@ inodirty(); } update_uquot(inumber, idesc->id_uid, idesc->id_gid, - idesc->id_entryno, 1); + (idesc->id_type == SNAP) ? 0 : idesc->id_entryno, 1); return; unknown: pfatal("UNKNOWN FILE TYPE I=%llu", (unsigned long long)inumber); Index: src/sbin/fsck_ffs/pass4.c diff -u src/sbin/fsck_ffs/pass4.c:1.25.14.1 src/sbin/fsck_ffs/pass4.c:1.25.14.2 --- src/sbin/fsck_ffs/pass4.c:1.25.14.1 Thu Jan 20 14:24:54 2011 +++ src/sbin/fsck_ffs/pass4.c Sat Feb 12 19:53:32 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: pass4.c,v 1.25.14.1 2011/01/20 14:24:54 bouyer Exp $ */ +/* $NetBSD: pass4.c,v 1.25.14.2 2011/02/12 19:53:32 bouyer Exp $ */ /* * Copyright (c) 1980, 1986, 1993 @@ -34,12 +34,13 @@ #if 0 static char sccsid[] = "@(#)pass4.c 8.4 (Berkeley) 4/28/95"; #else -__RCSID("$NetBSD: pass4.c,v 1.25.14.1 2011/01/20 14:24:54 bouyer Exp $"); +__RCSID("$NetBSD: pass4.c,v 1.25.14.2 2011/02/12 19:53:32 bouyer Exp $"); #endif #endif /* not lint */ #include <sys/param.h> #include <sys/time.h> +#include <sys/stat.h> #include <ufs/ufs/ufs_bswap.h> #include <ufs/ufs/dinode.h> @@ -65,7 +66,6 @@ struct inostat *info; memset(&idesc, 0, sizeof(struct inodesc)); - idesc.id_type = ADDR; idesc.id_func = pass4check; for (cg = 0; cg < sblock->fs_ncg; cg++) { @@ -89,6 +89,10 @@ idesc.id_number = inumber; idesc.id_uid = iswap32(DIP(dp, uid)); idesc.id_gid = iswap32(DIP(dp, gid)); + if (iswap32(DIP(dp, flags)) & SF_SNAPSHOT) + idesc.id_type = SNAP; + else + idesc.id_type = ADDR; switch (info->ino_state) { case FSTATE: case DFOUND: @@ -189,7 +193,8 @@ n_blks--; update_uquot(idesc->id_number, idesc->id_uid, - idesc->id_gid, -btodb(sblock->fs_fsize), 0); + idesc->id_gid, (idesc->id_type == SNAP) ? + 0 : -btodb(sblock->fs_fsize), 0); if (idesc->id_numfrags != sblock->fs_frag && cgp) { cgp->cg_cs.cs_nffree ++;