My colleague and myself are trying to trace the reads/writes to the L2ARC in OpenZFS. We want the block offsets, IO type (read/write) and the device-ids of the requests. Note that we don't want the offset in the L2ARC device but we want the offset/device-id from the original storage device in order to model what storage blocks go through the L2ARC cache.

Going through the OpenZFS source (github.com/openzfs/openzfs/blob/master/usr/src/uts/common/fs/zfs/arc.c) and using Brendan's dtrace tutorial (dtrace.org/blogs/brendan/2012/01/09/activity-of-the-zfs-arc) has been useful.

We believe the arc_buf_hdr_t struct contains the information we are looking for. More precisely the dva_t b_dva; field contains the offset and the device id of the underlying storage device and we can access an instance of arc_buf_hdr_t (variable name is hdr ) via the arc__miss dtrace probe event. This gives us the L2ARC reads but the writes are harder to get. Namely the l2arc__write dtrace probe event doesn't have access to this hdr , it should be in the io_private field on the zio_t that is passed into l2arc__write but it is always NULL in our testbed which doesn't make sense to us.