From 598243af9b5613d55cc48ca9b169df9164f1e9a6 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Mon, 21 Feb 2011 17:31:11 -0500 Subject: [svn-r20134] Description: Bring changes from metadata journaling branch to "merging" branch. Tested on: Mac OS X/32 10.6.6 (amazon) w/ debug, production & parallel (h5committest not necessary on this branch) --- src/H5Ddeprec.c | 3 ++- src/H5Dint.c | 42 ++++++++++++++++++++++++++++++++++++++++-- src/H5Dpkg.h | 5 +++++ src/H5HLcache.c | 34 +++++++++++++++++++++++++--------- 4 files changed, 72 insertions(+), 12 deletions(-) diff --git a/src/H5Ddeprec.c b/src/H5Ddeprec.c index 340f4a0..f06762a 100644 --- a/src/H5Ddeprec.c +++ b/src/H5Ddeprec.c @@ -357,7 +357,8 @@ H5D_extend(H5D_t *dataset, const hsize_t *size, hid_t dxpl_id) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize dataset with fill value") /* Mark the dataspace as dirty, for later writing to the file */ - dataset->shared->space_dirty = TRUE; + if(H5D_mark(dataset, dxpl_id, H5D_MARK_SPACE) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to mark dataspace as dirty") } /* end if */ done: diff --git a/src/H5Dint.c b/src/H5Dint.c index 5f96e94..faca4f7 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -1914,7 +1914,9 @@ H5D_alloc_storage(H5D_t *dset/*in,out*/, hid_t dxpl_id, H5D_time_alloc_t time_al * operation just sets the address and makes it constant) */ if(time_alloc != H5D_ALLOC_CREATE && addr_set) - dset->shared->layout_dirty = TRUE; + /* Mark the layout as dirty, for later writing to the file */ + if(H5D_mark(dset, dxpl_id, H5D_MARK_LAYOUT) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to mark dataspace as dirty") } /* end if */ done: @@ -2402,7 +2404,8 @@ H5D_set_extent(H5D_t *dset, const hsize_t *size, hid_t dxpl_id) } /* end if */ /* Mark the dataspace as dirty, for later writing to the file */ - dset->shared->space_dirty = TRUE; + if(H5D_mark(dset, dxpl_id, H5D_MARK_SPACE) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to mark dataspace as dirty") } /* end if */ done: @@ -2524,6 +2527,41 @@ done: /*------------------------------------------------------------------------- + * Function: H5D_mark + * + * Purpose: Mark some aspect of a dataset as dirty + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * July 4, 2008 + * + *------------------------------------------------------------------------- + */ +herr_t +H5D_mark(H5D_t *dataset, hid_t dxpl_id, unsigned flags) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT(H5D_mark) + + /* Check args */ + HDassert(dataset); + HDassert(!(flags & (unsigned)~(H5D_MARK_SPACE | H5D_MARK_LAYOUT))); + + /* Mark aspects of the dataset as dirty */ + if(flags & H5D_MARK_SPACE) + dataset->shared->space_dirty = TRUE; + if(flags & H5D_MARK_LAYOUT) + dataset->shared->layout_dirty = TRUE; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5D_mark() */ + + +/*------------------------------------------------------------------------- * Function: H5D_flush_cb * * Purpose: Flush any dataset information cached in memory diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h index 01dd142..cb2ddbf 100644 --- a/src/H5Dpkg.h +++ b/src/H5Dpkg.h @@ -66,6 +66,10 @@ #define H5D_CHUNK_HASH(D, ADDR) H5F_addr_hash(ADDR, (D)->cache.chunk.nslots) +/* Flags for marking aspects of a dataset dirty */ +#define H5D_MARK_SPACE 0x01 +#define H5D_MARK_LAYOUT 0x02 + /****************************/ /* Package Private Typedefs */ @@ -520,6 +524,7 @@ H5_DLL herr_t H5D_vlen_get_buf_size(void *elem, hid_t type_id, unsigned ndim, H5_DLL herr_t H5D_check_filters(H5D_t *dataset); H5_DLL herr_t H5D_set_extent(H5D_t *dataset, const hsize_t *size, hid_t dxpl_id); H5_DLL herr_t H5D_get_dxpl_cache(hid_t dxpl_id, H5D_dxpl_cache_t **cache); +H5_DLL herr_t H5D_mark(H5D_t *dataset, hid_t dxpl_id, unsigned flags); /* Functions that perform direct serial I/O operations */ H5_DLL herr_t H5D_select_read(const H5D_io_info_t *io_info, diff --git a/src/H5HLcache.c b/src/H5HLcache.c index 7721384..647f0cc 100644 --- a/src/H5HLcache.c +++ b/src/H5HLcache.c @@ -139,13 +139,14 @@ const H5AC_class_t H5AC_LHEAP_DBLK[1] = {{ static herr_t H5HL_fl_deserialize(H5HL_t *heap, hsize_t free_block) { - H5HL_free_t *fl, *tail = NULL; /* Heap free block nodes */ + H5HL_free_t *fl = NULL, *tail = NULL; /* Heap free block nodes */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5HL_fl_deserialize) /* check arguments */ HDassert(heap); + HDassert(!heap->freelist); /* Build free list */ while(H5HL_FREE_NULL != free_block) { @@ -162,13 +163,6 @@ H5HL_fl_deserialize(H5HL_t *heap, hsize_t free_block) fl->prev = tail; fl->next = NULL; - /* Insert node into list */ - if(tail) - tail->next = fl; - tail = fl; - if(!heap->freelist) - heap->freelist = fl; - /* Decode offset of next free block */ p = heap->dblk_image + free_block; H5F_DECODE_LENGTH_LEN(p, free_block, heap->sizeof_size); @@ -179,9 +173,21 @@ H5HL_fl_deserialize(H5HL_t *heap, hsize_t free_block) H5F_DECODE_LENGTH_LEN(p, fl->size, heap->sizeof_size); if((fl->offset + fl->size) > heap->dblk_size) HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "bad heap free list") + + /* Append node onto list */ + if(tail) + tail->next = fl; + else + heap->freelist = fl; + tail = fl; + fl = NULL; } /* end while */ done: + if(ret_value < 0) + if(fl) + fl = H5FL_FREE(H5HL_free_t, fl); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5HL_fl_deserialize() */ @@ -331,6 +337,11 @@ H5HL_prefix_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata) /* Check if the current buffer from the speculative read already has the heap data */ if(spec_read_size >= (heap->prfx_size + heap->dblk_size)) { + /* Set p to the start of the data block. This is necessary + * because there may be a gap between the used portion of the + * prefix and the data block due to alignment constraints. */ + p = buf + heap->prfx_size; + /* Copy the heap data from the speculative read buffer */ HDmemcpy(heap->dblk_image, p, heap->dblk_size); } /* end if */ @@ -436,6 +447,11 @@ H5HL_prefix_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, /* Check if the local heap is a single object in cache */ if(heap->single_cache_obj) { + /* Set p to the start of the data block. This is necessary because + * there may be a gap between the used portion of the prefix and the + * data block due to alignment constraints. */ + p = buf + heap->prfx_size; + /* Serialize the free list into the heap data's image */ H5HL_fl_serialize(heap); @@ -742,7 +758,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5HL_datablock_clear(H5F_t UNUSED *f, void *_thing, hbool_t destroy) +H5HL_datablock_clear(H5F_t *f, void *_thing, hbool_t destroy) { H5HL_dblk_t *dblk = (H5HL_dblk_t *)_thing; /* Pointer to the local heap data block */ herr_t ret_value = SUCCEED; /* Return value */ -- cgit v0.12