summaryrefslogtreecommitdiffstats
path: root/src/H5Oalloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/H5Oalloc.c')
-rw-r--r--src/H5Oalloc.c37
1 files changed, 22 insertions, 15 deletions
diff --git a/src/H5Oalloc.c b/src/H5Oalloc.c
index 03eb956..29c057d 100644
--- a/src/H5Oalloc.c
+++ b/src/H5Oalloc.c
@@ -169,7 +169,6 @@ H5O_add_gap(H5O_t *oh, unsigned chunkno, unsigned idx,
/* Create new null message, with the tail of the previous null message */
null_msg = &(oh->mesg[oh->nmesgs++]);
null_msg->type = H5O_MSG_NULL;
- null_msg->dirty = TRUE;
null_msg->native = NULL;
null_msg->raw_size = new_gap_size - H5O_SIZEOF_MSGHDR_OH(oh);
null_msg->raw = (oh->chunk[chunkno].image + oh->chunk[chunkno].size)
@@ -180,6 +179,9 @@ H5O_add_gap(H5O_t *oh, unsigned chunkno, unsigned idx,
if(null_msg->raw_size)
HDmemset(null_msg->raw, 0, null_msg->raw_size);
+ /* Mark message as dirty */
+ null_msg->dirty = TRUE;
+
/* Reset size of gap in chunk */
oh->chunk[chunkno].gap = 0;
} /* end if */
@@ -345,12 +347,14 @@ H5O_alloc_null(H5O_t *oh, unsigned null_idx, const H5O_msg_class_t *new_type,
/* Create new null message, with the tail of the previous null message */
null_msg = &(oh->mesg[oh->nmesgs++]);
null_msg->type = H5O_MSG_NULL;
- null_msg->dirty = TRUE;
null_msg->native = NULL;
null_msg->raw = alloc_msg->raw + new_mesg_size;
null_msg->raw_size = alloc_msg->raw_size - new_mesg_size;
null_msg->chunkno = alloc_msg->chunkno;
+ /* Mark the message as dirty */
+ null_msg->dirty = TRUE;
+
/* Check for gap in new null message's chunk */
if(oh->chunk[null_msg->chunkno].gap > 0) {
unsigned null_chunkno = null_msg->chunkno; /* Chunk w/gap */
@@ -372,9 +376,11 @@ H5O_alloc_null(H5O_t *oh, unsigned null_idx, const H5O_msg_class_t *new_type,
/* Initialize the new message */
alloc_msg->type = new_type;
- alloc_msg->dirty = TRUE;
alloc_msg->native = new_native;
+ /* Mark the new message as dirty */
+ alloc_msg->dirty = TRUE;
+
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5O_alloc_null() */
@@ -456,11 +462,8 @@ done:
*-------------------------------------------------------------------------
*/
static htri_t
-H5O_alloc_extend_chunk(H5F_t *f,
- H5O_t *oh,
- unsigned chunkno,
- size_t size,
- unsigned * msg_idx)
+H5O_alloc_extend_chunk(H5F_t *f, H5O_t *oh, unsigned chunkno,
+ size_t size, unsigned * msg_idx)
{
size_t delta; /* Change in chunk's size */
size_t aligned_size = H5O_ALIGN_OH(oh, size);
@@ -659,10 +662,7 @@ done:
*-------------------------------------------------------------------------
*/
static unsigned
-H5O_alloc_new_chunk(H5F_t *f,
- hid_t dxpl_id,
- H5O_t *oh,
- size_t size)
+H5O_alloc_new_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, size_t size)
{
/* Struct for storing information about "best" messages to allocate from */
typedef struct {
@@ -859,7 +859,6 @@ H5O_alloc_new_chunk(H5F_t *f,
found_null = oh->nmesgs++;
null_msg = &(oh->mesg[found_null]);
null_msg->type = H5O_MSG_NULL;
- null_msg->dirty = TRUE;
null_msg->native = NULL;
null_msg->raw = oh->mesg[found_other.msgno].raw;
null_msg->raw_size = oh->mesg[found_other.msgno].raw_size;
@@ -906,6 +905,9 @@ H5O_alloc_new_chunk(H5F_t *f,
/* Adjust message index for new NULL message */
found_null--;
} /* end if */
+
+ /* Mark the new null message as dirty */
+ null_msg->dirty = TRUE;
} /* end if */
HDassert(found_null >= 0);
@@ -1072,7 +1074,7 @@ H5O_release_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5O_mesg_t *mesg,
/* Clear message flags */
mesg->flags = 0;
- /* Indicate that the message was modified */
+ /* Mark the message as modified */
mesg->dirty = TRUE;
/* Check if chunk has a gap currently */
@@ -1269,12 +1271,14 @@ H5O_move_msgs_forward(H5O_t *oh)
/* Initialize new null message to take over non-null message's location */
oh->mesg[new_null_msg].type = H5O_MSG_NULL;
- oh->mesg[new_null_msg].dirty = TRUE;
oh->mesg[new_null_msg].native = NULL;
oh->mesg[new_null_msg].raw = old_raw;
oh->mesg[new_null_msg].raw_size = curr_msg->raw_size;
oh->mesg[new_null_msg].chunkno = old_chunkno;
+ /* Mark new null message dirty */
+ oh->mesg[new_null_msg].dirty = TRUE;
+
/* Check for gap in new null message's chunk */
if(oh->chunk[old_chunkno].gap > 0) {
/* Eliminate the gap in the chunk */
@@ -1538,7 +1542,10 @@ H5O_remove_empty_chunks(H5F_t *f, H5O_t *oh, hid_t dxpl_id)
/* Adjust chunk # for messages in chunks after deleted chunk */
for(u = 0, curr_msg = &oh->mesg[0]; u < oh->nmesgs; u++, curr_msg++) {
+ /* Sanity check - there should be no messages in deleted chunk */
HDassert(curr_msg->chunkno != deleted_chunkno);
+
+ /* Adjust chunk index for messages in later chunks */
if(curr_msg->chunkno > deleted_chunkno)
curr_msg->chunkno--;