| 1 |
/* |
| 2 |
* Copyright (C) by Argonne National Laboratory |
| 3 |
* See COPYRIGHT in top-level directory |
| 4 |
*/ |
| 5 |
|
| 6 |
#include "ad_daos.h" |
| 7 |
|
| 8 |
void ADIOI_DAOS_Close(ADIO_File fd, int *error_code) |
| 9 |
{ |
| 10 |
int rank; |
| 11 |
struct ADIO_DAOS_cont *cont = (struct ADIO_DAOS_cont *) fd->fs_ptr; |
| 12 |
static char myname[] = "ADIOI_DAOS_CLOSE"; |
| 13 |
int rc; |
| 14 |
|
| 15 |
MPI_Barrier(fd->comm); |
| 16 |
MPI_Comm_rank(fd->comm, &rank); |
| 17 |
|
| 18 |
/* release the dfs object handle for the file. */ |
| 19 |
rc = dfs_release(cont->obj); |
| 20 |
if (rc != 0) { |
| 21 |
*error_code = ADIOI_DAOS_err(myname, cont->obj_name, __LINE__, rc); |
| 22 |
return; |
| 23 |
} |
| 24 |
|
| 25 |
/* decrement ref count on the container and pool in the hashtable. */ |
| 26 |
adio_daos_coh_release(cont->c); |
| 27 |
cont->c = NULL; |
| 28 |
adio_daos_poh_release(cont->p); |
| 29 |
cont->p = NULL; |
| 30 |
|
| 31 |
if (rank == 0) { |
| 32 |
ADIOI_Free(cont->obj_name); |
| 33 |
ADIOI_Free(cont->cont_name); |
| 34 |
} |
| 35 |
#if CHECK_DAOS_API_VERSION(1, 3) |
| 36 |
duns_destroy_attr(&cont->attr); |
| 37 |
#else |
| 38 |
if (cont->attr.da_rel_path) { |
| 39 |
MPL_direct_free(cont->attr.da_rel_path); |
| 40 |
cont->attr.da_rel_path = NULL; |
| 41 |
} |
| 42 |
#endif |
| 43 |
|
| 44 |
ADIOI_Free(fd->fs_ptr); |
| 45 |
fd->fs_ptr = NULL; |
| 46 |
|
| 47 |
*error_code = MPI_SUCCESS; |
| 48 |
} |