disable mountinfo statvfs() calls for modules that do not need this info
Costa Tsaousis (ktsaou) committed
Jan 14, 2017 at 16:15 UTC
d8824718f0b21e1d8b94d39c2f14434d872d1a9c
5 files changed
+6
-6
src/plugin_proc_diskspace.c
+1
-1
@@ -14,7 +14,7 @@ static inline void mountinfo_reload(int force) {
14
mountinfo_free(disk_mountinfo_root);
15
16
// re-read mountinfo in case something changed
17
- disk_mountinfo_root = mountinfo_read();
17
+ disk_mountinfo_root = mountinfo_read(1);
18
19
last_loaded = now;
20
}
src/proc_diskstats.c
+1
-1
@@ -41,7 +41,7 @@ static inline void mountinfo_reload(int force) {
41
mountinfo_free(disk_mountinfo_root);
42
43
// re-read mountinfo in case something changed
44
- disk_mountinfo_root = mountinfo_read();
44
+ disk_mountinfo_root = mountinfo_read(0);
45
46
last_loaded = now;
47
}
src/proc_self_mountinfo.c
+2
-2
@@ -173,7 +173,7 @@ static inline int is_read_only(const char *s) {
173
}
174
175
// read the whole mountinfo into a linked list
176
-struct mountinfo *mountinfo_read() {
176
+struct mountinfo *mountinfo_read(int do_statvfs) {
177
char filename[FILENAME_MAX + 1];
178
snprintfz(filename, FILENAME_MAX, "%s/proc/self/mountinfo", global_host_prefix);
179
procfile *ff = procfile_open(filename, " \t", PROCFILE_FLAG_DEFAULT);
@@ -316,7 +316,7 @@ struct mountinfo *mountinfo_read() {
316
}
317
318
// check if it has size
319
- {
319
+ if(do_statvfs) {
320
struct statvfs buff_statvfs;
321
if(unlikely(statvfs(mi->mount_point, &buff_statvfs) < 0)) {
322
mi->flags |= MOUNTINFO_NO_STAT;
src/proc_self_mountinfo.h
+1
-1
@@ -50,6 +50,6 @@ extern struct mountinfo *mountinfo_find_by_filesystem_mount_source(struct mounti
50
extern struct mountinfo *mountinfo_find_by_filesystem_super_option(struct mountinfo *root, const char *filesystem, const char *super_options);
51
52
extern void mountinfo_free(struct mountinfo *mi);
53
-extern struct mountinfo *mountinfo_read();
53
+extern struct mountinfo *mountinfo_read(int do_statvfs);
54
55
#endif /* NETDATA_PROC_SELF_MOUNTINFO_H */
\ No newline at end of file
src/sys_fs_cgroup.c
+1
-1
@@ -28,7 +28,7 @@ void read_cgroup_plugin_configuration() {
28
cgroup_enable_blkio = config_get_boolean_ondemand("plugin:cgroups", "enable blkio", cgroup_enable_blkio);
29
30
char filename[FILENAME_MAX + 1], *s;
31
- struct mountinfo *mi, *root = mountinfo_read();
31
+ struct mountinfo *mi, *root = mountinfo_read(0);
32
33
mi = mountinfo_find_by_filesystem_super_option(root, "cgroup", "cpuacct");
34
if(!mi) mi = mountinfo_find_by_filesystem_mount_source(root, "cgroup", "cpuacct");