summaryrefslogtreecommitdiffstats
path: root/collectors/diskspace.plugin/plugin_diskspace.c
diff options
context:
space:
mode:
authorCosta Tsaousis <costa@netdata.cloud>2022-06-01 20:01:52 +0300
committerGitHub <noreply@github.com>2022-06-01 20:01:52 +0300
commit7784a16cc7af8260bb8877873a60d7dc6d2c9e73 (patch)
tree28964e18f97bfee01977240981fb53333f95bc7e /collectors/diskspace.plugin/plugin_diskspace.c
parentc261a771cc0c93fe4e9fbb83e1be141406d314be (diff)
Dictionary with JudyHS and double linked list (#13032)
* dictionary internals isolation * more dictionary cleanups * added unit test * we should use DICT internally * disable cups in cmake * implement DICTIONARY with Judy arrays * operational JUDY implementation * JUDY cleanup * JUDY summary added * JudyHS implementation with double linked list * test negative searches too * optimize destruction * optimize set to insert first without lookup * updated stats * code cleanup; better organization; updated info * more code cleanup and commenting * more cleanup, renames and comments * fix rename * more cleanups * use Judy.h from system paths * added foreach traversal; added flag to add item in front; isolated locks to their own functions; destruction returns the number of bytes freed * more comments; flags are now 16-bit * completed unittesting * addressed comments and added reference counters maintainance * added unittest in main; tested removal of items in front, back and middle * added read/write walkthrough and foreach; allowed walkthrough and foreach in write mode to delete the current element (used by cups.plugin); referenced counters removed from the API * DICTFE.name should be const too * added API calls for exposing all statistics * dictionary flags as enum and reference counters as atomic operations * more comments; improved error handling at unit tests * added functions to allow unsafe access while traversing the dictionary with locks in place * check for libcups in cmake * added delete callback; implemented statsd with this dictionary * added missing dfe_done() * added alternative implementation with AVL * added documentation * added comments and warning about AVL * dictionary walktrhough on new code * simplified foreach; updated docs * updated docs * AVL is much faster without hashes * AVL should follow DBENGINE
Diffstat (limited to 'collectors/diskspace.plugin/plugin_diskspace.c')
-rw-r--r--collectors/diskspace.plugin/plugin_diskspace.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/collectors/diskspace.plugin/plugin_diskspace.c b/collectors/diskspace.plugin/plugin_diskspace.c
index 13806277c3..663bb82fce 100644
--- a/collectors/diskspace.plugin/plugin_diskspace.c
+++ b/collectors/diskspace.plugin/plugin_diskspace.c
@@ -52,7 +52,8 @@ static DICTIONARY *dict_mountpoints = NULL;
#define rrdset_obsolete_and_pointer_null(st) do { if(st) { rrdset_is_obsolete(st); (st) = NULL; } } while(st)
-int mount_point_cleanup(void *entry, void *data) {
+int mount_point_cleanup(const char *name, void *entry, void *data) {
+ (void)name;
(void)data;
struct mount_point_metadata *mp = (struct mount_point_metadata *)entry;
@@ -439,7 +440,7 @@ void *diskspace_main(void *ptr) {
if(dict_mountpoints) {
worker_is_busy(WORKER_JOB_CLEANUP);
- dictionary_get_all(dict_mountpoints, mount_point_cleanup, NULL);
+ dictionary_walkthrough_read(dict_mountpoints, mount_point_cleanup, NULL);
}
}