Skip to content
This repository has been archived by the owner on Feb 26, 2020. It is now read-only.

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 #641
  • Loading branch information
gaurkuma authored and tonyhutter committed Mar 14, 2018
1 parent 3cc0ea2 commit cbf0dff
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 cbf0dff

Please sign in to comment.