<html lang='en'>
<head>
<meta content='text/html; charset=utf-8' http-equiv='Content-Type'>
<title>
GitLab
</title>
</meta>
</head>
<style>
  img {
    max-width: 100%;
    height: auto;
  }
  p.details {
    font-style:italic;
    color:#777
  }
  .footer p {
    font-size:small;
    color:#777
  }
  pre.commit-message {
    white-space: pre-wrap;
  }
  .file-stats a {
    text-decoration: none;
  }
  .file-stats .new-file {
    color: #090;
  }
  .file-stats .deleted-file {
    color: #B00;
  }
</style>
<body>
<div class='content'>
<h3>Shane Snyder pushed to branch mmap-dev at <a href="https://xgitlab.cels.anl.gov/darshan/darshan">darshan / darshan</a></h3>
<h4>
Commits:
</h4>
<ul>
<li>
<strong><a href="https://xgitlab.cels.anl.gov/darshan/darshan/commit/d3fae7822c1a9a15546947a8f845498a512dcf86">d3fae782</a></strong>
<div>
<span>by Shane Snyder</span>
<i>at 2016-01-18T21:42:11Z</i>
</div>
<pre class='commit-message'>update how module & record registration

- modules now receive a memory buffer after successfully
registering with darshan-core. modules can request a specific
memory amount, but may not be honored depending on the configured
darshan memory limit
- split the previous register_record function into 2 parts:
    * lookup() -> lookup darshan_record_id corresp. to path name
    * register() -> register record_id & name with darshan-core
- register_record now returns true if the record added; false
otherwise (if module was out of memory or darshan is out of memory
for storing id->name mappings)</pre>
</li>
</ul>
<h4>4 changed files:</h4>
<ul>
<li class='file-stats'>
<a href='#diff-0'>
darshan-runtime/darshan-core.h
</a>
</li>
<li class='file-stats'>
<a href='#diff-1'>
darshan-runtime/darshan.h
</a>
</li>
<li class='file-stats'>
<a href='#diff-2'>
darshan-runtime/lib/darshan-core.c
</a>
</li>
<li class='file-stats'>
<a href='#diff-3'>
darshan-runtime/lib/darshan-posix.c
</a>
</li>
</ul>
<h4>Changes:</h4>
<li id='diff-0'>
<a href='https://xgitlab.cels.anl.gov/darshan/darshan/commit/d3fae7822c1a9a15546947a8f845498a512dcf86#diff-0'>
<strong>
darshan-runtime/darshan-core.h
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/darshan-runtime/darshan-core.h
</span><span style="color: #000000;background-color: #ddffdd">+++ b/darshan-runtime/darshan-core.h
</span><span style="color: #aaaaaa">@@ -55,14 +55,15 @@ struct darshan_core_runtime
</span>     struct darshan_core_record_ref *rec_hash;
     int rec_hash_cnt;
     struct darshan_core_module* mod_array[DARSHAN_MAX_MODS];
<span style="color: #000000;background-color: #ffdddd">-    char comp_buf[DARSHAN_COMP_BUF_SIZE]; /* TODO: why is this allocated statically? only used in shutdown */
</span><span style="color: #000000;background-color: #ddffdd">+    int mod_mem_used;
+    char comp_buf[DARSHAN_COMP_BUF_SIZE];
</span>     double wtime_offset;
 };
 
 struct darshan_core_module
 {
<span style="color: #000000;background-color: #ffdddd">-    darshan_module_id id;
</span>     struct darshan_module_funcs mod_funcs;
<span style="color: #000000;background-color: #ddffdd">+    int mem_avail;
</span> };
 
 struct darshan_core_record_ref
</code></pre>

<br>
</li>
<li id='diff-1'>
<a href='https://xgitlab.cels.anl.gov/darshan/darshan/commit/d3fae7822c1a9a15546947a8f845498a512dcf86#diff-1'>
<strong>
darshan-runtime/darshan.h
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/darshan-runtime/darshan.h
</span><span style="color: #000000;background-color: #ddffdd">+++ b/darshan-runtime/darshan.h
</span><span style="color: #aaaaaa">@@ -53,6 +53,9 @@
</span> 
 #endif
 
