diff --git a/module/os/linux/zfs/abd.c b/module/os/linux/zfs/abd.c index 40d73de0ae..bc6f81000d 100644 --- a/module/os/linux/zfs/abd.c +++ b/module/os/linux/zfs/abd.c @@ -573,15 +573,14 @@ abd_init(void) abd_ksp = kstat_create("zfs", 0, "abdstats", "misc", KSTAT_TYPE_NAMED, sizeof (abd_stats) / sizeof (kstat_named_t), KSTAT_FLAG_VIRTUAL); if (abd_ksp != NULL) { - abd_ksp->ks_data = &abd_stats; - kstat_install(abd_ksp); - for (i = 0; i < MAX_ORDER; i++) { snprintf(abd_stats.abdstat_scatter_orders[i].name, KSTAT_STRLEN, "scatter_order_%d", i); abd_stats.abdstat_scatter_orders[i].data_type = KSTAT_DATA_UINT64; } + abd_ksp->ks_data = &abd_stats; + kstat_install(abd_ksp); } } diff --git a/module/zfs/dbuf.c b/module/zfs/dbuf.c index d460f9922a..15a8641b93 100644 --- a/module/zfs/dbuf.c +++ b/module/zfs/dbuf.c @@ -850,10 +850,6 @@ retry: KSTAT_TYPE_NAMED, sizeof (dbuf_stats) / sizeof (kstat_named_t), KSTAT_FLAG_VIRTUAL); if (dbuf_ksp != NULL) { - dbuf_ksp->ks_data = &dbuf_stats; - dbuf_ksp->ks_update = dbuf_kstat_update; - kstat_install(dbuf_ksp); - for (i = 0; i < DN_MAX_LEVELS; i++) { snprintf(dbuf_stats.cache_levels[i].name, KSTAT_STRLEN, "cache_level_%d", i); @@ -864,6 +860,9 @@ retry: dbuf_stats.cache_levels_bytes[i].data_type = KSTAT_DATA_UINT64; } + dbuf_ksp->ks_data = &dbuf_stats; + dbuf_ksp->ks_update = dbuf_kstat_update; + kstat_install(dbuf_ksp); } }