On Tue, Mar 2, 2010 at 3:20 AM, Henrik Johansen <fi...@hotmail.com> wrote: > Hi folks, > > While playing around with the FBT provider I came across something I simply > can't figure out how to do. > > I would really like to track I/O to some of our zvols - for writes something > like this does the trick : > > dtrace -qn 'fbt:zfs:zvol_log_write:entry { @[args[0]->zv_name] = count(); }'; > > For reads this proves more difficult since the zvol_state struct (which holds > the zvol name) is not passed as an argument. > > I haven't used C since school (more than a decade ago) so excuse me for > mistaking but > judging from the zvol_read function in > http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/uts/common/fs/zfs/zvol.c > uses a pointer to the zvol_state struct instead. > > How can I get my hands on that data from dtrace ?
zvol_read() gets the pointer to the zvol_state struct by caling ddi_get_soft_state(). You can get this pointer by tracing ddi_get_soft_state() predicated on being called from inside zvol_read(). For example, you could do something like this: fbt::zvol:read:entry { self->trace = 1; } fbt::ddi_get_soft_state:return / self->trace / { self->zv = args[1]; } fbt::zvol_read:return / self->zv / { @[self->zv->zv_name] = count(); self->zv = 0; self->trace = 0; } Chad _______________________________________________ dtrace-discuss mailing list dtrace-discuss@opensolaris.org