Sun May 1 06:22:54 2011 UTC ()
convert rf_tracing_mutex to a kmutex.


(mrg)
diff -r1.23 -r1.24 src/sys/dev/raidframe/rf_acctrace.c
diff -r1.9 -r1.10 src/sys/dev/raidframe/rf_acctrace.h
diff -r1.287 -r1.288 src/sys/dev/raidframe/rf_netbsdkintf.c

cvs diff -r1.23 -r1.24 src/sys/dev/raidframe/rf_acctrace.c (expand / switch to unified diff)

--- src/sys/dev/raidframe/rf_acctrace.c 2006/11/16 01:33:23 1.23
+++ src/sys/dev/raidframe/rf_acctrace.c 2011/05/01 06:22:54 1.24
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: rf_acctrace.c,v 1.23 2006/11/16 01:33:23 christos Exp $ */ 1/* $NetBSD: rf_acctrace.c,v 1.24 2011/05/01 06:22:54 mrg Exp $ */
2/* 2/*
3 * Copyright (c) 1995 Carnegie-Mellon University. 3 * Copyright (c) 1995 Carnegie-Mellon University.
4 * All rights reserved. 4 * All rights reserved.
5 * 5 *
6 * Author: Mark Holland 6 * Author: Mark Holland
7 * 7 *
8 * Permission to use, copy, modify and distribute this software and 8 * Permission to use, copy, modify and distribute this software and
9 * its documentation is hereby granted, provided that both the copyright 9 * its documentation is hereby granted, provided that both the copyright
10 * notice and this permission notice appear in all copies of the 10 * notice and this permission notice appear in all copies of the
11 * software, derivative works or modified versions, and any portions 11 * software, derivative works or modified versions, and any portions
12 * thereof, and that both notices appear in supporting documentation. 12 * thereof, and that both notices appear in supporting documentation.
13 * 13 *
14 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" 14 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
@@ -24,51 +24,58 @@ @@ -24,51 +24,58 @@
24 * 24 *
25 * any improvements or extensions that they make and grant Carnegie the 25 * any improvements or extensions that they make and grant Carnegie the
26 * rights to redistribute these changes. 26 * rights to redistribute these changes.
27 */ 27 */
28 28
29/***************************************************************************** 29/*****************************************************************************
30 * 30 *
31 * acctrace.c -- code to support collecting information about each access 31 * acctrace.c -- code to support collecting information about each access
32 * 32 *
33 *****************************************************************************/ 33 *****************************************************************************/
34 34
35 35
36#include <sys/cdefs.h> 36#include <sys/cdefs.h>
37__KERNEL_RCSID(0, "$NetBSD: rf_acctrace.c,v 1.23 2006/11/16 01:33:23 christos Exp $"); 37__KERNEL_RCSID(0, "$NetBSD: rf_acctrace.c,v 1.24 2011/05/01 06:22:54 mrg Exp $");
38 38
39#include <sys/stat.h> 39#include <sys/stat.h>
40#include <sys/types.h> 40#include <sys/types.h>
41#include <dev/raidframe/raidframevar.h> 41#include <dev/raidframe/raidframevar.h>
42 42
43#include "rf_threadstuff.h" 43#include "rf_threadstuff.h"
44#include "rf_debugMem.h" 44#include "rf_debugMem.h"
45#include "rf_acctrace.h" 45#include "rf_acctrace.h"
46#include "rf_general.h" 46#include "rf_general.h"
47#include "rf_raid.h" 47#include "rf_raid.h"
48#include "rf_etimer.h" 48#include "rf_etimer.h"
49#include "rf_hist.h" 49#include "rf_hist.h"
50#include "rf_shutdown.h" 50#include "rf_shutdown.h"
51 51
52#if RF_ACC_TRACE > 0 52#if RF_ACC_TRACE > 0
53static long numTracesSoFar; 53static long numTracesSoFar;
54 54
55RF_DECLARE_MUTEX(rf_tracing_mutex) 55rf_declare_mutex2(rf_tracing_mutex);
 56
 57static void
 58rf_ShutdownAccessTrace(void *unused)
 59{
 60 rf_destroy_mutex2(rf_tracing_mutex);
 61}
