diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/H5B2.c | 32 | ||||
-rw-r--r-- | src/H5B2private.h | 1 | ||||
-rw-r--r-- | src/H5Dbtree2.c | 12 | ||||
-rw-r--r-- | src/H5Dearray.c | 12 | ||||
-rw-r--r-- | src/H5Dfarray.c | 12 | ||||
-rw-r--r-- | src/H5Dio.c | 6 | ||||
-rw-r--r-- | src/H5EA.c | 33 | ||||
-rw-r--r-- | src/H5EAprivate.h | 1 | ||||
-rw-r--r-- | src/H5FA.c | 33 | ||||
-rw-r--r-- | src/H5FAprivate.h | 1 | ||||
-rw-r--r-- | src/H5T.c | 29 |
11 files changed, 163 insertions, 9 deletions
@@ -1538,3 +1538,35 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5B2_depend() */ +/*------------------------------------------------------------------------- + * Function: H5B2_patch_file + * + * Purpose: Patch the top-level file pointer contained in bt2 + * to point to idx_info->f if they are different. + * This is possible because the file pointer in bt2 can be + * closed out if bt2 remains open. + * + * Return: SUCCEED + * + *------------------------------------------------------------------------- + */ +herr_t +H5B2_patch_file(H5B2_t *bt2, H5F_t *f) +{ + FUNC_ENTER_NOAPI_NOINIT_NOERR + +#ifdef QAK +HDfprintf(stderr, "%s: Called\n", FUNC); +#endif /* QAK */ + + /* + * Check arguments. + */ + HDassert(bt2); + HDassert(f); + + if(bt2->f != f || bt2->hdr->f != f) + bt2->f = bt2->hdr->f = f; + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* H5B2_patch_file() */ diff --git a/src/H5B2private.h b/src/H5B2private.h index cc60c9b..dbc5d47 100644 --- a/src/H5B2private.h +++ b/src/H5B2private.h @@ -159,6 +159,7 @@ H5_DLL htri_t H5B2_support(H5B2_t *bt2, hid_t dxpl_id, void *udata, H5_DLL herr_t H5B2_unsupport(H5B2_t *bt2, hid_t dxpl_id, void *udata, H5AC_info_t *child); H5_DLL herr_t H5B2_depend(H5AC_info_t *parent_entry, H5B2_t *bt2); +H5_DLL herr_t H5B2_patch_file(H5B2_t *fa, H5F_t *f); /* Statistics routines */ H5_DLL herr_t H5B2_stat_info(H5B2_t *bt2, H5B2_stat_t *info); diff --git a/src/H5Dbtree2.c b/src/H5Dbtree2.c index f286db2..8d005fd 100644 --- a/src/H5Dbtree2.c +++ b/src/H5Dbtree2.c @@ -1014,10 +1014,12 @@ H5D__bt2_idx_insert(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata, HDassert(H5F_addr_defined(udata->chunk_block.offset)); /* Check if the v2 B-tree is open yet */ - if(NULL == idx_info->storage->u.btree2.bt2) + if(NULL == idx_info->storage->u.btree2.bt2) { /* Open existing v2 B-tree */ if(H5D__bt2_idx_open(idx_info) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open v2 B-tree") + } else /* Patch the top level file pointer contained in bt2 if needed */ + H5B2_patch_file(idx_info->storage->u.btree2.bt2, idx_info->f); /* Set convenience pointer to v2 B-tree structure */ bt2 = idx_info->storage->u.btree2.bt2; @@ -1114,10 +1116,12 @@ H5D__bt2_idx_get_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata) HDassert(udata); /* Check if the v2 B-tree is open yet */ - if(NULL == idx_info->storage->u.btree2.bt2) + if(NULL == idx_info->storage->u.btree2.bt2) { /* Open existing v2 B-tree */ if(H5D__bt2_idx_open(idx_info) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open v2 B-tree") + } else /* Patch the top level file pointer contained in bt2 if needed */ + H5B2_patch_file(idx_info->storage->u.btree2.bt2, idx_info->f); /* Set convenience pointer to v2 B-tree structure */ bt2 = idx_info->storage->u.btree2.bt2; @@ -1233,10 +1237,12 @@ H5D__bt2_idx_iterate(const H5D_chk_idx_info_t *idx_info, HDassert(chunk_udata); /* Check if the v2 B-tree is open yet */ - if(NULL == idx_info->storage->u.btree2.bt2) + if(NULL == idx_info->storage->u.btree2.bt2) { /* Open existing v2 B-tree */ if(H5D__bt2_idx_open(idx_info) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open v2 B-tree") + } else /* Patch the top level file pointer contained in bt2 if needed */ + H5B2_patch_file(idx_info->storage->u.btree2.bt2, idx_info->f); /* Set convenience pointer to v2 B-tree structure */ bt2 = idx_info->storage->u.btree2.bt2; diff --git a/src/H5Dearray.c b/src/H5Dearray.c index 84c26bf..3896172 100644 --- a/src/H5Dearray.c +++ b/src/H5Dearray.c @@ -1038,10 +1038,12 @@ H5D__earray_idx_insert(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata HDassert(udata); /* Check if the extensible array is open yet */ - if(NULL == idx_info->storage->u.earray.ea) + if(NULL == idx_info->storage->u.earray.ea) { /* Open the extensible array in file */ if(H5D__earray_idx_open(idx_info) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open extensible array") + } else /* Patch the top level file pointer contained in ea if needed */ + H5EA_patch_file(idx_info->storage->u.earray.ea, idx_info->f); /* Set convenience pointer to extensible array structure */ ea = idx_info->storage->u.earray.ea; @@ -1107,10 +1109,12 @@ H5D__earray_idx_get_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *uda HDassert(udata); /* Check if the extensible array is open yet */ - if(NULL == idx_info->storage->u.earray.ea) + if(NULL == idx_info->storage->u.earray.ea) { /* Open the extensible array in file */ if(H5D__earray_idx_open(idx_info) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open extensible array") + } else /* Patch the top level file pointer contained in ea if needed */ + H5EA_patch_file(idx_info->storage->u.earray.ea, idx_info->f); /* Set convenience pointer to extensible array structure */ ea = idx_info->storage->u.earray.ea; @@ -1309,10 +1313,12 @@ H5D__earray_idx_iterate(const H5D_chk_idx_info_t *idx_info, HDassert(chunk_udata); /* Check if the extensible array is open yet */ - if(NULL == idx_info->storage->u.earray.ea) + if(NULL == idx_info->storage->u.earray.ea) { /* Open the extensible array in file */ if(H5D__earray_idx_open(idx_info) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open extensible array") + } else /* Patch the top level file pointer contained in ea if needed */ + H5EA_patch_file(idx_info->storage->u.earray.ea, idx_info->f); /* Set convenience pointer to extensible array structure */ ea = idx_info->storage->u.earray.ea; diff --git a/src/H5Dfarray.c b/src/H5Dfarray.c index 2958a66..e5541c7 100644 --- a/src/H5Dfarray.c +++ b/src/H5Dfarray.c @@ -989,10 +989,12 @@ H5D__farray_idx_insert(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata HDassert(udata); /* Check if the fixed array is open yet */ - if(NULL == idx_info->storage->u.farray.fa) + if(NULL == idx_info->storage->u.farray.fa) { /* Open the fixed array in file */ if(H5D__farray_idx_open(idx_info) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open fixed array") + } else /* Patch the top level file pointer contained in fa if needed */ + H5FA_patch_file(idx_info->storage->u.farray.fa, idx_info->f); /* Set convenience pointer to fixed array structure */ fa = idx_info->storage->u.farray.fa; @@ -1058,10 +1060,12 @@ H5D__farray_idx_get_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *uda HDassert(udata); /* Check if the fixed array is open yet */ - if(NULL == idx_info->storage->u.farray.fa) + if(NULL == idx_info->storage->u.farray.fa) { /* Open the fixed array in file */ if(H5D__farray_idx_open(idx_info) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open fixed array") + } else /* Patch the top level file pointer contained in fa if needed */ + H5FA_patch_file(idx_info->storage->u.farray.fa, idx_info->f); /* Set convenience pointer to fixed array structure */ fa = idx_info->storage->u.farray.fa; @@ -1196,10 +1200,12 @@ H5D__farray_idx_iterate(const H5D_chk_idx_info_t *idx_info, HDassert(chunk_udata); /* Check if the fixed array is open yet */ - if(NULL == idx_info->storage->u.farray.fa) + if(NULL == idx_info->storage->u.farray.fa) { /* Open the fixed array in file */ if(H5D__farray_idx_open(idx_info) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open fixed array") + } else /* Patch the top level file pointer contained in fa if needed */ + H5FA_patch_file(idx_info->storage->u.farray.fa, idx_info->f); /* Set convenience pointer to fixed array structure */ fa = idx_info->storage->u.farray.fa; diff --git a/src/H5Dio.c b/src/H5Dio.c index c0aa83e..ac5c82b 100644 --- a/src/H5Dio.c +++ b/src/H5Dio.c @@ -412,6 +412,9 @@ H5D__read(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space, if(H5D__get_dxpl_cache(dxpl_id, &dxpl_cache) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't fill dxpl cache") + /* Patch the top level file pointer for dt->shared->u.vlen.f if needed */ + H5T_patch_vlen_file(dataset->shared->type, dataset->oloc.file); + /* Set up datatype info for operation */ if(H5D__typeinfo_init(dataset, dxpl_cache, dxpl_id, mem_type_id, FALSE, &type_info) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to set up type info") @@ -632,6 +635,9 @@ H5D__write(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space, if(H5D__get_dxpl_cache(dxpl_id, &dxpl_cache) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't fill dxpl cache") + /* Patch the top level file pointer for dt->shared->u.vlen.f if needed */ + H5T_patch_vlen_file(dataset->shared->type, dataset->oloc.file); + /* Set up datatype info for operation */ if(H5D__typeinfo_init(dataset, dxpl_cache, dxpl_id, mem_type_id, TRUE, &type_info) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to set up type info") @@ -1115,3 +1115,36 @@ CATCH elmt = H5FL_BLK_FREE(ea_native_elmt, elmt); END_FUNC(PRIV) /* end H5EA_iterate() */ + +/*------------------------------------------------------------------------- + * Function: H5EA_patch_file + * + * Purpose: Patch the top-level file pointer contained in ea + * to point to idx_info->f if they are different. + * This is possible because the file pointer in ea can be + * closed out if ea remains open. + * + * Return: SUCCEED + * + *------------------------------------------------------------------------- + */ +BEGIN_FUNC(PRIV, NOERR, +herr_t, SUCCEED, -, +H5EA_patch_file(H5EA_t *ea, H5F_t *f)) + + /* Local variables */ + +#ifdef H5EA_DEBUG +HDfprintf(stderr, "%s: Called\n", FUNC); +#endif /* H5EA_DEBUG */ + + /* + * Check arguments. + */ + HDassert(ea); + HDassert(f); + + if(ea->f != f || ea->hdr->f != f) + ea->f = ea->hdr->f = f; + +END_FUNC(PRIV) /* end H5EA_patch_file() */ diff --git a/src/H5EAprivate.h b/src/H5EAprivate.h index c00e118..78bcca8 100644 --- a/src/H5EAprivate.h +++ b/src/H5EAprivate.h @@ -146,6 +146,7 @@ H5_DLL herr_t H5EA_depend(H5AC_info_t *parent_entry, H5EA_t *ea); H5_DLL herr_t H5EA_iterate(H5EA_t *fa, hid_t dxpl_id, H5EA_operator_t op, void *udata); H5_DLL herr_t H5EA_close(H5EA_t *ea, hid_t dxpl_id); H5_DLL herr_t H5EA_delete(H5F_t *f, hid_t dxpl_id, haddr_t ea_addr, void *ctx_udata); +H5_DLL herr_t H5EA_patch_file(H5EA_t *fa, H5F_t *f); /* Statistics routines */ H5_DLL herr_t H5EA_get_stats(const H5EA_t *ea, H5EA_stat_t *stats); @@ -850,3 +850,36 @@ HDfprintf(stderr, "%s: Called\n", FUNC); CATCH END_FUNC(PRIV) /* end H5FA_undepend() */ + +/*------------------------------------------------------------------------- + * Function: H5FA_patch_file + * + * Purpose: Patch the top-level file pointer contained in fa + * to point to idx_info->f if they are different. + * This is possible because the file pointer in fa can be + * closed out if fa remains open. + * + * Return: SUCCEED + * + *------------------------------------------------------------------------- + */ +BEGIN_FUNC(PRIV, NOERR, +herr_t, SUCCEED, -, +H5FA_patch_file(H5FA_t *fa, H5F_t *f)) + + /* Local variables */ + +#ifdef H5FA_DEBUG +HDfprintf(stderr, "%s: Called\n", FUNC); +#endif /* H5FA_DEBUG */ + + /* + * Check arguments. + */ + HDassert(fa); + HDassert(f); + + if(fa->f != f || fa->hdr->f != f) + fa->f = fa->hdr->f = f; + +END_FUNC(PRIV) /* end H5FA_patch_file() */ diff --git a/src/H5FAprivate.h b/src/H5FAprivate.h index b7c141a..2ce9cbb 100644 --- a/src/H5FAprivate.h +++ b/src/H5FAprivate.h @@ -131,6 +131,7 @@ H5_DLL herr_t H5FA_depend(H5AC_info_t *parent_entry, H5FA_t *fa); H5_DLL herr_t H5FA_iterate(H5FA_t *fa, hid_t dxpl_id, H5FA_operator_t op, void *udata); H5_DLL herr_t H5FA_close(H5FA_t *fa, hid_t dxpl_id); H5_DLL herr_t H5FA_delete(H5F_t *f, hid_t dxpl_id, haddr_t fa_addr, void *ctx_udata); +H5_DLL herr_t H5FA_patch_file(H5FA_t *fa, H5F_t *f); /* Statistics routines */ H5_DLL herr_t H5FA_get_stats(const H5FA_t *ea, H5FA_stat_t *stats); @@ -5466,6 +5466,35 @@ done: /*------------------------------------------------------------------------- + * Function: H5T_patch_vlen_file + * + * Purpose: Patch the top-level file pointer contained in (dt->shared->u.vlen.f) + * to point to f. This is possible because + * the top-level file pointer can be closed out from under + * dt while dt is contained in the shared file's cache. + * + * Return: SUCCEED + * + *------------------------------------------------------------------------- + */ +herr_t +H5T_patch_vlen_file(H5T_t *dt, H5F_t *f) +{ + FUNC_ENTER_NOAPI_NOINIT_NOERR + + /* Sanity check */ + HDassert(dt); + HDassert(dt->shared); + HDassert(f); + + if((dt->shared->type == H5T_VLEN) && dt->shared->u.vlen.f != f) + dt->shared->u.vlen.f = f; + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5T_patch_vlen_file() */ + + +/*------------------------------------------------------------------------- * Function: H5Tflush * * Purpose: Flushes all buffers associated with a named datatype to disk. |