diff options
author | Vailin Choi <vchoi@hdfgroup.org> | 2011-10-13 22:41:56 (GMT) |
---|---|---|
committer | Vailin Choi <vchoi@hdfgroup.org> | 2011-10-13 22:41:56 (GMT) |
commit | 682a4f2b5d383d6abf6741a4a5a573f1c67e668e (patch) | |
tree | b3f05c0e95b537d39fc2471b5cbbeedd17b3c337 /src | |
parent | 309f0b543b70d87cb4dcf6f09df0e81657244a4c (diff) | |
download | hdf5-682a4f2b5d383d6abf6741a4a5a573f1c67e668e.zip hdf5-682a4f2b5d383d6abf6741a4a5a573f1c67e668e.tar.gz hdf5-682a4f2b5d383d6abf6741a4a5a573f1c67e668e.tar.bz2 |
[svn-r21555] 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.
Diffstat (limited to 'src')
-rw-r--r-- | src/H5Aint.c | 6 | ||||
-rw-r--r-- | src/H5Oattribute.c | 53 | ||||
-rw-r--r-- | src/H5Omessage.c | 28 | ||||
-rw-r--r-- | src/H5Oprivate.h | 7 | ||||
-rwxr-xr-x | src/H5SM.c | 8 | ||||
-rw-r--r-- | src/H5SMmessage.c | 8 |
6 files changed, 85 insertions, 25 deletions
diff --git a/src/H5Aint.c b/src/H5Aint.c index f1a40bd..123f265 100644 --- a/src/H5Aint.c +++ b/src/H5Aint.c @@ -134,11 +134,15 @@ H5FL_SEQ_DEFINE(H5A_t_ptr); * 24 June 2008 * Changed the table of attribute objects to be the table of * pointers to attribute objects for the ease of operation. + * + * Vailin Choi; September 2011 + * Change "oh_modified" from boolean to unsigned + * (See H5Oprivate.h for possible flags) *------------------------------------------------------------------------- */ 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 95235e4..4cb6afc 100644 --- a/src/H5Oattribute.c +++ b/src/H5Oattribute.c @@ -169,11 +169,15 @@ static htri_t H5O_attr_find_opened_attr(const H5O_loc_t *loc, H5A_t **attr, * koziol@hdfgroup.org * Dec 4 2006 * + * Modifications: + * Vailin Choi; Sept 2011 + * Indicate that the object header is modified and might possibly need + * to condense messages in the object header *------------------------------------------------------------------------- */ 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 +203,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) @@ -415,11 +419,15 @@ done: * koziol@hdfgroup.org * Dec 11 2006 * + * Modifications: + * Vailin Choi; September 2011 + * Change oh_modified from boolean to unsigned + * (See H5Oprivate.h for possible flags) *------------------------------------------------------------------------- */ 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 */ @@ -842,11 +850,16 @@ done: * 4 June 2008 * Took out the data copying part because the attribute data * is shared between attribute handle and object header. + * + * Modifications: + * Vailin Choi; Sept 2011 + * Indicate that the object header is modified but does not need to + * condense messages in the object header *------------------------------------------------------------------------- */ 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 +908,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; @@ -1001,11 +1014,15 @@ done: * koziol@hdfgroup.org * Dec 5 2006 * + * Modifications: + * Vailin Choi; September 2011 + * Change "oh_modified" from boolean to unsigned + * (See H5Oprivate.h for possible flags) *------------------------------------------------------------------------- */ 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 */ @@ -1047,11 +1064,15 @@ H5O_attr_rename_chk_cb(H5O_t UNUSED *oh, H5O_mesg_t *mesg/*in,out*/, * koziol@hdfgroup.org * Dec 5 2006 * + * Modifications: + * Vailin Choi; Sept 2011 + * Indicate that the object header is modified and might possibly need + * to condense messages in the object header *------------------------------------------------------------------------- */ 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 +1146,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 +1162,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; @@ -1507,11 +1530,15 @@ done: * koziol@hdfgroup.org * Dec 11 2006 * + * Modifications: + * Vailin Choi; Sept 2011 + * Indicate that the object header is modified and might possibly need + * to condense messages in the object header *------------------------------------------------------------------------- */ 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 +1557,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; @@ -1786,11 +1813,15 @@ done: * koziol@hdfgroup.org * Dec 11 2006 * + * Modifications: + * Vailin Choi; September 2011 + * Change "oh_modified" from boolean to unsigned + * (See H5Oprivate.h for possible flags) *------------------------------------------------------------------------- */ 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 62a1e1c..c151e5b 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); @@ -1059,11 +1059,15 @@ done: * koziol@ncsa.uiuc.edu * Sep 6 2005 * + * Modifications: + * Vailin Choi; Sept 2011 + * Indicate that the object header is modified and might possibly need + * to condense messages in the object header *------------------------------------------------------------------------- */ 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 */ @@ -1097,8 +1101,8 @@ H5O_msg_remove_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, unsigned sequence, if(H5O_release_mesg(udata->f, udata->dxpl_id, oh, mesg, udata->adj_link) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, H5_ITER_ERROR, "unable to release message") - /* Indicate that the object header was modified */ - *oh_modified = TRUE; + /* Indicate that the object header was modified & might need to condense messages in object header */ + *oh_modified = H5O_MODIFY_CONDENSE; /* Break out now, if we've found the correct message */ if(udata->sequence == H5O_FIRST || udata->sequence != H5O_ALL) @@ -1266,6 +1270,12 @@ done: * C. Negative causes the iterator to immediately return that value, * indicating failure. * + * Modifications: + * Vailin Choi; September 2011 + * Change "oh_modified" from boolean to unsigned so as to know: + * 1) object header is just modified + * 2) object header is modified and possibly need to condense messages there + * *------------------------------------------------------------------------- */ herr_t @@ -1275,7 +1285,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) @@ -1315,13 +1325,15 @@ H5O_msg_iterate_real(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *type, done: /* Check if object message was modified */ if(oh_modified) { - /* Try to condense object header info */ + /* Try to condense object header info if the flag indicates so */ /* (Since this routine is used to remove messages from an * 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 7cbad3d..3f10e81 100644 --- a/src/H5Oprivate.h +++ b/src/H5Oprivate.h @@ -570,7 +570,7 @@ typedef herr_t (*H5O_operator_t)(const void *mesg/*in*/, unsigned idx, /* 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*/); + 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 { @@ -578,6 +578,11 @@ typedef enum H5O_mesg_operator_type_t { H5O_MESG_OP_LIB /* Library internal callback */ } H5O_mesg_operator_type_t; +/* To indicate that the object header is just modified */ +#define H5O_MODIFY 0x01 +/* To indicate that the object header is modified and might possibly need to condense messages */ +#define H5O_MODIFY_CONDENSE 0x02 + typedef struct { H5O_mesg_operator_type_t op_type; union { @@ -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*/, @@ -2154,11 +2154,15 @@ done: * Programmer: James Laird * Wednesday, February 21, 2006 * + * Modifications: + * Vailin Choi; September 2011 + * Change "oh_modified" from boolean to unsigned + * (See H5Oprivate.h for possible flags) *------------------------------------------------------------------------- */ 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..b3dbeb3 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); /*********************/ @@ -121,11 +121,15 @@ H5SM_compare_cb(const void *obj, size_t obj_len, void *_udata) * Programmer: James Laird * Wednesday, February 7, 2007 * + * Modifications: + * Vailin Choi; September 2011 + * Change "oh_modified" from boolean to unsigned + * (See H5Oprivate.h for possible flags) *------------------------------------------------------------------------- */ 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; |