mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-04-24 17:51:25 +08:00
[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)
This commit is contained in:
parent
8f5f04bff2
commit
978c9c9d93
@ -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; m<H5FD_MEM_NTYPES; m=(H5FD_mem_t)(m+1))
|
||||
buf[m-1] = (unsigned char)file->fa.memb_map[m];
|
||||
buf[7] = 0;
|
||||
|
@ -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
|
||||
|
10
src/H5SM.c
10
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;
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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");
|
||||
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user