Skip to content

Commit

Permalink
Allow longer SPA names in stats
Browse files Browse the repository at this point in the history
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Giuseppe Di Natale <[email protected]>
Signed-off-by: gaurkuma <[email protected]>
Closes openzfs#641
  • Loading branch information
gaurkuma authored and behlendorf committed Aug 11, 2017
1 parent bbefaeb commit 9df9692
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion include/sys/kstat.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#include <sys/kmem.h>
#include <sys/mutex.h>

#define KSTAT_STRLEN 31
#define KSTAT_STRLEN 255
#define KSTAT_RAW_MAX (128*1024)

/* For reference valid classes are:
Expand Down
13 changes: 9 additions & 4 deletions module/spl/spl-kstat.c
Original file line number Diff line number Diff line change
Expand Up @@ -614,21 +614,26 @@ kstat_detect_collision(kstat_t *ksp)
{
kstat_module_t *module;
kstat_t *tmp;
char parent[KSTAT_STRLEN+1];
char *parent;
char *cp;

(void) strlcpy(parent, ksp->ks_module, sizeof(parent));
parent = kmem_asprintf("%s", ksp->ks_module);

if ((cp = strrchr(parent, '/')) == NULL)
if ((cp = strrchr(parent, '/')) == NULL) {
strfree(parent);
return (0);
}

cp[0] = '\0';
if ((module = kstat_find_module(parent)) != NULL) {
list_for_each_entry(tmp, &module->ksm_kstat_list, ks_list)
if (strncmp(tmp->ks_name, cp+1, KSTAT_STRLEN) == 0)
if (strncmp(tmp->ks_name, cp+1, KSTAT_STRLEN) == 0) {
strfree(parent);
return (EEXIST);
}
}

strfree(parent);
return (0);
}

Expand Down

0 comments on commit 9df9692

Please sign in to comment.