summaryrefslogtreecommitdiffstats
path: root/module/zfs
diff options
context:
space:
mode:
authorMatthew Ahrens <[email protected]>2020-08-12 10:10:50 -0700
committerGitHub <[email protected]>2020-08-12 10:10:50 -0700
commitd64c6a2eee4a28fd22beff5c82f57372758ac81b (patch)
treefb8ece0234546329ee74f2e26f874225bd3545fa /module/zfs
parente111c8024796e9bdd2cb883b5c10c8abc13c3a5b (diff)
Use zfs_dbgmsg to log metaslab_load/unload
Metaslabs are now (usually) loaded and unloaded infrequently, but when that is not the case, it is useful to have a log of when and why these events happened. This commit enables the zfs_dbgmsg() in metaslab_load(), and adds a zfs_dbgmsg() in metaslab_unload(). Reviewed-by: Serapheim Dimitropoulos <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Matthew Ahrens <[email protected]> Closes #10683
Diffstat (limited to 'module/zfs')
-rw-r--r--module/zfs/metaslab.c53
1 files changed, 34 insertions, 19 deletions
diff --git a/module/zfs/metaslab.c b/module/zfs/metaslab.c
index 1bc27824e..ccc247d15 100644
--- a/module/zfs/metaslab.c
+++ b/module/zfs/metaslab.c
@@ -2399,25 +2399,26 @@ metaslab_load_impl(metaslab_t *msp)
msp->ms_max_size = metaslab_largest_allocatable(msp);
ASSERT3U(max_size, <=, msp->ms_max_size);
hrtime_t load_end = gethrtime();
- msp->ms_load_time = load_end;
- if (zfs_flags & ZFS_DEBUG_LOG_SPACEMAP) {
- zfs_dbgmsg("loading: txg %llu, spa %s, vdev_id %llu, "
- "ms_id %llu, smp_length %llu, "
- "unflushed_allocs %llu, unflushed_frees %llu, "
- "freed %llu, defer %llu + %llu, "
- "loading_time %lld ms, ms_max_size %llu, "
- "max size error %llu",
- spa_syncing_txg(spa), spa_name(spa),
- msp->ms_group->mg_vd->vdev_id, msp->ms_id,
- space_map_length(msp->ms_sm),
- range_tree_space(msp->ms_unflushed_allocs),
- range_tree_space(msp->ms_unflushed_frees),
- range_tree_space(msp->ms_freed),
- range_tree_space(msp->ms_defer[0]),
- range_tree_space(msp->ms_defer[1]),
- (longlong_t)((load_end - load_start) / 1000000),
- msp->ms_max_size, msp->ms_max_size - max_size);
- }
+ msp->ms_load_time = load_end;
+ zfs_dbgmsg("metaslab_load: txg %llu, spa %s, vdev_id %llu, "
+ "ms_id %llu, smp_length %llu, "
+ "unflushed_allocs %llu, unflushed_frees %llu, "
+ "freed %llu, defer %llu + %llu, unloaded time %llu ms, "
+ "loading_time %lld ms, ms_max_size %llu, "
+ "max size error %lld, "
+ "old_weight %llx, new_weight %llx",
+ spa_syncing_txg(spa), spa_name(spa),
+ msp->ms_group->mg_vd->vdev_id, msp->ms_id,
+ space_map_length(msp->ms_sm),
+ range_tree_space(msp->ms_unflushed_allocs),
+ range_tree_space(msp->ms_unflushed_frees),
+ range_tree_space(msp->ms_freed),
+ range_tree_space(msp->ms_defer[0]),
+ range_tree_space(msp->ms_defer[1]),
+ (longlong_t)((load_start - msp->ms_unload_time) / 1000000),
+ (longlong_t)((load_end - load_start) / 1000000),
+ msp->ms_max_size, msp->ms_max_size - max_size,
+ weight, msp->ms_weight);
metaslab_verify_space(msp, spa_syncing_txg(spa));
mutex_exit(&msp->ms_sync_lock);
@@ -2508,6 +2509,20 @@ metaslab_unload(metaslab_t *msp)
if (multilist_link_active(&msp->ms_class_txg_node))
multilist_sublist_remove(mls, msp);
multilist_sublist_unlock(mls);
+
+ spa_t *spa = msp->ms_group->mg_vd->vdev_spa;
+ zfs_dbgmsg("metaslab_unload: txg %llu, spa %s, vdev_id %llu, "
+ "ms_id %llu, weight %llx, "
+ "selected txg %llu (%llu ms ago), alloc_txg %llu, "
+ "loaded %llu ms ago, max_size %llu",
+ spa_syncing_txg(spa), spa_name(spa),
+ msp->ms_group->mg_vd->vdev_id, msp->ms_id,
+ msp->ms_weight,
+ msp->ms_selected_txg,
+ (msp->ms_unload_time - msp->ms_selected_time) / 1000 / 1000,
+ msp->ms_alloc_txg,
+ (msp->ms_unload_time - msp->ms_load_time) / 1000 / 1000,
+ msp->ms_max_size);
}
/*