]> arthur.barton.de Git - netdata.git/commitdiff
disable mountinfo statvfs() calls for modules that do not need this info
authorCosta Tsaousis (ktsaou) <costa@tsaousis.gr>
Sat, 14 Jan 2017 14:15:27 +0000 (16:15 +0200)
committerCosta Tsaousis (ktsaou) <costa@tsaousis.gr>
Sat, 14 Jan 2017 14:15:27 +0000 (16:15 +0200)
src/plugin_proc_diskspace.c
src/proc_diskstats.c
src/proc_self_mountinfo.c
src/proc_self_mountinfo.h
src/sys_fs_cgroup.c

index 14168962fcf923c4248c2f624508ce820f474e22..8ca5dd256edc05db1f17c3fa6a8b8561a12d312c 100644 (file)
@@ -14,7 +14,7 @@ static inline void mountinfo_reload(int force) {
         mountinfo_free(disk_mountinfo_root);
 
         // re-read mountinfo in case something changed
-        disk_mountinfo_root = mountinfo_read();
+        disk_mountinfo_root = mountinfo_read(1);
 
         last_loaded = now;
     }
index ff036eb400effa1dc264aa160691a84fc6bdde64..fc9d46c004cda416bb57e501809cac4be48af5d8 100644 (file)
@@ -41,7 +41,7 @@ static inline void mountinfo_reload(int force) {
         mountinfo_free(disk_mountinfo_root);
 
         // re-read mountinfo in case something changed
-        disk_mountinfo_root = mountinfo_read();
+        disk_mountinfo_root = mountinfo_read(0);
 
         last_loaded = now;
     }
index 7c1d315585cffa87fa4aa07849e8591500da3b2f..08d5abce117dff3e3b9ac0932a03391342315a9d 100644 (file)
@@ -173,7 +173,7 @@ static inline int is_read_only(const char *s) {
 }
 
 // read the whole mountinfo into a linked list
-struct mountinfo *mountinfo_read() {
+struct mountinfo *mountinfo_read(int do_statvfs) {
     char filename[FILENAME_MAX + 1];
     snprintfz(filename, FILENAME_MAX, "%s/proc/self/mountinfo", global_host_prefix);
     procfile *ff = procfile_open(filename, " \t", PROCFILE_FLAG_DEFAULT);
@@ -316,7 +316,7 @@ struct mountinfo *mountinfo_read() {
         }
 
         // check if it has size
-        {
+        if(do_statvfs) {
             struct statvfs buff_statvfs;
             if(unlikely(statvfs(mi->mount_point, &buff_statvfs) < 0)) {
                 mi->flags |= MOUNTINFO_NO_STAT;
index 53f4456498f4340994af1e6e1e55f6be8e9aa50a..00cf699abc39698dde5bf059f616baeba428019f 100644 (file)
@@ -50,6 +50,6 @@ extern struct mountinfo *mountinfo_find_by_filesystem_mount_source(struct mounti
 extern struct mountinfo *mountinfo_find_by_filesystem_super_option(struct mountinfo *root, const char *filesystem, const char *super_options);
 
 extern void mountinfo_free(struct mountinfo *mi);
-extern struct mountinfo *mountinfo_read();
+extern struct mountinfo *mountinfo_read(int do_statvfs);
 
 #endif /* NETDATA_PROC_SELF_MOUNTINFO_H */
\ No newline at end of file
index 98e5d5272a184ba99210b3ac9230403177d1c967..2274c3f3cefceda30386872189ca662418747af0 100644 (file)
@@ -28,7 +28,7 @@ void read_cgroup_plugin_configuration() {
     cgroup_enable_blkio = config_get_boolean_ondemand("plugin:cgroups", "enable blkio", cgroup_enable_blkio);
 
     char filename[FILENAME_MAX + 1], *s;
-    struct mountinfo *mi, *root = mountinfo_read();
+    struct mountinfo *mi, *root = mountinfo_read(0);
 
     mi = mountinfo_find_by_filesystem_super_option(root, "cgroup", "cpuacct");
     if(!mi) mi = mountinfo_find_by_filesystem_mount_source(root, "cgroup", "cpuacct");