summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThordur I. Bjornsson <thib@cvs.openbsd.org>2009-08-14 21:16:14 +0000
committerThordur I. Bjornsson <thib@cvs.openbsd.org>2009-08-14 21:16:14 +0000
commitf8b1f34773266b2eb78bfde67f54046befc4a5c2 (patch)
tree6c9b413b711443d586b2280e619ac44a1160bf83
parent31321762e2f18a8b0185b04f003f256a65fa9ecc (diff)
add ddb functions to be able to show all the nfsnodes in the system
and rewrite the nfsreq code to use pool_walk(). OK beck@, blambert@
-rw-r--r--sys/ddb/db_command.c24
-rw-r--r--sys/ddb/db_command.h3
-rw-r--r--sys/ddb/db_interface.h7
-rw-r--r--sys/nfs/nfs.h3
-rw-r--r--sys/nfs/nfs_debug.c55
5 files changed, 70 insertions, 22 deletions
diff --git a/sys/ddb/db_command.c b/sys/ddb/db_command.c
index 93160167b8b..1115a45d70b 100644
--- a/sys/ddb/db_command.c
+++ b/sys/ddb/db_command.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: db_command.c,v 1.58 2009/08/13 15:42:03 thib Exp $ */
+/* $OpenBSD: db_command.c,v 1.59 2009/08/14 21:16:13 thib Exp $ */
/* $NetBSD: db_command.c,v 1.20 1996/03/30 22:30:05 christos Exp $ */
/*
@@ -398,14 +398,28 @@ db_vnode_print_cmd(db_expr_t addr, int have_addr, db_expr_t count, char *modif)
#ifdef NFSCLIENT
/*ARGSUSED*/
void
-db_nfsreq_print_cmd(db_expr_t addr, int have_addr, db_expr_t count, char *modif)
+db_nfsreq_print_cmd(db_expr_t addr, int have_addr, db_expr_t count,
+ char *modif)
+{
+ boolean_t full = FALSE;
+
+ if (modif[0] == 'f')
+ full = TRUE;
+
+ nfs_request_print((void *)addr, full, db_printf);
+}
+
+/*ARGSUSED*/
+void
+db_nfsnode_print_cmd(db_expr_t addr, int have_addr, db_expr_t count,
+ char *modif)
{
boolean_t full = FALSE;
if (modif[0] == 'f')
full = TRUE;
- db_nfsreq_print((struct nfsreq *) addr, full, db_printf);
+ nfs_node_print((void *)addr, full, db_printf);
}
#endif
@@ -471,7 +485,8 @@ struct db_command db_show_all_cmds[] = {
{ "mounts", db_show_all_mounts, 0, NULL },
{ "vnodes", db_show_all_vnodes, 0, NULL },
#ifdef NFSCLIENT
- { "nfsreq", db_show_all_nfsreqs, 0, NULL },
+ { "nfsreqs", db_show_all_nfsreqs, 0, NULL },
+ { "nfsnodes", db_show_all_nfsnodes, 0, NULL },
#endif
{ NULL, NULL, 0, NULL }
};
@@ -487,6 +502,7 @@ struct db_command db_show_cmds[] = {
{ "mount", db_mount_print_cmd, 0, NULL },
#ifdef NFSCLIENT
{ "nfsreq", db_nfsreq_print_cmd, 0, NULL },
+ { "nfsnode", db_nfsnode_print_cmd, 0, NULL },
#endif
{ "object", db_object_print_cmd, 0, NULL },
#ifdef DDB_STRUCT_INFORMATION
diff --git a/sys/ddb/db_command.h b/sys/ddb/db_command.h
index b306d206428..13ef6ccaab1 100644
--- a/sys/ddb/db_command.h
+++ b/sys/ddb/db_command.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: db_command.h,v 1.27 2009/08/13 13:49:20 thib Exp $ */
+/* $OpenBSD: db_command.h,v 1.28 2009/08/14 21:16:13 thib Exp $ */
/* $NetBSD: db_command.h,v 1.8 1996/02/05 01:56:55 christos Exp $ */
/*
@@ -52,6 +52,7 @@ void db_proc_print_cmd(db_expr_t, int, db_expr_t, char *);
void db_uvmexp_print_cmd(db_expr_t, int, db_expr_t, char *);
void db_vnode_print_cmd(db_expr_t, int, db_expr_t, char *);
void db_nfsreq_print_cmd(db_expr_t, int, db_expr_t, char *);
+void db_nfsnode_print_cmd(db_expr_t, int, db_expr_t, char *);
void db_machine_commands_install(struct db_command *);
void db_help_cmd(db_expr_t, int, db_expr_t, char *);
void db_command_loop(void);
diff --git a/sys/ddb/db_interface.h b/sys/ddb/db_interface.h
index 5d57ed043d9..7b25667d3c6 100644
--- a/sys/ddb/db_interface.h
+++ b/sys/ddb/db_interface.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: db_interface.h,v 1.13 2009/08/13 13:49:20 thib Exp $ */
+/* $OpenBSD: db_interface.h,v 1.14 2009/08/14 21:16:13 thib Exp $ */
/* $NetBSD: db_interface.h,v 1.1 1996/02/05 01:57:03 christos Exp $ */
/*
@@ -56,9 +56,10 @@ void vfs_mount_print(struct mount *, int, int (*)(const char *, ...));
void db_show_all_pools(db_expr_t, int, db_expr_t, char *);
/* nfs/nfs_debug.c */
-struct nfsreq;
void db_show_all_nfsreqs(db_expr_t, int, db_expr_t, char *);
-void db_nfsreq_print(struct nfsreq *, int, int (*)(const char *, ...));
+void nfs_request_print(void *, int, int (*)(const char *, ...));
+void db_show_all_nfsnodes(db_expr_t, int, db_expr_t, char *);
+void nfs_node_print(void *, int, int (*)(const char *, ...));
/* ufs/ffs/ffs_softdep.c */
struct worklist;
diff --git a/sys/nfs/nfs.h b/sys/nfs/nfs.h
index e6f0f924cb9..8e092f5cafc 100644
--- a/sys/nfs/nfs.h
+++ b/sys/nfs/nfs.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfs.h,v 1.47 2009/08/10 10:59:11 thib Exp $ */
+/* $OpenBSD: nfs.h,v 1.48 2009/08/14 21:16:13 thib Exp $ */
/* $NetBSD: nfs.h,v 1.10.4.1 1996/05/27 11:23:56 fvdl Exp $ */
/*
@@ -339,6 +339,7 @@ struct nfsrv_descript {
#define ND_NFSV3 0x08
extern struct pool nfsreqpl;
+extern struct pool nfs_node_pool;
extern TAILQ_HEAD(nfsdhead, nfsd) nfsd_head;
extern int nfsd_head_flag;
#define NFSD_CHECKSLP 0x01
diff --git a/sys/nfs/nfs_debug.c b/sys/nfs/nfs_debug.c
index 6f66ceced8f..880df0e0257 100644
--- a/sys/nfs/nfs_debug.c
+++ b/sys/nfs/nfs_debug.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfs_debug.c,v 1.2 2009/01/18 13:57:17 thib Exp $ */
+/* $OpenBSD: nfs_debug.c,v 1.3 2009/08/14 21:16:13 thib Exp $ */
/*
* Copyright (c) 2009 Thordur I. Bjornsson. <thib@openbsd.org>
*
@@ -19,36 +19,36 @@
#include <sys/proc.h>
#include <sys/mount.h>
#include <sys/kernel.h>
-#include <sys/queue.h>
+#include <sys/pool.h>
+#include <sys/vnode.h>
#include <nfs/rpcv2.h>
#include <nfs/nfsproto.h>
#include <nfs/nfs.h>
+#include <nfs/nfsnode.h>
+#include <nfs/nfsmount.h>
+#include <nfs/nfs_var.h>
#include <machine/db_machdep.h>
#include <ddb/db_interface.h>
#include <ddb/db_output.h>
-extern struct nfsreqhead nfs_reqq;
-
void
db_show_all_nfsreqs(db_expr_t expr, int haddr, db_expr_t count, char *modif)
{
- struct nfsreq *rep;
-
- if (TAILQ_EMPTY(&nfs_reqq)) {
- db_printf("no outstanding requests\n");
- return;
- }
+ boolean_t full = FALSE;
- TAILQ_FOREACH(rep, &nfs_reqq, r_chain)
- db_printf("%p\n", rep);
+ if (modif[0] == 'f')
+ full = TRUE;
+ pool_walk(&nfsreqpl, full, db_printf, nfs_request_print);
}
void
-db_nfsreq_print(struct nfsreq *rep, int full, int (*pr)(const char *, ...))
+nfs_request_print(void *v, int full, int (*pr)(const char *, ...))
{
+ struct nfsreq *rep = v;
+
(*pr)("xid 0x%x flags 0x%x rexmit %i procnum %i proc %p\n",
rep->r_xid, rep->r_flags, rep->r_rexmit, rep->r_procnum,
rep->r_procp);
@@ -60,3 +60,32 @@ db_nfsreq_print(struct nfsreq *rep, int full, int (*pr)(const char *, ...))
rep->r_vp, rep->r_timer, rep->r_rtt);
}
}
+
+void
+db_show_all_nfsnodes(db_expr_t expr, int haddr, db_expr_t count, char *modif)
+{
+ boolean_t full = FALSE;
+
+ if (modif[0] == 'f')
+ full = TRUE;
+
+ pool_walk(&nfs_node_pool, full, db_printf, nfs_node_print);
+}
+
+
+
+void
+nfs_node_print(void *v, int full, int (*pr)(const char *, ...))
+{
+ struct nfsnode *np = v;
+
+ (*pr)("size %llu flag %i vnode %p accstamp %i\n",
+ np->n_size, np->n_flag, np->n_vnode, np->n_accstamp);
+
+ if (full) {
+ (*pr)("pushedlo %llu pushedhi %llu pushlo %llu pushhi %llu\n",
+ np->n_pushedlo, np->n_pushedhi, np->n_pushlo,
+ np->n_pushhi);
+ (*pr)("commitflags %i\n", np->n_commitflags);
+ }
+}