From 2aa8fde998bca6cbdafa2c2c6b62d3443ad7fb12 Mon Sep 17 00:00:00 2001 From: Fabian Keil Date: Wed, 27 Apr 2016 11:21:17 +0200 Subject: [PATCH 231/257] ZFS: Add sysctl to show how often the write buffer was limitted Obtained from: ElectroBSD --- sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c index f1a0688cb1b3..6cc268812cde 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c @@ -46,6 +46,12 @@ typedef void (*dmu_tx_hold_func_t)(dmu_tx_t *tx, struct dnode *dn, extern int zio_use_uma; /* Needs to be visible; DO NOT MODIFY! */ int zfs_dynamic_write_buffer = 1; /* Dynamically tune writes */ +SYSCTL_DECL(_vfs_zfs); +static uint64_t zfs_dynamic_write_buffer_hits = 0; +SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, dynamic_write_buffer_hits, CTLFLAG_RWTUN, + &zfs_dynamic_write_buffer_hits, 0, + "Number of times the dynamic write buffer was limitted"); + dmu_tx_t * dmu_tx_create_dd(dsl_dir_t *dd) { @@ -1383,6 +1389,9 @@ dmu_tx_assign(dmu_tx_t *tx, txg_how_t txg_how) last_max = zfs_dirty_data_max_internal / (1024 * 1024); DTRACE_PROBE1(dmu__tx_dirty, uint64_t, last_max); } + if (zfs_dirty_data_max_internal < zfs_dirty_data_max) { + zfs_dynamic_write_buffer_hits++; + } } else { zfs_dirty_data_max_internal = zfs_dirty_data_max; } -- 2.11.0