From 978c9c9d93fc51ea64c83256a97d72d51656bc3a Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Fri, 8 Dec 2006 14:44:20 -0500 Subject: [svn-r13034] Description: Take out separate memory type in the file for SOHM objects and create aliases for existing memory types for SOHM use. Tested on: FreeBSD/32 4.11 (sleipnir) --- src/H5FDmulti.c | 6 +++--- src/H5FDpublic.h | 14 +++++++++++++- src/H5SM.c | 10 +++++----- src/H5SMcache.c | 8 ++++---- test/h5test.c | 3 +-- test/tsohm.c | 4 ++-- tools/h5dump/h5dumpgentest.c | 2 +- 7 files changed, 29 insertions(+), 18 deletions(-) diff --git a/src/H5FDmulti.c b/src/H5FDmulti.c index 3e7e1aa..398cd86 100644 --- a/src/H5FDmulti.c +++ b/src/H5FDmulti.c @@ -379,7 +379,7 @@ H5Pset_fapl_split(hid_t fapl, const char *meta_ext, hid_t meta_plist_id, * letters `s' (H5FD_MEM_SUPER), * `b' (H5FD_MEM_BTREE), `r' (H5FD_MEM_DRAW), * `g' (H5FD_MEM_GHEAP), 'l' (H5FD_MEM_LHEAP), - * `o' (H5FD_MEM_OHDR), 'h' (H5FD_MEM_SOHM). + * `o' (H5FD_MEM_OHDR). * * memb_addr: The value HADDR_UNDEF for each element. * @@ -439,7 +439,7 @@ H5Pset_fapl_multi(hid_t fapl_id, const H5FD_mem_t *memb_map, char _memb_name[H5FD_MEM_NTYPES][16]; const char *_memb_name_ptrs[H5FD_MEM_NTYPES]; haddr_t _memb_addr[H5FD_MEM_NTYPES]; - static const char *letters = "Xsbrglom"; + static const char *letters = "Xsbrglo"; static const char *func="H5FDset_fapl_multi"; /* Function Name for error reporting */ /*NO TRACE*/ @@ -776,7 +776,7 @@ H5FD_multi_sb_encode(H5FD_t *_file, char *name/*out*/, strncpy(name, "NCSAmulti", (size_t)8); name[8] = '\0'; - assert(8==H5FD_MEM_NTYPES); + assert(7==H5FD_MEM_NTYPES); for (m=H5FD_MEM_SUPER; mfa.memb_map[m]; buf[7] = 0; diff --git a/src/H5FDpublic.h b/src/H5FDpublic.h index bab96c0..e6467d5 100644 --- a/src/H5FDpublic.h +++ b/src/H5FDpublic.h @@ -39,7 +39,6 @@ typedef enum H5FD_mem_t { H5FD_MEM_GHEAP = 4, H5FD_MEM_LHEAP = 5, H5FD_MEM_OHDR = 6, - H5FD_MEM_SOHM = 7, H5FD_MEM_NTYPES /*must be last*/ } H5FD_mem_t; @@ -76,6 +75,19 @@ typedef enum H5FD_mem_t { #define H5FD_MEM_FSPACE_HDR H5FD_MEM_OHDR #define H5FD_MEM_FSPACE_SINFO H5FD_MEM_LHEAP +/* Map "shared object header message" master table to 'ohdr' type file memory, + * since its a fair amount of work to add a new kind of file memory and they are + * similar enough to object headers and probably too minor to deserve their own + * type. + * + * Map "shared object header message" indices to 'btree' type file memory, + * since they are similar enough to B-tree nodes. + * + * -QAK + */ +#define H5FD_MEM_SOHM_TABLE H5FD_MEM_OHDR +#define H5FD_MEM_SOHM_INDEX H5FD_MEM_BTREE + /* * A free-list map which maps all types of allocation requests to a single * free list. This is useful for drivers that don't really care about diff --git a/src/H5SM.c b/src/H5SM.c index c3c8d85..2654483 100755 --- a/src/H5SM.c +++ b/src/H5SM.c @@ -193,7 +193,7 @@ H5SM_init(H5F_t *f, H5P_genplist_t * fc_plist, hid_t dxpl_id) /* Allocate space for the table on disk */ table_size = (hsize_t) H5SM_TABLE_SIZE(f) + (hsize_t) (table->num_indexes * H5SM_INDEX_HEADER_SIZE(f)); - if(HADDR_UNDEF == (table_addr = H5MF_alloc(f, H5FD_MEM_SOHM, dxpl_id, table_size))) + if(HADDR_UNDEF == (table_addr = H5MF_alloc(f, H5FD_MEM_SOHM_TABLE, dxpl_id, table_size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "file allocation failed for SOHM table") /* Cache the new table */ @@ -207,7 +207,7 @@ done: if(ret_value < 0) { if(table_addr != HADDR_UNDEF) - H5MF_xfree(f, H5FD_MEM_SOHM, dxpl_id, table_addr, (hsize_t)H5SM_TABLE_SIZE(f)); + H5MF_xfree(f, H5FD_MEM_SOHM_TABLE, dxpl_id, table_addr, (hsize_t)H5SM_TABLE_SIZE(f)); if(table != NULL) H5FL_FREE(H5SM_master_table_t, table); } @@ -455,7 +455,7 @@ H5SM_create_list(H5F_t *f, H5SM_index_header_t * header, hid_t dxpl_id) /* Allocate space for the list on disk */ size = H5SM_LIST_SIZE(f, num_entries); - if(HADDR_UNDEF == (addr = H5MF_alloc(f, H5FD_MEM_SOHM, dxpl_id, size))) + if(HADDR_UNDEF == (addr = H5MF_alloc(f, H5FD_MEM_SOHM_INDEX, dxpl_id, size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, "file allocation failed for SOHM list") /* Put the list into the cache */ @@ -475,7 +475,7 @@ done: H5FL_FREE(H5SM_list_t, list); } if(addr != HADDR_UNDEF) - H5MF_xfree(f, H5FD_MEM_SOHM, dxpl_id, addr, size); + H5MF_xfree(f, H5FD_MEM_SOHM_INDEX, dxpl_id, addr, size); } FUNC_LEAVE_NOAPI(ret_value) @@ -731,7 +731,7 @@ H5SM_write_mesg(H5F_t *f, hid_t dxpl_id, H5SM_index_header_t *header, list = NULL; list_size = H5SM_LIST_SIZE(f, header->list_to_btree); - if(H5MF_xfree(f, H5FD_MEM_SOHM, dxpl_id, header->index_addr, list_size) < 0) + if(H5MF_xfree(f, H5FD_MEM_SOHM_INDEX, dxpl_id, header->index_addr, list_size) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to free shared message list") header->index_addr = tree_addr; diff --git a/src/H5SMcache.c b/src/H5SMcache.c index a74926f..6c9118e 100644 --- a/src/H5SMcache.c +++ b/src/H5SMcache.c @@ -161,7 +161,7 @@ H5SM_flush_table(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5SM_ma /* Write the table to disk */ HDassert((size_t)(p - buf) == size); - if(H5F_block_write(f, H5FD_MEM_SOHM, addr, size, dxpl_id, buf) < 0) + if(H5F_block_write(f, H5FD_MEM_SOHM_TABLE, addr, size, dxpl_id, buf) < 0) HGOTO_ERROR(H5E_SOHM, H5E_CANTFLUSH, FAIL, "unable to save sohm table to disk") table->cache_info.is_dirty = FALSE; @@ -216,7 +216,7 @@ H5SM_load_table(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *udata1 HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* Read header from disk */ - if(H5F_block_read(f, H5FD_MEM_SOHM, addr, table_size, dxpl_id, buf) < 0) + if(H5F_block_read(f, H5FD_MEM_SOHM_TABLE, addr, table_size, dxpl_id, buf) < 0) HGOTO_ERROR(H5E_SOHM, H5E_READERROR, NULL, "can't read SOHM table") p = buf; @@ -438,7 +438,7 @@ H5SM_flush_list(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5SM_lis /* Write the list to disk */ HDassert((size_t)(p - buf) == size); - if(H5F_block_write(f, H5FD_MEM_SOHM, addr, size, dxpl_id, buf) < 0) + if(H5F_block_write(f, H5FD_MEM_SOHM_INDEX, addr, size, dxpl_id, buf) < 0) HGOTO_ERROR(H5E_SOHM, H5E_CANTFLUSH, FAIL, "unable to save sohm table to disk") list->cache_info.is_dirty = FALSE; @@ -503,7 +503,7 @@ H5SM_load_list(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *udata1, HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* Read list from disk */ - if(H5F_block_read(f, H5FD_MEM_SOHM, addr, size, dxpl_id, buf) < 0) + if(H5F_block_read(f, H5FD_MEM_SOHM_INDEX, addr, size, dxpl_id, buf) < 0) HGOTO_ERROR(H5E_SOHM, H5E_READERROR, NULL, "can't read SOHM list") p = buf; diff --git a/test/h5test.c b/test/h5test.c index bae9da2..086e812 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -86,9 +86,8 @@ MPI_Info h5_io_info_g=MPI_INFO_NULL;/* MPI INFO object for IO */ * g: Global heap * l: local heap (object names) * o: object headers - * h: shared object header message structures */ -static const char *multi_letters = "msbrgloh"; +static const char *multi_letters = "msbrglo"; static herr_t h5_errors(void *client_data); diff --git a/test/tsohm.c b/test/tsohm.c index e82ddb6..77a475f 100644 --- a/test/tsohm.c +++ b/test/tsohm.c @@ -2187,7 +2187,7 @@ static void test_sohm_size2(int close_reopen) */ if(btree_index.attrs1 > list_index_small.attrs1) VERIFY(0, 1, "h5_get_file_size"); - if(btree_index.attrs1 > list_index_med.attrs1) + if(btree_index.attrs1 > list_index_med.attrs1 * OVERHEAD_ALLOWED) VERIFY(0, 1, "h5_get_file_size"); if(list_index_med.attrs1 > btree_index.attrs1 * OVERHEAD_ALLOWED) VERIFY(0, 1, "h5_get_file_size"); @@ -2224,7 +2224,7 @@ static void test_sohm_size2(int close_reopen) VERIFY(0, 1, "h5_get_file_size"); if(list_index_small.attrs2 > btree_index.attrs2 * OVERHEAD_ALLOWED) VERIFY(0, 1, "h5_get_file_size"); - if(btree_index.attrs2 > list_index_med.attrs2) + if(btree_index.attrs2 > list_index_med.attrs2 * OVERHEAD_ALLOWED) VERIFY(0, 1, "h5_get_file_size"); if(list_index_med.attrs2 > btree_index.attrs2 * OVERHEAD_ALLOWED) VERIFY(0, 1, "h5_get_file_size"); diff --git a/tools/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c index 669445c..463f718 100644 --- a/tools/h5dump/h5dumpgentest.c +++ b/tools/h5dump/h5dumpgentest.c @@ -2999,7 +2999,7 @@ void gent_family(void) H5Pclose(fapl); } -static const char *multi_letters = "msbrgloh"; +static const char *multi_letters = "msbrglo"; static void gent_multi(void) -- cgit v0.12