Module Name: src
Committed By: riz
Date: Mon Mar 7 04:09:28 UTC 2011
Modified Files:
src/sys/kern [netbsd-5]: vfs_wapbl.c
Log Message:
Pull up following revision(s) (requested by bouyer in ticket #1543):
sys/kern/vfs_wapbl.c: revision 1.27
sys/kern/vfs_wapbl.c: revision 1.28
Turn a KASSERT into a panic. I don't want us to be randomly
overwriting memory on non-DIAGNOSTIC kernels if resource estimation
fails.
Add dealloccnt to list of things to be considered in the stetson-harrison
decision making algorithm for flushing a wapbl transation.
To generate a diff of this commit:
cvs rdiff -u -r1.3.8.4 -r1.3.8.5 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.3.8.4 src/sys/kern/vfs_wapbl.c:1.3.8.5
--- src/sys/kern/vfs_wapbl.c:1.3.8.4 Wed Feb 16 19:31:44 2011
+++ src/sys/kern/vfs_wapbl.c Mon Mar 7 04:09:28 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: vfs_wapbl.c,v 1.3.8.4 2011/02/16 19:31:44 bouyer Exp $ */
+/* $NetBSD: vfs_wapbl.c,v 1.3.8.5 2011/03/07 04:09:28 riz Exp $ */
/*-
* Copyright (c) 2003, 2008, 2009 The NetBSD Foundation, Inc.
@@ -33,7 +33,7 @@
* This implements file system independent write ahead filesystem logging.
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_wapbl.c,v 1.3.8.4 2011/02/16 19:31:44 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_wapbl.c,v 1.3.8.5 2011/03/07 04:09:28 riz Exp $");
#include <sys/param.h>
@@ -829,16 +829,20 @@
wl->wl_bufbytes_max / 2) ||
((wl->wl_bufcount + (lockcount * 10)) >
wl->wl_bufcount_max / 2) ||
- (wapbl_transaction_len(wl) > wl->wl_circ_size / 2);
+ (wapbl_transaction_len(wl) > wl->wl_circ_size / 2) ||
+ (wl->wl_dealloccnt >=
+ (wl->wl_dealloclim - (wl->wl_dealloclim >> 8)));
mutex_exit(&wl->wl_mtx);
if (doflush) {
WAPBL_PRINTF(WAPBL_PRINT_FLUSH,
("force flush lockcnt=%d bufbytes=%zu "
- "(max=%zu) bufcount=%zu (max=%zu)\n",
+ "(max=%zu) bufcount=%zu (max=%zu) "
+ "dealloccnt %d (lim=%d)\n",
lockcount, wl->wl_bufbytes,
wl->wl_bufbytes_max, wl->wl_bufcount,
- wl->wl_bufcount_max));
+ wl->wl_bufcount_max,
+ wl->wl_dealloccnt, wl->wl_dealloclim));
}
if (doflush) {
@@ -1720,8 +1724,14 @@
mutex_enter(&wl->wl_mtx);
/* XXX should eventually instead tie this into resource estimation */
- /* XXX this KASSERT needs locking/mutex analysis */
- KASSERT(wl->wl_dealloccnt < wl->wl_dealloclim);
+ /*
+ * XXX this panic needs locking/mutex analysis and the
+ * ability to cope with the failure.
+ */
+ /* XXX this XXX doesn't have enough XXX */
+ if (__predict_false(wl->wl_dealloccnt >= wl->wl_dealloclim))
+ panic("wapbl_register_deallocation: out of resources");
+
wl->wl_deallocblks[wl->wl_dealloccnt] = blk;
wl->wl_dealloclens[wl->wl_dealloccnt] = len;
wl->wl_dealloccnt++;