diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2005-02-08 21:48:14 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2005-02-08 21:48:14 (GMT) |
commit | 71434c4d035e153b48375015a25a1818170538fb (patch) | |
tree | d34bd4731e8c6e9ccfb114cf228e37430169dfee /src/H5FL.c | |
parent | 983e9a9e267845c80995898fba2bc7e6ebb0e881 (diff) | |
download | hdf5-71434c4d035e153b48375015a25a1818170538fb.zip hdf5-71434c4d035e153b48375015a25a1818170538fb.tar.gz hdf5-71434c4d035e153b48375015a25a1818170538fb.tar.bz2 |
[svn-r9962] Purpose:
Bug fix & code update
Description:
Fix error in new free-list factory routines that was causing errors on
tungsten, et al.
Also, checkpoint v2 B-tree code.
Platforms tested:
FreeBSD 4.11 (sleipnir) w/parallel
Linux 2.4 (tungsten)
Otherwise too minor to require h5committest
Diffstat (limited to 'src/H5FL.c')
-rw-r--r-- | src/H5FL.c | 65 |
1 files changed, 65 insertions, 0 deletions
@@ -104,6 +104,7 @@ static herr_t H5FL_arr_gc(void); static herr_t H5FL_arr_gc_list(H5FL_arr_head_t *head); static herr_t H5FL_blk_gc(void); static herr_t H5FL_blk_gc_list(H5FL_blk_head_t *head); +static herr_t H5FL_blk_unlink(H5FL_blk_head_t *pq); /* Declare a free list to manage the H5FL_fac_head_t struct */ H5FL_DEFINE(H5FL_fac_head_t); @@ -1005,6 +1006,67 @@ done: } /* end H5FL_blk_realloc() */ +/*-------------------------------------------------------------------------- + NAME + H5FL_blk_unlink + PURPOSE + Remove a block free list from the global list of initialized block free + lists. + USAGE + void H5FL_blk_unlink(H5FL_blk_head_t *pq) + H5FL_blk_head_t *pq; IN: Block free list to remove from global list + RETURNS + Success: Non-negative + Failure: Negative + DESCRIPTION + Search through the global list of initialized block free lists and remove + a particular free list. + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +static herr_t +H5FL_blk_unlink(H5FL_blk_head_t *pq) +{ + H5FL_blk_gc_node_t *last; /* Pointer to the last garbage collection node examined */ + H5FL_blk_gc_node_t *tmp; /* Temporary pointer to a garbage collection node */ + herr_t ret_value=SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT(H5FL_blk_unlink) + + /* Find the node to remove from the global list */ + last=NULL; + tmp=H5FL_blk_gc_head.first; + while(tmp!=NULL) { + /* Check if the list has allocations outstanding */ + if(tmp->pq==pq) { + /* Unlink node from linked list */ + if(last==NULL) + H5FL_blk_gc_head.first=H5FL_blk_gc_head.first->next; + else + last->next=tmp->next; + + /* Free the block node */ + H5MM_xfree(tmp); + + /* Leave now */ + break; + } /* end if */ + + /* Advance to next node in list */ + last=tmp; + tmp=tmp->next; + } /* end while */ + + if(tmp==NULL) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGC, FAIL, "can't release block free list") + +done: + FUNC_LEAVE_NOAPI(ret_value); +} /* end H5FL_blk_unlink() */ + + /*------------------------------------------------------------------------- * Function: H5FL_blk_gc_list * @@ -1954,6 +2016,9 @@ H5FL_fac_term(H5FL_fac_head_t *factory) if(factory->queue.allocated>0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "factory still has objects allocated") + /* Unlink block free list for factory from global free list */ + H5FL_blk_unlink(&(factory->queue)); + /* Free factory info */ H5FL_FREE(H5FL_fac_head_t,factory); |