Module Name:    src
Committed By:   riastradh
Date:           Sat May  7 20:39:33 UTC 2016

Modified Files:
        src/sys/kern: vfs_wapbl.c

Log Message:
Delete debugging option wapbl_lazy_truncate.  Simplify.

Likely nobody has used this in the past decade -- you would have to
enter ddb and write 1 to it in order to enable it anyway.

Patch prepared by coypu.


To generate a diff of this commit:
cvs rdiff -u -r1.72 -r1.73 src/sys/kern/vfs_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/sys/kern/vfs_wapbl.c
diff -u src/sys/kern/vfs_wapbl.c:1.72 src/sys/kern/vfs_wapbl.c:1.73
--- src/sys/kern/vfs_wapbl.c:1.72	Sat May  7 20:18:44 2016
+++ src/sys/kern/vfs_wapbl.c	Sat May  7 20:39:33 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_wapbl.c,v 1.72 2016/05/07 20:18:44 riastradh Exp $	*/
+/*	$NetBSD: vfs_wapbl.c,v 1.73 2016/05/07 20:39:33 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2003, 2008, 2009 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 #define WAPBL_INTERNAL
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_wapbl.c,v 1.72 2016/05/07 20:18:44 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_wapbl.c,v 1.73 2016/05/07 20:39:33 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/bitops.h>
@@ -269,12 +269,6 @@ int wapbl_replay_verify(struct wapbl_rep
 
 static int wapbl_replay_isopen1(struct wapbl_replay *);
 
-/*
- * This is useful for debugging.  If set, the log will
- * only be truncated when necessary.
- */
-int wapbl_lazy_truncate = 0;
-
 struct wapbl_ops wapbl_ops = {
 	.wo_wapbl_discard	= wapbl_discard,
 	.wo_wapbl_replay_isopen	= wapbl_replay_isopen1,
@@ -1295,19 +1289,18 @@ wapbl_advance_tail(size_t size, size_t o
 /****************************************************************/
 
 /*
- * wapbl_truncate(wl, minfree, waitonly)
+ * wapbl_truncate(wl, minfree)
  *
  *	Wait until at least minfree bytes are available in the log.
  *
- *	If it was necessary to wait for writes to complete, and if
- *	waitonly is not true, advance the circular queue tail to
- *	reflect the new write completions and issue a write commit to
- *	the log.
+ *	If it was necessary to wait for writes to complete,
+ *	advance the circular queue tail to reflect the new write
+ *	completions and issue a write commit to the log.
  *
  *	=> Caller must hold wl->wl_rwlock writer lock.
  */
 static int
-wapbl_truncate(struct wapbl *wl, size_t minfree, int waitonly)
+wapbl_truncate(struct wapbl *wl, size_t minfree)
 {
 	size_t delta;
 	size_t avail;
@@ -1366,9 +1359,6 @@ wapbl_truncate(struct wapbl *wl, size_t 
 	if (error)
 		return error;
 
-	if (waitonly)
-		return 0;
-
 	/*
 	 * This is where head, tail and delta are unprotected
 	 * from races against itself or flush.  This is ok since
@@ -1624,7 +1614,7 @@ wapbl_flush(struct wapbl *wl, int waitfo
 		panic("wapbl_flush: current transaction too big to flush");
 	}
 
-	error = wapbl_truncate(wl, flushsize, 0);
+	error = wapbl_truncate(wl, flushsize);
 	if (error)
 		goto out;
 
@@ -1658,13 +1648,11 @@ wapbl_flush(struct wapbl *wl, int waitfo
 	    flushsize);
 
 	/* Opportunistically move the tail forward if we can */
-	if (!wapbl_lazy_truncate) {
-		mutex_enter(&wl->wl_mtx);
-		delta = wl->wl_reclaimable_bytes;
-		mutex_exit(&wl->wl_mtx);
-		wapbl_advance_tail(wl->wl_circ_size, wl->wl_circ_off, delta,
-		    &head, &tail);
-	}
+	mutex_enter(&wl->wl_mtx);
+	delta = wl->wl_reclaimable_bytes;
+	mutex_exit(&wl->wl_mtx);
+	wapbl_advance_tail(wl->wl_circ_size, wl->wl_circ_off, delta,
+	    &head, &tail);
 
 	error = wapbl_write_commit(wl, head, tail);
 	if (error)
@@ -1754,7 +1742,7 @@ wapbl_flush(struct wapbl *wl, int waitfo
 	 */
 	if (waitfor) {
 		error = wapbl_truncate(wl, wl->wl_circ_size - 
-			wl->wl_reserved_bytes, wapbl_lazy_truncate);
+			wl->wl_reserved_bytes);
 	}
 
  out:

Reply via email to