summaryrefslogtreecommitdiffstats
path: root/collectors/proc.plugin/sys_block_zram.c
diff options
context:
space:
mode:
Diffstat (limited to 'collectors/proc.plugin/sys_block_zram.c')
-rw-r--r--collectors/proc.plugin/sys_block_zram.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/collectors/proc.plugin/sys_block_zram.c b/collectors/proc.plugin/sys_block_zram.c
index 170c7206..3a39b3b6 100644
--- a/collectors/proc.plugin/sys_block_zram.c
+++ b/collectors/proc.plugin/sys_block_zram.c
@@ -165,7 +165,7 @@ static int init_devices(DICTIONARY *devices, unsigned int zram_id, int update_ev
return count;
}
-static void free_device(DICTIONARY *dict, char *name)
+static void free_device(DICTIONARY *dict, const char *name)
{
ZRAM_DEVICE *d = (ZRAM_DEVICE*)dictionary_get(dict, name);
info("ZRAM : Disabling monitoring of device %s", name);
@@ -173,7 +173,7 @@ static void free_device(DICTIONARY *dict, char *name)
rrdset_obsolete_and_pointer_null(d->st_savings);
rrdset_obsolete_and_pointer_null(d->st_alloc_efficiency);
rrdset_obsolete_and_pointer_null(d->st_comp_ratio);
- dictionary_del(dict, name);
+ dictionary_del_having_write_lock(dict, name);
}
// --------------------------------------------------------------------
@@ -200,7 +200,7 @@ static inline int read_mm_stat(procfile *ff, MM_STAT *stats) {
return 0;
}
-static inline int _collect_zram_metrics(char* name, ZRAM_DEVICE *d, int advance, DICTIONARY* dict) {
+static inline int _collect_zram_metrics(const char* name, ZRAM_DEVICE *d, int advance, DICTIONARY* dict) {
MM_STAT mm;
int value;
if (unlikely(read_mm_stat(d->file, &mm) < 0))
@@ -235,12 +235,12 @@ static inline int _collect_zram_metrics(char* name, ZRAM_DEVICE *d, int advance,
return 0;
}
-static int collect_first_zram_metrics(char *name, void *entry, void *data) {
+static int collect_first_zram_metrics(const char *name, void *entry, void *data) {
// collect without calling rrdset_next (init only)
return _collect_zram_metrics(name, (ZRAM_DEVICE *)entry, 0, (DICTIONARY *)data);
}
-static int collect_zram_metrics(char *name, void *entry, void *data) {
+static int collect_zram_metrics(const char *name, void *entry, void *data) {
(void)name;
// collect with calling rrdset_next
return _collect_zram_metrics(name, (ZRAM_DEVICE *)entry, 1, (DICTIONARY *)data);
@@ -280,13 +280,13 @@ int do_sys_block_zram(int update_every, usec_t dt) {
device_count = init_devices(devices, (unsigned int)zram_id, update_every);
if (device_count < 1)
return 1;
- dictionary_get_all_name_value(devices, collect_first_zram_metrics, devices);
+ dictionary_walkthrough_write(devices, collect_first_zram_metrics, devices);
}
else
{
if (unlikely(device_count < 1))
return 1;
- dictionary_get_all_name_value(devices, collect_zram_metrics, devices);
+ dictionary_walkthrough_write(devices, collect_zram_metrics, devices);
}
return 0;
} \ No newline at end of file