1 #!/usr/sbin/dtrace -s
2 
3 /* This D script attempts to verify whether a single dbuf is being held by
4  * multiple transaction groups at the time it is fixed up.  The purpose is
5  * to verify whether the txg_integrity test exercises the kernel code paths
6  * that we want it to.
7  * XXX this is a work in progress.  It is not yet usable
8  *
9  * $FreeBSD$
10  */
11 
12 /* zfs:kernel:dbuf_fix_old_data:entry
13 {
14 	printf("entry");
15 }*/
16 
17 dtrace:::BEGIN
18 {
19    dmu_write_uio_dnode_size = 0;
20    dmu_write_uio_dnode_loffset = 0;
21    dmu_write_uio_dnode_numbufs = 0;
22    dbuf_dirty_size = 0;
23    dbuf_dirty_offset = 0;
24    uio_stats2_refcount = 0,
25    uio_stats2_dirtycnt = 0,
26    dbuf_dirty_entry_refcount = 0;
27    dbuf_dirty_entry_dirtycnt = 0;
28    dbuf_dirty_refcount = 0;
29    dbuf_dirty_dirtycnt = 0;
30    ge2TrackerName[0] = "";
31    ge2TrackerCount[0] = 0;
32 }
33 
34 zfs:kernel:dbuf_fix_old_data:db_get_spa
35 {
36 	/*printf("db_get_spa");*/
37 	/* stack(); */
38 	printf("uio_stats: size=%d\tloffset=%x\tnumbufs=%d\n\trefcount(holds)=%d\tdirtycnt=%d\n",
39       dmu_write_uio_dnode_size ,
40       dmu_write_uio_dnode_loffset,
41       dmu_write_uio_dnode_numbufs ,
42       uio_stats2_refcount,
43       uio_stats2_dirtycnt);
44    printf("dbuf_dirty stats: size=%d\toffset=%x\n\tentry: refcount(holds)=%d\tdirtycnt=%d\n\texit: refcount(holds)=%d\tdirtycnt=%d\n",
45          dbuf_dirty_size,
46          dbuf_dirty_offset,
47          dbuf_dirty_entry_refcount,
48          dbuf_dirty_entry_dirtycnt,
49          dbuf_dirty_refcount,
50          dbuf_dirty_dirtycnt);
51    printf("DR_TXG=%d\tDB address = %x\n", args[0], (long long)args[1]);
52    printf("ge2Tracker entry: name=%s\tcount=%d", ge2TrackerName[(long long)args[1]], ge2TrackerCount[(long long)args[1]]);
53    exit(0);
54 }
55 
56 zfs:kernel:dbuf_dirty:entry
57 {
58    dbuf_dirty_size = args[0];
59    dbuf_dirty_offset = args[1];
60    dbuf_dirty_entry_refcount = args[2];
61    dbuf_dirty_entry_dirtycnt = args[3];
62 }
63 
64 
65 zfs2:kernel:dmu_write_uio_dnode:uio_stats
66 {
67    dmu_write_uio_dnode_size = args[0];
68    dmu_write_uio_dnode_loffset = args[1];
69    dmu_write_uio_dnode_numbufs = args[2];
70    printf("uio_stats: size=%d\tloffset=%x\tnumbufs=%d", args[0], args[1], args[2]);
71 }
72 
73 zfs2:kernel:dmu_write_uio_dnode:uio_stats_two
74 {
75    uio_stats2_refcount = args[0];
76    uio_stats2_dirtycnt = args[1];
77    printf("uio_stats2: refcount=%d\tdirtycnt=%d\tdb=%x", args[0], args[1], (long long)args[2]);
78 }
79 
80 zfs2:kernel:dmu_write_uio_dnode:uio_stats_three
81 {
82    printf("uio_stats3: io_txg=%d", args[0]);
83 }
84 
85 zfs:kernel:dbuf_dirty:no_db_nofill
86 {
87    dbuf_dirty_refcount = args[0];
88    dbuf_dirty_dirtycnt = args[1];
89 }
90 
91 /* refcount:kernel::ge2
92 {
93    stack();
94 } */
95 
96 zfs:kernel:dbuf_hold_impl:ge2
97 {
98    ge2TrackerName[(long long)args[0]] = "dbuf_hold_impl";
99    ge2TrackerCount[(long long)args[0]] = args[1];
100    printf(">= 2: db=%x\trc=%d", (long long)args[0], args[1]);
101    /* stack(); */
102    /* ustack(10); */
103 }
104 
105 /* zfs:kernel:dbuf_add_ref:ge2
106 {
107    ge2TrackerName[(long long)args[0]] = "dbuf_add_ref";
108    ge2TrackerCount[(long long)args[0]] = args[1];
109 } */
110 
111 /* zfs2:kernel:dmu_bonus_hold:ge2
112 {
113    ge2TrackerName[(long long)args[0]] = "dmu_bonus_hold";
114    ge2TrackerCount[(long long)args[0]] = args[1];
115 }*/
116 
117 
118