summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVailin Choi <vchoi@hdfgroup.org>2011-10-05 15:52:12 (GMT)
committerVailin Choi <vchoi@hdfgroup.org>2011-10-05 15:52:12 (GMT)
commit3f4b1f3b7402a83eade18efebaf8f6d0ee0c94a1 (patch)
tree82d811c89f78bf8de9d3a6222ca915e90bd191e8
parent817bfb6499f266113fa8146b980e065a133b1374 (diff)
downloadhdf5-3f4b1f3b7402a83eade18efebaf8f6d0ee0c94a1.zip
hdf5-3f4b1f3b7402a83eade18efebaf8f6d0ee0c94a1.tar.gz
hdf5-3f4b1f3b7402a83eade18efebaf8f6d0ee0c94a1.tar.bz2
[svn-r21476] The first part fix for bug HDFFV-7640: does not need to do H5O_move_msgs_forward() when writing attributes. h5committested.
Tests are checked into the performance suite.
-rw-r--r--src/H5Aint.c2
-rw-r--r--src/H5Oattribute.c24
-rw-r--r--src/H5Omessage.c14
-rw-r--r--src/H5Oprivate.h8
-rwxr-xr-xsrc/H5SM.c4
-rw-r--r--src/H5SMmessage.c4
6 files changed, 34 insertions, 22 deletions
diff --git a/src/H5Aint.c b/src/H5Aint.c
index 4e610e4..db9508e 100644
--- a/src/H5Aint.c
+++ b/src/H5Aint.c
@@ -138,7 +138,7 @@ H5FL_SEQ_DEFINE(H5A_t_ptr);
*/
static herr_t
H5A_compact_build_table_cb(H5O_t UNUSED *oh, H5O_mesg_t *mesg/*in,out*/,
- unsigned sequence, hbool_t UNUSED *oh_modified, void *_udata/*in,out*/)
+ unsigned sequence, unsigned UNUSED *oh_modified, void *_udata/*in,out*/)
{
H5A_compact_bt_ud_t *udata = (H5A_compact_bt_ud_t *)_udata; /* Operator user data */
herr_t ret_value = H5_ITER_CONT; /* Return value */
diff --git a/src/H5Oattribute.c b/src/H5Oattribute.c
index cafc664..82d832b 100644
--- a/src/H5Oattribute.c
+++ b/src/H5Oattribute.c
@@ -173,7 +173,7 @@ static htri_t H5O_attr_find_opened_attr(const H5O_loc_t *loc, H5A_t **attr,
*/
static herr_t
H5O_attr_to_dense_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
- unsigned UNUSED sequence, hbool_t *oh_modified, void *_udata/*in,out*/)
+ unsigned UNUSED sequence, unsigned *oh_modified, void *_udata/*in,out*/)
{
H5O_iter_cvt_t *udata = (H5O_iter_cvt_t *)_udata; /* Operator user data */
H5A_t *attr = (H5A_t *)mesg->native; /* Pointer to attribute to insert */
@@ -199,7 +199,7 @@ H5O_attr_to_dense_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, H5_ITER_ERROR, "unable to convert into null message")
/* Indicate that the object header was modified */
- *oh_modified = TRUE;
+ *oh_modified = H5O_MODIFY_CONDENSE;
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -419,7 +419,7 @@ done:
*/
static herr_t
H5O_attr_open_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, unsigned sequence,
- hbool_t UNUSED *oh_modified, void *_udata/*in,out*/)
+ unsigned UNUSED *oh_modified, void *_udata/*in,out*/)
{
H5O_iter_opn_t *udata = (H5O_iter_opn_t *)_udata; /* Operator user data */
herr_t ret_value = H5_ITER_CONT; /* Return value */
@@ -846,7 +846,7 @@ done:
*/
static herr_t
H5O_attr_write_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
- unsigned UNUSED sequence, hbool_t *oh_modified, void *_udata/*in,out*/)
+ unsigned UNUSED sequence, unsigned *oh_modified, void *_udata/*in,out*/)
{
H5O_iter_wrt_t *udata = (H5O_iter_wrt_t *)_udata; /* Operator user data */
H5O_chunk_proxy_t *chk_proxy = NULL; /* Chunk that message is in */
@@ -895,7 +895,7 @@ H5O_attr_write_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, H5_ITER_ERROR, "unable to update attribute in shared storage")
/* Indicate that the object header was modified */
- *oh_modified = TRUE;
+ *oh_modified = H5O_MODIFY;
/* Indicate that the attribute was found */
udata->found = TRUE;
@@ -1005,7 +1005,7 @@ done:
*/
static herr_t
H5O_attr_rename_chk_cb(H5O_t UNUSED *oh, H5O_mesg_t *mesg/*in,out*/,
- unsigned UNUSED sequence, hbool_t UNUSED *oh_modified, void *_udata/*in,out*/)
+ unsigned UNUSED sequence, unsigned UNUSED *oh_modified, void *_udata/*in,out*/)
{
H5O_iter_ren_t *udata = (H5O_iter_ren_t *)_udata; /* Operator user data */
herr_t ret_value = H5_ITER_CONT; /* Return value */
@@ -1051,7 +1051,7 @@ H5O_attr_rename_chk_cb(H5O_t UNUSED *oh, H5O_mesg_t *mesg/*in,out*/,
*/
static herr_t
H5O_attr_rename_mod_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
- unsigned UNUSED sequence, hbool_t *oh_modified, void *_udata/*in,out*/)
+ unsigned UNUSED sequence, unsigned *oh_modified, void *_udata/*in,out*/)
{
H5O_iter_ren_t *udata = (H5O_iter_ren_t *)_udata; /* Operator user data */
H5O_chunk_proxy_t *chk_proxy = NULL; /* Chunk that message is in */
@@ -1125,6 +1125,8 @@ H5O_attr_rename_mod_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
if(H5O_release_mesg(udata->f, udata->dxpl_id, oh, mesg, FALSE) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, H5_ITER_ERROR, "unable to release previous attribute")
+ *oh_modified = H5O_MODIFY_CONDENSE;
+
/* Append renamed attribute to object header */
/* (Don't let it become shared) */
if(H5O_msg_append_real(udata->f, udata->dxpl_id, oh, H5O_MSG_ATTR, (mesg->flags | H5O_MSG_FLAG_DONTSHARE), 0, attr) < 0)
@@ -1139,7 +1141,7 @@ H5O_attr_rename_mod_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
} /* end else */
/* Indicate that the object header was modified */
- *oh_modified = TRUE;
+ *oh_modified |= H5O_MODIFY;
/* Indicate that we found an existing attribute with the old name */
udata->found = TRUE;
@@ -1511,7 +1513,7 @@ done:
*/
static herr_t
H5O_attr_remove_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
- unsigned UNUSED sequence, hbool_t *oh_modified, void *_udata/*in,out*/)
+ unsigned UNUSED sequence, unsigned *oh_modified, void *_udata/*in,out*/)
{
H5O_iter_rm_t *udata = (H5O_iter_rm_t *)_udata; /* Operator user data */
herr_t ret_value = H5_ITER_CONT; /* Return value */
@@ -1530,7 +1532,7 @@ H5O_attr_remove_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, H5_ITER_ERROR, "unable to convert into null message")
/* Indicate that the object header was modified */
- *oh_modified = TRUE;
+ *oh_modified = H5O_MODIFY_CONDENSE;
/* Indicate that this message is the attribute to be deleted */
udata->found = TRUE;
@@ -1790,7 +1792,7 @@ done:
*/
static herr_t
H5O_attr_exists_cb(H5O_t UNUSED *oh, H5O_mesg_t *mesg/*in,out*/,
- unsigned UNUSED sequence, hbool_t UNUSED *oh_modified, void *_udata/*in,out*/)
+ unsigned UNUSED sequence, unsigned UNUSED *oh_modified, void *_udata/*in,out*/)
{
H5O_iter_rm_t *udata = (H5O_iter_rm_t *)_udata; /* Operator user data */
herr_t ret_value = H5_ITER_CONT; /* Return value */
diff --git a/src/H5Omessage.c b/src/H5Omessage.c
index 0dd4565..c03bf0a 100644
--- a/src/H5Omessage.c
+++ b/src/H5Omessage.c
@@ -75,7 +75,7 @@ typedef struct {
static herr_t H5O_msg_reset_real(const H5O_msg_class_t *type, void *native);
static herr_t H5O_msg_remove_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
- unsigned sequence, hbool_t *oh_modified, void *_udata/*in,out*/);
+ unsigned sequence, unsigned *oh_modified, void *_udata/*in,out*/);
static herr_t H5O_copy_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned idx,
const H5O_msg_class_t *type, const void *mesg, unsigned mesg_flags,
unsigned update_flags);
@@ -1063,7 +1063,7 @@ done:
*/
static herr_t
H5O_msg_remove_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, unsigned sequence,
- hbool_t *oh_modified, void *_udata/*in,out*/)
+ unsigned *oh_modified, void *_udata/*in,out*/)
{
H5O_iter_rm_t *udata = (H5O_iter_rm_t *)_udata; /* Operator user data */
htri_t try_remove = FALSE; /* Whether to try removing a message */
@@ -1098,7 +1098,7 @@ H5O_msg_remove_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, unsigned sequence,
HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, H5_ITER_ERROR, "unable to release message")
/* Indicate that the object header was modified */
- *oh_modified = TRUE;
+ *oh_modified = H5O_MODIFY_CONDENSE;
/* Break out now, if we've found the correct message */
if(udata->sequence == H5O_FIRST || udata->sequence != H5O_ALL)
@@ -1275,7 +1275,7 @@ H5O_msg_iterate_real(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *type,
H5O_mesg_t *idx_msg; /* Pointer to current message */
unsigned idx; /* Absolute index of current message in all messages */
unsigned sequence; /* Relative index of current message for messages of type */
- hbool_t oh_modified = FALSE; /* Whether the callback modified the object header */
+ unsigned oh_modified = 0; /* Whether the callback modified the object header */
herr_t ret_value = H5_ITER_CONT; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5O_msg_iterate_real)
@@ -1320,8 +1320,10 @@ done:
* object header, the header will be condensed after each
* message removal)
*/
- if(H5O_condense_header(f, oh, dxpl_id) < 0)
- HDONE_ERROR(H5E_OHDR, H5E_CANTPACK, FAIL, "can't pack object header")
+ if(oh_modified & H5O_MODIFY_CONDENSE) {
+ if(H5O_condense_header(f, oh, dxpl_id) < 0)
+ HDONE_ERROR(H5E_OHDR, H5E_CANTPACK, FAIL, "can't pack object header")
+ }
/* Mark object header as changed */
if(H5O_touch_oh(f, dxpl_id, oh, FALSE) < 0)
diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h
index 56901f3..7727a30 100644
--- a/src/H5Oprivate.h
+++ b/src/H5Oprivate.h
@@ -592,9 +592,14 @@ typedef struct H5O_fsinfo_t {
typedef herr_t (*H5O_operator_t)(const void *mesg/*in*/, unsigned idx,
void *operator_data/*in,out*/);
+#ifdef OUT
/* Typedef for "internal library" iteration operations */
typedef herr_t (*H5O_lib_operator_t)(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
unsigned sequence, hbool_t *oh_modified/*out*/, void *operator_data/*in,out*/);
+#endif
+/* Typedef for "internal library" iteration operations */
+typedef herr_t (*H5O_lib_operator_t)(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
+ unsigned sequence, unsigned *oh_modified/*out*/, void *operator_data/*in,out*/);
/* Some syntactic sugar to make the compiler happy with two different kinds of iterator callbacks */
typedef enum H5O_mesg_operator_type_t {
@@ -602,6 +607,9 @@ typedef enum H5O_mesg_operator_type_t {
H5O_MESG_OP_LIB /* Library internal callback */
} H5O_mesg_operator_type_t;
+#define H5O_MODIFY_CONDENSE 0x01
+#define H5O_MODIFY 0x02
+
typedef struct {
H5O_mesg_operator_type_t op_type;
union {
diff --git a/src/H5SM.c b/src/H5SM.c
index e5d2765..3928ab5 100755
--- a/src/H5SM.c
+++ b/src/H5SM.c
@@ -73,7 +73,7 @@ static herr_t H5SM_delete_from_index(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
unsigned *cache_flags, void ** /*out*/ encoded_mesg);
static herr_t H5SM_type_to_flag(unsigned type_id, unsigned *type_flag);
static herr_t H5SM_read_iter_op(H5O_t *oh, H5O_mesg_t *mesg, unsigned sequence,
- hbool_t *oh_modified, void *_udata);
+ unsigned *oh_modified, void *_udata);
static herr_t H5SM_read_mesg_fh_cb(const void *obj, size_t obj_len, void *_udata);
static herr_t H5SM_read_mesg(H5F_t *f, const H5SM_sohm_t *mesg, H5HF_t *fheap,
H5O_t * open_oh, hid_t dxpl_id, size_t *encoding_size /*out*/,
@@ -2158,7 +2158,7 @@ done:
*/
static herr_t
H5SM_read_iter_op(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, unsigned sequence,
- hbool_t UNUSED *oh_modified, void *_udata/*in,out*/)
+ unsigned UNUSED *oh_modified, void *_udata/*in,out*/)
{
H5SM_read_udata_t *udata = (H5SM_read_udata_t *) _udata;
herr_t ret_value = H5_ITER_CONT;
diff --git a/src/H5SMmessage.c b/src/H5SMmessage.c
index 0d41a09..237e247 100644
--- a/src/H5SMmessage.c
+++ b/src/H5SMmessage.c
@@ -52,7 +52,7 @@ typedef struct H5SM_compare_udata_t {
/********************/
static herr_t H5SM_compare_cb(const void *obj, size_t obj_len, void *udata);
static herr_t H5SM_compare_iter_op(H5O_t *oh, H5O_mesg_t *mesg, unsigned sequence,
- hbool_t *oh_modified, void *udata);
+ unsigned *oh_modified, void *udata);
/*********************/
@@ -125,7 +125,7 @@ H5SM_compare_cb(const void *obj, size_t obj_len, void *_udata)
*/
static herr_t
H5SM_compare_iter_op(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, unsigned sequence,
- hbool_t UNUSED *oh_modified, void *_udata/*in,out*/)
+ unsigned UNUSED *oh_modified, void *_udata/*in,out*/)
{
H5SM_compare_udata_t *udata = (H5SM_compare_udata_t *) _udata;
herr_t ret_value = H5_ITER_CONT;