CVS commit: [bouyer-quota2] src/sbin/fsck_ffs

2011-02-17 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Thu Feb 17 17:13:48 UTC 2011

Modified Files:
src/sbin/fsck_ffs [bouyer-quota2]: setup.c

Log Message:
Move quota2_check_doquota() call so that an unclean, wapbl filesystem
will still be ckecked if a quota inode needs to be created.


To generate a diff of this commit:
cvs rdiff -u -r1.90.2.1 -r1.90.2.2 src/sbin/fsck_ffs/setup.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/setup.c
diff -u src/sbin/fsck_ffs/setup.c:1.90.2.1 src/sbin/fsck_ffs/setup.c:1.90.2.2
--- src/sbin/fsck_ffs/setup.c:1.90.2.1	Thu Jan 20 14:24:54 2011
+++ src/sbin/fsck_ffs/setup.c	Thu Feb 17 17:13:48 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: setup.c,v 1.90.2.1 2011/01/20 14:24:54 bouyer Exp $	*/
+/*	$NetBSD: setup.c,v 1.90.2.2 2011/02/17 17:13:48 bouyer Exp $	*/
 
 /*
  * Copyright (c) 1980, 1986, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = @(#)setup.c	8.10 (Berkeley) 5/9/95;
 #else
-__RCSID($NetBSD: setup.c,v 1.90.2.1 2011/01/20 14:24:54 bouyer Exp $);
+__RCSID($NetBSD: setup.c,v 1.90.2.2 2011/02/17 17:13:48 bouyer Exp $);
 #endif
 #endif /* not lint */
 
@@ -174,6 +174,10 @@
 		doskipclean = 0;
 		pwarn(USING ALTERNATE SUPERBLOCK AT %d\n, bflag);
 	}
