Module Name:    src
Committed By:   bouyer
Date:           Sun Sep 13 14:13:24 UTC 2009

Modified Files:
        src/sbin/tunefs: tunefs.c
        src/sys/ufs/ffs: ffs_wapbl.c

Log Message:
Allow tunefs to clear any type of WAPBL log, not only in-filesystem
ones. Discussed in
http://mail-index.netbsd.org/tech-kern/2009/08/17/msg005896.html
and followups.


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sbin/tunefs/tunefs.c
cvs rdiff -u -r1.12 -r1.13 src/sys/ufs/ffs/ffs_wapbl.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/tunefs/tunefs.c
diff -u src/sbin/tunefs/tunefs.c:1.40 src/sbin/tunefs/tunefs.c:1.41
--- src/sbin/tunefs/tunefs.c:1.40	Mon Aug 17 21:28:24 2009
+++ src/sbin/tunefs/tunefs.c	Sun Sep 13 14:13:23 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: tunefs.c,v 1.40 2009/08/17 21:28:24 bouyer Exp $	*/
+/*	$NetBSD: tunefs.c,v 1.41 2009/09/13 14:13:23 bouyer Exp $	*/
 
 /*
  * Copyright (c) 1983, 1993
@@ -39,7 +39,7 @@
 #if 0
 static char sccsid[] = "@(#)tunefs.c	8.3 (Berkeley) 5/3/95";
 #else
-__RCSID("$NetBSD: tunefs.c,v 1.40 2009/08/17 21:28:24 bouyer Exp $");
+__RCSID("$NetBSD: tunefs.c,v 1.41 2009/09/13 14:13:23 bouyer Exp $");
 #endif
 #endif /* not lint */
 
@@ -353,15 +353,6 @@
 		break;
 	}
 
-	if (!in_fs_log)
-		errx(1, "Can't change size of non-in-filesystem log");
-
-	if (logfilesize > 0 && old_size == (uint64_t)logfilesize) {
-		/* no action */
-		warnx("log file size remains unchanged at %lld", logfilesize);
-		return;
-	}
-
 	if (logfilesize == 0) {
 		/*
 		 * Don't clear out the locators - the kernel might need
@@ -374,6 +365,15 @@
 		return;
 	}
 
+	if (!in_fs_log && logfilesize > 0 && old_size > 0)
+		errx(1, "Can't change size of non-in-filesystem log");
+
+	if (old_size == logfilesize && logfilesize > 0) {
+		/* no action */
+		warnx("log file size remains unchanged at %lld", logfilesize);
+		return;
+	}
+
 	if (old_size == 0) {
 		/* create new log of desired size next mount */
 		sblock.fs_journal_location = UFS_WAPBL_JOURNALLOC_IN_FILESYSTEM;

Index: src/sys/ufs/ffs/ffs_wapbl.c
diff -u src/sys/ufs/ffs/ffs_wapbl.c:1.12 src/sys/ufs/ffs/ffs_wapbl.c:1.13
--- src/sys/ufs/ffs/ffs_wapbl.c:1.12	Sun Feb 22 20:28:06 2009
+++ src/sys/ufs/ffs/ffs_wapbl.c	Sun Sep 13 14:13:23 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: ffs_wapbl.c,v 1.12 2009/02/22 20:28:06 ad Exp $	*/
+/*	$NetBSD: ffs_wapbl.c,v 1.13 2009/09/13 14:13:23 bouyer Exp $	*/
 
 /*-
  * Copyright (c) 2003,2006,2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ffs_wapbl.c,v 1.12 2009/02/22 20:28:06 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ffs_wapbl.c,v 1.13 2009/09/13 14:13:23 bouyer Exp $");
 
 #define WAPBL_INTERNAL
 
@@ -275,7 +275,7 @@
 	default:
 		printf("ffs_wapbl: unknown journal type %d\n",
 		    fs->fs_journal_location);
-		return EINVAL;
+		break;
 	}
 
 

Reply via email to