[svn-r27081] Description:

Clean up H5HL interface, to align w/v3 metadata cache changes

Tested on:
    MacOSX/64 10.10.3 (amazon) w/serial & parallel
    Linux/32 2.6.* (jam) w/serial & parallel
This commit is contained in:
Quincey Koziol 2015-05-14 21:10:46 -05:00
parent 8cc79c0825
commit 2e9d48a551
2 changed files with 25 additions and 24 deletions

View File

@ -121,7 +121,7 @@ const H5AC_class_t H5AC_LHEAP_DBLK[1] = {{
/*------------------------------------------------------------------------- /*-------------------------------------------------------------------------
* Function: H5HL_fl_deserialize * Function: H5HL__fl_deserialize
* *
* Purpose: Deserialize the free list for a heap data block * Purpose: Deserialize the free list for a heap data block
* *
@ -134,13 +134,13 @@ const H5AC_class_t H5AC_LHEAP_DBLK[1] = {{
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
static herr_t static herr_t
H5HL_fl_deserialize(H5HL_t *heap) H5HL__fl_deserialize(H5HL_t *heap)
{ {
H5HL_free_t *fl = NULL, *tail = NULL; /* Heap free block nodes */ H5HL_free_t *fl = NULL, *tail = NULL; /* Heap free block nodes */
hsize_t free_block; /* Offset of free block */ hsize_t free_block; /* Offset of free block */
herr_t ret_value = SUCCEED; /* Return value */ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT FUNC_ENTER_STATIC
/* check arguments */ /* check arguments */
HDassert(heap); HDassert(heap);
@ -188,11 +188,11 @@ done:
fl = H5FL_FREE(H5HL_free_t, fl); fl = H5FL_FREE(H5HL_free_t, fl);
FUNC_LEAVE_NOAPI(ret_value) FUNC_LEAVE_NOAPI(ret_value)
} /* end H5HL_fl_deserialize() */ } /* end H5HL__fl_deserialize() */
/*------------------------------------------------------------------------- /*-------------------------------------------------------------------------
* Function: H5HL_fl_serialize * Function: H5HL__fl_serialize
* *
* Purpose: Serialize the free list for a heap data block * Purpose: Serialize the free list for a heap data block
* *
@ -206,11 +206,11 @@ done:
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
static void static void
H5HL_fl_serialize(const H5HL_t *heap) H5HL__fl_serialize(const H5HL_t *heap)
{ {
H5HL_free_t *fl; /* Pointer to heap free list node */ H5HL_free_t *fl; /* Pointer to heap free list node */
FUNC_ENTER_NOAPI_NOINIT_NOERR FUNC_ENTER_STATIC_NOERR
/* check arguments */ /* check arguments */
HDassert(heap); HDassert(heap);
@ -231,7 +231,7 @@ H5HL_fl_serialize(const H5HL_t *heap)
} /* end for */ } /* end for */
FUNC_LEAVE_NOAPI_VOID FUNC_LEAVE_NOAPI_VOID
} /* end H5HL_fl_serialize() */ } /* end H5HL__fl_serialize() */
/*------------------------------------------------------------------------- /*-------------------------------------------------------------------------
@ -300,11 +300,11 @@ H5HL_prefix_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata)
/* Allocate space in memory for the heap */ /* Allocate space in memory for the heap */
if(NULL == (heap = H5HL_new(udata->sizeof_size, udata->sizeof_addr, udata->sizeof_prfx))) if(NULL == (heap = H5HL_new(udata->sizeof_size, udata->sizeof_addr, udata->sizeof_prfx)))
HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "can't allocate local heap structure") HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "can't allocate local heap structure")
/* Allocate the heap prefix */ /* Allocate the heap prefix */
if(NULL == (prfx = H5HL_prfx_new(heap))) if(NULL == (prfx = H5HL_prfx_new(heap)))
HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "can't allocate local heap prefix") HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "can't allocate local heap prefix")
/* Store the prefix's address & length */ /* Store the prefix's address & length */
heap->prfx_addr = udata->prfx_addr; heap->prfx_addr = udata->prfx_addr;
@ -315,8 +315,9 @@ H5HL_prefix_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata)
/* Free list head */ /* Free list head */
H5F_DECODE_LENGTH_LEN(p, heap->free_block, udata->sizeof_size); H5F_DECODE_LENGTH_LEN(p, heap->free_block, udata->sizeof_size);
if(heap->free_block != H5HL_FREE_NULL && heap->free_block >= heap->dblk_size)
HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, NULL, "bad heap free list") if((heap->free_block != H5HL_FREE_NULL) && (heap->free_block >= heap->dblk_size))
HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, NULL, "bad heap free list")
/* Heap data address */ /* Heap data address */
H5F_addr_decode_len(udata->sizeof_addr, &p, &(heap->dblk_addr)); H5F_addr_decode_len(udata->sizeof_addr, &p, &(heap->dblk_addr));
@ -349,7 +350,7 @@ H5HL_prefix_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata)
} /* end else */ } /* end else */
/* Build free list */ /* Build free list */
if(H5HL_fl_deserialize(heap) < 0) if(H5HL__fl_deserialize(heap) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, NULL, "can't initialize free list") HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, NULL, "can't initialize free list")
} /* end if */ } /* end if */
else else
@ -455,7 +456,7 @@ H5HL_prefix_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr,
} /* end if */ } /* end if */
/* Serialize the free list into the heap data's image */ /* Serialize the free list into the heap data's image */
H5HL_fl_serialize(heap); H5HL__fl_serialize(heap);
/* Copy the heap data block into the cache image */ /* Copy the heap data block into the cache image */
HDmemcpy(p, heap->dblk_image, heap->dblk_size); HDmemcpy(p, heap->dblk_image, heap->dblk_size);
@ -634,7 +635,7 @@ H5HL_datablock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata)
FUNC_ENTER_NOAPI_NOINIT FUNC_ENTER_NOAPI_NOINIT
/* check arguments */ /* Check arguments */
HDassert(f); HDassert(f);
HDassert(H5F_addr_defined(addr)); HDassert(H5F_addr_defined(addr));
HDassert(udata); HDassert(udata);
@ -644,7 +645,7 @@ H5HL_datablock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata)
/* Allocate space in memory for the heap data block */ /* Allocate space in memory for the heap data block */
if(NULL == (dblk = H5HL_dblk_new(udata->heap))) if(NULL == (dblk = H5HL_dblk_new(udata->heap)))
HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "memory allocation failed") HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "memory allocation failed")
/* Check for heap still retaining image */ /* Check for heap still retaining image */
if(NULL == udata->heap->dblk_image) { if(NULL == udata->heap->dblk_image) {
@ -657,7 +658,7 @@ H5HL_datablock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata)
HGOTO_ERROR(H5E_HEAP, H5E_READERROR, NULL, "unable to read local heap data block") HGOTO_ERROR(H5E_HEAP, H5E_READERROR, NULL, "unable to read local heap data block")
/* Build free list */ /* Build free list */
if(H5HL_fl_deserialize(udata->heap) < 0) if(H5HL__fl_deserialize(udata->heap) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, NULL, "can't initialize free list") HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, NULL, "can't initialize free list")
} /* end if */ } /* end if */
@ -671,7 +672,7 @@ done:
/* Release the [possibly partially initialized] local heap on errors */ /* Release the [possibly partially initialized] local heap on errors */
if(!ret_value && dblk) if(!ret_value && dblk)
if(H5HL_dblk_dest(dblk) < 0) if(H5HL_dblk_dest(dblk) < 0)
HDONE_ERROR(H5E_HEAP, H5E_CANTRELEASE, NULL, "unable to destroy local heap data block") HDONE_ERROR(H5E_HEAP, H5E_CANTRELEASE, NULL, "unable to destroy local heap data block")
FUNC_LEAVE_NOAPI(ret_value) FUNC_LEAVE_NOAPI(ret_value)
} /* end H5HL_datablock_load() */ } /* end H5HL_datablock_load() */
@ -714,7 +715,7 @@ H5HL_datablock_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr,
heap->free_block = heap->freelist ? heap->freelist->offset : H5HL_FREE_NULL; heap->free_block = heap->freelist ? heap->freelist->offset : H5HL_FREE_NULL;
/* Serialize the free list into the heap data's image */ /* Serialize the free list into the heap data's image */
H5HL_fl_serialize(heap); H5HL__fl_serialize(heap);
/* Write the data block to the file */ /* Write the data block to the file */
if(H5F_block_write(f, H5FD_MEM_LHEAP, heap->dblk_addr, heap->dblk_size, dxpl_id, heap->dblk_image) < 0) if(H5F_block_write(f, H5FD_MEM_LHEAP, heap->dblk_addr, heap->dblk_size, dxpl_id, heap->dblk_image) < 0)
@ -754,7 +755,7 @@ H5HL_datablock_dest(H5F_t *f, void *_thing)
FUNC_ENTER_NOAPI_NOINIT FUNC_ENTER_NOAPI_NOINIT
/* check arguments */ /* Check arguments */
HDassert(dblk); HDassert(dblk);
HDassert(dblk->heap); HDassert(dblk->heap);
HDassert(!dblk->heap->single_cache_obj); HDassert(!dblk->heap->single_cache_obj);
@ -804,7 +805,7 @@ H5HL_datablock_clear(H5F_t *f, void *_thing, hbool_t destroy)
FUNC_ENTER_NOAPI_NOINIT FUNC_ENTER_NOAPI_NOINIT
/* check arguments */ /* Check arguments */
HDassert(dblk); HDassert(dblk);
/* Mark local heap data block as clean */ /* Mark local heap data block as clean */

View File

@ -114,9 +114,9 @@ struct H5HL_dblk_t {
/* Struct for heap prefix */ /* Struct for heap prefix */
struct H5HL_prfx_t { struct H5HL_prfx_t {
H5AC_info_t cache_info; /* Information for H5AC cache functions, _must_ be */ H5AC_info_t cache_info; /* Information for H5AC cache functions, */
/* first field in structure */ /* _must_ be first field in structure */
H5HL_t *heap; /* Pointer to heap for prefix */ H5HL_t *heap; /* Pointer to heap for prefix */
}; };
/* Callback information for loading local heap prefix from disk */ /* Callback information for loading local heap prefix from disk */