+
+	if (!quota2_check_doquota())
+		doskipclean = 0;
+		
 	/* ffs_superblock_layout() == 2 */
 	if (sblock-fs_magic != FS_UFS1_MAGIC ||
 	(sblock-fs_old_flags  FS_FLAGS_UPDATED) != 0) {
@@ -182,7 +186,7 @@
 			doskipclean = 0;
 		}
 		if (sblock-fs_flags  FS_DOWAPBL) {
-			if (preen  skipclean) {
+			if (preen  doskipclean) {
 if (!quiet)
 	pwarn(file system is journaled; 
 	not checking\n);
@@ -210,9 +214,6 @@
 	if (doswap)
 		doskipclean = 0;
 
-	if (!quota2_check_doquota())
-		doskipclean = 0;
-		
 	if (sblock-fs_clean  FS_ISCLEAN) {
 		if (doskipclean) {
 			if (!quiet)



CVS commit: [bouyer-quota2] src/sbin/fsck_ffs

2011-02-12 Thread Manuel Bouyer
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 ++;



CVS commit: [bouyer-quota2] src/sbin/fsck_ffs

2011-02-12 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sat Feb 12 21:48:41 UTC 2011

Modified Files:
src/sbin/fsck_ffs [bouyer-quota2]: inode.c pass1.c pass4.c

Log Message:
Skip snapshot inodes for both block and inode quotas.


To generate a diff of this commit:
cvs rdiff -u -r1.63.2.2 -r1.63.2.3 src/sbin/fsck_ffs/inode.c
cvs rdiff -u -r1.46.14.2 -r1.46.14.3 src/sbin/fsck_ffs/pass1.c
cvs rdiff -u -r1.25.14.2 -r1.25.14.3 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.2 src/sbin/fsck_ffs/inode.c:1.63.2.3
--- src/sbin/fsck_ffs/inode.c:1.63.2.2	Sat Feb 12 19:53:32 2011
+++ src/sbin/fsck_ffs/inode.c	Sat Feb 12 21:48:41 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: inode.c,v 1.63.2.2 2011/02/12 19:53:32 bouyer Exp $	*/
+/*	$NetBSD: inode.c,v 1.63.2.3 2011/02/12 21:48:41 bouyer Exp $	*/
 
 /*
  * Copyright (c) 1980, 1986, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = @(#)inode.c	8.8 (Berkeley) 4/28/95;
 #else
-__RCSID($NetBSD: inode.c,v 1.63.2.2 2011/02/12 19:53:32 bouyer Exp $);
+__RCSID($NetBSD: inode.c,v 1.63.2.3 2011/02/12 21:48:41 bouyer Exp $);
 #endif
 #endif /* not lint */
 
@@ -580,8 +580,9 @@
 		 * ckinode will call id_func (actually always pass4check)
 		 * which will update the block count
 		 */
-		update_uquot(idesc-id_number, idesc-id_uid, idesc-id_gid,
-		0, -1);
+		if (idesc-id_type != SNAP)
+			update_uquot(idesc-id_number,
+			idesc-id_uid, idesc-id_gid, 0, -1);
 		(void)ckinode(dp, idesc);
 		clearinode(dp);
 		inoinfo(idesc-id_number)-ino_state = USTATE;
@@ -844,7 +845,9 @@
 	clearinode(dp);
 	inodirty();
 	inoinfo(ino)-ino_state = USTATE;
-	update_uquot(idesc.id_number, idesc.id_uid, idesc.id_gid, 0, -1);
+	if (idesc.id_type != SNAP)
+		update_uquot(idesc.id_number,
+		idesc.id_uid, idesc.id_gid, 0, -1);
 	n_files--;
 	if (cgp) {
 		clrbit(cg_inosused(cgp, 0), ino % sblock-fs_ipg);

Index: src/sbin/fsck_ffs/pass1.c
diff -u src/sbin/fsck_ffs/pass1.c:1.46.14.2 src/sbin/fsck_ffs/pass1.c:1.46.14.3
--- src/sbin/fsck_ffs/pass1.c:1.46.14.2	Sat Feb 12 19:53:32 2011
+++ src/sbin/fsck_ffs/pass1.c	Sat Feb 12 21:48:41 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: pass1.c,v 1.46.14.2 2011/02/12 19:53:32 bouyer Exp $	*/
+/*	$NetBSD: pass1.c,v 1.46.14.3 2011/02/12 21:48:41 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.2 2011/02/12 19:53:32 bouyer Exp $);
+__RCSID($NetBSD: pass1.c,v 1.46.14.3 2011/02/12 21:48:41 bouyer Exp $);
 #endif
 #endif /* not lint */
 
@@ -466,8 +466,9 @@
 			dp-dp1.di_blocks = iswap32((int32_t)idesc-id_entryno);
 		inodirty();
 	}
-	update_uquot(inumber, idesc-id_uid, idesc-id_gid,
-	(idesc-id_type == SNAP) ? 0 : idesc-id_entryno, 1);
+	if (idesc-id_type != SNAP)
+		update_uquot(inumber, idesc-id_uid, idesc-id_gid,
+		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.2 src/sbin/fsck_ffs/pass4.c:1.25.14.3
--- src/sbin/fsck_ffs/pass4.c:1.25.14.2	Sat Feb 12 19:53:32 2011
+++ src/sbin/fsck_ffs/pass4.c	Sat Feb 12 21:48:41 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: pass4.c,v 1.25.14.2 2011/02/12 19:53:32 bouyer Exp $	*/
+/*	$NetBSD: pass4.c,v 1.25.14.3 2011/02/12 21:48:41 bouyer Exp $	*/
 
 /*
  * Copyright (c) 1980, 1986, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = @(#)pass4.c	8.4 (Berkeley) 4/28/95;
 #else
-__RCSID($NetBSD: pass4.c,v 1.25.14.2 2011/02/12 19:53:32 bouyer Exp $);
+__RCSID($NetBSD: pass4.c,v 1.25.14.3 2011/02/12 21:48:41 bouyer Exp $);
 #endif
 #endif /* not lint */
 
@@ -192,9 +192,11 @@
 	dtogd(sblock, blkno));
 
 n_blks--;
-update_uquot(idesc-id_number, idesc-id_uid,
-idesc-id_gid, (idesc-id_type == SNAP) ?
-0 : -btodb(sblock-fs_fsize), 0);
+if (idesc-id_type != SNAP) {
+	update_uquot(idesc-id_number,
+	idesc-id_uid, idesc-id_gid, 
+	-btodb(sblock-fs_fsize), 0);
+}
 if (idesc-id_numfrags != sblock-fs_frag 
 cgp) {
 	cgp-cg_cs.cs_nffree ++;



CVS commit: [bouyer-quota2] src/sbin/fsck_ffs

2011-02-08 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Tue Feb  8 14:50:37 UTC 2011

Modified Files:
src/sbin/fsck_ffs [bouyer-quota2]: quota2.c

Log Message:
Q2V_ - QL_ rename


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.1 -r1.1.2.2 src/sbin/fsck_ffs/quota2.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/quota2.c
diff -u src/sbin/fsck_ffs/quota2.c:1.1.2.1 src/sbin/fsck_ffs/quota2.c:1.1.2.2
--- src/sbin/fsck_ffs/quota2.c:1.1.2.1	Thu Jan 20 14:24:54 2011
+++ src/sbin/fsck_ffs/quota2.c	Tue Feb  8 14:50:37 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: quota2.c,v 1.1.2.1 2011/01/20 14:24:54 bouyer Exp $ */
+/* $NetBSD: quota2.c,v 1.1.2.2 2011/02/08 14:50:37 bouyer Exp $ */
 /*-
   * Copyright (c) 2010 Manuel Bouyer
   * All rights reserved.
@@ -117,8 +117,8 @@
 
 	memcpy(q2e, q2h-q2h_defentry, sizeof(*q2e));
 	q2e-q2e_uid = iswap32(uid);
-	q2e-q2e_val[Q2V_BLOCK].q2v_cur = iswap64(u_b);
-	q2e-q2e_val[Q2V_FILE].q2v_cur = iswap64(u_i);
+	q2e-q2e_val[QL_BLOCK].q2v_cur = iswap64(u_b);
+	q2e-q2e_val[QL_FILE].q2v_cur = iswap64(u_i);
 	/* insert in hash list */
 	q2e-q2e_next = q2h-q2h_entries[uid  q2h_hash_mask];
 	q2h-q2h_entries[uid  q2h_hash_mask] = iswap64(off);
@@ -439,21 +439,21 @@
 	else
 		remove_uquot(a-uquot_hash, uq);
 		
-	if (iswap64(q2e-q2e_val[Q2V_BLOCK].q2v_cur) == uq-uq_b  
-	iswap64(q2e-q2e_val[Q2V_FILE].q2v_cur) == uq-uq_i)
+	if (iswap64(q2e-q2e_val[QL_BLOCK].q2v_cur) == uq-uq_b  
+	iswap64(q2e-q2e_val[QL_FILE].q2v_cur) == uq-uq_i)
 		return 0;
 	pwarn(%s QUOTA MISMATCH FOR ID %d: % PRIu64 /% PRIu64  SHOULD BE 
 	% PRIu64 /% PRIu64, a-capstrtype, uid,
-	iswap64(q2e-q2e_val[Q2V_BLOCK].q2v_cur),
-	iswap64(q2e-q2e_val[Q2V_FILE].q2v_cur), uq-uq_b, uq-uq_i);
+	iswap64(q2e-q2e_val[QL_BLOCK].q2v_cur),
+	iswap64(q2e-q2e_val[QL_FILE].q2v_cur), uq-uq_b, uq-uq_i);
 	if (preen) {
 		printf( (FIXED)\n);
 	} else if (!reply(FIX)) {
 		markclean = 0;
 		return 0;
 	}
-	q2e-q2e_val[Q2V_BLOCK].q2v_cur = iswap64(uq-uq_b);
-	q2e-q2e_val[Q2V_FILE].q2v_cur = iswap64(uq-uq_i);
+	q2e-q2e_val[QL_BLOCK].q2v_cur = iswap64(uq-uq_b);
+	q2e-q2e_val[QL_FILE].q2v_cur = iswap64(uq-uq_i);
 	return Q2WL_DIRTY;
 }
 



CVS commit: [bouyer-quota2] src/sbin/fsck_ffs

2011-01-30 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sun Jan 30 14:26:31 UTC 2011

Modified Files:
src/sbin/fsck_ffs [bouyer-quota2]: utilities.c

Log Message:
Fix cut-n-paste: compare gid against gid, not uid.


To generate a diff of this commit:
cvs rdiff -u -r1.58.2.1 -r1.58.2.2 src/sbin/fsck_ffs/utilities.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/utilities.c
diff -u src/sbin/fsck_ffs/utilities.c:1.58.2.1 src/sbin/fsck_ffs/utilities.c:1.58.2.2
--- src/sbin/fsck_ffs/utilities.c:1.58.2.1	Thu Jan 20 14:24:54 2011
+++ src/sbin/fsck_ffs/utilities.c	Sun Jan 30 14:26:31 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: utilities.c,v 1.58.2.1 2011/01/20 14:24:54 bouyer Exp $	*/
+/*	$NetBSD: utilities.c,v 1.58.2.2 2011/01/30 14:26:31 bouyer Exp $	*/
 
 /*
  * Copyright (c) 1980, 1986, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = @(#)utilities.c	8.6 (Berkeley) 5/19/95;
 #else
-__RCSID($NetBSD: utilities.c,v 1.58.2.1 2011/01/20 14:24:54 bouyer Exp $);
+__RCSID($NetBSD: utilities.c,v 1.58.2.2 2011/01/30 14:26:31 bouyer Exp $);
 #endif
 #endif /* not lint */
 
@@ -786,7 +786,7 @@
 		uq_u = find_uquot(uquot_user_hash, uid, 1);
 	uq_u-uq_b += bchange;
 	uq_u-uq_i += ichange;
-	if (uq_g == NULL || uq_g-uq_uid != uid)
+	if (uq_g == NULL || uq_g-uq_uid != gid)
 		uq_g = find_uquot(uquot_group_hash, gid, 1);
 	uq_g-uq_b += bchange;
 	uq_g-uq_i += ichange;