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 
10 /* zfs:kernel:dbuf_fix_old_data:entry
11 {
12 	printf("entry");
13 }*/
14 
15 dtrace:::BEGIN
16 {
17    dmu_write_uio_dnode_size = 0;
18    dmu_write_uio_dnode_loffset = 0;
19    dmu_write_uio_dnode_numbufs = 0;
20    dbuf_dirty_size = 0;
21    dbuf_dirty_offset = 0;
22    uio_stats2_refcount = 0,
23    uio_stats2_dirtycnt = 0,
24    dbuf_dirty_entry_refcount = 0;
25    dbuf_dirty_entry_dirtycnt = 0;
26    dbuf_dirty_refcount = 0;
27    dbuf_dirty_dirtycnt = 0;
28    ge2TrackerName[0] = "";
29    ge2TrackerCount[0] = 0;
30 }
31 
32 zfs:kernel:dbuf_fix_old_data:db_get_spa
33 {
34 	/*printf("db_get_spa");*/
35 	/* stack(); */
36 	printf("uio_stats: size=%d\tloffset=%x\tnumbufs=%d\n\trefcount(holds)=%d\tdirtycnt=%d\n",
37       dmu_write_uio_dnode_size ,
38       dmu_write_uio_dnode_loffset,
39       dmu_write_uio_dnode_numbufs ,
40       uio_stats2_refcount,
41       uio_stats2_dirtycnt);
42    printf("dbuf_dirty stats: size=%d\toffset=%x\n\tentry: refcount(holds)=%d\tdirtycnt=%d\n\texit: refcount(holds)=%d\tdirtycnt=%d\n",
43          dbuf_dirty_size,
44          dbuf_dirty_offset,
45          dbuf_dirty_entry_refcount,
46          dbuf_dirty_entry_dirtycnt,
47          dbuf_dirty_refcount,
48          dbuf_dirty_dirtycnt);
49    printf("DR_TXG=%d\tDB address = %x\n", args[0], (long long)args[1]);
50    printf("ge2Tracker entry: name=%s\tcount=%d", ge2TrackerName[(long long)args[1]], ge2TrackerCount[(long long)args[1]]);
51    exit(0);
52 }
53 
54 zfs:kernel:dbuf_dirty:entry
55 {
56    dbuf_dirty_size = args[0];
57    dbuf_dirty_offset = args[1];
58    dbuf_dirty_entry_refcount = args[2];
59    dbuf_dirty_entry_dirtycnt = args[3];
60 }
61 
62 
63 zfs2:kernel:dmu_write_uio_dnode:uio_stats
64 {
65    dmu_write_uio_dnode_size = args[0];
66    dmu_write_uio_dnode_loffset = args[1];
67    dmu_write_uio_dnode_numbufs = args[2];
68    printf("uio_stats: size=%d\tloffset=%x\tnumbufs=%d", args[0], args[1], args[2]);
69 }
70 
71 zfs2:kernel:dmu_write_uio_dnode:uio_stats_two
72 {
73    uio_stats2_refcount = args[0];
74    uio_stats2_dirtycnt = args[1];
75    printf("uio_stats2: refcount=%d\tdirtycnt=%d\tdb=%x", args[0], args[1], (long long)args[2]);
76 }
77 
78 zfs2:kernel:dmu_write_uio_dnode:uio_stats_three
79 {
80    printf("uio_stats3: io_txg=%d", args[0]);
81 }
82 
83 zfs:kernel:dbuf_dirty:no_db_nofill
84 {
85    dbuf_dirty_refcount = args[0];
86    dbuf_dirty_dirtycnt = args[1];
87 }
88 
89 /* refcount:kernel::ge2
90 {
91    stack();
92 } */
93 
94 zfs:kernel:dbuf_hold_impl:ge2
95 {
96    ge2TrackerName[(long long)args[0]] = "dbuf_hold_impl";
97    ge2TrackerCount[(long long)args[0]] = args[1];
98    printf(">= 2: db=%x\trc=%d", (long long)args[0], args[1]);
99    /* stack(); */
100    /* ustack(10); */
101 }
102 
103 /* zfs:kernel:dbuf_add_ref:ge2
104 {
105    ge2TrackerName[(long long)args[0]] = "dbuf_add_ref";
106    ge2TrackerCount[(long long)args[0]] = args[1];
107 } */
108 
109 /* zfs2:kernel:dmu_bonus_hold:ge2
110 {
111    ge2TrackerName[(long long)args[0]] = "dmu_bonus_hold";
112    ge2TrackerCount[(long long)args[0]] = args[1];
113 }*/
114 
115 
116