[Darshan-commits] [Git][darshan/darshan][master] prevent duplicate mount point entries

Shane Snyder xgitlab at cels.anl.gov
Tue Sep 20 22:58:21 CDT 2016


Shane Snyder pushed to branch master at darshan / darshan


Commits:
5bf35a7a by Shane Snyder at 2016-09-20T20:57:31-07:00
prevent duplicate mount point entries

- - - - -


1 changed file:

- darshan-runtime/lib/darshan-core.c


Changes:

=====================================
darshan-runtime/lib/darshan-core.c
=====================================
--- a/darshan-runtime/lib/darshan-core.c
+++ b/darshan-runtime/lib/darshan-core.c
@@ -932,10 +932,21 @@ static int mnt_data_cmp(const void* a, const void* b)
 /* adds an entry to table of mounted file systems */
 static void add_entry(char* buf, int* space_left, struct mntent* entry)
 {
+    int i;
     int ret;
     char tmp_mnt[256];
     struct statfs statfsbuf;
 
+    /* avoid adding the same mount points multiple times -- to limit
+     * storage space and potential statfs, ioctl, etc calls
+     */
+    for(i = 0; i < mnt_data_count; i++)
+    {
+        if((strncmp(mnt_data_array[i].path, entry->mnt_dir, DARSHAN_MAX_MNT_PATH) == 0) &&
+           (strncmp(mnt_data_array[i].type, entry->mnt_type, DARSHAN_MAX_MNT_PATH) == 0))
+            return;
+    }
+
     strncpy(mnt_data_array[mnt_data_count].path, entry->mnt_dir,
         DARSHAN_MAX_MNT_PATH-1);
     strncpy(mnt_data_array[mnt_data_count].type, entry->mnt_type,



View it on GitLab: https://xgitlab.cels.anl.gov/darshan/darshan/commit/5bf35a7ab8c91037acb29f1b22e1adcdfd2ba03f
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/darshan-commits/attachments/20160920/b2fd148c/attachment-0001.html>


More information about the Darshan-commits mailing list