56 62
57int 63int
58rf_ConfigureAccessTrace(RF_ShutdownList_t **listp) 64rf_ConfigureAccessTrace(RF_ShutdownList_t **listp)
59{ 65{
60 numTracesSoFar = 0; 66 numTracesSoFar = 0;
61 rf_mutex_init(&rf_tracing_mutex); 67 rf_init_mutex2(rf_tracing_mutex, IPL_VM);
 68 rf_ShutdownCreate(listp, rf_ShutdownAccessTrace, NULL);
62 return (0); 69 return (0);
63} 70}
64 71
65/* install a trace record. cause a flush to disk or to the trace 72/* install a trace record. cause a flush to disk or to the trace
66 * collector daemon if the trace buffer is at least 1/2 full. 73 * collector daemon if the trace buffer is at least 1/2 full.
67 */ 74 */
68void 75void
69rf_LogTraceRec(RF_Raid_t *raid, RF_AccTraceEntry_t *rec) 76rf_LogTraceRec(RF_Raid_t *raid, RF_AccTraceEntry_t *rec)
70{ 77{
71 RF_AccTotals_t *acc = &raid->acc_totals; 78 RF_AccTotals_t *acc = &raid->acc_totals;
72 79
73 if (((rf_maxNumTraces >= 0) && (numTracesSoFar >= rf_maxNumTraces))) 80 if (((rf_maxNumTraces >= 0) && (numTracesSoFar >= rf_maxNumTraces)))
74 return; 81 return;

cvs diff -r1.9 -r1.10 src/sys/dev/raidframe/rf_acctrace.h (expand / switch to unified diff)

--- src/sys/dev/raidframe/rf_acctrace.h 2011/04/27 07:55:14 1.9
+++ src/sys/dev/raidframe/rf_acctrace.h 2011/05/01 06:22:54 1.10
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: rf_acctrace.h,v 1.9 2011/04/27 07:55:14 mrg Exp $ */ 1/* $NetBSD: rf_acctrace.h,v 1.10 2011/05/01 06:22:54 mrg Exp $ */
2/* 2/*
3 * Copyright (c) 1995 Carnegie-Mellon University. 3 * Copyright (c) 1995 Carnegie-Mellon University.
4 * All rights reserved. 4 * All rights reserved.
5 * 5 *
6 * Author: Mark Holland 6 * Author: Mark Holland
7 * 7 *
8 * Permission to use, copy, modify and distribute this software and 8 * Permission to use, copy, modify and distribute this software and
9 * its documentation is hereby granted, provided that both the copyright 9 * its documentation is hereby granted, provided that both the copyright
10 * notice and this permission notice appear in all copies of the 10 * notice and this permission notice appear in all copies of the
11 * software, derivative works or modified versions, and any portions 11 * software, derivative works or modified versions, and any portions
12 * thereof, and that both notices appear in supporting documentation. 12 * thereof, and that both notices appear in supporting documentation.
13 * 13 *
14 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" 14 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
@@ -113,20 +113,20 @@ typedef struct RF_AccTotals_s { @@ -113,20 +113,20 @@ typedef struct RF_AccTotals_s {
113 RF_uint64 diskqueue_us; 113 RF_uint64 diskqueue_us;
114 RF_uint64 diskwait_us; 114 RF_uint64 diskwait_us;
115 RF_uint64 total_us; 115 RF_uint64 total_us;
116 RF_uint64 num_log_ents; 116 RF_uint64 num_log_ents;
117 RF_uint64 phys_io_overflow_count; 117 RF_uint64 phys_io_overflow_count;
118 RF_uint64 num_phys_ios; 118 RF_uint64 num_phys_ios;
119 RF_uint64 phys_io_us; 119 RF_uint64 phys_io_us;
120 RF_uint64 bigvals; 120 RF_uint64 bigvals;
121 /* histograms */ 121 /* histograms */
122 RF_Hist_t dw_hist[RF_HIST_NUM_BUCKETS]; 122 RF_Hist_t dw_hist[RF_HIST_NUM_BUCKETS];
123 RF_Hist_t tot_hist[RF_HIST_NUM_BUCKETS]; 123 RF_Hist_t tot_hist[RF_HIST_NUM_BUCKETS];
124} RF_AccTotals_t; 124} RF_AccTotals_t;
125 125
126extern RF_DECLARE_MUTEX(rf_tracing_mutex); 126extern rf_declare_mutex2(rf_tracing_mutex);
127 127
128 128
129int rf_ConfigureAccessTrace(RF_ShutdownList_t ** listp); 129int rf_ConfigureAccessTrace(RF_ShutdownList_t ** listp);
130void rf_LogTraceRec(RF_Raid_t * raid, RF_AccTraceEntry_t * rec); 130void rf_LogTraceRec(RF_Raid_t * raid, RF_AccTraceEntry_t * rec);
131 131
132#endif /* !_RF__RF_ACCTRACE_H_ */ 132#endif /* !_RF__RF_ACCTRACE_H_ */

cvs diff -r1.287 -r1.288 src/sys/dev/raidframe/rf_netbsdkintf.c (expand / switch to unified diff)

