summaryrefslogtreecommitdiffstats
path: root/src/H5Oshared.h
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2007-05-14 20:24:08 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2007-05-14 20:24:08 (GMT)
commit31ff357f3190a869147378a9a136510be2caafd7 (patch)
tree5220b17a8e4b6c434b799108719a1dc15d6c0326 /src/H5Oshared.h
parent1726061075e9adc99ac2286fb542438acc79c4ab (diff)
downloadhdf5-31ff357f3190a869147378a9a136510be2caafd7.zip
hdf5-31ff357f3190a869147378a9a136510be2caafd7.tar.gz
hdf5-31ff357f3190a869147378a9a136510be2caafd7.tar.bz2
[svn-r13753] Description:
Check in "unique, but sharable" optimization to ISOHM code, which allows object header messages that are only used in one object to remain in the sole user's header, but migrates messages that are used in more than one header into the ISOHM heap. Tested on: Mac OS X/32 10.4.9 (amazon) FreeBSD/32 6.2 (duty) Linux/32 2.6 (chicago) Linux/64 2.6 (chicago2)
Diffstat (limited to 'src/H5Oshared.h')
-rw-r--r--src/H5Oshared.h51
1 files changed, 26 insertions, 25 deletions
diff --git a/src/H5Oshared.h b/src/H5Oshared.h
index 268e605..27d2ac3 100644
--- a/src/H5Oshared.h
+++ b/src/H5Oshared.h
@@ -116,8 +116,11 @@ H5O_SHARED_ENCODE(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mes
#error "Need to define H5O_SHARED_ENCODE_REAL macro!"
#endif /* H5O_SHARED_ENCODE_REAL */
- /* Check for shared message */
- if(H5O_IS_SHARED(sh_mesg->flags) && !disable_shared) {
+ /* Sanity check */
+ HDassert(sh_mesg->type == H5O_SHARE_TYPE_UNSHARED || sh_mesg->msg_type_id == H5O_SHARED_TYPE->id);
+
+ /* Check for message stored elsewhere */
+ if(H5O_IS_STORED_SHARED(sh_mesg->type) && !disable_shared) {
/* Encode shared message into buffer */
if(H5O_shared_encode(f, p, sh_mesg) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "unable to encode shared message")
@@ -168,8 +171,8 @@ H5O_SHARED_SIZE(const H5F_t *f, hbool_t disable_shared, const void *_mesg)
#error "Need to define H5O_SHARED_SIZE_REAL macro!"
#endif /* H5O_SHARED_SIZE_REAL */
- /* Check for shared message */
- if(H5O_IS_SHARED(sh_mesg->flags) && !disable_shared) {
+ /* Check for message stored elsewhere */
+ if(H5O_IS_STORED_SHARED(sh_mesg->type) && !disable_shared) {
/* Retrieve encoded size of shared message */
if(0 == (ret_value = H5O_shared_size(f, sh_mesg)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, 0, "unable to retrieve encoded size of shared message")
@@ -204,9 +207,9 @@ done:
*-------------------------------------------------------------------------
*/
static H5_inline herr_t
-H5O_SHARED_DELETE(H5F_t *f, hid_t dxpl_id, const void *_mesg)
+H5O_SHARED_DELETE(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, void *_mesg)
{
- const H5O_shared_t *sh_mesg = (const H5O_shared_t *)_mesg; /* Pointer to shared message portion of actual message */
+ H5O_shared_t *sh_mesg = (H5O_shared_t *)_mesg; /* Pointer to shared message portion of actual message */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5O_SHARED_DELETE)
@@ -218,16 +221,16 @@ H5O_SHARED_DELETE(H5F_t *f, hid_t dxpl_id, const void *_mesg)
#error "Need to define H5O_SHARED_DELETE macro!"
#endif /* H5O_SHARED_DELETE */
- /* Check for shared message */
- if(H5O_IS_SHARED(sh_mesg->flags)) {
+ /* Check for message tracked elsewhere */
+ if(H5O_IS_TRACKED_SHARED(sh_mesg->type)) {
/* Decrement the reference count on the shared message/object */
- if(H5O_shared_delete(f, dxpl_id, sh_mesg, H5O_SHARED_TYPE) < 0)
+ if(H5O_shared_delete(f, dxpl_id, open_oh, H5O_SHARED_TYPE, sh_mesg) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTDEC, FAIL, "unable to decrement ref count for shared message")
} /* end if */
#ifdef H5O_SHARED_DELETE_REAL
else {
/* Decrement the reference count on the native message directly */
- if(H5O_SHARED_DELETE_REAL(f, dxpl_id, _mesg) < 0)
+ if(H5O_SHARED_DELETE_REAL(f, dxpl_id, open_oh, _mesg) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTDEC, FAIL, "unable to decrement ref count for native message")
} /* end else */
#endif /* H5O_SHARED_DELETE_REAL */
@@ -256,9 +259,9 @@ done:
*-------------------------------------------------------------------------
*/
static H5_inline herr_t
-H5O_SHARED_LINK(H5F_t *f, hid_t dxpl_id, const void *_mesg)
+H5O_SHARED_LINK(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, void *_mesg)
{
- const H5O_shared_t *sh_mesg = (const H5O_shared_t *)_mesg; /* Pointer to shared message portion of actual message */
+ H5O_shared_t *sh_mesg = (H5O_shared_t *)_mesg; /* Pointer to shared message portion of actual message */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5O_SHARED_LINK)
@@ -270,16 +273,16 @@ H5O_SHARED_LINK(H5F_t *f, hid_t dxpl_id, const void *_mesg)
#error "Need to define H5O_SHARED_LINK macro!"
#endif /* H5O_SHARED_LINK */
- /* Check for shared message */
- if(H5O_IS_SHARED(sh_mesg->flags)) {
+ /* Check for message tracked elsewhere */
+ if(H5O_IS_TRACKED_SHARED(sh_mesg->type)) {
/* Increment the reference count on the shared message/object */
- if(H5O_shared_link(f, dxpl_id, sh_mesg, H5O_SHARED_TYPE) < 0)
+ if(H5O_shared_link(f, dxpl_id, open_oh, H5O_SHARED_TYPE, sh_mesg) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINC, FAIL, "unable to increment ref count for shared message")
} /* end if */
#ifdef H5O_SHARED_LINK_REAL
else {
/* Increment the reference count on the native message directly */
- if(H5O_SHARED_LINK_REAL(f, dxpl_id, _mesg) < 0)
+ if(H5O_SHARED_LINK_REAL(f, dxpl_id, open_oh, _mesg) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINC, FAIL, "unable to increment ref count for native message")
} /* end else */
#endif /* H5O_SHARED_LINK_REAL */
@@ -307,9 +310,8 @@ done:
*-------------------------------------------------------------------------
*/
static H5_inline void *
-H5O_SHARED_COPY_FILE(H5F_t *file_src,
- void *_native_src, H5F_t *file_dst, hid_t dxpl_id, H5O_copy_t *cpy_info,
- void *udata)
+H5O_SHARED_COPY_FILE(H5F_t *file_src, void *_native_src, H5F_t *file_dst,
+ hbool_t *recompute_size, H5O_copy_t *cpy_info, void *udata, hid_t dxpl_id)
{
void *dst_mesg = NULL; /* Destination message */
void *ret_value; /* Return value */
@@ -325,7 +327,7 @@ H5O_SHARED_COPY_FILE(H5F_t *file_src,
#ifdef H5O_SHARED_COPY_FILE_REAL
/* Call native message's copy file callback to copy the message */
- if(NULL == (dst_mesg = H5O_SHARED_COPY_FILE_REAL(file_src, H5O_SHARED_TYPE, _native_src, file_dst, dxpl_id, cpy_info, udata)))
+ if(NULL == (dst_mesg = H5O_SHARED_COPY_FILE_REAL(file_src, H5O_SHARED_TYPE, _native_src, file_dst, recompute_size, cpy_info, udata, dxpl_id)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, NULL, "unable to copy native message to another file")
#else /* H5O_SHARED_COPY_FILE_REAL */
/* No copy file callback defined, just copy the message itself */
@@ -337,8 +339,8 @@ H5O_SHARED_COPY_FILE(H5F_t *file_src,
HDmemset(dst_mesg, 0, sizeof(H5O_shared_t));
/* Handle sharing destination message */
- if(H5O_shared_copy_file(file_src, file_dst, dxpl_id, H5O_SHARED_TYPE,
- _native_src, dst_mesg, cpy_info, udata) < 0)
+ if(H5O_shared_copy_file(file_src, file_dst, H5O_SHARED_TYPE,
+ _native_src, dst_mesg, recompute_size, cpy_info, udata, dxpl_id) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, NULL, "unable to determine if message should be shared")
/* Set return value */
@@ -389,8 +391,8 @@ H5O_SHARED_DEBUG(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE *stream,
#error "Need to define H5O_SHARED_DEBUG_REAL macro!"
#endif /* H5O_SHARED_DEBUG_REAL */
- /* Check for shared message */
- if(H5O_IS_SHARED(sh_mesg->flags)) {
+ /* Check for message stored elsewhere */
+ if(H5O_IS_STORED_SHARED(sh_mesg->type)) {
/* Print shared message information */
if(H5O_shared_debug(sh_mesg, stream, indent, fwidth) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to display shared message info")
@@ -400,7 +402,6 @@ H5O_SHARED_DEBUG(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE *stream,
if(H5O_SHARED_DEBUG_REAL(f, dxpl_id, _mesg, stream, indent, fwidth) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to display native message info")
-
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_SHARED_DEBUG() */