FreeBSD/Linux Kernel Cross Reference
sys/nfs/nfs_debug.c
1 /* $OpenBSD: nfs_debug.c,v 1.6 2014/09/14 14:17:26 jsg Exp $ */
2 /*
3 * Copyright (c) 2009 Thordur I. Bjornsson. <thib@openbsd.org>
4 *
5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */
17 #include <sys/param.h>
18 #include <sys/systm.h>
19 #include <sys/timeout.h>
20 #include <sys/mount.h>
21 #include <sys/kernel.h>
22 #include <sys/pool.h>
23 #include <sys/vnode.h>
24
25 #include <nfs/rpcv2.h>
26 #include <nfs/nfsproto.h>
27 #include <nfs/nfs.h>
28 #include <nfs/nfsnode.h>
29 #include <nfs/nfsmount.h>
30 #include <nfs/nfs_var.h>
31
32 #include <machine/db_machdep.h>
33 #include <ddb/db_interface.h>
34 #include <ddb/db_output.h>
35
36 void
37 db_show_all_nfsreqs(db_expr_t expr, int haddr, db_expr_t count, char *modif)
38 {
39 int full = 0;
40
41 if (modif[0] == 'f')
42 full = 1;
43
44 pool_walk(&nfsreqpl, full, db_printf, nfs_request_print);
45 }
46
47 void
48 nfs_request_print(void *v, int full, int (*pr)(const char *, ...))
49 {
50 struct nfsreq *rep = v;
51
52 (*pr)("xid 0x%x flags 0x%x rexmit %i procnum %i proc %p\n",
53 rep->r_xid, rep->r_flags, rep->r_rexmit, rep->r_procnum,
54 rep->r_procp);
55
56 if (full) {
57 (*pr)("mreq %p mrep %p md %p nfsmount %p vnode %p timer %i",
58 " rtt %i\n",
59 rep->r_mreq, rep->r_mrep, rep->r_md, rep->r_nmp,
60 rep->r_vp, rep->r_timer, rep->r_rtt);
61 }
62 }
63
64 void
65 db_show_all_nfsnodes(db_expr_t expr, int haddr, db_expr_t count, char *modif)
66 {
67 int full = 0;
68
69 if (modif[0] == 'f')
70 full = 1;
71
72 pool_walk(&nfs_node_pool, full, db_printf, nfs_node_print);
73 }
74
75
76
77 void
78 nfs_node_print(void *v, int full, int (*pr)(const char *, ...))
79 {
80 struct nfsnode *np = v;
81
82 (*pr)("size %llu flag %i vnode %p accstamp %lld\n",
83 np->n_size, np->n_flag, np->n_vnode, (long long)np->n_accstamp);
84
85 if (full) {
86 (*pr)("pushedlo %llu pushedhi %llu pushlo %llu pushhi %llu\n",
87 np->n_pushedlo, np->n_pushedhi, np->n_pushlo,
88 np->n_pushhi);
89 (*pr)("commitflags %i\n", np->n_commitflags);
90 }
91 }
Cache object: 31aba33e76f8a43119f9fe127527629b
|