diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2007-03-08 20:10:12 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2007-03-08 20:10:12 (GMT) |
commit | 74a30fff3e0fcd8919ced487abd03eefd27d57c1 (patch) | |
tree | 2df0a0d2cfc51cce067f25e503e6dfd26c8e827d /src/H5Omessage.c | |
parent | 25bb6f5dd8af42d2facaab26f0cdeb7fc76456ae (diff) | |
download | hdf5-74a30fff3e0fcd8919ced487abd03eefd27d57c1.zip hdf5-74a30fff3e0fcd8919ced487abd03eefd27d57c1.tar.gz hdf5-74a30fff3e0fcd8919ced487abd03eefd27d57c1.tar.bz2 |
[svn-r13477] Description:
The main purpose of this checkin was to eliminate the
space used for tracking creation time indices when there is no way they
can be used (i.e. attributes can't be shared in the file and the user hasn't
turned on attribute creation tracking), however there were some other minor
changes which crept in:
- Fix a cache locking deadlock when a shared attribute and one of its
components end up in the same fractal heap direct block.
(This is fixed the "slow" way for right now, until John has time
to add support for readers/writer locking to the cache.
- Optimize attribute copying when a copy will be kept during a v2 B-tree
search.
- When freeing a block on disk, attempt to merge it with the metadata
and "small data" aggregators.
Tested on:
Mac OS X/32 10.4.8 (amazon)
FreeBSD/32 6.2 (duty)
Diffstat (limited to 'src/H5Omessage.c')
-rw-r--r-- | src/H5Omessage.c | 80 |
1 files changed, 73 insertions, 7 deletions
diff --git a/src/H5Omessage.c b/src/H5Omessage.c index cccf8b8..bf0d0b0 100644 --- a/src/H5Omessage.c +++ b/src/H5Omessage.c @@ -37,6 +37,7 @@ #include "H5Aprivate.h" /* Attributes */ #include "H5Eprivate.h" /* Error handling */ #include "H5Fprivate.h" /* File access */ +#include "H5Iprivate.h" /* IDs */ #include "H5MMprivate.h" /* Memory management */ #include "H5Opkg.h" /* Object headers */ #include "H5SMprivate.h" /* Shared object header messages */ @@ -1327,7 +1328,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5O_msg_mesg_size + * Function: H5O_msg_size_f * * Purpose: Calculate the final size of an encoded message in an object * header. @@ -1344,12 +1345,15 @@ done: *------------------------------------------------------------------------- */ size_t -H5O_msg_mesg_size(const H5F_t *f, unsigned type_id, const void *mesg, size_t extra_raw) +H5O_msg_size_f(const H5F_t *f, hid_t ocpl_id, unsigned type_id, + const void *mesg, size_t extra_raw) { - const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ - size_t ret_value; /* Return value */ + const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ + H5P_genplist_t *ocpl; /* Object Creation Property list */ + uint8_t oh_flags; /* Object header status flags */ + size_t ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5O_msg_mesg_size, 0) + FUNC_ENTER_NOAPI(H5O_msg_size_f, 0) /* Check args */ HDassert(type_id < NELMTS(H5O_msg_class_g)); @@ -1359,6 +1363,15 @@ H5O_msg_mesg_size(const H5F_t *f, unsigned type_id, const void *mesg, size_t ext HDassert(f); HDassert(mesg); + /* Get the property list */ + if(NULL == (ocpl = H5I_object(ocpl_id))) + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, 0, "not a property list") + + /* Get any object header status flags set by properties */ + if(H5P_get(ocpl, H5O_CRT_OHDR_FLAGS_NAME, &oh_flags) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, 0, "can't get object header flags") + + /* Compute the raw data size for the mesg */ if((ret_value = (type->raw_size)(f, FALSE, mesg)) == 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTCOUNT, 0, "unable to determine size of message") @@ -1370,11 +1383,64 @@ H5O_msg_mesg_size(const H5F_t *f, unsigned type_id, const void *mesg, size_t ext ret_value = H5O_ALIGN_F(f, ret_value); /* Add space for message header */ - ret_value += H5O_SIZEOF_MSGHDR_F(f); + ret_value += H5O_SIZEOF_MSGHDR_F(f, + (H5F_STORE_MSG_CRT_IDX(f) || oh_flags & H5O_HDR_ATTR_CRT_ORDER_TRACKED)); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5O_msg_size_f() */ + + +/*------------------------------------------------------------------------- + * Function: H5O_msg_size_oh + * + * Purpose: Calculate the final size of an encoded message in an object + * header. + * + * Note: This routine assumes that the message is already used in + * an object header. + * + * Return: Size of message on success, 0 on failure + * + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Mar 7 2007 + * + *------------------------------------------------------------------------- + */ +size_t +H5O_msg_size_oh(const H5F_t *f, const H5O_t *oh, unsigned type_id, + const void *mesg, size_t extra_raw) +{ + const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ + size_t ret_value; /* Return value */ + + FUNC_ENTER_NOAPI(H5O_msg_size_oh, 0) + + /* Check args */ + HDassert(type_id < NELMTS(H5O_msg_class_g)); + type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */ + HDassert(type); + HDassert(type->raw_size); + HDassert(f); + HDassert(mesg); + + /* Compute the raw data size for the mesg */ + if((ret_value = (type->raw_size)(f, FALSE, mesg)) == 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTCOUNT, 0, "unable to determine size of message") + + /* Add in "extra" raw space */ + ret_value += extra_raw; + + /* Adjust size for alignment, if necessary */ + ret_value = H5O_ALIGN_OH(oh, ret_value); + + /* Add space for message header */ + ret_value += H5O_SIZEOF_MSGHDR_OH(oh); done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_msg_mesg_size() */ +} /* end H5O_msg_size_oh() */ /*------------------------------------------------------------------------- |