summaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
authorgaurkuma <[email protected]>2017-08-11 08:56:24 -0700
committerBrian Behlendorf <[email protected]>2017-08-11 08:56:24 -0700
commit761b8ec6bf98f39550353173ad7bec5306073f9c (patch)
tree75308c5341691961a0cc69f58199852fef406212 /module
parentc25b8f99f8dcbe898b81728e6a9dab107df4fc0b (diff)
Allow longer SPA names in stats
The pool name can be 256 chars long. Today, in /proc/spl/kstat/zfs/ the name is limited to < 32 characters. This change is to allows bigger pool names. Reviewed-by: Giuseppe Di Natale <[email protected]> Reviewed-by: loli10K <[email protected]> Reviewed-by: George Melikov <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: gaurkuma <[email protected]> Closes #6481
Diffstat (limited to 'module')
-rw-r--r--module/icp/spi/kcf_spi.c11
-rw-r--r--module/zfs/spa_stats.c25
2 files changed, 21 insertions, 15 deletions
diff --git a/module/icp/spi/kcf_spi.c b/module/icp/spi/kcf_spi.c
index c2c2b54bc..0a6e38df8 100644
--- a/module/icp/spi/kcf_spi.c
+++ b/module/icp/spi/kcf_spi.c
@@ -111,7 +111,7 @@ int
crypto_register_provider(crypto_provider_info_t *info,
crypto_kcf_provider_handle_t *handle)
{
- char ks_name[KSTAT_STRLEN];
+ char *ks_name;
kcf_provider_desc_t *prov_desc = NULL;
int ret = CRYPTO_ARGUMENTS_BAD;
@@ -238,12 +238,12 @@ crypto_register_provider(crypto_provider_info_t *info,
* This kstat is deleted, when the provider unregisters.
*/
if (prov_desc->pd_prov_type == CRYPTO_SW_PROVIDER) {
- (void) snprintf(ks_name, KSTAT_STRLEN, "%s_%s",
+ ks_name = kmem_asprintf("%s_%s",
"NONAME", "provider_stats");
} else {
- (void) snprintf(ks_name, KSTAT_STRLEN, "%s_%d_%u_%s",
- "NONAME", 0,
- prov_desc->pd_prov_id, "provider_stats");
+ ks_name = kmem_asprintf("%s_%d_%u_%s",
+ "NONAME", 0, prov_desc->pd_prov_id,
+ "provider_stats");
}
prov_desc->pd_kstat = kstat_create("kcf", 0, ks_name, "crypto",
@@ -261,6 +261,7 @@ crypto_register_provider(crypto_provider_info_t *info,
prov_desc->pd_kstat->ks_update = kcf_prov_kstat_update;
kstat_install(prov_desc->pd_kstat);
}
+ strfree(ks_name);
}
if (prov_desc->pd_prov_type == CRYPTO_HW_PROVIDER)
diff --git a/module/zfs/spa_stats.c b/module/zfs/spa_stats.c
index 7ca359806..8c4dba29e 100644
--- a/module/zfs/spa_stats.c
+++ b/module/zfs/spa_stats.c
@@ -142,7 +142,7 @@ static void
spa_read_history_init(spa_t *spa)
{
spa_stats_history_t *ssh = &spa->spa_stats.read_history;
- char name[KSTAT_STRLEN];
+ char *name;
kstat_t *ksp;
mutex_init(&ssh->lock, NULL, MUTEX_DEFAULT, NULL);
@@ -153,7 +153,7 @@ spa_read_history_init(spa_t *spa)
ssh->size = 0;
ssh->private = NULL;
- (void) snprintf(name, KSTAT_STRLEN, "zfs/%s", spa_name(spa));
+ name = kmem_asprintf("zfs/%s", spa_name(spa));
ksp = kstat_create(name, 0, "reads", "misc",
KSTAT_TYPE_RAW, 0, KSTAT_FLAG_VIRTUAL);
@@ -168,6 +168,7 @@ spa_read_history_init(spa_t *spa)
spa_read_history_data, spa_read_history_addr);
kstat_install(ksp);
}
+ strfree(name);
}
static void
@@ -365,7 +366,7 @@ static void
spa_txg_history_init(spa_t *spa)
{
spa_stats_history_t *ssh = &spa->spa_stats.txg_history;
- char name[KSTAT_STRLEN];
+ char *name;
kstat_t *ksp;
mutex_init(&ssh->lock, NULL, MUTEX_DEFAULT, NULL);
@@ -376,7 +377,7 @@ spa_txg_history_init(spa_t *spa)
ssh->size = 0;
ssh->private = NULL;
- (void) snprintf(name, KSTAT_STRLEN, "zfs/%s", spa_name(spa));
+ name = kmem_asprintf("zfs/%s", spa_name(spa));
ksp = kstat_create(name, 0, "txgs", "misc",
KSTAT_TYPE_RAW, 0, KSTAT_FLAG_VIRTUAL);
@@ -391,6 +392,7 @@ spa_txg_history_init(spa_t *spa)
spa_txg_history_data, spa_txg_history_addr);
kstat_install(ksp);
}
+ strfree(name);
}
static void
@@ -598,7 +600,7 @@ static void
spa_tx_assign_init(spa_t *spa)
{
spa_stats_history_t *ssh = &spa->spa_stats.tx_assign_histogram;
- char name[KSTAT_STRLEN];
+ char *name;
kstat_named_t *ks;
kstat_t *ksp;
int i;
@@ -609,7 +611,7 @@ spa_tx_assign_init(spa_t *spa)
ssh->size = ssh->count * sizeof (kstat_named_t);
ssh->private = kmem_alloc(ssh->size, KM_SLEEP);
- (void) snprintf(name, KSTAT_STRLEN, "zfs/%s", spa_name(spa));
+ name = kmem_asprintf("zfs/%s", spa_name(spa));
for (i = 0; i < ssh->count; i++) {
ks = &((kstat_named_t *)ssh->private)[i];
@@ -632,6 +634,7 @@ spa_tx_assign_init(spa_t *spa)
ksp->ks_update = spa_tx_assign_update;
kstat_install(ksp);
}
+ strfree(name);
}
static void
@@ -678,12 +681,12 @@ static void
spa_io_history_init(spa_t *spa)
{
spa_stats_history_t *ssh = &spa->spa_stats.io_history;
- char name[KSTAT_STRLEN];
+ char *name;
kstat_t *ksp;
mutex_init(&ssh->lock, NULL, MUTEX_DEFAULT, NULL);
- (void) snprintf(name, KSTAT_STRLEN, "zfs/%s", spa_name(spa));
+ name = kmem_asprintf("zfs/%s", spa_name(spa));
ksp = kstat_create(name, 0, "io", "disk", KSTAT_TYPE_IO, 1, 0);
ssh->kstat = ksp;
@@ -694,6 +697,7 @@ spa_io_history_init(spa_t *spa)
ksp->ks_update = spa_io_history_update;
kstat_install(ksp);
}
+ strfree(name);
}
static void
@@ -806,7 +810,7 @@ static void
spa_mmp_history_init(spa_t *spa)
{
spa_stats_history_t *ssh = &spa->spa_stats.mmp_history;
- char name[KSTAT_STRLEN];
+ char *name;
kstat_t *ksp;
mutex_init(&ssh->lock, NULL, MUTEX_DEFAULT, NULL);
@@ -817,7 +821,7 @@ spa_mmp_history_init(spa_t *spa)
ssh->size = 0;
ssh->private = NULL;
- (void) snprintf(name, KSTAT_STRLEN, "zfs/%s", spa_name(spa));
+ name = kmem_asprintf("zfs/%s", spa_name(spa));
ksp = kstat_create(name, 0, "multihost", "misc",
KSTAT_TYPE_RAW, 0, KSTAT_FLAG_VIRTUAL);
@@ -832,6 +836,7 @@ spa_mmp_history_init(spa_t *spa)
spa_mmp_history_data, spa_mmp_history_addr);
kstat_install(ksp);
}
+ strfree(name);
}
static void