<span style="color: #000000;background-color: #ddffdd">+/* default number of records to attempt to store for each module */
+#define DARSHAN_DEF_MOD_REC_COUNT 1024
+
</span> /* module developers provide the following functions to darshan-core */
 struct darshan_module_funcs
 {
<span style="color: #aaaaaa">@@ -98,8 +101,8 @@ struct darshan_module_funcs
</span> void darshan_core_register_module(
     darshan_module_id mod_id,
     struct darshan_module_funcs *funcs,
<span style="color: #000000;background-color: #ddffdd">+    int *inout_mod_size,
</span>     void **mod_buf,
<span style="color: #000000;background-color: #ffdddd">-    int *mod_buf_size,
</span>     int *my_rank,
     int *sys_mem_alignment);
 
<span style="color: #aaaaaa">@@ -111,6 +114,15 @@ void darshan_core_register_module(
</span> void darshan_core_unregister_module(
     darshan_module_id mod_id);
 
<span style="color: #000000;background-color: #ddffdd">+/* darshan_core_lookup_record()
+ *
+ *
+ */
+void darshan_core_lookup_record(
+    void *name,
+    int name_len,
+    darshan_record_id *rec_id);
+
</span> /* darshan_core_register_record()
  *
  * Register the Darshan record given by 'name' with the darshan-core
<span style="color: #aaaaaa">@@ -125,13 +137,11 @@ void darshan_core_unregister_module(
</span>  * is an output pointer storing the file system alignment value for the
  * given record.
  */
-void darshan_core_register_record(
<span style="color: #000000;background-color: #ddffdd">+int darshan_core_register_record(
+    darshan_record_id rec_id,
</span>     void *name,
<span style="color: #000000;background-color: #ffdddd">-    int name_len,
-    int rec_size,
</span>     darshan_module_id mod_id,
<span style="color: #000000;background-color: #ffdddd">-    int printable_flag,
-    darshan_record_id *rec_id,
</span><span style="color: #000000;background-color: #ddffdd">+    int rec_size,
</span>     int *file_alignment);
 
 /* darshan_core_unregister_record()
</code></pre>

<br>
</li>
<li id='diff-2'>
<a href='https://xgitlab.cels.anl.gov/darshan/darshan/commit/d3fae7822c1a9a15546947a8f845498a512dcf86#diff-2'>
<strong>
darshan-runtime/lib/darshan-core.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/darshan-runtime/lib/darshan-core.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/darshan-runtime/lib/darshan-core.c
</span><span style="color: #aaaaaa">@@ -200,9 +200,8 @@ void darshan_core_initialize(int argc, char **argv)
</span>             sys_page_size = sysconf(_SC_PAGESIZE);
             assert(sys_page_size > 0);
 
<span style="color: #000000;background-color: #ffdddd">-            /* XXX: MMAP */
</span>             mmap_size = sizeof(struct darshan_header) + DARSHAN_JOB_RECORD_SIZE +
<span style="color: #000000;background-color: #ffdddd">-                DARSHAN_MOD_MEM_MAX;
</span><span style="color: #000000;background-color: #ddffdd">+                + DARSHAN_RECORD_BUF_SIZE + DARSHAN_MOD_MEM_MAX;
</span>             if(mmap_size % sys_page_size)
                 mmap_size = ((mmap_size / sys_page_size) + 1) * sys_page_size;
 
<span style="color: #aaaaaa">@@ -262,7 +261,6 @@ void darshan_core_initialize(int argc, char **argv)
</span>                 ((char *)init_core->log_exemnt_p + DARSHAN_EXE_LEN + 1);
             init_core->log_mod_p = (void *)
                 ((char *)init_core->log_rec_p + DARSHAN_RECORD_BUF_SIZE);
<span style="color: #000000;background-color: #ffdddd">-            /* XXX: MMAP */
</span> 
             /* set known header fields for the log file */
             strcpy(init_core->log_hdr_p->version_string, DARSHAN_LOG_VERSION);
<span style="color: #aaaaaa">@@ -1562,29 +1560,21 @@ static void darshan_core_cleanup(struct darshan_core_runtime* core)
</span> void darshan_core_register_module(
     darshan_module_id mod_id,
     struct darshan_module_funcs *funcs,
<span style="color: #000000;background-color: #ddffdd">+    int *inout_mod_size,
</span>     void **mod_buf,
<span style="color: #000000;background-color: #ffdddd">-    int *mod_buf_size,
</span>     int *my_rank,
     int *sys_mem_alignment)
 {
<span style="color: #000000;background-color: #ffdddd">-    int ret;
-    int tmpval;
</span>     struct darshan_core_module* mod;
<span style="color: #000000;background-color: #ffdddd">-    char *mod_mem_str = NULL;
</span><span style="color: #000000;background-color: #ddffdd">+    int mod_mem_req = *inout_mod_size;
+    int mod_mem_avail;
</span> 
<span style="color: #000000;background-color: #ffdddd">-    *mod_buf_size = 0;
</span>     *mod_buf = NULL;
<span style="color: #000000;background-color: #ddffdd">+    *inout_mod_size = 0;
</span> 
     if(!darshan_core || (mod_id >= DARSHAN_MAX_MODS))
         return;
 
<span style="color: #000000;background-color: #ffdddd">-    if(sys_mem_alignment)
-        *sys_mem_alignment = darshan_mem_alignment;
</span>-
<span style="color: #000000;background-color: #ffdddd">-    /* get the calling process's rank */
-    DARSHAN_MPI_CALL(PMPI_Comm_rank)(MPI_COMM_WORLD, my_rank);
</span>-
<span style="color: #000000;background-color: #ffdddd">-    /* see if this module is already registered */
</span>     DARSHAN_CORE_LOCK();
     if(darshan_core->mod_array[mod_id])
     {
<span style="color: #aaaaaa">@@ -1593,13 +1583,20 @@ void darshan_core_register_module(
</span>         return;
     }
 
<span style="color: #000000;background-color: #ffdddd">-    /* XXX MMAP: how do we assign size and address */
-    *mod_buf = darshan_core->log_mod_p;
-    *mod_buf_size = DARSHAN_MOD_MEM_MAX;
</span><span style="color: #000000;background-color: #ddffdd">+    /* assign a buffer from Darshan's contiguous module memory range for
+     * this module to use for storing record data
+     */
+    mod_mem_avail = DARSHAN_MOD_MEM_MAX - darshan_core->mod_mem_used;
+    if(mod_mem_avail >= mod_mem_req)
+        *inout_mod_size = mod_mem_req;
+    else
+        *inout_mod_size = mod_mem_avail;
+
+    *mod_buf = darshan_core->log_mod_p + darshan_core->mod_mem_used;
+    darshan_core->mod_mem_used += *inout_mod_size;
</span>     darshan_core->log_hdr_p->mod_map[mod_id].off =
<span style="color: #000000;background-color: #ffdddd">-        ((char *)darshan_core->log_mod_p - (char *)darshan_core->log_hdr_p);
</span><span style="color: #000000;background-color: #ddffdd">+        ((char *)*mod_buf - (char *)darshan_core->log_hdr_p);
</span> 
<span style="color: #000000;background-color: #ffdddd">-    /* this module has not been registered yet, allocate and initialize it */
</span>     mod = malloc(sizeof(*mod));
     if(!mod)
     {
<span style="color: #aaaaaa">@@ -1607,16 +1604,19 @@ void darshan_core_register_module(
</span>         return;
     }
     memset(mod, 0, sizeof(*mod));
<span style="color: #000000;background-color: #ffdddd">-    mod->id = mod_id;
</span>     mod->mod_funcs = *funcs;
<span style="color: #000000;background-color: #ddffdd">+    mod->mem_avail = *inout_mod_size;
</span> 
     /* register module with darshan */
     darshan_core->mod_array[mod_id] = mod;
-
<span style="color: #000000;background-color: #ffdddd">-    /* get the calling process's rank */
-    DARSHAN_MPI_CALL(PMPI_Comm_rank)(MPI_COMM_WORLD, my_rank);
</span>     DARSHAN_CORE_UNLOCK();
 
<span style="color: #000000;background-color: #ddffdd">+    /* set the memory alignment and calling process's rank, if desired */
+    if(sys_mem_alignment)
+        *sys_mem_alignment = darshan_mem_alignment;
+    if(my_rank)
+        DARSHAN_MPI_CALL(PMPI_Comm_rank)(MPI_COMM_WORLD, my_rank);
+
</span>     return;
 }
 
<span style="color: #aaaaaa">@@ -1645,60 +1645,78 @@ void darshan_core_unregister_module(
</span>     return;
 }
 
-/* TODO: maybe a return code to distinguish between id 0 and a failure */
-void darshan_core_register_record(
<span style="color: #000000;background-color: #ddffdd">+void darshan_core_lookup_record(
</span>     void *name,
     int name_len,
<span style="color: #000000;background-color: #ffdddd">-    int rec_size,
</span><span style="color: #000000;background-color: #ddffdd">+    darshan_record_id *rec_id)
+{
+    darshan_record_id tmp_rec_id;
+
+    /* TODO: how do we handle potentially non-ascii record names? */
+
+    /* hash the input name to get a unique id for this record */
+    tmp_rec_id = darshan_hash(name, name_len, 0);
+    *rec_id = tmp_rec_id;
+
+    return;
+}
+
+int darshan_core_register_record(
+    darshan_record_id rec_id,
+    void *name,
</span>     darshan_module_id mod_id,
<span style="color: #000000;background-color: #ffdddd">-    int printable_flag,
-    darshan_record_id *rec_id,
</span><span style="color: #000000;background-color: #ddffdd">+    int rec_size,
</span>     int *file_alignment)
 {
<span style="color: #000000;background-color: #ffdddd">-    darshan_record_id tmp_rec_id;
</span>     struct darshan_core_record_ref *ref;
-
<span style="color: #000000;background-color: #ffdddd">-    *rec_id = 0;
-    *file_alignment = 0;
</span><span style="color: #000000;background-color: #ddffdd">+    int mod_oom = 0;
</span> 
     if(!darshan_core)
<span style="color: #000000;background-color: #ffdddd">-        return;
</span><span style="color: #000000;background-color: #ddffdd">+        return 0;
</span> 
<span style="color: #000000;background-color: #ffdddd">-    /* TODO: what do you do with printable flag? */
-    /* TODO: what about partial flag? */
</span><span style="color: #000000;background-color: #ddffdd">+    DARSHAN_CORE_LOCK();
</span> 
<span style="color: #000000;background-color: #ffdddd">-    /* hash the input name to get a unique id for this record */
-    tmp_rec_id = darshan_hash(name, name_len, 0);
</span><span style="color: #000000;background-color: #ddffdd">+    /* check to see if this module has enough space to store a new record */
+    if(darshan_core->mod_array[mod_id]->mem_avail < rec_size)
+        mod_oom = 1;
</span> 
     /* check to see if we've already stored the id->name mapping for this record */
<span style="color: #000000;background-color: #ffdddd">-    DARSHAN_CORE_LOCK();
-    HASH_FIND(hlink, darshan_core->rec_hash, &tmp_rec_id, sizeof(darshan_record_id), ref);
</span><span style="color: #000000;background-color: #ddffdd">+    HASH_FIND(hlink, darshan_core->rec_hash, &rec_id, sizeof(darshan_record_id), ref);
+    if(!ref && !mod_oom)
+    {
+        /* no mapping already exists, but this module has memory available for
+         * storing the record being registered, so we create a new id->name
+         * mapping to correspond to the record
+         */
+        darshan_add_record_hashref(darshan_core, name, rec_id, &ref);
+    }
+
</span>     if(!ref)
     {
<span style="color: #000000;background-color: #ffdddd">-        /* record not found -- add it to the hash if this module has not already used
-         * all of its memory
</span><span style="color: #000000;background-color: #ddffdd">+        /* if there still is no mapping for this record, either the
+         * module is out of memory or there is no more memory available for
+         * id->name mappings. just back out and indicate the record was 
+         * not registered
</span>          */
<span style="color: #000000;background-color: #ffdddd">-        darshan_add_record_hashref(darshan_core, name, tmp_rec_id, &ref);
-        if(!ref)
-        {
-            /* just give up and return if adding this record failed */
-            DARSHAN_CORE_UNLOCK();
-            return;
-        }
</span><span style="color: #000000;background-color: #ddffdd">+        if(mod_oom)
+            DARSHAN_MOD_FLAG_SET(darshan_core->log_hdr_p->partial_flag, mod_id);
+
+        DARSHAN_CORE_UNLOCK();
+        return 0;
</span>     }
 
     if(!DARSHAN_MOD_FLAG_ISSET(ref->mod_flags, mod_id))
     {
         DARSHAN_MOD_FLAG_SET(ref->mod_flags, mod_id);
         darshan_core->log_hdr_p->mod_map[mod_id].len += rec_size;
<span style="color: #000000;background-color: #ddffdd">+        darshan_core->mod_array[mod_id]->mem_avail -= rec_size;
</span>     }
     DARSHAN_CORE_UNLOCK();
 
     if(file_alignment)
         darshan_block_size_from_path(name, file_alignment);
 
<span style="color: #000000;background-color: #ffdddd">-    *rec_id = tmp_rec_id;
-    return;
</span><span style="color: #000000;background-color: #ddffdd">+    return 1;
</span> }
 
 /* TODO: test */
</code></pre>

<br>
</li>
<li id='diff-3'>
<a href='https://xgitlab.cels.anl.gov/darshan/darshan/commit/d3fae7822c1a9a15546947a8f845498a512dcf86#diff-3'>
<strong>
darshan-runtime/lib/darshan-posix.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/darshan-runtime/lib/darshan-posix.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/darshan-runtime/lib/darshan-posix.c
</span><span style="color: #aaaaaa">@@ -173,7 +173,6 @@ struct posix_runtime
</span> {
     struct posix_file_runtime* file_runtime_array;
     struct darshan_posix_file* file_record_array;
<span style="color: #000000;background-color: #ffdddd">-    int file_array_size;
</span>     int file_array_ndx;
     struct posix_file_runtime* file_hash;
     struct posix_file_runtime_ref* fd_hash;
<span style="color: #aaaaaa">@@ -1625,22 +1624,26 @@ static void posix_runtime_initialize()
</span>     };
     void *psx_buf;
     int psx_buf_size;
<span style="color: #000000;background-color: #ddffdd">+    int file_array_size;
</span> 
     /* don't do anything if already initialized or instrumenation is disabled */
     if(posix_runtime || instrumentation_disabled)
         return;
 
<span style="color: #000000;background-color: #ddffdd">+    /* try and store the default number of records for this module */
+    psx_buf_size = DARSHAN_DEF_MOD_REC_COUNT * sizeof(struct darshan_posix_file);
+
</span>     /* register the posix module with darshan core */
     darshan_core_register_module(
         DARSHAN_POSIX_MOD,
         &posix_mod_fns,
<span style="color: #000000;background-color: #ffdddd">-        &psx_buf,
</span>         &psx_buf_size,
<span style="color: #000000;background-color: #ddffdd">+        &psx_buf,
</span>         &my_rank,
         &darshan_mem_alignment);
 
<span style="color: #000000;background-color: #ffdddd">-    /* return if no memory assigned by darshan-core */
-    if(psx_buf_size == 0)
</span><span style="color: #000000;background-color: #ddffdd">+    /* return if darshan-core does not provide enough module memory */
+    if(psx_buf_size < sizeof(struct darshan_posix_file))
</span>         return;
 
     posix_runtime = malloc(sizeof(*posix_runtime));
<span style="color: #aaaaaa">@@ -1650,22 +1653,26 @@ static void posix_runtime_initialize()
</span> 
     /* set maximum number of file records according to max memory limit */
     /* NOTE: maximum number of records is based on the size of a posix file record */
<span style="color: #000000;background-color: #ffdddd">-    posix_runtime->file_array_size = psx_buf_size / sizeof(struct darshan_posix_file);
</span><span style="color: #000000;background-color: #ddffdd">+    file_array_size = psx_buf_size / sizeof(struct darshan_posix_file);
</span>     posix_runtime->file_array_ndx = 0;
 
<span style="color: #000000;background-color: #ddffdd">+    /* store pointer to POSIX record buffer given by darshan-core */
+    posix_runtime->file_record_array = (struct darshan_posix_file *)psx_buf;
+
</span>     /* allocate array of runtime file records */
<span style="color: #000000;background-color: #ffdddd">-    posix_runtime->file_runtime_array = malloc(posix_runtime->file_array_size *
</span><span style="color: #000000;background-color: #ddffdd">+    posix_runtime->file_runtime_array = malloc(file_array_size *
</span>                                                sizeof(struct posix_file_runtime));
     if(!posix_runtime->file_runtime_array)
     {
<span style="color: #000000;background-color: #ffdddd">-        posix_runtime->file_array_size = 0;
</span><span style="color: #000000;background-color: #ddffdd">+        free(posix_runtime);
+        posix_runtime = NULL;
+        darshan_core_unregister_module(DARSHAN_POSIX_MOD);
</span>         return;
     }
<span style="color: #000000;background-color: #ffdddd">-    memset(posix_runtime->file_runtime_array, 0, posix_runtime->file_array_size *
</span><span style="color: #000000;background-color: #ddffdd">+    memset(posix_runtime->file_runtime_array, 0, file_array_size *
</span>            sizeof(struct posix_file_runtime));
-
<span style="color: #000000;background-color: #ffdddd">-    /* store pointer to POSIX record buffer given by darshan-core */
-    posix_runtime->file_record_array = (struct darshan_posix_file *)psx_buf;
</span><span style="color: #000000;background-color: #ddffdd">+    memset(posix_runtime->file_record_array, 0, file_array_size *
+           sizeof(struct darshan_posix_file));
</span> 
     return;
 }
<span style="color: #aaaaaa">@@ -1674,9 +1681,11 @@ static void posix_runtime_initialize()
</span> static struct posix_file_runtime* posix_file_by_name(const char *name)
 {
     struct posix_file_runtime *file = NULL;
<span style="color: #000000;background-color: #ddffdd">+    struct darshan_posix_file *file_rec;
</span>     char *newname = NULL;
     darshan_record_id file_id;
     int file_alignment;
<span style="color: #000000;background-color: #ddffdd">+    int ret;
</span> 
     if(!posix_runtime || instrumentation_disabled)
         return(NULL);
<span style="color: #aaaaaa">@@ -1685,50 +1694,39 @@ static struct posix_file_runtime* posix_file_by_name(const char *name)
</span>     if(!newname)
         newname = (char*)name;
 
<span style="color: #000000;background-color: #ffdddd">-    /* get a unique id for this file from darshan core */
-    darshan_core_register_record(
</span><span style="color: #000000;background-color: #ddffdd">+    /* lookup the unique id for this file */
+    darshan_core_lookup_record(
</span>         (void*)newname,
         strlen(newname),
<span style="color: #000000;background-color: #ffdddd">-        sizeof(struct darshan_posix_file),
-        DARSHAN_POSIX_MOD,
-        1,
-        &file_id,
-        &file_alignment);
</span>-
<span style="color: #000000;background-color: #ffdddd">-    /* the file record id is set to 0 if no memory is available for tracking
-     * new records -- just fall through and ignore this record
-     */
-    if(file_id == 0)
-    {
-        if(newname != name)
-            free(newname);
-        return(NULL);
-    }
</span><span style="color: #000000;background-color: #ddffdd">+        &file_id);
</span> 
     /* search the hash table for this file record, and return if found */
     HASH_FIND(hlink, posix_runtime->file_hash, &file_id, sizeof(darshan_record_id), file);
<span style="color: #000000;background-color: #ffdddd">-    if(file)
</span><span style="color: #000000;background-color: #ddffdd">+    if(!file)
</span>     {
<span style="color: #000000;background-color: #ffdddd">-        if(newname != name)
-            free(newname);
-        return(file);
</span><span style="color: #000000;background-color: #ddffdd">+        /* register the record with the darshan core component */
+        ret = darshan_core_register_record(file_id, (void *)newname, DARSHAN_POSIX_MOD,
+            sizeof(struct darshan_posix_file), &file_alignment);
+        if(ret == 1)
+        {
+            /* register was successful */
+            file = &(posix_runtime->file_runtime_array[posix_runtime->file_array_ndx]);
+            file->file_record = 
+                &(posix_runtime->file_record_array[posix_runtime->file_array_ndx]);
+            file_rec = file->file_record;
+
+            file_rec->base_rec.id = file_id;
+            file_rec->base_rec.rank = my_rank;
+            file_rec->counters[POSIX_MEM_ALIGNMENT] = darshan_mem_alignment;
+            file_rec->counters[POSIX_FILE_ALIGNMENT] = file_alignment;
+
+            /* add new record to file hash table */
+            HASH_ADD(hlink, posix_runtime->file_hash, file_record->base_rec.id,
+                sizeof(darshan_record_id), file);
+            posix_runtime->file_array_ndx++;
+        }
</span>     }
 
<span style="color: #000000;background-color: #ffdddd">-    /* TODO: what happens when there are no more records? */
</span>-
<span style="color: #000000;background-color: #ffdddd">-    /* no existing record, assign a new file record from the global array */
-    file = &(posix_runtime->file_runtime_array[posix_runtime->file_array_ndx]);
-    file->file_record = &(posix_runtime->file_record_array[posix_runtime->file_array_ndx]);
-    file->file_record->base_rec.id = file_id;
-    file->file_record->base_rec.rank = my_rank;
-    file->file_record->counters[POSIX_MEM_ALIGNMENT] = darshan_mem_alignment;
-    file->file_record->counters[POSIX_FILE_ALIGNMENT] = file_alignment;
</span>-
<span style="color: #000000;background-color: #ffdddd">-    /* add new record to file hash table */
-    HASH_ADD(hlink, posix_runtime->file_hash, file_record->base_rec.id,
-        sizeof(darshan_record_id), file);
-    posix_runtime->file_array_ndx++;
</span>-
     if(newname != name)
         free(newname);
     return(file);
<span style="color: #aaaaaa">@@ -2364,7 +2362,6 @@ static void posix_shutdown()
</span>     HASH_CLEAR(hlink, posix_runtime->file_hash); /* these entries are freed all at once below */
 
     free(posix_runtime->file_runtime_array);
<span style="color: #000000;background-color: #ffdddd">-    /* XXX: MMAP free(posix_runtime->file_record_array); */
</span>     free(posix_runtime);
     posix_runtime = NULL;
 
</code></pre>

<br>
</li>

</div>
<div class='footer' style='margin-top: 10px;'>
<p>

<br>
<a href="https://xgitlab.cels.anl.gov/darshan/darshan/commit/d3fae7822c1a9a15546947a8f845498a512dcf86">View it on GitLab</a>
<script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","action":{"@type":"ViewAction","name":"View Commit","url":"https://xgitlab.cels.anl.gov/darshan/darshan/commit/d3fae7822c1a9a15546947a8f845498a512dcf86"}}</script>
</p>
</div>
</body>
</html>