zil: Add some more statistics.

In addition to a number of actual log bytes written, account also a
total written bytes including padding and total allocated bytes (bytes
<= write <= alloc).  It should allow to monitor zil traffic and space
efficiency.

Add dtrace probe for zil block size selection.

Make zilstat report more information and fit it into less width.

Reviewed-by: Ameer Hamza <ahamza@ixsystems.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by:  Alexander Motin <mav@FreeBSD.org>
Sponsored by:   iXsystems, Inc.
Closes #14863
This commit is contained in:
Alexander Motin
2023-05-25 16:51:53 -04:00
committed by GitHub
parent f63811f072
commit b6fbe61fa6
6 changed files with 213 additions and 52 deletions
+34
View File
@@ -215,6 +215,39 @@ DEFINE_EVENT(zfs_zil_commit_io_error_class, name, \
TP_ARGS(zilog, zcw))
DEFINE_ZIL_COMMIT_IO_ERROR_EVENT(zfs_zil__commit__io__error);
/*
* Generic support for three argument tracepoints of the form:
*
* DTRACE_PROBE3(...,
* zilog_t *, ...,
* uint64_t, ...,
* uint64_t, ...);
*/
/* BEGIN CSTYLED */
DECLARE_EVENT_CLASS(zfs_zil_block_size_class,
TP_PROTO(zilog_t *zilog, uint64_t res, uint64_t s1),
TP_ARGS(zilog, res, s1),
TP_STRUCT__entry(
ZILOG_TP_STRUCT_ENTRY
__field(uint64_t, res)
__field(uint64_t, s1)
),
TP_fast_assign(
ZILOG_TP_FAST_ASSIGN
__entry->res = res;
__entry->s1 = s1;
),
TP_printk(
ZILOG_TP_PRINTK_FMT " res %llu s1 %llu",
ZILOG_TP_PRINTK_ARGS, __entry->res, __entry->s1)
);
#define DEFINE_ZIL_BLOCK_SIZE_EVENT(name) \
DEFINE_EVENT(zfs_zil_block_size_class, name, \
TP_PROTO(zilog_t *zilog, uint64_t res, uint64_t s1), \
TP_ARGS(zilog, res, s1))
DEFINE_ZIL_BLOCK_SIZE_EVENT(zfs_zil__block__size);
#endif /* _TRACE_ZIL_H */
#undef TRACE_INCLUDE_PATH
@@ -228,6 +261,7 @@ DEFINE_ZIL_COMMIT_IO_ERROR_EVENT(zfs_zil__commit__io__error);
DEFINE_DTRACE_PROBE2(zil__process__commit__itx);
DEFINE_DTRACE_PROBE2(zil__process__normal__itx);
DEFINE_DTRACE_PROBE2(zil__commit__io__error);
DEFINE_DTRACE_PROBE3(zil__block__size);
#endif /* HAVE_DECLARE_EVENT_CLASS */
#endif /* _KERNEL */
+10 -2
View File
@@ -489,18 +489,22 @@ typedef struct zil_stats {
* Transactions which have been allocated to the "normal"
* (i.e. not slog) storage pool. Note that "bytes" accumulate
* the actual log record sizes - which do not include the actual
* data in case of indirect writes.
* data in case of indirect writes. bytes <= write <= alloc.
*/
kstat_named_t zil_itx_metaslab_normal_count;
kstat_named_t zil_itx_metaslab_normal_bytes;
kstat_named_t zil_itx_metaslab_normal_write;
kstat_named_t zil_itx_metaslab_normal_alloc;
/*
* Transactions which have been allocated to the "slog" storage pool.
* If there are no separate log devices, this is the same as the
* "normal" pool.
* "normal" pool. bytes <= write <= alloc.
*/
kstat_named_t zil_itx_metaslab_slog_count;
kstat_named_t zil_itx_metaslab_slog_bytes;
kstat_named_t zil_itx_metaslab_slog_write;
kstat_named_t zil_itx_metaslab_slog_alloc;
} zil_kstat_values_t;
typedef struct zil_sums {
@@ -515,8 +519,12 @@ typedef struct zil_sums {
wmsum_t zil_itx_needcopy_bytes;
wmsum_t zil_itx_metaslab_normal_count;
wmsum_t zil_itx_metaslab_normal_bytes;
wmsum_t zil_itx_metaslab_normal_write;
wmsum_t zil_itx_metaslab_normal_alloc;
wmsum_t zil_itx_metaslab_slog_count;
wmsum_t zil_itx_metaslab_slog_bytes;
wmsum_t zil_itx_metaslab_slog_write;
wmsum_t zil_itx_metaslab_slog_alloc;
} zil_sums_t;
#define ZIL_STAT_INCR(zil, stat, val) \