summaryrefslogtreecommitdiffstats
path: root/sys/dev/vinum/vinummemory.c
diff options
context:
space:
mode:
authorgrog <grog@FreeBSD.org>1998-10-21 08:32:32 +0000
committergrog <grog@FreeBSD.org>1998-10-21 08:32:32 +0000
commitc4f583ab45280938d0a6fb05b51d4ecadfc1f413 (patch)
treedae6747deab534df8daae0214b7739eb96b1f003 /sys/dev/vinum/vinummemory.c
parentf8807b8fc154475494280090923ce6f4d311d64e (diff)
downloadFreeBSD-src-c4f583ab45280938d0a6fb05b51d4ecadfc1f413.zip
FreeBSD-src-c4f583ab45280938d0a6fb05b51d4ecadfc1f413.tar.gz
config.c:
config_drive: Catch an instance of anonymous drives. Doubtless many remain. interrupt.c: complete_rqe: Call logrq to log iodone events if DEBUG_LASTREQS is set. Call set_sd_state with setstate_noupdate to avoid buffered I/O out of interrupt context. Use define DEBUG_RESID instead of constant. memory.c: Remove dead expandrq() function Malloc: Remove directory component of file names in malloc table. Add function vinum_rqinfo (part of the request tracing stuff). request.c: Add function logrq (part of the request tracing stuff). vinumstrategy: Check whether config needs to be written to disk, do it if so. This is a stopgap until the Vinum daemon (bacchusd? oenologistd?) is written. If DEBUG_LASTREQS is set, call logrq to log user buffer headers. launch_requests: Correct format of debug output to console. If DEBUG_LASTREQS is set, call logrq to log request elements. request.h: Add definitions for request trace. state.c: set_sd_state: Check flags for setstate_noupdate. If set, don't write the config to disk, just set global VF_DIRTYCONFIG flag. This is part of the kludge to avoid writing config from an interrupt context. vinumext.h: Add declaration for vinum_rqinfo, put inside #ifdef DEBUG Remove dead macro expandrq vinumio.h: Increase maximum ioctl reply length to 4 kB if DEBUG is set. Define VINUM_RQINFO ioctl if DEBUG is set. vinumioctl.c: vinumioctl: Change implementation of VINUM_DEBUG ioctl: use a debug flag (DEBUG_REMOTEGDB) to decide whether to go into remote debugging or not. Implement VINUM_RQINFO. vinumkw.h: Define kw_info even when not debugging. vinumvar.h: Define VF_DIRTYCONFIG Add pointers to request info to vinum_info if DEBUG is set. Define setstate_noupdate Define additional debug bits DEBUG_RESID, DEBUG_LASTREQS and DEBUG_REMOTEGDB.
Diffstat (limited to 'sys/dev/vinum/vinummemory.c')
-rw-r--r--sys/dev/vinum/vinummemory.c46
1 files changed, 29 insertions, 17 deletions
diff --git a/sys/dev/vinum/vinummemory.c b/sys/dev/vinum/vinummemory.c
index 5dee671..e77af7e 100644
--- a/sys/dev/vinum/vinummemory.c
+++ b/sys/dev/vinum/vinummemory.c
@@ -1,4 +1,3 @@
-
/*-
* Copyright (c) 1997, 1998
* Nan Yang Computer Services Limited. All rights reserved.
@@ -34,7 +33,7 @@
* otherwise) arising in any way out of the use of this software, even if
* advised of the possibility of such damage.
*
- * $Id: memory.c,v 1.16 1998/08/08 04:43:22 grog Exp grog $
+ * $Id: memory.c,v 1.17 1998/09/29 05:18:09 grog Exp grog $
*/
#define REALLYKERNEL
@@ -43,6 +42,12 @@
extern jmp_buf command_fail; /* return on a failed command */
+#ifdef DEBUG
+#include "request.h"
+extern struct rqinfo rqinfo[];
+extern struct rqinfo *rqip;
+#endif
+
#if __FreeBSD__ >= 3
/* Why aren't these declared anywhere? XXX */
int setjmp(jmp_buf);
@@ -68,20 +73,6 @@ expand_table(void **table, int oldsize, int newsize)
}
}
-#ifndef DEBUG
-/* increase the size of a request block */
-void
-expandrq(struct plexrq *prq)
-{
- expand_table((void **) &prq->rqe,
- prq->requests * sizeof(struct rqelement),
- (prq->requests + RQELTS) * sizeof(struct rqelement));
- bzero(&prq->rqe[prq->requests], RQELTS * sizeof(struct rqelement)); /* clear the new part */
- prq->rqcount += RQELTS;
-}
-
-#endif
-
#if DEBUG /* XXX debug */
#define MALLOCENTRIES 16384
int malloccount = 0;
@@ -115,6 +106,10 @@ MMalloc(int size, char *file, int line)
Debugger("Malloc overlap");
}
if (result) {
+ char *f = index(file, '/'); /* chop off dirname if present */
+
+ if (f == NULL)
+ f = file;
i = malloccount++;
total_malloced += size;
malloced[i].address = result;
@@ -123,7 +118,7 @@ MMalloc(int size, char *file, int line)
malloced[i].seq = seq++;
malloced[i].flags = me.flags;
malloced[i].databuf = me.databuf; /* only used with kva alloc */
- bcopy(file, malloced[i].file, min(strlen(file) + 1, 16));
+ bcopy(f, malloced[i].file, min(strlen(f) + 1, 16));
}
if (malloccount > highwater)
highwater = malloccount;
@@ -183,4 +178,21 @@ vinum_mallocinfo(caddr_t data)
return 0;
}
+/* return the nth request trace buffer entry. This
+ * is indexed back from the current entry (which
+ * has index 0) */
+int
+vinum_rqinfo(caddr_t data)
+{
+ struct rqinfo *rq = (struct rqinfo *) data;
+ int ent = *(int *) data; /* 1st word is index */
+ int lastent = rqip - rqinfo; /* entry number of current entry */
+
+ if (ent >= RQINFO_SIZE) /* out of the table */
+ return ENOENT;
+ if ((ent = lastent - ent - 1) < 0)
+ ent += RQINFO_SIZE; /* roll over backwards */
+ bcopy(&rqinfo[ent], rq, sizeof(struct rqinfo));
+ return 0;
+}
#endif
OpenPOWER on IntegriCloud