diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2000-04-20 16:36:38 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2000-04-20 16:36:38 (GMT) |
commit | ba8fbc02dbee6abeeb8eddd3a3e47aeb5c58ae1e (patch) | |
tree | bac8e162e0874ce0e891f52c082d584bbe0da45d /src | |
parent | 37f774f5a9a71ba023d021dd90b53527530cd8a9 (diff) | |
download | hdf5-ba8fbc02dbee6abeeb8eddd3a3e47aeb5c58ae1e.zip hdf5-ba8fbc02dbee6abeeb8eddd3a3e47aeb5c58ae1e.tar.gz hdf5-ba8fbc02dbee6abeeb8eddd3a3e47aeb5c58ae1e.tar.bz2 |
[svn-r2165] Fixed last batch of problems when using free-lists on the SGI machines. They
should (hopefully) work on all platforms again now.
Diffstat (limited to 'src')
-rw-r--r-- | src/H5B.c | 10 | ||||
-rw-r--r-- | src/H5Bprivate.h | 2 | ||||
-rw-r--r-- | src/H5Distore.c | 2 | ||||
-rw-r--r-- | src/H5FL.c | 32 | ||||
-rw-r--r-- | src/H5FLprivate.h | 15 | ||||
-rw-r--r-- | src/H5Fistore.c | 2 | ||||
-rw-r--r-- | src/H5Fprivate.h | 6 | ||||
-rw-r--r-- | src/H5Gstab.c | 2 |
8 files changed, 40 insertions, 31 deletions
@@ -106,7 +106,7 @@ /* PRIVATE PROTOTYPES */ static H5B_ins_t H5B_insert_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, - const float split_ratios[], + const double split_ratios[], uint8_t *lt_key, hbool_t *lt_key_changed, uint8_t *md_key, void *udata, @@ -124,7 +124,7 @@ static size_t H5B_nodesize(H5F_t *f, const H5B_class_t *type, size_t *total_nkey_size, size_t sizeof_rkey); static herr_t H5B_split(H5F_t *f, const H5B_class_t *type, H5B_t *old_bt, haddr_t old_addr, intn idx, - const float split_ratios[], void *udata, + const double split_ratios[], void *udata, haddr_t *new_addr/*out*/); static H5B_t * H5B_copy(H5F_t *f, const H5B_t *old_bt); #ifdef H5B_DEBUG @@ -629,7 +629,7 @@ H5B_find(H5F_t *f, const H5B_class_t *type, haddr_t addr, void *udata) */ static herr_t H5B_split(H5F_t *f, const H5B_class_t *type, H5B_t *old_bt, haddr_t old_addr, - intn idx, const float split_ratios[], void *udata, + intn idx, const double split_ratios[], void *udata, haddr_t *new_addr_p/*out*/) { H5B_t *new_bt = NULL, *tmp_bt = NULL; @@ -866,7 +866,7 @@ H5B_decode_keys(H5F_t *f, H5B_t *bt, intn idx) */ herr_t H5B_insert(H5F_t *f, const H5B_class_t *type, haddr_t addr, - const float split_ratios[], void *udata) + const double split_ratios[], void *udata) { /* * These are defined this way to satisfy alignment constraints. @@ -1161,7 +1161,7 @@ H5B_insert_child(H5F_t *f, const H5B_class_t *type, H5B_t *bt, */ static H5B_ins_t H5B_insert_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, - const float split_ratios[], uint8_t *lt_key, + const double split_ratios[], uint8_t *lt_key, hbool_t *lt_key_changed, uint8_t *md_key, void *udata, uint8_t *rt_key, hbool_t *rt_key_changed, haddr_t *new_node_p/*out*/) diff --git a/src/H5Bprivate.h b/src/H5Bprivate.h index 01f94c4..cb60768 100644 --- a/src/H5Bprivate.h +++ b/src/H5Bprivate.h @@ -131,7 +131,7 @@ __DLL__ herr_t H5B_create (H5F_t *f, const H5B_class_t *type, void *udata, __DLL__ herr_t H5B_find (H5F_t *f, const H5B_class_t *type, haddr_t addr, void *udata); __DLL__ herr_t H5B_insert (H5F_t *f, const H5B_class_t *type, haddr_t addr, - const float split_ratios[], void *udata); + const double split_ratios[], void *udata); __DLL__ herr_t H5B_remove(H5F_t *f, const H5B_class_t *type, haddr_t addr, void *udata); __DLL__ herr_t H5B_iterate (H5F_t *f, const H5B_class_t *type, haddr_t addr, diff --git a/src/H5Distore.c b/src/H5Distore.c index cd9acac..17102f9 100644 --- a/src/H5Distore.c +++ b/src/H5Distore.c @@ -85,7 +85,7 @@ typedef struct H5F_rdcc_ent_t { hbool_t locked; /*entry is locked in cache */ hbool_t dirty; /*needs to be written to disk? */ H5O_layout_t *layout; /*the layout message */ - float split_ratios[3];/*B-tree node splitting ratios */ + double split_ratios[3];/*B-tree node splitting ratios */ H5O_pline_t *pline; /*filter pipeline message */ hssize_t offset[H5O_LAYOUT_NDIMS]; /*chunk name */ size_t rd_count; /*bytes remaining to be read */ @@ -145,7 +145,7 @@ H5FL_free(H5FL_head_t *head, void *obj) assert(head->init); /* Get the pointer to the info header in front of the block to free */ - temp=(H5FL_node_t *)((unsigned char *)obj-offsetof(H5FL_node_t,block)); + temp=(H5FL_node_t *)((unsigned char *)obj-sizeof(H5FL_node_t)); #ifdef H5FL_DEBUG assert(temp->inuse); @@ -205,7 +205,7 @@ H5FL_alloc(H5FL_head_t *head, uintn clear) /* Check for nodes available on the free list first */ if(head->list!=NULL) { /* Get a pointer to the block on the free list */ - ret_value=&(head->list->block); + ret_value=((char *)(head->list))+sizeof(H5FL_node_t); #ifdef H5FL_DEBUG head->list->inuse=1; @@ -219,7 +219,7 @@ H5FL_alloc(H5FL_head_t *head, uintn clear) } /* end if */ /* Otherwise allocate a node */ else { - if (NULL==(new_obj = H5MM_malloc(sizeof(H5FL_node_t)+(head->size-1)))) + if (NULL==(new_obj = H5MM_malloc(sizeof(H5FL_node_t)+head->size))) HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); #ifdef H5FL_DEBUG @@ -230,7 +230,7 @@ H5FL_alloc(H5FL_head_t *head, uintn clear) head->allocated++; /* Get a pointer to the new block */ - ret_value=&(new_obj->block); + ret_value=((char *)new_obj)+sizeof(H5FL_node_t); } /* end else */ /* Clear to zeros, if asked */ @@ -345,7 +345,7 @@ printf("H5FL_term: head->name=%s, head->allocated=%d\n", H5FL_gc_head->list->nam } /* end if */ /* No allocations left open for list, get rid of it */ else { - /* Reset the "initialized" flag, in case we restat this list somehow (I don't know how..) */ + /* Reset the "initialized" flag, in case we restart this list somehow (I don't know how..) */ H5FL_gc_head->list->init=0; /* Free the node from the garbage collection list */ @@ -556,7 +556,7 @@ H5FL_blk_alloc(H5FL_blk_head_t *head, size_t size, uintn clear) /* and if there are any blocks available on the list */ if((free_list=H5FL_blk_find_list(&(head->head),size))!=NULL && free_list->list!=NULL) { /* Remove the first node from the list and return it */ - ret_value=(void *)&(free_list->list->block); + ret_value=((char *)(free_list->list))+sizeof(H5FL_blk_list_t); free_list->list=free_list->list->next; /* Decrement the number of blocks on free list */ @@ -565,7 +565,7 @@ H5FL_blk_alloc(H5FL_blk_head_t *head, size_t size, uintn clear) /* No free list available, or there are no nodes on the list, allocate a new node to give to the user */ else { /* Allocate new node, with room for the page info header and the actual page data */ - if(NULL==(temp=H5MM_malloc(sizeof(H5FL_blk_list_t)+(size-1)))) + if(NULL==(temp=H5MM_malloc(sizeof(H5FL_blk_list_t)+size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for chunk"); /* Increment the number of blocks allocated */ @@ -576,7 +576,7 @@ H5FL_blk_alloc(H5FL_blk_head_t *head, size_t size, uintn clear) temp->next=NULL; /* Set the return value to the block itself */ - ret_value=(void *)&(temp->block); + ret_value=((char *)temp)+sizeof(H5FL_blk_list_t); } /* end else */ /* Clear the block to zeros, if requested */ @@ -623,7 +623,7 @@ H5FL_blk_free(H5FL_blk_head_t *head, void *block) H5MM_xfree(block); #else /* NO_BLK_FREE_LISTS */ /* Get the pointer to the native block info header in front of the native block to free */ - temp=(H5FL_blk_list_t *)((unsigned char *)block-offsetof(H5FL_blk_list_t,block)); + temp=(H5FL_blk_list_t *)((unsigned char *)block-sizeof(H5FL_blk_list_t)); /* check if there is a free list for native blocks of this size */ if((free_list=H5FL_blk_find_list(&(head->head),temp->size))==NULL) { @@ -679,7 +679,7 @@ H5FL_blk_realloc(H5FL_blk_head_t *head, void *block, size_t new_size) /* Check if we are actually re-allocating a block */ if(block!=NULL) { /* Get the pointer to the chunk info header in front of the chunk to free */ - temp=(H5FL_blk_list_t *)((unsigned char *)block-offsetof(H5FL_blk_list_t,block)); + temp=(H5FL_blk_list_t *)((unsigned char *)block-sizeof(H5FL_blk_list_t)); /* check if we are actually changing the size of the buffer */ if(new_size!=temp->size) { @@ -841,7 +841,7 @@ printf("H5FL_blk_term: head->name=%s, head->allocated=%d\n", H5FL_blk_gc_head->p } /* end if */ /* No allocations left open for list, get rid of it */ else { - /* Reset the "initialized" flag, in case we restat this list somehow (I don't know how..) */ + /* Reset the "initialized" flag, in case we restart this list somehow (I don't know how..) */ H5FL_blk_gc_head->pq->init=0; /* Free the node from the garbage collection list */ @@ -948,7 +948,7 @@ H5FL_arr_free(H5FL_arr_head_t *head, void *obj) /* Check if there are a maximum number of elements in list */ if(head->maxelem>0) { /* Get the pointer to the info header in front of the block to free */ - temp=(H5FL_arr_node_t *)((unsigned char *)obj-offsetof(H5FL_arr_node_t,arr)); + temp=(H5FL_arr_node_t *)((unsigned char *)obj-sizeof(H5FL_arr_node_t)); /* Double-check that there is enough room for arrays of this size */ assert((intn)temp->nelem<=head->maxelem); @@ -1013,7 +1013,7 @@ H5FL_arr_alloc(H5FL_arr_head_t *head, uintn elem, uintn clear) /* Check for nodes available on the free list first */ if(head->u.list_arr[elem]!=NULL) { /* Get a pointer to the block on the free list */ - ret_value=&(head->u.list_arr[elem]->arr); + ret_value=((char *)(head->u.list_arr[elem]))+sizeof(H5FL_arr_node_t); /* Remove node from free list */ head->u.list_arr[elem]=head->u.list_arr[elem]->next; @@ -1023,7 +1023,7 @@ H5FL_arr_alloc(H5FL_arr_head_t *head, uintn elem, uintn clear) } /* end if */ /* Otherwise allocate a node */ else { - if (NULL==(new_obj = H5MM_malloc(sizeof(H5FL_arr_node_t)+((head->size)*elem)-1))) + if (NULL==(new_obj = H5MM_malloc(sizeof(H5FL_arr_node_t)+head->size*elem))) HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); /* Increment the number of blocks allocated in list */ @@ -1034,7 +1034,7 @@ H5FL_arr_alloc(H5FL_arr_head_t *head, uintn elem, uintn clear) new_obj->next=NULL; /* Get a pointer to the new block */ - ret_value=&(new_obj->arr); + ret_value=((char *)new_obj)+sizeof(H5FL_arr_node_t); } /* end else */ /* Clear to zeros, if asked */ @@ -1088,7 +1088,7 @@ H5FL_arr_realloc(H5FL_arr_head_t *head, void * obj, uintn new_elem) /* Check if there is a maximum number of elements in array */ if(head->maxelem>0) { /* Get the pointer to the info header in front of the block to free */ - temp=(H5FL_arr_node_t *)((unsigned char *)obj-offsetof(H5FL_arr_node_t,arr)); + temp=(H5FL_arr_node_t *)((unsigned char *)obj-sizeof(H5FL_arr_node_t)); /* Check if the size is really changing */ if(temp->nelem!=new_elem) { diff --git a/src/H5FLprivate.h b/src/H5FLprivate.h index d5caa32..e64ba1e 100644 --- a/src/H5FLprivate.h +++ b/src/H5FLprivate.h @@ -34,7 +34,10 @@ typedef struct H5FL_node_t { #ifdef H5FL_DEBUG uintn inuse; /* Indicate when object is in use */ #endif /* H5FL_DEBUG */ - unsigned char block; /* Actual storage for the data */ + union { + double unused1; /* Unused normally, just here for aligment */ + haddr_t unused2; /* Unused normally, just here for aligment */ + }align; /* Bogus union, just here to align following block */ } H5FL_node_t; /* Data structure for free list of blocks */ @@ -73,7 +76,10 @@ typedef struct H5FL_head_t { typedef struct H5FL_blk_list_t { size_t size; /* Size of the page */ struct H5FL_blk_list_t *next; /* Pointer to next block in free list */ - unsigned char block; /* Actual storage for the data */ + union { + double unused1; /* Unused normally, just here for aligment */ + haddr_t unused2; /* Unused normally, just here for aligment */ + }align; /* Bogus union, just here to align following block */ } H5FL_blk_list_t; /* Data structure for priority queue node of block free lists */ @@ -118,7 +124,10 @@ typedef struct H5FL_blk_head_t { typedef struct H5FL_arr_node_t { struct H5FL_arr_node_t *next; /* Pointer to next block in free list */ size_t nelem; /* Number of elements in this array */ - unsigned char arr; /* Actual storage for the array data */ + union { + double unused1; /* Unused normally, just here for aligment */ + haddr_t unused2; /* Unused normally, just here for aligment */ + }align; /* Bogus union, just here to align following block */ } H5FL_arr_node_t; /* Data structure for free list of array blocks */ diff --git a/src/H5Fistore.c b/src/H5Fistore.c index cd9acac..17102f9 100644 --- a/src/H5Fistore.c +++ b/src/H5Fistore.c @@ -85,7 +85,7 @@ typedef struct H5F_rdcc_ent_t { hbool_t locked; /*entry is locked in cache */ hbool_t dirty; /*needs to be written to disk? */ H5O_layout_t *layout; /*the layout message */ - float split_ratios[3];/*B-tree node splitting ratios */ + double split_ratios[3];/*B-tree node splitting ratios */ H5O_pline_t *pline; /*filter pipeline message */ hssize_t offset[H5O_LAYOUT_NDIMS]; /*chunk name */ size_t rd_count; /*bytes remaining to be read */ diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index ea108ac..ee7d7c6 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -251,7 +251,7 @@ typedef struct H5F_access_t { intn mdc_nelmts; /* Size of meta data cache (elements) */ intn rdcc_nelmts; /* Size of raw data chunk cache (elmts) */ size_t rdcc_nbytes; /* Size of raw data chunk cache (bytes) */ - float rdcc_w0; /* Preempt read chunks first? [0.0..1.0]*/ + double rdcc_w0; /* Preempt read chunks first? [0.0..1.0]*/ hsize_t threshold; /* Threshold for alignment */ hsize_t alignment; /* Alignment */ uintn gc_ref; /* Garbage-collect references? */ @@ -265,7 +265,7 @@ typedef struct H5F_xfer_t { void *tconv_buf; /*type conversion buffer or null */ void *bkg_buf; /*background buffer or null */ H5T_bkg_t need_bkg; /*type of background buffer needed */ - float split_ratios[3];/*B-tree node splitting ratios */ + double split_ratios[3];/*B-tree node splitting ratios */ uintn cache_hyper; /*cache hyperslab blocks during I/O? */ uintn block_limit; /*largest hyperslab block to cache */ H5MM_allocate_t vlen_alloc; /*VL datatype allocation function */ @@ -320,7 +320,7 @@ typedef struct H5F_file_t { intn mdc_nelmts; /* Size of meta data cache (elements) */ intn rdcc_nelmts; /* Size of raw data chunk cache (elmts) */ size_t rdcc_nbytes; /* Size of raw data chunk cache (bytes) */ - float rdcc_w0; /* Preempt read chunks first? [0.0..1.0]*/ + double rdcc_w0; /* Preempt read chunks first? [0.0..1.0]*/ hsize_t threshold; /* Threshold for alignment */ hsize_t alignment; /* Alignment */ uintn gc_ref; /* Garbage-collect references? */ diff --git a/src/H5Gstab.c b/src/H5Gstab.c index 26f1212..2b48712 100644 --- a/src/H5Gstab.c +++ b/src/H5Gstab.c @@ -177,7 +177,7 @@ H5G_stab_insert(H5G_entry_t *grp_ent, const char *name, H5G_entry_t *obj_ent) { H5O_stab_t stab; /*symbol table message */ H5G_bt_ud1_t udata; /*data to pass through B-tree */ - static float split_ratios[3] = {0.1, 0.5, 0.9}; + static double split_ratios[3] = {0.1, 0.5, 0.9}; FUNC_ENTER(H5G_stab_insert, FAIL); |