diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2015-06-18 00:58:49 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2015-06-18 00:58:49 (GMT) |
commit | f30ab55f41296667eab0b273132ffc20c4323717 (patch) | |
tree | 2fd6a85b7c15e3505e308e21b41e67297cc58508 /src/H5HFdblock.c | |
parent | 6e9e9e0dd200979642de8d2a2bce2f66f9728237 (diff) | |
download | hdf5-f30ab55f41296667eab0b273132ffc20c4323717.zip hdf5-f30ab55f41296667eab0b273132ffc20c4323717.tar.gz hdf5-f30ab55f41296667eab0b273132ffc20c4323717.tar.bz2 |
[svn-r27237] Description:
Merge v3 metadata cache changes to trunk. Yay! :-)
Tested on:
MacOSX/64 10.10.3 (amazon) w/serial & parallel
Linux/32 2.6.x (jam) w/serial & parallel
(daily tested on branch)
Diffstat (limited to 'src/H5HFdblock.c')
-rw-r--r-- | src/H5HFdblock.c | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/src/H5HFdblock.c b/src/H5HFdblock.c index 9a8da4a..5dd5b0c 100644 --- a/src/H5HFdblock.c +++ b/src/H5HFdblock.c @@ -149,6 +149,9 @@ H5HF_man_dblock_create(hid_t dxpl_id, H5HF_hdr_t *hdr, H5HF_indirect_t *par_iblo HDmemset(dblock->blk, 0, dblock->size); #endif /* H5_CLEAR_MEMORY */ + dblock->write_buf = NULL; + dblock->write_size = 0; + /* Allocate [temporary] space for the direct block on disk */ if(H5F_USE_TMP_SPACE(hdr->f)) { if(HADDR_UNDEF == (dblock_addr = H5MF_alloc_tmp(hdr->f, (hsize_t)dblock->size))) @@ -308,9 +311,13 @@ H5HF_man_dblock_destroy(H5HF_hdr_t *hdr, hid_t dxpl_id, H5HF_direct_t *dblock, } /* end if */ } /* end else */ - /* Indicate that the indirect block should be deleted & file space freed */ + /* Indicate that the indirect block should be deleted */ dblock->file_size = dblock_size; - cache_flags |= H5AC__DIRTIED_FLAG | H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG; + cache_flags |= H5AC__DIRTIED_FLAG | H5AC__DELETED_FLAG; + + /* If the dblock is in real file space, also tell the cache to free its file space */ + if (!H5F_IS_TMP_ADDR(hdr->f, dblock_addr)) + cache_flags |= H5AC__FREE_FILE_SPACE_FLAG; done: /* Unprotect the indirect block, with appropriate flags */ @@ -436,7 +443,7 @@ done: H5HF_direct_t * H5HF_man_dblock_protect(H5HF_hdr_t *hdr, hid_t dxpl_id, haddr_t dblock_addr, size_t dblock_size, H5HF_indirect_t *par_iblock, unsigned par_entry, - H5AC_protect_t rw) + unsigned flags) { H5HF_direct_t *dblock; /* Direct block from cache */ H5HF_dblock_cache_ud_t udata; /* parent and other infor for deserializing direct block */ @@ -451,6 +458,9 @@ H5HF_man_dblock_protect(H5HF_hdr_t *hdr, hid_t dxpl_id, haddr_t dblock_addr, HDassert(H5F_addr_defined(dblock_addr)); HDassert(dblock_size > 0); + /* only H5AC__READ_ONLY_FLAG may appear in flags */ + HDassert((flags & (~H5AC__READ_ONLY_FLAG)) == 0); + /* Set up parent info */ udata.par_info.hdr = hdr; udata.par_info.iblock = par_iblock; @@ -485,7 +495,7 @@ H5HF_man_dblock_protect(H5HF_hdr_t *hdr, hid_t dxpl_id, haddr_t dblock_addr, } /* end else */ /* Protect the direct block */ - if(NULL == (dblock = (H5HF_direct_t *)H5AC_protect(hdr->f, dxpl_id, H5AC_FHEAP_DBLOCK, dblock_addr, &udata, rw))) + if(NULL == (dblock = (H5HF_direct_t *)H5AC_protect(hdr->f, dxpl_id, H5AC_FHEAP_DBLOCK, dblock_addr, &udata, flags))) HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, NULL, "unable to protect fractal heap direct block") /* Set the return value */ @@ -512,7 +522,7 @@ done: herr_t H5HF_man_dblock_locate(H5HF_hdr_t *hdr, hid_t dxpl_id, hsize_t obj_off, H5HF_indirect_t **ret_iblock, unsigned *ret_entry, hbool_t *ret_did_protect, - H5AC_protect_t rw) + unsigned flags) { haddr_t iblock_addr; /* Indirect block's address */ H5HF_indirect_t *iblock; /* Pointer to indirect block */ @@ -531,6 +541,9 @@ H5HF_man_dblock_locate(H5HF_hdr_t *hdr, hid_t dxpl_id, hsize_t obj_off, HDassert(ret_iblock); HDassert(ret_did_protect); + /* only H5AC__READ_ONLY_FLAG may appear in flags */ + HDassert((flags & (~H5AC__READ_ONLY_FLAG)) == 0); + /* Look up row & column for object */ if(H5HF_dtable_lookup(&hdr->man_dtable, obj_off, &row, &col) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTCOMPUTE, FAIL, "can't compute row & column of object") @@ -539,7 +552,7 @@ H5HF_man_dblock_locate(H5HF_hdr_t *hdr, hid_t dxpl_id, hsize_t obj_off, iblock_addr = hdr->man_dtable.table_addr; /* Lock root indirect block */ - if(NULL == (iblock = H5HF_man_iblock_protect(hdr, dxpl_id, iblock_addr, hdr->man_dtable.curr_root_rows, NULL, 0, FALSE, rw, &did_protect))) + if(NULL == (iblock = H5HF_man_iblock_protect(hdr, dxpl_id, iblock_addr, hdr->man_dtable.curr_root_rows, NULL, 0, FALSE, flags, &did_protect))) HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap indirect block") /* Check for indirect block row */ @@ -569,7 +582,7 @@ H5HF_man_dblock_locate(H5HF_hdr_t *hdr, hid_t dxpl_id, hsize_t obj_off, } /* end if */ /* Lock child indirect block */ - if(NULL == (new_iblock = H5HF_man_iblock_protect(hdr, dxpl_id, iblock_addr, nrows, iblock, entry, FALSE, rw, &new_did_protect))) + if(NULL == (new_iblock = H5HF_man_iblock_protect(hdr, dxpl_id, iblock_addr, nrows, iblock, entry, FALSE, flags, &new_did_protect))) HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap indirect block") /* Release the current indirect block */ |