aboutsummaryrefslogtreecommitdiffstats
path: root/include/sys/zil.h
diff options
context:
space:
mode:
authorixhamza <[email protected]>2022-07-21 05:14:06 +0500
committerGitHub <[email protected]>2022-07-20 17:14:06 -0700
commitfb087146de0118108e3b44222d2052415dcb1f7f (patch)
treed4d4ec788bc0ef3640b2dcfa02a6e9ad964e2b79 /include/sys/zil.h
parent33dba8c79224ce33dc661d545ab1d17fc3d84a0c (diff)
Add support for per dataset zil stats and use wmsum counters
ZIL kstats are reported in an inclusive way, i.e., same counters are shared to capture all the activities happening in zil. Added support to report zil stats for every datset individually by combining them with already exposed dataset kstats. Wmsum uses per cpu counters and provide less overhead as compared to atomic operations. Updated zil kstats to replace wmsum counters to avoid atomic operations. Reviewed-by: Christian Schwarz <[email protected]> Reviewed-by: Ryan Moeller <[email protected]> Reviewed-by: Alexander Motin <[email protected]> Signed-off-by: Ameer Hamza <[email protected]> Closes #13636
Diffstat (limited to 'include/sys/zil.h')
-rw-r--r--include/sys/zil.h43
1 files changed, 36 insertions, 7 deletions
diff --git a/include/sys/zil.h b/include/sys/zil.h
index 3f1c38220..cec04f120 100644
--- a/include/sys/zil.h
+++ b/include/sys/zil.h
@@ -33,6 +33,7 @@
#include <sys/zio.h>
#include <sys/dmu.h>
#include <sys/zio_crypt.h>
+#include <sys/wmsum.h>
#ifdef __cplusplus
extern "C" {
@@ -472,12 +473,34 @@ typedef struct zil_stats {
*/
kstat_named_t zil_itx_metaslab_slog_count;
kstat_named_t zil_itx_metaslab_slog_bytes;
-} zil_stats_t;
-
-#define ZIL_STAT_INCR(stat, val) \
- atomic_add_64(&zil_stats.stat.value.ui64, (val));
-#define ZIL_STAT_BUMP(stat) \
- ZIL_STAT_INCR(stat, 1);
+} zil_kstat_values_t;
+
+typedef struct zil_sums {
+ wmsum_t zil_commit_count;
+ wmsum_t zil_commit_writer_count;
+ wmsum_t zil_itx_count;
+ wmsum_t zil_itx_indirect_count;
+ wmsum_t zil_itx_indirect_bytes;
+ wmsum_t zil_itx_copied_count;
+ wmsum_t zil_itx_copied_bytes;
+ wmsum_t zil_itx_needcopy_count;
+ 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_slog_count;
+ wmsum_t zil_itx_metaslab_slog_bytes;
+} zil_sums_t;
+
+#define ZIL_STAT_INCR(zil, stat, val) \
+ do { \
+ int64_t tmpval = (val); \
+ wmsum_add(&(zil_sums_global.stat), tmpval); \
+ if ((zil)->zl_sums) \
+ wmsum_add(&((zil)->zl_sums->stat), tmpval); \
+ } while (0)
+
+#define ZIL_STAT_BUMP(zil, stat) \
+ ZIL_STAT_INCR(zil, stat, 1);
typedef int zil_parse_blk_func_t(zilog_t *zilog, const blkptr_t *bp, void *arg,
uint64_t txg);
@@ -497,7 +520,8 @@ extern void zil_fini(void);
extern zilog_t *zil_alloc(objset_t *os, zil_header_t *zh_phys);
extern void zil_free(zilog_t *zilog);
-extern zilog_t *zil_open(objset_t *os, zil_get_data_t *get_data);
+extern zilog_t *zil_open(objset_t *os, zil_get_data_t *get_data,
+ zil_sums_t *zil_sums);
extern void zil_close(zilog_t *zilog);
extern void zil_replay(objset_t *os, void *arg,
@@ -537,6 +561,11 @@ extern void zil_set_logbias(zilog_t *zilog, uint64_t slogval);
extern uint64_t zil_max_copied_data(zilog_t *zilog);
extern uint64_t zil_max_log_data(zilog_t *zilog);
+extern void zil_sums_init(zil_sums_t *zs);
+extern void zil_sums_fini(zil_sums_t *zs);
+extern void zil_kstat_values_update(zil_kstat_values_t *zs,
+ zil_sums_t *zil_sums);
+
extern int zil_replay_disable;
#ifdef __cplusplus