--- src/sys/dev/raidframe/rf_netbsdkintf.c 2011/05/01 05:44:47 1.287
+++ src/sys/dev/raidframe/rf_netbsdkintf.c 2011/05/01 06:22:54 1.288
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: rf_netbsdkintf.c,v 1.287 2011/05/01 05:44:47 mrg Exp $ */ 1/* $NetBSD: rf_netbsdkintf.c,v 1.288 2011/05/01 06:22:54 mrg Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1996, 1997, 1998, 2008 The NetBSD Foundation, Inc. 4 * Copyright (c) 1996, 1997, 1998, 2008 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Greg Oster; Jason R. Thorpe. 8 * by Greg Oster; Jason R. Thorpe.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -91,27 +91,27 @@ @@ -91,27 +91,27 @@
91 * Pittsburgh PA 15213-3890 91 * Pittsburgh PA 15213-3890
92 * 92 *
93 * any improvements or extensions that they make and grant Carnegie the 93 * any improvements or extensions that they make and grant Carnegie the
94 * rights to redistribute these changes. 94 * rights to redistribute these changes.
95 */ 95 */
96 96
97/*********************************************************** 97/***********************************************************
98 * 98 *
99 * rf_kintf.c -- the kernel interface routines for RAIDframe 99 * rf_kintf.c -- the kernel interface routines for RAIDframe
100 * 100 *
101 ***********************************************************/ 101 ***********************************************************/
102 102
103#include <sys/cdefs.h> 103#include <sys/cdefs.h>
104__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.287 2011/05/01 05:44:47 mrg Exp $"); 104__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.288 2011/05/01 06:22:54 mrg Exp $");
105 105
106#ifdef _KERNEL_OPT 106#ifdef _KERNEL_OPT
107#include "opt_compat_netbsd.h" 107#include "opt_compat_netbsd.h"
108#include "opt_raid_autoconfig.h" 108#include "opt_raid_autoconfig.h"
109#include "raid.h" 109#include "raid.h"
110#endif 110#endif
111 111
112#include <sys/param.h> 112#include <sys/param.h>
113#include <sys/errno.h> 113#include <sys/errno.h>
114#include <sys/pool.h> 114#include <sys/pool.h>
115#include <sys/proc.h> 115#include <sys/proc.h>
116#include <sys/queue.h> 116#include <sys/queue.h>
117#include <sys/disk.h> 117#include <sys/disk.h>
@@ -2165,31 +2165,31 @@ KernelWakeupFunc(struct buf *bp) @@ -2165,31 +2165,31 @@ KernelWakeupFunc(struct buf *bp)
2165 2165
2166 db1_printf(("recovering the request queue:\n")); 2166 db1_printf(("recovering the request queue:\n"));
2167 2167
2168 req = bp->b_private; 2168 req = bp->b_private;
2169 2169
2170 queue = (RF_DiskQueue_t *) req->queue; 2170 queue = (RF_DiskQueue_t *) req->queue;
2171 2171
2172 rf_lock_mutex2(queue->raidPtr->iodone_lock); 2172 rf_lock_mutex2(queue->raidPtr->iodone_lock);
2173 2173
2174#if RF_ACC_TRACE > 0 2174#if RF_ACC_TRACE > 0
2175 if (req->tracerec) { 2175 if (req->tracerec) {
2176 RF_ETIMER_STOP(req->tracerec->timer); 2176 RF_ETIMER_STOP(req->tracerec->timer);
2177 RF_ETIMER_EVAL(req->tracerec->timer); 2177 RF_ETIMER_EVAL(req->tracerec->timer);
2178 RF_LOCK_MUTEX(rf_tracing_mutex); 2178 rf_lock_mutex2(rf_tracing_mutex);
2179 req->tracerec->diskwait_us += RF_ETIMER_VAL_US(req->tracerec->timer); 2179 req->tracerec->diskwait_us += RF_ETIMER_VAL_US(req->tracerec->timer);
2180 req->tracerec->phys_io_us += RF_ETIMER_VAL_US(req->tracerec->timer); 2180 req->tracerec->phys_io_us += RF_ETIMER_VAL_US(req->tracerec->timer);
2181 req->tracerec->num_phys_ios++; 2181 req->tracerec->num_phys_ios++;
2182 RF_UNLOCK_MUTEX(rf_tracing_mutex); 2182 rf_unlock_mutex2(rf_tracing_mutex);
2183 } 2183 }
2184#endif 2184#endif
2185 2185
2186 /* XXX Ok, let's get aggressive... If b_error is set, let's go 2186 /* XXX Ok, let's get aggressive... If b_error is set, let's go
2187 * ballistic, and mark the component as hosed... */ 2187 * ballistic, and mark the component as hosed... */
2188 2188
2189 if (bp->b_error != 0) { 2189 if (bp->b_error != 0) {
2190 /* Mark the disk as dead */ 2190 /* Mark the disk as dead */
2191 /* but only mark it once... */ 2191 /* but only mark it once... */
2192 /* and only if it wouldn't leave this RAID set 2192 /* and only if it wouldn't leave this RAID set
2193 completely broken */ 2193 completely broken */
2194 if (((queue->raidPtr->Disks[queue->col].status == 2194 if (((queue->raidPtr->Disks[queue->col].status ==
2195 rf_ds_optimal) || 2195 rf_ds_optimal) ||