diff --git a/src/clib/pio.h b/src/clib/pio.h index 4fb6830e31c..d88a4b3f3f6 100644 --- a/src/clib/pio.h +++ b/src/clib/pio.h @@ -573,8 +573,7 @@ typedef struct file_desc_t /** PIO data type. */ int pio_type; - /** Pointer to the next file_desc_t in the list of open files. */ -// struct file_desc_t *next; + /* hash table entry */ UT_hash_handle hh; /** True if this task should participate in IO (only true for one diff --git a/src/clib/pio_lists.c b/src/clib/pio_lists.c index 8363b35a83d..3a8281dadde 100644 --- a/src/clib/pio_lists.c +++ b/src/clib/pio_lists.c @@ -96,7 +96,7 @@ int pio_get_file(int ncid, file_desc_t **cfile1) */ int pio_delete_file_from_list(int ncid) { - file_desc_t *cfile, *pfile = NULL; + file_desc_t *cfile = NULL; int ret; /* Find the file pointer. */ @@ -263,8 +263,10 @@ io_desc_t *pio_get_iodesc_from_id(int ioid) if (current_iodesc && current_iodesc->ioid == ioid) ciodesc = current_iodesc; else + { HASH_FIND_INT(pio_iodesc_list, &ioid, ciodesc); - + current_iodesc = ciodesc; + } return ciodesc; } @@ -283,6 +285,8 @@ int pio_delete_iodesc_from_list(int ioid) if(ciodesc) { HASH_DEL(pio_iodesc_list, ciodesc); + if (current_iodesc = ciodesc) + current_iodesc = pio_iodesc_list; free(ciodesc); return PIO_NOERR; }