1 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2 From: gaurkuma <gaurkuma@users.noreply.github.com>
3 Date: Fri, 11 Aug 2017 08:53:35 -0700
4 Subject: [PATCH] Allow longer SPA names in stats
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
9 Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
10 Reviewed-by: Giuseppe Di Natale <dinatale2@llnl.gov>
11 Signed-off-by: gaurkuma <gauravk.18@gmail.com>
13 (cherry picked from commit cbf0dff3d8a13c2b4e547321ff2005055521e5ee)
14 Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
16 include/sys/kstat.h | 2 +-
17 module/spl/spl-kstat.c | 13 +++++++++----
18 2 files changed, 10 insertions(+), 5 deletions(-)
20 diff --git a/include/sys/kstat.h b/include/sys/kstat.h
21 index faf6b81..7862ab0 100644
22 --- a/include/sys/kstat.h
23 +++ b/include/sys/kstat.h
26 #include <sys/mutex.h>
28 -#define KSTAT_STRLEN 31
29 +#define KSTAT_STRLEN 255
30 #define KSTAT_RAW_MAX (128*1024)
32 /* For reference valid classes are:
33 diff --git a/module/spl/spl-kstat.c b/module/spl/spl-kstat.c
34 index e306915..ed52653 100644
35 --- a/module/spl/spl-kstat.c
36 +++ b/module/spl/spl-kstat.c
37 @@ -614,21 +614,26 @@ kstat_detect_collision(kstat_t *ksp)
39 kstat_module_t *module;
41 - char parent[KSTAT_STRLEN+1];
45 - (void) strlcpy(parent, ksp->ks_module, sizeof(parent));
46 + parent = kmem_asprintf("%s", ksp->ks_module);
48 - if ((cp = strrchr(parent, '/')) == NULL)
49 + if ((cp = strrchr(parent, '/')) == NULL) {
55 if ((module = kstat_find_module(parent)) != NULL) {
56 list_for_each_entry(tmp, &module->ksm_kstat_list, ks_list)
57 - if (strncmp(tmp->ks_name, cp+1, KSTAT_STRLEN) == 0)
58 + if (strncmp(tmp->ks_name, cp+1, KSTAT_STRLEN) == 0) {