mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-26 03:09:34 +03:00
Allow longer SPA names in stats
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Giuseppe Di Natale <dinatale2@llnl.gov> Signed-off-by: gaurkuma <gauravk.18@gmail.com> Closes #641
This commit is contained in:
parent
bbefaeba29
commit
9df9692637
@ -32,7 +32,7 @@
|
|||||||
#include <sys/kmem.h>
|
#include <sys/kmem.h>
|
||||||
#include <sys/mutex.h>
|
#include <sys/mutex.h>
|
||||||
|
|
||||||
#define KSTAT_STRLEN 31
|
#define KSTAT_STRLEN 255
|
||||||
#define KSTAT_RAW_MAX (128*1024)
|
#define KSTAT_RAW_MAX (128*1024)
|
||||||
|
|
||||||
/* For reference valid classes are:
|
/* For reference valid classes are:
|
||||||
|
@ -614,21 +614,26 @@ kstat_detect_collision(kstat_t *ksp)
|
|||||||
{
|
{
|
||||||
kstat_module_t *module;
|
kstat_module_t *module;
|
||||||
kstat_t *tmp;
|
kstat_t *tmp;
|
||||||
char parent[KSTAT_STRLEN+1];
|
char *parent;
|
||||||
char *cp;
|
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);
|
return (0);
|
||||||
|
}
|
||||||
|
|
||||||
cp[0] = '\0';
|
cp[0] = '\0';
|
||||||
if ((module = kstat_find_module(parent)) != NULL) {
|
if ((module = kstat_find_module(parent)) != NULL) {
|
||||||
list_for_each_entry(tmp, &module->ksm_kstat_list, ks_list)
|
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);
|
return (EEXIST);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
strfree(parent);
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user