diff --git a/include/sys/trace_vdev.h b/include/sys/trace_vdev.h index bc9061eecafa..2de304ff9ba9 100644 --- a/include/sys/trace_vdev.h +++ b/include/sys/trace_vdev.h @@ -34,41 +34,81 @@ #include /* - * Generic support for tracepoints of the form: + * Support for tracepoints of the form: * - * DTRACE_PROBE2(..., - * vdev_t *, ..., - * metaslab_group_t *, ...); + * DTRACE_PROBE3(..., + * vdev_t *vd, ..., + * uint64_t mused, ..., + * uint64_t mlim, ..., */ /* BEGIN CSTYLED */ -DECLARE_EVENT_CLASS(zfs_vdev_mg_class, - TP_PROTO(vdev_t *vd, metaslab_group_t *mg), - TP_ARGS(vd, mg), +DECLARE_EVENT_CLASS(zfs_vdev_mused_mlim_class, + TP_PROTO(vdev_t *vd, uint64_t mused, uint64_t mlim), + TP_ARGS(vd, mused, mlim), TP_STRUCT__entry( __field(uint64_t, vdev_id) __field(uint64_t, vdev_guid) - __field(boolean_t, mg_allocatable) - __field(uint64_t, mg_free_capacity) + __field(uint64_t, mused) + __field(uint64_t, mlim) ), TP_fast_assign( __entry->vdev_id = vd->vdev_id; __entry->vdev_guid = vd->vdev_guid; - __entry->mg_allocatable = mg->mg_allocatable; - __entry->mg_free_capacity = mg->mg_free_capacity; + __entry->mused = mused; + __entry->mlim = mlim; ), TP_printk("vd { vdev_id %llu vdev_guid %llu }" - "mg { mg_allocatable %d mg_free_capacity %llu }", + " mused = %llu mlim = %llu", __entry->vdev_id, __entry->vdev_guid, - __entry->mg_allocatable, __entry->mg_free_capacity) + __entry->mused, __entry->mlim) ); +/* END CSTYLED */ + +/* BEGIN CSTYLED */ +#define DEFINE_VDEV_MUSED_MLIM_EVENT(name) \ +DEFINE_EVENT(zfs_vdev_mused_mlim_class, name, \ + TP_PROTO(vdev_t *vd, uint64_t mused, uint64_t mlim), \ + TP_ARGS(vd, mused, mlim)) +/* END CSTYLED */ +DEFINE_VDEV_MUSED_MLIM_EVENT(zfs_autotrim__mem__lim); + +/* + * Generic support for tracepoints of the form: + * + * DTRACE_PROBE1(..., + * metaslab_t *, ..., + */ +/* BEGIN CSTYLED */ +DECLARE_EVENT_CLASS(zfs_msp_class, + TP_PROTO(metaslab_t *msp), + TP_ARGS(msp), + TP_STRUCT__entry( + __field(uint64_t, ms_id) + __field(uint64_t, ms_start) + __field(uint64_t, ms_size) + __field(uint64_t, ms_fragmentation) + ), + TP_fast_assign( + __entry->ms_id = msp->ms_id; + __entry->ms_start = msp->ms_start; + __entry->ms_size = msp->ms_size; + __entry->ms_fragmentation = msp->ms_fragmentation; + ), + TP_printk("msp { ms_id %llu ms_start %llu ms_size %llu " + "ms_fragmentation %llu }", + __entry->ms_id, __entry->ms_start, + __entry->ms_size, __entry->ms_fragmentation) +); +/* END CSTYLED */ /* BEGIN CSTYLED */ -#define DEFINE_VDEV_MG_EVENT(name) \ -DEFINE_EVENT(zfs_vdev_mg_class, name, \ - TP_PROTO(vdev_t *vd, metaslab_group_t *mg), \ - TP_ARGS(vd, mg)) +#define DEFINE_MSP_EVENT(name) \ +DEFINE_EVENT(zfs_msp_class, name, \ + TP_PROTO(metaslab_t *msp), \ + TP_ARGS(msp)) /* END CSTYLED */ -DEFINE_VDEV_MG_EVENT(zfs_vdev_trim_all_restart); +DEFINE_MSP_EVENT(zfs_preserve__spilled); +DEFINE_MSP_EVENT(zfs_drop__spilled); #endif /* _TRACE_VDEV_H */ diff --git a/module/zfs/metaslab.c b/module/zfs/metaslab.c index 1cc3ca4c298d..12db576215ff 100644 --- a/module/zfs/metaslab.c +++ b/module/zfs/metaslab.c @@ -34,6 +34,7 @@ #include #include #include +#include #define WITH_DF_BLOCK_ALLOCATOR