X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fzfs_arc.c;h=cc988625b32178a005222befd9dccae0898270e5;hb=9f6f901889d4c9f594b5ae1fd0f449fcdd2d8fe3;hp=f4352ff48f60588b72a1ae83d337ba817ff09031;hpb=76a7816d2c066f2feff5c77e7da58df4dbc982c2;p=collectd.git diff --git a/src/zfs_arc.c b/src/zfs_arc.c index f4352ff4..cc988625 100644 --- a/src/zfs_arc.c +++ b/src/zfs_arc.c @@ -28,7 +28,7 @@ /* * Global variables */ -static kstat_t *ksp; + extern kstat_ctl_t *kc; static void za_submit (const char* type, const char* type_instance, value_t* values, int values_len) @@ -63,7 +63,7 @@ static int za_read_derive (kstat_t *ksp, const char *kstat_value, tmp = get_kstat_value (ksp, (char *)kstat_value); if (tmp == -1LL) { - ERROR ("zfs_arc plugin: Reading kstat value \"%s\" failed.", kstat_value); + WARNING ("zfs_arc plugin: Reading kstat value \"%s\" failed.", kstat_value); return (-1); } @@ -81,7 +81,7 @@ static int za_read_gauge (kstat_t *ksp, const char *kstat_value, tmp = get_kstat_value (ksp, (char *)kstat_value); if (tmp == -1LL) { - ERROR ("zfs_arc plugin: Reading kstat value \"%s\" failed.", kstat_value); + WARNING ("zfs_arc plugin: Reading kstat value \"%s\" failed.", kstat_value); return (-1); } @@ -109,6 +109,7 @@ static int za_read (void) { gauge_t arc_hits, arc_misses, l2_hits, l2_misses; value_t l2_io[2]; + kstat_t *ksp = NULL; get_kstat (&ksp, "zfs", 0, "arcstats"); if (ksp == NULL) @@ -122,12 +123,14 @@ static int za_read (void) za_read_gauge (ksp, "l2_size", "cache_size", "L2"); /* Operations */ - za_read_derive (ksp, "allocated","cache_operation", "allocated"); za_read_derive (ksp, "deleted", "cache_operation", "deleted"); +#if __FreeBSD__ + za_read_derive (ksp, "allocated","cache_operation", "allocated"); za_read_derive (ksp, "stolen", "cache_operation", "stolen"); +#endif /* Issue indicators */ - za_read_derive (ksp, "mutex_miss", "mutex_operation", "miss"); + za_read_derive (ksp, "mutex_miss", "mutex_operations", "miss"); za_read_derive (ksp, "hash_collisions", "hash_collisions", ""); /* Evictions */ @@ -165,8 +168,6 @@ static int za_read (void) static int za_init (void) /* {{{ */ { - ksp = NULL; - /* kstats chain already opened by update_kstat (using *kc), verify everything went fine. */ if (kc == NULL) {