diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2006-03-13 19:47:16 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2006-03-13 19:47:16 (GMT) |
commit | ee3fdc2dbcdf9daaf4e41c085fddd37c1eadbcf9 (patch) | |
tree | 7cbd8c5fc545197f4efed76b9c317c817ebf791f /src | |
parent | c619cf0f518bfea91a34136a1424951eb17b99a4 (diff) | |
download | hdf5-ee3fdc2dbcdf9daaf4e41c085fddd37c1eadbcf9.zip hdf5-ee3fdc2dbcdf9daaf4e41c085fddd37c1eadbcf9.tar.gz hdf5-ee3fdc2dbcdf9daaf4e41c085fddd37c1eadbcf9.tar.bz2 |
[svn-r12084] Purpose:
Code checkpoint
Description:
The fractal heap code is reasonably stable and is passing all its
current tests, so checkpoint everything with CVS.
Also, add "statistics" module for v2 B-trees code, which is only a
stub right now.
Platforms tested:
FreeBSD 4.11 (sleipnir)
Mac OSX (amazon)
Linux 2.4 (chicago)
Diffstat (limited to 'src')
-rw-r--r-- | src/H5AC.c | 1 | ||||
-rw-r--r-- | src/H5ACprivate.h | 1 | ||||
-rw-r--r-- | src/H5B2stat.c | 107 | ||||
-rw-r--r-- | src/H5Cpkg.h | 2 | ||||
-rw-r--r-- | src/H5HF.c | 23 | ||||
-rw-r--r-- | src/H5HFcache.c | 500 | ||||
-rw-r--r-- | src/H5HFdbg.c | 211 | ||||
-rw-r--r-- | src/H5HFflist.c | 367 | ||||
-rw-r--r-- | src/H5HFint.c | 922 | ||||
-rw-r--r-- | src/H5HFpkg.h | 157 | ||||
-rw-r--r-- | src/H5HFprivate.h | 2 | ||||
-rw-r--r-- | src/H5HFstat.c | 117 | ||||
-rw-r--r-- | src/H5HFtest.c | 8 | ||||
-rwxr-xr-x | src/Makefile.am | 4 | ||||
-rw-r--r-- | src/Makefile.in | 11 |
15 files changed, 2153 insertions, 280 deletions
@@ -744,6 +744,7 @@ static const char * H5AC_entry_type_names[H5AC_NTYPES] = "v2 B-tree leaf nodes", "fractal heap headers", "fractal heap direct blocks", + "fractal heap indirect blocks", "test entry" /* for testing only -- not used for actual files */ }; diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h index e50c573..9d89621 100644 --- a/src/H5ACprivate.h +++ b/src/H5ACprivate.h @@ -52,6 +52,7 @@ typedef enum { H5AC_TEST_ID, /*test entry -- not used for actual files */ H5AC_FHEAP_HDR_ID, /*fractal heap header */ H5AC_FHEAP_DBLOCK_ID, /*fractal heap direct block */ + H5AC_FHEAP_IBLOCK_ID, /*fractal heap indirect block */ H5AC_NTYPES /* Number of types, must be last */ } H5AC_type_t; diff --git a/src/H5B2stat.c b/src/H5B2stat.c new file mode 100644 index 0000000..5b8cfc0 --- /dev/null +++ b/src/H5B2stat.c @@ -0,0 +1,107 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu> + * Monday, March 6, 2006 + * + * Purpose: v2 B-tree metadata statistics functions. + * + */ + +/****************/ +/* Module Setup */ +/****************/ + +#define H5B2_PACKAGE /*suppress error about including H5B2pkg */ + +/***********/ +/* Headers */ +/***********/ +#include "H5private.h" /* Generic Functions */ +#include "H5B2pkg.h" /* v2 B-trees */ +#include "H5Eprivate.h" /* Error handling */ + +/****************/ +/* Local Macros */ +/****************/ + + +/******************/ +/* Local Typedefs */ +/******************/ + + +/********************/ +/* Local Prototypes */ +/********************/ + + +/*********************/ +/* Package Variables */ +/*********************/ + + +/*****************************/ +/* Library Private Variables */ +/*****************************/ + + +/*******************/ +/* Local Variables */ +/*******************/ + + +/*------------------------------------------------------------------------- + * Function: H5B2_stat_info + * + * Purpose: Retrieve metadata statistics for the fractal heap + * + * Return: Success: non-negative + * + * Failure: negative + * + * Programmer: Quincey Koziol + * Monday, March 6, 2006 + * + *------------------------------------------------------------------------- + */ +herr_t +H5B2_stat_info(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, + haddr_t addr, H5B2_stat_t *info) +{ + H5B2_t *bt2 = NULL; /* Pointer to the B-tree header */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT(H5B2_get_root_addr_test) + + /* Check arguments. */ + HDassert(f); + HDassert(type); + HDassert(H5F_addr_defined(addr)); + HDassert(info); + + /* Look up the B-tree header */ + if(NULL == (bt2 = H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, type, NULL, H5AC_READ))) + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree header") + +/* XXX: Fill in metadata statistics for the heap */ + +done: + /* Release B-tree header node */ + if(bt2 && H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, addr, bt2, H5AC__NO_FLAGS_SET) < 0) + HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree header info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* H5B2_stat_info() */ + diff --git a/src/H5Cpkg.h b/src/H5Cpkg.h index 155c7f5..9a3cdcd 100644 --- a/src/H5Cpkg.h +++ b/src/H5Cpkg.h @@ -609,7 +609,7 @@ ****************************************************************************/ #define H5C__H5C_T_MAGIC 0x005CAC0E -#define H5C__MAX_NUM_TYPE_IDS 11 +#define H5C__MAX_NUM_TYPE_IDS 12 #define H5C__PREFIX_LEN 32 struct H5C_t @@ -38,8 +38,8 @@ /* Headers */ /***********/ #include "H5private.h" /* Generic Functions */ -#include "H5HFpkg.h" /* Fractal heaps */ #include "H5Eprivate.h" /* Error handling */ +#include "H5HFpkg.h" /* Fractal heaps */ #include "H5MFprivate.h" /* File memory management */ /****************/ @@ -160,7 +160,9 @@ H5HF_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t size, herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI(H5HF_insert, FAIL) +#ifdef QAK HDfprintf(stderr, "%s: size = %Zu\n", FUNC, size); +#endif /* QAK */ /* * Check arguments. @@ -190,16 +192,23 @@ HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "standalone blocks not supported ye if(shared->write_once) { HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "'write once' managed blocks not supported yet") } /* end if */ - else if(size <= shared->total_man_free) { -HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "allocating internal managed blocks not supported yet") - } /* end if */ else { - /* Allocate space at end of heap */ - if(H5HF_man_alloc_end(fh->shared, dxpl_id, &hdr_flags, size, obj, id) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "can't allocate space at end of managed blocks") + H5HF_section_free_node_t *sec_node; + + /* Find free space in heap */ + if(H5HF_man_find(fh->shared, dxpl_id, size, &sec_node) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "can't allocate space in fractal heap") + + /* Use free space for allocating object */ + if(H5HF_man_insert(fh->shared, dxpl_id, sec_node, size, obj, id) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "can't allocate space for object in fractal heap") } /* end else */ } /* end else */ + /* Check for making header dirty */ + if(shared->dirty) + hdr_flags |= H5AC__DIRTIED_FLAG; + done: if(fh && H5AC_unprotect(f, dxpl_id, H5AC_FHEAP_HDR, addr, fh, hdr_flags) < 0) HDONE_ERROR(H5E_HEAP, H5E_PROTECT, FAIL, "unable to release fractal heap header") diff --git a/src/H5HFcache.c b/src/H5HFcache.c index 735037b..348f9eb 100644 --- a/src/H5HFcache.c +++ b/src/H5HFcache.c @@ -33,8 +33,8 @@ /* Headers */ /***********/ #include "H5private.h" /* Generic Functions */ -#include "H5HFpkg.h" /* Fractal heaps */ #include "H5Eprivate.h" /* Error handling */ +#include "H5HFpkg.h" /* Fractal heaps */ #include "H5Vprivate.h" /* Vectors and arrays */ /****************/ @@ -44,9 +44,7 @@ /* Fractal heap format version #'s */ #define H5HF_HDR_VERSION 0 /* Header */ #define H5HF_DBLOCK_VERSION 0 /* Direct block */ - -/* Size of free space description in an absolute managed direct block */ -#define H5HF_MAN_ABS_FREE_NODE_SIZE(d) (2 * (d)->blk_off_size) +#define H5HF_IBLOCK_VERSION 0 /* Indirect block */ /******************/ @@ -58,18 +56,22 @@ /********************/ /* Metadata cache callbacks */ -static H5HF_t *H5HF_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_type, void *udata); +static H5HF_t *H5HF_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *udata, void *udata2); static herr_t H5HF_cache_hdr_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5HF_t *fh); static herr_t H5HF_cache_hdr_clear(H5F_t *f, H5HF_t *fh, hbool_t destroy); static herr_t H5HF_cache_hdr_size(const H5F_t *f, const H5HF_t *fh, size_t *size_ptr); -static H5HF_direct_t *H5HF_cache_dblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_type, void *udata); +static H5HF_direct_t *H5HF_cache_dblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *udata, void *udata2); static herr_t H5HF_cache_dblock_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5HF_direct_t *dblock); static herr_t H5HF_cache_dblock_clear(H5F_t *f, H5HF_direct_t *dblock, hbool_t destroy); static herr_t H5HF_cache_dblock_size(const H5F_t *f, const H5HF_direct_t *dblock, size_t *size_ptr); +static H5HF_indirect_t *H5HF_cache_iblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *udata, void *udata2); +static herr_t H5HF_cache_iblock_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5HF_indirect_t *iblock); +static herr_t H5HF_cache_iblock_clear(H5F_t *f, H5HF_indirect_t *iblock, hbool_t destroy); +static herr_t H5HF_cache_iblock_size(const H5F_t *f, const H5HF_indirect_t *iblock, size_t *size_ptr); /* Local encode/decode routines */ -static herr_t H5HF_dtable_encode(H5F_t *f, uint8_t **pp, const H5HF_dtable_param_t *dt_param); -static herr_t H5HF_dtable_decode(H5F_t *f, const uint8_t **pp, H5HF_dtable_param_t *dt_param); +static herr_t H5HF_dtable_encode(H5F_t *f, uint8_t **pp, const H5HF_dtable_t *dtable); +static herr_t H5HF_dtable_decode(H5F_t *f, const uint8_t **pp, H5HF_dtable_t *dtable); /*********************/ /* Package Variables */ @@ -95,6 +97,17 @@ const H5AC_class_t H5AC_FHEAP_DBLOCK[1] = {{ (H5AC_size_func_t)H5HF_cache_dblock_size, }}; +/* H5HF indirect block inherits cache-like properties from H5AC */ +const H5AC_class_t H5AC_FHEAP_IBLOCK[1] = {{ + H5AC_FHEAP_IBLOCK_ID, + (H5AC_load_func_t)H5HF_cache_iblock_load, + (H5AC_flush_func_t)H5HF_cache_iblock_flush, + (H5AC_dest_func_t)H5HF_cache_iblock_dest, + (H5AC_clear_func_t)H5HF_cache_iblock_clear, + (H5AC_size_func_t)H5HF_cache_iblock_size, +}}; + + /*****************************/ /* Library Private Variables */ /*****************************/ @@ -110,6 +123,9 @@ H5FL_BLK_DEFINE_STATIC(header_block); /* Declare a free list to manage heap direct block data to/from disk */ H5FL_BLK_DEFINE(direct_block); +/* Declare a free list to manage heap indirect block data to/from disk */ +H5FL_BLK_DEFINE_STATIC(indirect_block); + /*------------------------------------------------------------------------- @@ -128,35 +144,44 @@ H5FL_BLK_DEFINE(direct_block); *------------------------------------------------------------------------- */ static herr_t -H5HF_dtable_decode(H5F_t *f, const uint8_t **pp, H5HF_dtable_param_t *dt_param) +H5HF_dtable_decode(H5F_t *f, const uint8_t **pp, H5HF_dtable_t *dtable) { FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_dtable_decode) /* Check arguments */ HDassert(f); HDassert(pp && *pp); - HDassert(dt_param); + HDassert(dtable); /* Table width */ - UINT16DECODE(*pp, dt_param->cparam.width); + UINT16DECODE(*pp, dtable->cparam.width); /* Starting block size */ - H5F_DECODE_LENGTH(f, *pp, dt_param->cparam.start_block_size); + H5F_DECODE_LENGTH(f, *pp, dtable->cparam.start_block_size); /* Maximum direct block size */ - H5F_DECODE_LENGTH(f, *pp, dt_param->cparam.max_direct_size); + H5F_DECODE_LENGTH(f, *pp, dtable->cparam.max_direct_size); /* Maximum heap size (as # of bits) */ - UINT16DECODE(*pp, dt_param->cparam.max_index); + UINT16DECODE(*pp, dtable->cparam.max_index); /* Starting # of rows in root indirect block */ - UINT16DECODE(*pp, dt_param->cparam.start_root_rows); + UINT16DECODE(*pp, dtable->cparam.start_root_rows); /* Address of table */ - H5F_addr_decode(f, pp, &(dt_param->table_addr)); + H5F_addr_decode(f, pp, &(dtable->table_addr)); /* Current # of rows in root indirect block */ - UINT16DECODE(*pp, dt_param->curr_root_rows); + UINT16DECODE(*pp, dtable->curr_root_rows); + + /* Next direct block's heap offset */ + H5F_DECODE_LENGTH(f, *pp, dtable->next_dir_block); + + /* Next direct block size */ + H5F_DECODE_LENGTH(f, *pp, dtable->next_dir_size); + + /* Next direct block column */ + UINT16DECODE(*pp, dtable->next_dir_col); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5HF_dtable_decode() */ @@ -178,35 +203,44 @@ H5HF_dtable_decode(H5F_t *f, const uint8_t **pp, H5HF_dtable_param_t *dt_param) *------------------------------------------------------------------------- */ static herr_t -H5HF_dtable_encode(H5F_t *f, uint8_t **pp, const H5HF_dtable_param_t *dt_param) +H5HF_dtable_encode(H5F_t *f, uint8_t **pp, const H5HF_dtable_t *dtable) { FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_dtable_encode) /* Check arguments */ HDassert(f); HDassert(pp && *pp); - HDassert(dt_param); + HDassert(dtable); /* Table width */ - UINT16ENCODE(*pp, dt_param->cparam.width); + UINT16ENCODE(*pp, dtable->cparam.width); /* Starting block size */ - H5F_ENCODE_LENGTH(f, *pp, dt_param->cparam.start_block_size); + H5F_ENCODE_LENGTH(f, *pp, dtable->cparam.start_block_size); /* Maximum direct block size */ - H5F_ENCODE_LENGTH(f, *pp, dt_param->cparam.max_direct_size); + H5F_ENCODE_LENGTH(f, *pp, dtable->cparam.max_direct_size); /* Maximum heap size (as # of bits) */ - UINT16ENCODE(*pp, dt_param->cparam.max_index); + UINT16ENCODE(*pp, dtable->cparam.max_index); /* Starting # of rows in root indirect block */ - UINT16ENCODE(*pp, dt_param->cparam.start_root_rows); + UINT16ENCODE(*pp, dtable->cparam.start_root_rows); /* Address of table */ - H5F_addr_encode(f, pp, dt_param->table_addr); + H5F_addr_encode(f, pp, dtable->table_addr); /* Current # of rows in root indirect block */ - UINT16ENCODE(*pp, dt_param->curr_root_rows); + UINT16ENCODE(*pp, dtable->curr_root_rows); + + /* Next direct block's heap offset */ + H5F_ENCODE_LENGTH(f, *pp, dtable->next_dir_block); + + /* Next direct block size */ + H5F_ENCODE_LENGTH(f, *pp, dtable->next_dir_size); + + /* Next direct block column */ + UINT16ENCODE(*pp, dtable->next_dir_col); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5HF_dtable_encode() */ @@ -296,14 +330,21 @@ H5HF_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *ud /* Min. size of standalone objects */ UINT32DECODE(p, shared->standalone_size); - /* Length of fixed-length objects in heap */ - UINT32DECODE(p, shared->fixed_len_size); - /* Size of ref. count for objects in heap */ shared->ref_count_size = *p++; + /* Internal management information */ + H5F_DECODE_LENGTH(f, p, shared->total_man_free); + H5F_DECODE_LENGTH(f, p, shared->total_std_free); + + /* Statistics information */ + H5F_DECODE_LENGTH(f, p, shared->total_size); + H5F_DECODE_LENGTH(f, p, shared->man_size); + H5F_DECODE_LENGTH(f, p, shared->std_size); + H5F_DECODE_LENGTH(f, p, shared->nobjs); + /* Managed objects' doubling-table info */ - if(H5HF_dtable_decode(shared->f, &p, &(shared->man_dtable_info)) < 0) + if(H5HF_dtable_decode(shared->f, &p, &(shared->man_dtable)) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTENCODE, NULL, "unable to encode managed obj. doubling table info") HDassert((size_t)(p - buf) == size); @@ -360,6 +401,9 @@ H5HF_cache_hdr_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5H uint8_t *p; /* Pointer into raw data buffer */ size_t size; /* Header size on disk */ + /* Sanity check */ + HDassert(shared->dirty); + /* Compute the size of the heap header on disk */ size = H5HF_HEADER_SIZE(f); @@ -391,14 +435,21 @@ H5HF_cache_hdr_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5H /* Min. size of standalone objects */ UINT32ENCODE(p, shared->standalone_size); - /* Size of fixed-length objects in heap */ - UINT32ENCODE(p, shared->fixed_len_size); - /* Size of ref. count for objects in heap */ *p++ = shared->ref_count_size; + /* Internal management information */ + H5F_ENCODE_LENGTH(f, p, shared->total_man_free); + H5F_ENCODE_LENGTH(f, p, shared->total_std_free); + + /* Statistics information */ + H5F_ENCODE_LENGTH(f, p, shared->total_size); + H5F_ENCODE_LENGTH(f, p, shared->man_size); + H5F_ENCODE_LENGTH(f, p, shared->std_size); + H5F_ENCODE_LENGTH(f, p, shared->nobjs); + /* Managed objects' doubling-table info */ - if(H5HF_dtable_encode(shared->f, &p, &(shared->man_dtable_info)) < 0) + if(H5HF_dtable_encode(shared->f, &p, &(shared->man_dtable)) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTENCODE, FAIL, "unable to encode managed obj. doubling table info") /* Write the heap header. */ @@ -408,6 +459,7 @@ H5HF_cache_hdr_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5H H5FL_BLK_FREE(header_block, buf); + shared->dirty = FALSE; fh->cache_info.is_dirty = FALSE; } /* end if */ @@ -545,7 +597,6 @@ H5HF_cache_dblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_size, H5RC_t *fh_shared = (H5RC_t *)_fh_shared; /* Shared heap information */ H5HF_shared_t *shared = NULL; /* Shared fractal heap information */ H5HF_direct_t *dblock = NULL; /* Direct block info */ - uint8_t *buf = NULL; /* Temporary buffer */ const uint8_t *p; /* Pointer into raw data buffer */ haddr_t heap_addr; /* Address of heap header in the file */ uint32_t metadata_chksum; /* Metadata checksum value */ @@ -578,14 +629,14 @@ H5HF_cache_dblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_size, /* Allocate block buffer */ /* XXX: Change to using free-list factories */ - if((buf = H5FL_BLK_MALLOC(direct_block, (size_t)dblock->size)) == NULL) + if((dblock->blk = H5FL_BLK_MALLOC(direct_block, (size_t)dblock->size)) == NULL) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") - /* Read header from disk */ - if(H5F_block_read(f, H5FD_MEM_FHEAP_HDR, addr, (size_t)dblock->size, dxpl_id, buf) < 0) + /* Read direct block from disk */ + if(H5F_block_read(f, H5FD_MEM_FHEAP_DBLOCK, addr, (size_t)dblock->size, dxpl_id, dblock->blk) < 0) HGOTO_ERROR(H5E_HEAP, H5E_READERROR, NULL, "can't read fractal heap direct block") - p = buf; + p = dblock->blk; /* Magic number */ if(HDmemcmp(p, H5HF_DBLOCK_MAGIC, H5HF_SIZEOF_MAGIC)) @@ -622,9 +673,6 @@ H5HF_cache_dblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_size, /* (Defer deserializing the whole free list until we actually need to modify it) */ UINT64DECODE_VAR(p, dblock->free_list_head, dblock->blk_off_size); - /* Keep pointer to block buffer */ - dblock->blk = buf; - /* Set return value */ ret_value = dblock; @@ -714,7 +762,7 @@ H5HF_cache_dblock_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, node = dblock->free_list->first; while(node) { /* Find first node which has enough room to describe free space */ - while(node && node->size < H5HF_MAN_ABS_FREE_NODE_SIZE(dblock)) + while(node && node->size < H5HF_MAN_ABS_DIRECT_FREE_NODE_SIZE(dblock)) node = node->next; /* Check for free space node to encode */ @@ -723,7 +771,7 @@ H5HF_cache_dblock_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, /* Probe ahead for next node that is large enough to encode free space description */ next_node = node->next; - while(next_node && next_node->size < H5HF_MAN_ABS_FREE_NODE_SIZE(dblock)) + while(next_node && next_node->size < H5HF_MAN_ABS_DIRECT_FREE_NODE_SIZE(dblock)) next_node = next_node->next; /* Encode information for this node on free list */ @@ -741,8 +789,8 @@ H5HF_cache_dblock_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, dblock->free_list->dirty = FALSE; } /* end if */ - /* Write the heap header. */ - if(H5F_block_write(f, H5FD_MEM_FHEAP_HDR, addr, (size_t)dblock->size, dxpl_id, dblock->blk) < 0) + /* Write the direct block */ + if(H5F_block_write(f, H5FD_MEM_FHEAP_DBLOCK, addr, (size_t)dblock->size, dxpl_id, dblock->blk) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTFLUSH, FAIL, "unable to save fractal heap direct block to disk") dblock->cache_info.is_dirty = FALSE; @@ -857,7 +905,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5HF_cache_block_size + * Function: H5HF_cache_dblock_size * * Purpose: Compute the size in bytes of a fractal heap direct block * on disk, and return it in *size_ptr. On failure, @@ -886,3 +934,361 @@ H5HF_cache_dblock_size(const H5F_t UNUSED *f, const H5HF_direct_t *dblock, size_ FUNC_LEAVE_NOAPI(SUCCEED) } /* H5HF_cache_dblock_size() */ + +/*------------------------------------------------------------------------- + * Function: H5HF_cache_iblock_load + * + * Purpose: Loads a fractal heap indirect block from the disk. + * + * Return: Success: Pointer to a new fractal heap indirect block + * + * Failure: NULL + * + * Programmer: Quincey Koziol + * koziol@ncsa.uiuc.edu + * Feb 27 2006 + * + *------------------------------------------------------------------------- + */ +static H5HF_indirect_t * +H5HF_cache_iblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_nrows, void *_fh_shared) +{ + const unsigned *nrows = (const unsigned *)_nrows; /* # of rows in indirect block */ + H5RC_t *fh_shared = (H5RC_t *)_fh_shared; /* Shared heap information */ + H5HF_shared_t *shared = NULL; /* Shared fractal heap information */ + H5HF_indirect_t *iblock = NULL; /* Indirect block info */ + uint8_t *buf = NULL; /* Temporary buffer */ + const uint8_t *p; /* Pointer into raw data buffer */ + haddr_t heap_addr; /* Address of heap header in the file */ + uint32_t metadata_chksum; /* Metadata checksum value */ + size_t u; /* Local index variable */ + H5HF_indirect_t *ret_value; /* Return value */ + + FUNC_ENTER_NOAPI(H5HF_cache_iblock_load, NULL) + + /* Check arguments */ + HDassert(f); + HDassert(H5F_addr_defined(addr)); + HDassert(fh_shared); + + /* Allocate space for the fractal heap indirect block */ + if(NULL == (iblock = H5FL_MALLOC(H5HF_indirect_t))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HDmemset(&iblock->cache_info, 0, sizeof(H5AC_info_t)); + + /* Share common heap information */ + iblock->shared = fh_shared; + H5RC_INC(iblock->shared); + + /* Get the pointer to the shared heap info */ + shared = H5RC_GET_OBJ(iblock->shared); + HDassert(shared); + + /* Set block's internal information */ + iblock->nrows = *nrows; + if(iblock->nrows > shared->man_dtable.max_direct_rows) { + iblock->ndir_rows = shared->man_dtable.max_direct_rows; + iblock->nindir_rows = iblock->nrows - iblock->ndir_rows; + } /* end if */ + else { + iblock->ndir_rows = iblock->nrows; + iblock->nindir_rows = 0; + } /* end else */ + + /* Compute size of indirect block */ + iblock->size = H5HF_MAN_INDIRECT_SIZE(shared, iblock); + + /* Allocate buffer to decode block */ +/* XXX: Use free list factories? */ + if((buf = H5FL_BLK_MALLOC(indirect_block, iblock->size)) == NULL) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + + /* Read indirect block from disk */ + if(H5F_block_read(f, H5FD_MEM_FHEAP_IBLOCK, addr, iblock->size, dxpl_id, buf) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_READERROR, NULL, "can't read fractal heap indirect block") + + p = buf; + + /* Magic number */ + if(HDmemcmp(p, H5HF_IBLOCK_MAGIC, H5HF_SIZEOF_MAGIC)) + HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, NULL, "wrong fractal heap indirect block signature") + p += H5HF_SIZEOF_MAGIC; + + /* Version */ + if(*p++ != H5HF_IBLOCK_VERSION) + HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, NULL, "wrong fractal heap direct block version") + + /* Metadata flags (unused, currently) */ +/* XXX: Plan out metadata flags (including "read-only duplicate" feature) */ + if(*p++ != 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, NULL, "unknown metadata flag in fractal heap direct block") + + /* Metadata checksum (unused, currently) */ + UINT32DECODE(p, metadata_chksum); +/* XXX: Verify checksum */ + if(metadata_chksum != 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, NULL, "incorrect metadata checksum for fractal heap direct block") + + /* Address of heap that owns this block (skip) */ + H5F_addr_decode(f, &p, &heap_addr); + if(H5F_addr_ne(heap_addr, shared->heap_addr)) + HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, NULL, "incorrect heap header address for direct block") + + /* Offset of heap within the heap's address space */ + UINT64DECODE_VAR(p, iblock->block_off, shared->heap_off_size); + + /* Allocate & decode indirect block entry tables */ + HDassert(iblock->ndir_rows > 0); + if(NULL == (iblock->dblock_ents = H5FL_SEQ_MALLOC(H5HF_indirect_dblock_ent_t, (iblock->ndir_rows * shared->man_dtable.cparam.width)))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for direct entries") + for(u = 0; u < (iblock->ndir_rows * shared->man_dtable.cparam.width); u++) { + H5F_addr_decode(f, &p, &(iblock->dblock_ents[u].addr)); + UINT32DECODE_VAR(p, iblock->dblock_ents[u].free_space, shared->man_dtable.max_dir_blk_off_size); + } /* end for */ + if(iblock->nindir_rows > 0) { + if(NULL == (iblock->iblock_ents = H5FL_SEQ_MALLOC(H5HF_indirect_iblock_ent_t, (iblock->nindir_rows * shared->man_dtable.cparam.width)))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for indirect entries") + + /* Decode indirect block-specific fields */ + for(u = 0; u < (iblock->nindir_rows * shared->man_dtable.cparam.width); u++) + H5F_addr_decode(f, &p, &(iblock->iblock_ents[u].addr)); + } /* end if */ + else + iblock->iblock_ents = NULL; + + /* Sanity check */ + HDassert((size_t)(p - buf) == iblock->size); + + /* Set return value */ + ret_value = iblock; + +done: + /* Free buffer */ +/* XXX: Keep buffer around? */ + H5FL_BLK_FREE(indirect_block, buf); + + if(!ret_value && iblock) + (void)H5HF_cache_iblock_dest(f, iblock); + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5HF_cache_iblock_load() */ + + +/*------------------------------------------------------------------------- + * Function: H5HF_cache_iblock_flush + * + * Purpose: Flushes a dirty fractal heap indirect block to disk. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * koziol@ncsa.uiuc.edu + * Mar 6 2006 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5HF_cache_iblock_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5HF_indirect_t *iblock) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(H5HF_cache_iblock_flush, FAIL) + + /* check arguments */ + HDassert(f); + HDassert(H5F_addr_defined(addr)); + HDassert(iblock); + + if(iblock->cache_info.is_dirty) { + H5HF_shared_t *shared; /* Shared fractal heap information */ + uint8_t *buf = NULL; /* Temporary buffer */ + uint8_t *p; /* Pointer into raw data buffer */ + size_t u; /* Local index variable */ + + /* Get the pointer to the shared heap info */ + shared = H5RC_GET_OBJ(iblock->shared); + HDassert(shared); + + /* Allocate buffer to encode block */ +/* XXX: Use free list factories? */ +#ifdef QAK +HDfprintf(stderr, "%s: iblock->nrows = %u\n", FUNC, iblock->nrows); +HDfprintf(stderr, "%s: iblock->ndir_rows = %u\n", FUNC, iblock->ndir_rows); +HDfprintf(stderr, "%s: iblock->nindir_rows = %u\n", FUNC, iblock->nindir_rows); +HDfprintf(stderr, "%s: iblock->size = %Zu\n", FUNC, iblock->size); +HDfprintf(stderr, "%s: iblock->block_off = %Hu\n", FUNC, iblock->block_off); +HDfprintf(stderr, "%s: shared->man_dtable.cparam.width = %u\n", FUNC, shared->man_dtable.cparam.width); +#endif /* QAK */ + if((buf = H5FL_BLK_MALLOC(indirect_block, iblock->size)) == NULL) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + + p = buf; + + /* Magic number */ + HDmemcpy(p, H5HF_IBLOCK_MAGIC, H5HF_SIZEOF_MAGIC); + p += H5HF_SIZEOF_MAGIC; + + /* Version # */ + *p++ = H5HF_IBLOCK_VERSION; + + /* Metadata status flags */ +/* XXX: Set this? */ + *p++ = 0; + + /* Metadata checksum */ +/* XXX: Set this! (After all the metadata is in the buffer) */ + HDmemset(p, 0, 4); + p += 4; + + /* Address of heap header for heap which owns this block */ + H5F_addr_encode(f, &p, shared->heap_addr); + + /* Offset of block in heap */ + UINT64ENCODE_VAR(p, iblock->block_off, shared->heap_off_size); + + /* Encode indirect block-specific fields */ + HDassert(iblock->ndir_rows > 0); + for(u = 0; u < (iblock->ndir_rows * shared->man_dtable.cparam.width); u++) { + H5F_addr_encode(f, &p, iblock->dblock_ents[u].addr); + UINT32ENCODE_VAR(p, iblock->dblock_ents[u].free_space, shared->man_dtable.max_dir_blk_off_size); + } /* end for */ + if(iblock->nindir_rows > 0) + for(u = 0; u < (iblock->nindir_rows * shared->man_dtable.cparam.width); u++) + H5F_addr_encode(f, &p, iblock->iblock_ents[u].addr); + + /* Sanity check */ + HDassert((size_t)(p - buf) == iblock->size); + + /* Write the indirect block */ + if(H5F_block_write(f, H5FD_MEM_FHEAP_IBLOCK, addr, iblock->size, dxpl_id, buf) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTFLUSH, FAIL, "unable to save fractal heap indirect block to disk") + + /* Free buffer */ + H5FL_BLK_FREE(indirect_block, buf); + + iblock->cache_info.is_dirty = FALSE; + } /* end if */ + + if(destroy) + if(H5HF_cache_iblock_dest(f, iblock) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy fractal heap indirect block") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5HF_cache_iblock_flush() */ + + +/*------------------------------------------------------------------------- + * Function: H5HF_cache_iblock_dest + * + * Purpose: Destroys a fractal heap indirect block in memory. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * koziol@ncsa.uiuc.edu + * Mar 6 2006 + * + *------------------------------------------------------------------------- + */ +/* ARGSUSED */ +herr_t +H5HF_cache_iblock_dest(H5F_t UNUSED *f, H5HF_indirect_t *iblock) +{ + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_cache_iblock_dest) + + /* + * Check arguments. + */ + HDassert(iblock); + + /* Decrement reference count on shared fractal heap info */ + if(iblock->shared) + H5RC_DEC(iblock->shared); + + /* Release entry tables */ + if(iblock->dblock_ents) + H5FL_SEQ_FREE(H5HF_indirect_dblock_ent_t, iblock->dblock_ents); + if(iblock->iblock_ents) + H5FL_SEQ_FREE(H5HF_indirect_iblock_ent_t, iblock->iblock_ents); + + /* Free fractal heap indirect block info */ + H5FL_FREE(H5HF_indirect_t, iblock); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5HF_cache_iblock_dest() */ + + +/*------------------------------------------------------------------------- + * Function: H5HF_cache_iblock_clear + * + * Purpose: Mark a fractal heap indirect block in memory as non-dirty. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * koziol@ncsa.uiuc.edu + * Mar 6 2006 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5HF_cache_iblock_clear(H5F_t *f, H5HF_indirect_t *iblock, hbool_t destroy) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT(H5HF_cache_iblock_clear) + + /* + * Check arguments. + */ + HDassert(iblock); + + /* Reset the dirty flag. */ + iblock->cache_info.is_dirty = FALSE; + + if(destroy) + if(H5HF_cache_iblock_dest(f, iblock) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy fractal heap indirect block") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5HF_cache_iblock_clear() */ + + +/*------------------------------------------------------------------------- + * Function: H5HF_cache_iblock_size + * + * Purpose: Compute the size in bytes of a fractal heap indirect block + * on disk, and return it in *size_ptr. On failure, + * the value of *size_ptr is undefined. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * koziol@ncsa.uiuc.edu + * Mar 6 2006 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5HF_cache_iblock_size(const H5F_t UNUSED *f, const H5HF_indirect_t *iblock, size_t *size_ptr) +{ + H5HF_shared_t *shared; /* Shared fractal heap information */ + + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_cache_iblock_size) + + /* check arguments */ + HDassert(iblock); + HDassert(size_ptr); + + /* Get the pointer to the shared heap info */ + shared = H5RC_GET_OBJ(iblock->shared); + HDassert(shared); + + /* Set size value */ + *size_ptr = iblock->size; + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* H5HF_cache_iblock_size() */ + diff --git a/src/H5HFdbg.c b/src/H5HFdbg.c index 2024402..977f40f 100644 --- a/src/H5HFdbg.c +++ b/src/H5HFdbg.c @@ -52,7 +52,7 @@ /* Local Prototypes */ /********************/ -static herr_t H5HF_dtable_debug(H5HF_dtable_param_t *dt_param, FILE *stream, +static herr_t H5HF_dtable_debug(H5HF_dtable_t *dtable, FILE *stream, int indent, int fwidth); @@ -85,14 +85,14 @@ static herr_t H5HF_dtable_debug(H5HF_dtable_param_t *dt_param, FILE *stream, *------------------------------------------------------------------------- */ static herr_t -H5HF_dtable_debug(H5HF_dtable_param_t *dt_param, FILE *stream, int indent, int fwidth) +H5HF_dtable_debug(H5HF_dtable_t *dtable, FILE *stream, int indent, int fwidth) { FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_dtable_debug) /* * Check arguments. */ - HDassert(dt_param); + HDassert(dtable); HDassert(stream); HDassert(indent >= 0); HDassert(fwidth >= 0); @@ -100,27 +100,50 @@ H5HF_dtable_debug(H5HF_dtable_param_t *dt_param, FILE *stream, int indent, int f /* * Print the values. */ + /* Creation parameter values */ HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Doubling table width:", - dt_param->cparam.width); + dtable->cparam.width); HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, "Starting block size:", - dt_param->cparam.start_block_size); + dtable->cparam.start_block_size); HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, "Max. direct block size:", - dt_param->cparam.max_direct_size); + dtable->cparam.max_direct_size); HDfprintf(stream, "%*s%-*s %u (bits)\n", indent, "", fwidth, "Max. index size:", - dt_param->cparam.max_index); + dtable->cparam.max_index); HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Starting # of rows in root indirect block:", - dt_param->cparam.start_root_rows); + dtable->cparam.start_root_rows); + + /* Run-time varying parameter values */ HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, "Table's root address:", - dt_param->table_addr); + dtable->table_addr); HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Current # of rows in root indirect block:", - dt_param->curr_root_rows); + dtable->curr_root_rows); + HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, + "Next direct block size:", + dtable->next_dir_size); + HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, + "Next direct block column:", + dtable->next_dir_col); + + /* Computed values */ + HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, + "Max. # of rows in root indirect block:", + dtable->max_root_indirect_rows); + HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, + "Max. # of direct rows in any indirect block:", + dtable->max_direct_rows); + HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, + "# of bits for IDs in first row:", + dtable->first_row_bits); + HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, + "# of IDs in first row:", + dtable->num_id_first_row); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5HF_dtable_debug() */ @@ -181,15 +204,31 @@ H5HF_hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, HDfprintf(stream, "%*s%-*s %lu\n", indent, "", fwidth, "Min. size of standalone object:", (unsigned long)shared->standalone_size); - HDfprintf(stream, "%*s%-*s %lu\n", indent, "", fwidth, - "Fixed length object size:", - (unsigned long)shared->fixed_len_size); - HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, - "Ref. count size:", - (unsigned)shared->ref_count_size); + HDfprintf(stream, "%*s%-*s %u%s\n", indent, "", fwidth, + "Ref. count size:", + (unsigned)shared->ref_count_size, + (shared->ref_count_size == 0 ? " (ref. count not stored)" : "")); + HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, + "Total free space in managed blocks:", + shared->total_man_free); + HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, + "Total # of free entries for standalone blocks:", + shared->total_std_free); + HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, + "Total data block size:", + shared->total_size); + HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, + "Total managed space data block size:", + shared->man_size); + HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, + "Total standalone space data block size:", + shared->std_size); + HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, + "Number of objects in heap:", + shared->nobjs); HDfprintf(stream, "%*sManaged Objects Doubling-Table Info...\n", indent, ""); - H5HF_dtable_debug(&shared->man_dtable_info, stream, indent + 3, MAX(0, fwidth -3)); + H5HF_dtable_debug(&shared->man_dtable, stream, indent + 3, MAX(0, fwidth -3)); done: if(fh && H5AC_unprotect(f, dxpl_id, H5AC_FHEAP_HDR, addr, fh, H5AC__NO_FLAGS_SET) < 0) @@ -225,7 +264,7 @@ H5HF_dblock_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, size_t amount_free = 0; /* Amount of free space in block */ uint8_t *marker = NULL; /* Track free space for block */ size_t overlap; /* Number of free space overlaps */ - size_t u, v; /* Local index variable */ + size_t u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5HF_dblock_debug, FAIL) @@ -276,7 +315,7 @@ H5HF_dblock_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, dblock->block_off); blk_prefix_size = H5HF_MAN_ABS_DIRECT_OVERHEAD_DBLOCK(shared, dblock); HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, - "Size of prefix:", + "Size of block header:", blk_prefix_size); HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, "Size of block offsets:", @@ -290,7 +329,7 @@ H5HF_dblock_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, /* Check for valid free list */ if(!dblock->free_list) - if(H5HF_man_dblock_build_freelist(dblock) < 0) + if(H5HF_man_dblock_build_freelist(dblock, addr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTDECODE, FAIL, "can't decode free list for block") HDassert(dblock->free_list); @@ -333,8 +372,8 @@ H5HF_dblock_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, } /* end while */ HDfprintf(stream, "%*s%-*s %.2f%%\n", indent, "", fwidth, - "Percent of block used:", - (100.0 * (double)(dblock->size - (blk_prefix_size + amount_free)) / (double)dblock->size)); + "Percent of available space for data used:", + (100.0 * (double)((dblock->size - blk_prefix_size) - amount_free) / (double)(dblock->size - blk_prefix_size))); /* * Print the data in a VMS-style octal dump. @@ -348,3 +387,131 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5HF_dblock_debug() */ + +/*------------------------------------------------------------------------- + * Function: H5HF_iblock_debug + * + * Purpose: Prints debugging info about a fractal heap indirect block. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * koziol@ncsa.uiuc.edu + * Mar 7 2006 + * + *------------------------------------------------------------------------- + */ +herr_t +H5HF_iblock_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, + int indent, int fwidth, haddr_t hdr_addr, unsigned nrows) +{ + H5HF_t *fh = NULL; /* Fractal heap header info */ + H5HF_shared_t *shared; /* Shared fractal heap information */ + H5HF_indirect_t *iblock = NULL; /* Fractal heap direct block info */ + char temp_str[64]; /* Temporary string, for formatting */ + size_t u, v; /* Local index variable */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(H5HF_iblock_debug, FAIL) + + /* + * Check arguments. + */ + HDassert(f); + HDassert(H5F_addr_defined(addr)); + HDassert(stream); + HDassert(indent >= 0); + HDassert(fwidth >= 0); + HDassert(H5F_addr_defined(hdr_addr)); + HDassert(nrows > 0); + + /* + * Load the fractal heap header. + */ + if(NULL == (fh = H5AC_protect(f, dxpl_id, H5AC_FHEAP_HDR, hdr_addr, NULL, NULL, H5AC_READ))) + HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load fractal heap header") + + /* Get the pointer to the shared fractal heap info */ + shared = H5RC_GET_OBJ(fh->shared); + HDassert(shared); + + /* + * Load the heap direct block + */ + if(NULL == (iblock = H5AC_protect(f, dxpl_id, H5AC_FHEAP_IBLOCK, addr, &nrows, fh->shared, H5AC_READ))) + HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load fractal heap indirect block") + + /* Release the heap header */ + if(H5AC_unprotect(f, dxpl_id, H5AC_FHEAP_HDR, hdr_addr, fh, H5AC__NO_FLAGS_SET) < 0) + HDONE_ERROR(H5E_HEAP, H5E_PROTECT, FAIL, "unable to release fractal heap header") + fh = NULL; + + /* Print opening message */ + HDfprintf(stream, "%*sFractal Heap Indirect Block...\n", indent, ""); + + /* + * Print the values. + */ + HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, + "Address of fractal heap that owns this block:", + shared->heap_addr); + HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, + "Offset of indirect block in heap:", + iblock->block_off); + HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, + "Size of indirect block:", + iblock->size); + HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, + "Total # of rows:", + iblock->nrows); + HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, + "# of direct rows:", + iblock->ndir_rows); + HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, + "# of indirect rows:", + iblock->nindir_rows); + + /* Print the entry tables */ + HDfprintf(stream, "%*sDirect Block Entries (address, free space):\n", indent, ""); + for(u = 0; u < iblock->ndir_rows; u++) { + sprintf(temp_str, "Row #%u:", (unsigned)u); + HDfprintf(stream, "%*s%-*s\n", indent + 3, "", MAX(0, fwidth - 3), + temp_str); + for(v = 0; v < shared->man_dtable.cparam.width; v++) { + size_t off = (u * shared->man_dtable.cparam.width) + v; + + sprintf(temp_str, "Col #%u:", (unsigned)v); + HDfprintf(stream, "%*s%-*s %8a, %8Zu\n", indent + 6, "", MAX(0, fwidth - 6), + temp_str, + iblock->dblock_ents[off].addr, + iblock->dblock_ents[off].free_space); + } /* end for */ + } /* end for */ + HDfprintf(stream, "%*sIndirect Block Entries:\n", indent, ""); + if(iblock->nindir_rows > 0) { + for(u = 0; u < iblock->nindir_rows; u++) { + sprintf(temp_str, "Row #%u:", (unsigned)u); + HDfprintf(stream, "%*s%-*s\n", indent + 3, "", MAX(0, fwidth - 3), + temp_str); + for(v = 0; v < shared->man_dtable.cparam.width; v++) { + size_t off = (u * shared->man_dtable.cparam.width) + v; + + sprintf(temp_str, "Col #%u:", (unsigned)v); + HDfprintf(stream, "%*s%-*s %8a\n", indent + 6, "", MAX(0, fwidth - 6), + temp_str, + iblock->iblock_ents[off].addr); + } /* end for */ + } /* end for */ + } /* end if */ + else + HDfprintf(stream, "%*s%-*s\n", indent + 3, "", MAX(0, fwidth - 3), + "<none>"); + + +done: + if(iblock && H5AC_unprotect(f, dxpl_id, H5AC_FHEAP_IBLOCK, addr, iblock, H5AC__NO_FLAGS_SET) < 0) + HDONE_ERROR(H5E_HEAP, H5E_PROTECT, FAIL, "unable to release fractal heap direct block") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5HF_iblock_debug() */ + diff --git a/src/H5HFflist.c b/src/H5HFflist.c new file mode 100644 index 0000000..361bb37 --- /dev/null +++ b/src/H5HFflist.c @@ -0,0 +1,367 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu> + * Tuesday, March 7, 2006 + * + * Purpose: Fractal heap free space functions. + * + */ + +/****************/ +/* Module Setup */ +/****************/ + +#define H5HF_PACKAGE /*suppress error about including H5HFpkg */ + +/***********/ +/* Headers */ +/***********/ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5HFpkg.h" /* Fractal heaps */ +#include "H5Vprivate.h" /* Vectors and arrays */ + +/****************/ +/* Local Macros */ +/****************/ + +/* Max. height of the skip list holding free list nodes */ +#define H5HF_FLIST_DEFAULT_SKIPLIST_HEIGHT 16 + +/******************/ +/* Local Typedefs */ +/******************/ + +/* Free list node for free list sections of the same size */ +typedef struct H5HF_flist_node_t { + size_t sec_size; /* Size of all sections on list */ + H5SL_t *sec_list; /* Skip list to hold pointers to actual free list section node */ +} H5HF_flist_node_t; + + +/********************/ +/* Package Typedefs */ +/********************/ + +/* Main free list info */ +struct H5HF_freelist_t { + hsize_t tot_space; /* Total amount of space in free list */ + unsigned nbins; /* Number of bins */ + H5SL_operator_t node_free_op; /* Callback for freeing nodes when free list is destroyed */ + H5SL_t **bins; /* Pointer to array of lists of free nodes */ +}; + + +/********************/ +/* Local Prototypes */ +/********************/ +static herr_t H5HF_flist_node_free_cb(void *item, void *key, void *op_data); + + +/*********************/ +/* Package Variables */ +/*********************/ + +/* Declare a free list to manage the H5HF_freelist_t struct */ +H5FL_DEFINE_STATIC(H5HF_freelist_t); + +/* Declare a free list to manage the H5HF_flist_node_t struct */ +H5FL_DEFINE_STATIC(H5HF_flist_node_t); + +/* Declare a free list to manage the 'H5SL_t *' sequence information */ +typedef H5SL_t *H5SL_ptr_t; +H5FL_SEQ_DEFINE_STATIC(H5SL_ptr_t); + + +/*****************************/ +/* Library Private Variables */ +/*****************************/ + + +/*******************/ +/* Local Variables */ +/*******************/ + + + +/*------------------------------------------------------------------------- + * Function: H5HF_flist_create + * + * Purpose: Allocate & initialize free list for heap + * + * Return: Success: Pointer to free list structure + * + * Failure: NULL + * + * Programmer: Quincey Koziol + * Tuesday, March 7, 2006 + * + *------------------------------------------------------------------------- + */ +H5HF_freelist_t * +H5HF_flist_create(size_t max_block_size, H5SL_operator_t node_free_op) +{ + H5HF_freelist_t *flist; /* New free list structure */ + H5HF_freelist_t *ret_value; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT(H5HF_flist_create) + + /* Check arguments. */ + + /* + * Allocate top free list structure + */ + if(NULL == (flist = H5FL_MALLOC(H5HF_freelist_t))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fractal heap free list") + + /* Set free list parameters */ + flist->tot_space = 0; + flist->nbins = H5V_log2_of2(max_block_size); + flist->node_free_op = node_free_op; + + /* Allocate the bins for free space sizes */ + if(NULL == (flist->bins = H5FL_SEQ_CALLOC(H5SL_ptr_t, flist->nbins))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for free list bins") + + /* Set return value */ + ret_value = flist; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5HF_flist_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5HF_flist_add + * + * Purpose: Add a section of free space in a direct block to the free list + * + * Return: Success: non-negative + * + * Failure: negative + * + * Programmer: Quincey Koziol + * Tuesday, March 7, 2006 + * + *------------------------------------------------------------------------- + */ +herr_t +H5HF_flist_add(H5HF_freelist_t *flist, void *node, size_t *size_key, haddr_t *addr_key) +{ + H5HF_flist_node_t *flist_node = NULL; /* Pointer to free list node of the correct size */ + unsigned bin; /* Bin to put the free space section in */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT(H5HF_flist_add) +#ifdef QAK +HDfprintf(stderr, "%s: *size_key = %Zu, *addr_key = %a\n", FUNC, *size_key, *addr_key); +#endif /* QAK */ + + /* Check arguments. */ + HDassert(flist); + HDassert(node); + HDassert(size_key); + HDassert(addr_key); + + /* Determine correct bin which holds items of the section's size */ + bin = H5V_log2_gen((hsize_t)*size_key); + if(flist->bins[bin] == NULL) { + if(NULL == (flist->bins[bin] = H5SL_create(H5SL_TYPE_SIZE, 0.5, H5HF_FLIST_DEFAULT_SKIPLIST_HEIGHT))) + HGOTO_ERROR(H5E_HEAP, H5E_CANTCREATE, FAIL, "can't create skip list for free list nodes") + } /* end if */ + else { + /* Check for node list of the correct size already */ + flist_node = H5SL_search(flist->bins[bin], size_key); + } /* end else */ + + /* Check if we need to create a new skip list for nodes of this size */ + if(flist_node == NULL) { + /* Allocate new free list size node */ + if(NULL == (flist_node = H5FL_MALLOC(H5HF_flist_node_t))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for fractal heap free list") + + /* Initialize the free list size node */ + flist_node->sec_size = *size_key; + if(NULL == (flist_node->sec_list = H5SL_create(H5SL_TYPE_HADDR, 0.5, H5HF_FLIST_DEFAULT_SKIPLIST_HEIGHT))) + HGOTO_ERROR(H5E_HEAP, H5E_CANTCREATE, FAIL, "can't create skip list for free list nodes") + + /* Insert new free list size node into bin's list */ + if(H5SL_insert(flist->bins[bin], flist_node, &flist_node->sec_size) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTINSERT, FAIL, "can't insert free list node into skip list") + } /* end if */ + + /* Insert free list node into correct skip list */ + if(H5SL_insert(flist_node->sec_list, node, addr_key) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTINSERT, FAIL, "can't insert free list node into skip list") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5HF_flist_add() */ + + +/*------------------------------------------------------------------------- + * Function: H5HF_flist_find + * + * Purpose: Locate a section of free space (in existing free list) that + * is large enough to fulfill request. + * + * Return: Success: non-negative + * + * Failure: negative + * + * Programmer: Quincey Koziol + * Tuesday, March 7, 2006 + * + *------------------------------------------------------------------------- + */ +htri_t +H5HF_flist_find(H5HF_freelist_t *flist, size_t request, void **node) +{ + H5HF_flist_node_t *flist_node; /* Free list size node */ + unsigned bin; /* Bin to put the free space section in */ + herr_t ret_value = FALSE; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT(H5HF_flist_find) + + /* Check arguments. */ + HDassert(flist); + HDassert(request > 0); + HDassert(node); + + /* Determine correct bin which holds items of at least the section's size */ + bin = H5V_log2_gen((hsize_t)request); + while(bin < flist->nbins && flist->bins[bin] == NULL) + bin++; + + /* Find the first free space section that is large enough to fulfill request */ + /* (Since the bins use skip lists to track the sizes of the address-ordered + * lists, this is actually a "best fit" algorithm) + */ +#ifdef QAK +HDfprintf(stderr, "%s: flist->nbins = %u\n", FUNC, flist->nbins); +HDfprintf(stderr, "%s: bin = %u\n", FUNC, bin); +#endif /* QAK */ + if(bin < flist->nbins) + do { + /* Look for large enough free list section in this bin */ + if(flist->bins[bin]) + /* Check for large enough list of sections on list */ + if((flist_node = H5SL_greater(flist->bins[bin], &request))) { + /* Take first node off of the list (ie. node w/lowest address) */ + if(NULL == (*node = H5SL_remove_first(flist_node->sec_list))) + HGOTO_ERROR(H5E_HEAP, H5E_CANTDELETE, FAIL, "can't remove free list node from skip list") + + /* Check for no more nodes on list of that size */ + if(H5SL_count(flist_node->sec_list) == 0) { + H5HF_flist_node_t *tmp_flist_node; /* Free list size node */ + + /* Remove size tracking list from bin */ + tmp_flist_node = H5SL_remove(flist->bins[bin], &flist_node->sec_size); + if(tmp_flist_node == NULL || tmp_flist_node != flist_node) + HGOTO_ERROR(H5E_HEAP, H5E_CANTDELETE, FAIL, "can't remove free list node from skip list") + + /* Destroy skip list for size tracking node */ + if(H5SL_close(flist_node->sec_list) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTCLOSEOBJ, FAIL, "can't destroy size tracking node's skip list") + + /* Release free list node */ + H5FL_FREE(H5HF_flist_node_t, flist_node); + } /* end if */ + + HGOTO_DONE(TRUE) + } /* end if */ + + /* Advance to next larger bin */ + bin++; + } while(bin < flist->nbins); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5HF_flist_find() */ + + +/*------------------------------------------------------------------------- + * Function: H5HF_flist_node_free_cb + * + * Purpose: Free a size-tracking node for a bin + * + * Return: Success: non-negative + * + * Failure: negative + * + * Programmer: Quincey Koziol + * Saturday, March 11, 2006 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5HF_flist_node_free_cb(void *item, void UNUSED *key, void *op_data) +{ + H5HF_flist_node_t *flist_node = (H5HF_flist_node_t *)item; /* Temporary pointer to free list node */ + + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_flist_node_free_cb) + + HDassert(flist_node); + + /* Release the skip list for sections of this size */ + H5SL_destroy(flist_node->sec_list, (H5SL_operator_t)op_data, NULL); + + /* Release free list node */ + H5FL_FREE(H5HF_flist_node_t, flist_node); + + FUNC_LEAVE_NOAPI(0) +} /* H5HF_flist_node_free_cb() */ + + +/*------------------------------------------------------------------------- + * Function: H5HF_flist_free + * + * Purpose: Destroy & deallocate free list structure + * + * Return: Success: non-negative + * + * Failure: negative + * + * Programmer: Quincey Koziol + * Tuesday, March 7, 2006 + * + *------------------------------------------------------------------------- + */ +herr_t +H5HF_flist_free(H5HF_freelist_t *flist) +{ + unsigned u; /* Local index variable */ + + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_flist_free) + + /* Check arguments. */ + HDassert(flist); + + /* Clear out lists of nodes */ + for(u = 0; u < flist->nbins; u++) + if(flist->bins[u]) { + H5SL_destroy(flist->bins[u], H5HF_flist_node_free_cb, (void *)flist->node_free_op); + flist->bins[u] = NULL; + } /* end if */ + + /* Release bins for skip lists */ + H5FL_SEQ_FREE(H5SL_ptr_t, flist->bins); + + /* Free fractal heap free list info */ + H5FL_FREE(H5HF_freelist_t, flist); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* H5HF_flist_free() */ + diff --git a/src/H5HFint.c b/src/H5HFint.c index 151b19f..fce8640 100644 --- a/src/H5HFint.c +++ b/src/H5HFint.c @@ -33,9 +33,10 @@ /* Headers */ /***********/ #include "H5private.h" /* Generic Functions */ -#include "H5HFpkg.h" /* Fractal heaps */ #include "H5Eprivate.h" /* Error handling */ +#include "H5HFpkg.h" /* Fractal heaps */ #include "H5MFprivate.h" /* File memory management */ +#include "H5MMprivate.h" /* Memory management */ #include "H5Vprivate.h" /* Vectors and arrays */ /****************/ @@ -44,7 +45,8 @@ /* Limit on the size of the max. direct block size */ /* (This is limited to 32-bits currently, because I think it's unlikely to - * need to be larger, and the 32-bit limit for H5V_log2_of2(n) - QAK) + * need to be larger, the 32-bit limit for H5V_log2_of2(n), and + * some offsets/sizes are encoded with a maxiumum of 32-bits - QAK) */ #define H5HL_MAX_DIRECT_SIZE_LIMIT ((hsize_t)2 * 1024 * 1024 * 1024) @@ -54,15 +56,45 @@ /********************/ +/* Package Typedefs */ +/********************/ + +/* Direct block free list section node */ +struct H5HF_section_free_node_t { + haddr_t sect_addr; /* Address of free list section in the file */ + /* (Not actually used as address, used as unique ID for free list node) */ + haddr_t block_addr; /* Address of direct block for free section */ + size_t sect_size; /* Size of free space section */ + /* (section size is "object size", without the metadata overhead, since metadata overhead varies from block to block) */ + size_t block_size; /* Size of direct block */ + /* (Needed to retrieve direct block) */ +}; + + +/********************/ /* Local Prototypes */ /********************/ +/* Doubling table routines */ +static herr_t H5HF_dtable_init(const H5HF_shared_t *shared, H5HF_dtable_t *dtable); +static herr_t H5HF_dtable_lookup(const H5HF_dtable_t *dtable, hsize_t off, + unsigned *row, unsigned *col); + +/* Shared heap header routines */ static herr_t H5HF_shared_free(void *_shared); + +/* Direct block routines */ +static herr_t H5HF_dblock_section_node_free_cb(void *item, void UNUSED *key, + void UNUSED *op_data); +static herr_t H5HF_man_dblock_inc_size(H5HF_shared_t *shared); static herr_t H5HF_man_dblock_create(H5RC_t *fh_shared, hid_t dxpl_id, size_t block_size, hsize_t block_off, haddr_t *addr_p); -static herr_t H5HF_man_dblock_insert(H5RC_t *fh_shared, hid_t dxpl_id, - haddr_t block_addr, size_t block_size, size_t obj_size, const void *obj, - void *id); +static herr_t H5HF_man_dblock_new(H5RC_t *fh_shared, hid_t dxpl_id, + size_t request); + +/* Indirect block routines */ +static herr_t H5HF_man_iblock_create(H5RC_t *fh_shared, hid_t dxpl_id, + hsize_t block_off, unsigned nrows, haddr_t *addr_p); /*********************/ /* Package Variables */ @@ -77,6 +109,18 @@ H5FL_DEFINE(H5HF_direct_free_head_t); /* Declare a free list to manage the H5HF_direct_free_node_t struct */ H5FL_DEFINE(H5HF_direct_free_node_t); +/* Declare a free list to manage the H5HF_section_free_node_t struct */ +H5FL_DEFINE(H5HF_section_free_node_t); + +/* Declare a free list to manage the H5HF_indirect_t struct */ +H5FL_DEFINE(H5HF_indirect_t); + +/* Declare a free list to manage the H5HF_indirect_dblock_ent_t sequence information */ +H5FL_SEQ_DEFINE(H5HF_indirect_dblock_ent_t); + +/* Declare a free list to manage the H5HF_indirect_iblock_ent_t sequence information */ +H5FL_SEQ_DEFINE(H5HF_indirect_iblock_ent_t); + /*****************************/ /* Library Private Variables */ @@ -93,6 +137,101 @@ H5FL_DEFINE_STATIC(H5HF_shared_t); /*------------------------------------------------------------------------- + * Function: H5HF_dtable_init + * + * Purpose: Initialize values for doubling table + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * koziol@ncsa.uiuc.edu + * Mar 6 2006 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5HF_dtable_init(const H5HF_shared_t *shared, H5HF_dtable_t *dtable) +{ + hsize_t tmp_block_size; /* Temporary block size */ + size_t u; /* Local index variable */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT(H5HF_dtable_init) + + /* + * Check arguments. + */ + HDassert(shared); + HDassert(dtable); + + /* Compute/cache some values */ + dtable->first_row_bits = H5V_log2_of2(dtable->cparam.start_block_size) + + H5V_log2_of2(dtable->cparam.width); + dtable->max_root_indirect_rows = (dtable->cparam.max_index - dtable->first_row_bits) + 1; + dtable->max_direct_rows = (H5V_log2_of2(dtable->cparam.max_direct_size) - + H5V_log2_of2(dtable->cparam.start_block_size)) + 2; + dtable->num_id_first_row = dtable->cparam.start_block_size * dtable->cparam.width; + dtable->max_dir_blk_off_size = H5HF_SIZEOF_OFFSET_LEN(dtable->cparam.max_direct_size); + dtable->next_dir_size = dtable->cparam.start_block_size; + + /* Build table of block sizes for each row */ + if(NULL == (dtable->row_block_size = H5MM_malloc(dtable->max_root_indirect_rows * sizeof(hsize_t)))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't create doubling table block size table") + tmp_block_size = dtable->cparam.start_block_size; + dtable->row_block_size[0] = dtable->cparam.start_block_size; + for(u = 1; u < dtable->max_root_indirect_rows; u++) { + dtable->row_block_size[u] = tmp_block_size; + tmp_block_size *= 2; + } /* end for */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5HF_dtable_init() */ + + +/*------------------------------------------------------------------------- + * Function: H5HF_dtable_lookup + * + * Purpose: Compute the row & col of an offset in a doubling-table + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * koziol@ncsa.uiuc.edu + * Mar 6 2006 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5HF_dtable_lookup(const H5HF_dtable_t *dtable, hsize_t off, unsigned *row, unsigned *col) +{ + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_dtable_lookup) + + /* + * Check arguments. + */ + HDassert(dtable); + HDassert(row); + HDassert(col); + + /* Check for offset in first row */ + if(off < dtable->num_id_first_row) { + *row = 0; + *col = off / dtable->cparam.start_block_size; + } /* end if */ + else { + unsigned high_bit = H5V_log2_gen(off); /* Determine the high bit in the offset */ + hsize_t off_mask = 1 << high_bit; /* Compute mask for determining column */ + + *row = (high_bit - dtable->first_row_bits) + 1; + *col = (off - off_mask) / dtable->row_block_size[*row]; + } /* end else */ + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5HF_dtable_lookup() */ + + +/*------------------------------------------------------------------------- * Function: H5HF_shared_alloc * * Purpose: Allocate shared fractal heap info @@ -153,7 +292,7 @@ done: herr_t H5HF_shared_own(H5HF_t *fh, H5HF_shared_t *shared) { - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5HF_shared_own) @@ -164,9 +303,14 @@ H5HF_shared_own(H5HF_t *fh, H5HF_shared_t *shared) HDassert(shared); /* Compute/cache some values */ - shared->fixed_len_obj = (shared->fixed_len_size > 0); shared->ref_count_obj = (shared->ref_count_size > 0); - shared->heap_off_size = H5HF_SIZEOF_OFFSET_BITS(shared->man_dtable_info.cparam.max_index); + shared->heap_off_size = H5HF_SIZEOF_OFFSET_BITS(shared->man_dtable.cparam.max_index); + if(H5HF_dtable_init(shared, &shared->man_dtable) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't initialize doubling table info") + + /* Create the free-list structure for the heap */ + if(NULL == (shared->flist = H5HF_flist_create(shared->man_dtable.cparam.max_direct_size, H5HF_dblock_section_node_free_cb))) + HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't initialize free list info") /* Make shared heap info reference counted */ if(NULL == (fh->shared = H5RC_create(shared, H5HF_shared_free))) @@ -214,6 +358,8 @@ H5HF_shared_create(H5F_t *f, H5HF_t *fh, haddr_t fh_addr, H5HF_create_t *cparam) if(!POWER_OF_TWO(cparam->managed.max_direct_size) || (cparam->managed.max_direct_size == 0 || cparam->managed.max_direct_size > H5HL_MAX_DIRECT_SIZE_LIMIT)) HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, FAIL, "max. direct block size not power of two") + if(cparam->managed.max_direct_size < cparam->standalone_size) + HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, FAIL, "max. direct block size not large enough to hold all managed blocks") if(cparam->managed.max_index > (8 * H5F_SIZEOF_SIZE(f)) || cparam->managed.max_index == 0) HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, FAIL, "max. direct block size not power of two") #endif /* NDEBUG */ @@ -226,9 +372,11 @@ H5HF_shared_create(H5F_t *f, H5HF_t *fh, haddr_t fh_addr, H5HF_create_t *cparam) shared->heap_addr = fh_addr; shared->addrmap = cparam->addrmap; shared->standalone_size = cparam->standalone_size; - shared->fixed_len_size = cparam->fixed_len_size; shared->ref_count_size = cparam->ref_count_size; - HDmemcpy(&(shared->man_dtable_info.cparam), &(cparam->managed), sizeof(H5HF_dtable_cparam_t)); + HDmemcpy(&(shared->man_dtable.cparam), &(cparam->managed), sizeof(H5HF_dtable_cparam_t)); + + /* Note that the shared info is dirty (it's not written to the file yet) */ + shared->dirty = TRUE; /* Make shared heap info reference counted */ if(H5HF_shared_own(fh, shared) < 0) @@ -266,6 +414,13 @@ H5HF_shared_free(void *_shared) /* Sanity check */ HDassert(shared); + /* Free the free list information for the heap */ + if(shared->flist) + H5HF_flist_free(shared->flist); + + /* Free the block size lookup table for the doubling table */ + H5MM_xfree(shared->man_dtable.row_block_size); + /* Free the shared info itself */ H5FL_FREE(H5HF_shared_t, shared); @@ -274,84 +429,49 @@ H5HF_shared_free(void *_shared) /*------------------------------------------------------------------------- - * Function: H5HF_man_alloc_end + * Function: H5HF_man_dblock_inc_size * - * Purpose: Allocate space for an object at the end of the managed obj. heap + * Purpose: Increment size of next direct block * - * Return: Non-negative on success (with heap ID of new object - * filled in), negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@ncsa.uiuc.edu - * Feb 27 2006 + * Mar 6 2006 * *------------------------------------------------------------------------- */ -herr_t -H5HF_man_alloc_end(H5RC_t *fh_shared, hid_t dxpl_id, unsigned *fh_flags_ptr, - size_t size, const void *obj, void *id/*out*/) +static herr_t +H5HF_man_dblock_inc_size(H5HF_shared_t *shared) { - H5HF_shared_t *shared; /* Shared heap information */ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI_NOINIT(H5HF_man_alloc_end) -HDfprintf(stderr, "%s: size = %Zu\n", FUNC, size); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_man_dblock_inc_size) /* * Check arguments. */ - HDassert(fh_shared); - HDassert(fh_flags_ptr); - HDassert(size > 0); - HDassert(obj); - HDassert(id); - - /* Get the pointer to the shared heap info */ - shared = H5RC_GET_OBJ(fh_shared); HDassert(shared); - /* Check if this is the first object in the heap */ - if(shared->next_man_block == 0) { - /* Check if the object can fit in a direct block of the starting block size */ -#ifndef QAK -HDfprintf(stderr, "%s: H5HF_MAN_ABS_DIRECT_OVERHEAD_SIZE = %u\n", FUNC, H5HF_MAN_ABS_DIRECT_OVERHEAD_SIZE(shared, shared->man_dtable_info.cparam.start_block_size)); -HDfprintf(stderr, "%s: H5HF_MAN_ABS_DIRECT_OBJ_PREFIX_LEN_SIZE = %u\n", FUNC, H5HF_MAN_ABS_DIRECT_OBJ_PREFIX_LEN_SIZE(shared, shared->man_dtable_info.cparam.start_block_size)); -#endif /* QAK */ - if((size + H5HF_MAN_ABS_DIRECT_OVERHEAD_SIZE(shared, shared->man_dtable_info.cparam.start_block_size) - + H5HF_MAN_ABS_DIRECT_OBJ_PREFIX_LEN_SIZE(shared, shared->man_dtable_info.cparam.start_block_size)) - <= shared->man_dtable_info.cparam.start_block_size) { - haddr_t dblock_addr; /* Address of new direct block */ - size_t dblock_size; /* Size of new direct block */ - - /* Allocate initial direct block */ - dblock_size = shared->man_dtable_info.cparam.start_block_size; - if(H5HF_man_dblock_create(fh_shared, dxpl_id, dblock_size, (hsize_t)0, &dblock_addr) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate fractal heap direct block") -HDfprintf(stderr, "%s: dblock_addr = %a\n", FUNC, dblock_addr); - - /* Point root at new direct block */ - shared->next_man_block = dblock_size; - shared->man_dtable_info.curr_root_rows = 0; - shared->man_dtable_info.table_addr = dblock_addr; - - /* Mark heap header as modified */ - *fh_flags_ptr |= H5AC__DIRTIED_FLAG; - - /* Attempt to insert object into direct block */ - if(H5HF_man_dblock_insert(fh_shared, dxpl_id, dblock_addr, dblock_size, size, obj, id) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't insert object into fractal heap direct block") - } /* end if */ - else { -HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "first object doesn't fit into starting direct block") - } /* end else */ + /* Check for another block of the same size, in the same row */ + if(shared->man_dtable.next_dir_col < shared->man_dtable.cparam.width) { + /* Move to next column in doubling table */ + shared->man_dtable.next_dir_col++; } /* end if */ else { -HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "allocating objects at end of heap not supported yet") + /* Check for "doubling" block to next row or resetting to initial size */ +/* XXX: The maximum size will vary for different indirect blocks... */ + if(shared->man_dtable.next_dir_size < shared->man_dtable.cparam.max_direct_size) + /* Double block size */ + shared->man_dtable.next_dir_size *= 2; + else + /* Reset to starting block size */ + shared->man_dtable.next_dir_size = shared->man_dtable.cparam.start_block_size; + + /* Set next column */ + shared->man_dtable.next_dir_col = 0; } /* end else */ -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HF_man_alloc_end() */ + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5HF_man_dblock_inc_size() */ /*------------------------------------------------------------------------- @@ -368,10 +488,11 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5HF_man_dblock_create(H5RC_t *fh_shared, hid_t dxpl_id, size_t block_size, - hsize_t block_off, haddr_t *addr_p) +H5HF_man_dblock_create(H5RC_t *fh_shared, hid_t dxpl_id, + size_t block_size, hsize_t block_off, haddr_t *addr_p) { H5HF_direct_free_node_t *node; /* Pointer to free list node for block */ + H5HF_section_free_node_t *sec_node; /* Pointer to free list section for block */ H5HF_shared_t *shared; /* Pointer to shared heap info */ H5HF_direct_t *dblock = NULL; /* Pointer to direct block */ herr_t ret_value = SUCCEED; /* Return value */ @@ -389,7 +510,7 @@ H5HF_man_dblock_create(H5RC_t *fh_shared, hid_t dxpl_id, size_t block_size, * Allocate file and memory data structures. */ if(NULL == (dblock = H5FL_MALLOC(H5HF_direct_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for fractal heap header") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for fractal heap direct block") /* Reset the metadata cache info for the heap header */ HDmemset(&dblock->cache_info, 0, sizeof(H5AC_info_t)); @@ -403,7 +524,9 @@ H5HF_man_dblock_create(H5RC_t *fh_shared, hid_t dxpl_id, size_t block_size, HDassert(shared); /* Set info for direct block */ +#ifdef QAK HDfprintf(stderr, "%s: size = %Zu, block_off = %Hu\n", FUNC, block_size, block_off); +#endif /* QAK */ dblock->size = block_size; dblock->block_off = block_off; dblock->blk_off_size = H5HF_SIZEOF_OFFSET_LEN(block_size); @@ -434,15 +557,39 @@ HDmemset(dblock->blk, 0, dblock->size); node->prev = node->next = NULL; /* Attach to free list head */ +/* XXX: Convert this list to a skip list? */ dblock->free_list->first = node; /* Allocate space for the header on disk */ if(HADDR_UNDEF == (*addr_p = H5MF_alloc(shared->f, H5FD_MEM_FHEAP_DBLOCK, dxpl_id, (hsize_t)block_size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "file allocation failed for fractal heap header") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "file allocation failed for fractal heap direct block") - /* Cache the new fractal heap header */ + /* Create free list section node */ + if(NULL == (sec_node = H5FL_MALLOC(H5HF_section_free_node_t))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for direct block free list section") + + /* Set section's information */ + sec_node->block_addr = *addr_p; + sec_node->block_size = block_size; + sec_node->sect_addr = *addr_p + node->my_offset; + /* (section size is "object size", without the metadata overhead) */ + sec_node->sect_size = node->size - H5HF_MAN_ABS_DIRECT_OBJ_PREFIX_LEN_DBLOCK(shared, dblock); + + /* Add new free space to the global list of space */ + if(H5HF_flist_add(shared->flist, sec_node, &sec_node->sect_size, &sec_node->sect_addr) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't add direct block free space to global list") + + /* Update shared heap info */ + shared->total_man_free += dblock->blk_free_space; + shared->total_size += dblock->size; + shared->man_size += dblock->size; + + /* Mark heap header as modified */ + shared->dirty = TRUE; + + /* Cache the new fractal heap direct block */ if(H5AC_set(shared->f, dxpl_id, H5AC_FHEAP_DBLOCK, *addr_p, dblock, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't add fractal heap header to cache") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't add fractal heap direct block to cache") done: if(ret_value < 0) @@ -454,6 +601,34 @@ done: /*------------------------------------------------------------------------- + * Function: H5HF_dblock_section_node_free_cb + * + * Purpose: Free a section node for a block + * + * Return: Success: non-negative + * + * Failure: negative + * + * Programmer: Quincey Koziol + * Monday, March 13, 2006 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5HF_dblock_section_node_free_cb(void *item, void UNUSED *key, void UNUSED *op_data) +{ + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_dblock_section_node_free_cb) + + HDassert(item); + + /* Release the sections */ + H5FL_FREE(H5HF_section_free_node_t, item); + + FUNC_LEAVE_NOAPI(0) +} /* H5HF_dblock_section_node_free_cb() */ + + +/*------------------------------------------------------------------------- * Function: H5HF_man_dblock_build_freelist * * Purpose: Parse the free list information for a direct block and build @@ -468,9 +643,10 @@ done: *------------------------------------------------------------------------- */ herr_t -H5HF_man_dblock_build_freelist(H5HF_direct_t *dblock) +H5HF_man_dblock_build_freelist(H5HF_direct_t *dblock, haddr_t dblock_addr) { H5HF_direct_free_head_t *head = NULL; /* Pointer to free list head for block */ + H5HF_shared_t *shared; /* Pointer to shared heap info */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5HF_man_dblock_build_freelist) @@ -489,6 +665,7 @@ H5HF_man_dblock_build_freelist(H5HF_direct_t *dblock) if(dblock->free_list_head == 0) head->first = NULL; else { + H5HF_section_free_node_t *sec_node; /* Pointer to free list section for block */ H5HF_direct_free_node_t *node = NULL; /* Pointer to free list node for block */ H5HF_direct_free_node_t *prev_node; /* Pointer to previous free list node for block */ hsize_t free_len; /* Length of free list info */ @@ -496,6 +673,10 @@ H5HF_man_dblock_build_freelist(H5HF_direct_t *dblock) hsize_t prev_off; /* Prev node offset in block */ uint8_t *p; /* Temporary pointer to free node info */ + /* Get the pointer to the shared B-tree info */ + shared = H5RC_GET_OBJ(dblock->shared); + HDassert(shared); + /* Point to first node in free list */ p = dblock->blk + dblock->free_list_head; @@ -516,6 +697,21 @@ H5HF_man_dblock_build_freelist(H5HF_direct_t *dblock) /* Attach to free list head */ head->first = node; + /* Create free list section node */ + if(NULL == (sec_node = H5FL_MALLOC(H5HF_section_free_node_t))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for direct block free list section") + + /* Set section's information */ + sec_node->block_addr = dblock_addr; + sec_node->block_size = dblock->size; + sec_node->sect_addr = dblock_addr + node->my_offset; + /* (section size is "object size", without the metadata overhead) */ + sec_node->sect_size = node->size - H5HF_MAN_ABS_DIRECT_OBJ_PREFIX_LEN_DBLOCK(shared, dblock); + + /* Add new free space to the global list of space */ + if(H5HF_flist_add(shared->flist, sec_node, &sec_node->sect_size, &sec_node->sect_addr) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't add direct block free space to global list") + /* Set up trailing node pointer */ prev_node = node; prev_off = next_off; @@ -540,6 +736,21 @@ H5HF_man_dblock_build_freelist(H5HF_direct_t *dblock) node->prev = prev_node; node->next = NULL; + /* Create free list section node */ + if(NULL == (sec_node = H5FL_MALLOC(H5HF_section_free_node_t))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for direct block free list section") + + /* Set section's information */ + sec_node->block_addr = dblock_addr; + sec_node->block_size = dblock->size; + sec_node->sect_addr = dblock_addr + node->my_offset; + /* (section size is "object size", without the metadata overhead) */ + sec_node->sect_size = node->size - H5HF_MAN_ABS_DIRECT_OBJ_PREFIX_LEN_DBLOCK(shared, dblock); + + /* Add new free space to the global list of space */ + if(H5HF_flist_add(shared->flist, sec_node, &sec_node->sect_size, &sec_node->sect_addr) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't add direct block free space to global list") + /* Update trailing info */ prev_node->next = node; prev_off = next_off; @@ -559,34 +770,260 @@ done: /*------------------------------------------------------------------------- - * Function: H5HF_man_dblock_insert + * Function: H5HF_man_dblock_new * - * Purpose: Allocate space in a managed direct block + * Purpose: Create a direct block large enough to hold an object of + * the requested size * * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * koziol@ncsa.uiuc.edu - * Feb 28 2006 + * Mar 13 2006 * *------------------------------------------------------------------------- */ static herr_t -H5HF_man_dblock_insert(H5RC_t *fh_shared, hid_t dxpl_id, haddr_t block_addr, - size_t block_size, size_t obj_size, const void *obj, void *id) +H5HF_man_dblock_new(H5RC_t *fh_shared, hid_t dxpl_id, size_t request) +{ + size_t min_dblock_size; /* Min. size of direct block to allocate */ + H5HF_shared_t *shared; /* Shared heap information */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT(H5HF_man_dblock_new) +#ifdef QAK +HDfprintf(stderr, "%s: request = %Zu\n", FUNC, request); +#endif /* QAK */ + + /* + * Check arguments. + */ + HDassert(fh_shared); + HDassert(request > 0); + + /* Get the pointer to the shared heap info */ + shared = H5RC_GET_OBJ(fh_shared); + HDassert(shared); + + /* Compute the min. size of the direct block needed to fulfill the request */ + if(request < shared->man_dtable.cparam.start_block_size) + min_dblock_size = shared->man_dtable.cparam.start_block_size; + else { + min_dblock_size = 2 * H5V_log2_gen((hsize_t)request); + HDassert(min_dblock_size <= shared->man_dtable.cparam.max_direct_size); + } /* end else */ + + /* Adjust the size of block needed to fulfill request, with overhead */ +#ifdef QAK +HDfprintf(stderr, "%s: H5HF_MAN_ABS_DIRECT_OVERHEAD_SIZE = %u\n", FUNC, H5HF_MAN_ABS_DIRECT_OVERHEAD_SIZE(shared, shared->man_dtable.cparam.start_block_size)); +HDfprintf(stderr, "%s: H5HF_MAN_ABS_DIRECT_OBJ_PREFIX_LEN_SIZE = %u\n", FUNC, H5HF_MAN_ABS_DIRECT_OBJ_PREFIX_LEN_SIZE(shared, shared->man_dtable.cparam.start_block_size)); +#endif /* QAK */ + if((min_dblock_size - request) < (H5HF_MAN_ABS_DIRECT_OVERHEAD_SIZE(shared, min_dblock_size) + + H5HF_MAN_ABS_DIRECT_OBJ_PREFIX_LEN_SIZE(shared, min_dblock_size))) + min_dblock_size *= 2; +#ifdef QAK +HDfprintf(stderr, "%s: min_dblock_size = %Zu\n", FUNC, min_dblock_size); +HDfprintf(stderr, "%s: shared->man_dtable.next_dir_size = %Zu\n", FUNC, shared->man_dtable.next_dir_size); +#endif /* QAK */ + + /* Add direct block to heap */ + if(min_dblock_size <= shared->man_dtable.next_dir_size) { + haddr_t dblock_addr; /* Address of new direct block */ + size_t dblock_size; /* SIze of new direct block */ + + /* Create new direct block */ + dblock_size = shared->man_dtable.next_dir_size; + if(H5HF_man_dblock_create(fh_shared, dxpl_id, dblock_size, shared->man_dtable.next_dir_block, &dblock_addr) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "can't allocate fractal heap direct block") +#ifdef QAK +HDfprintf(stderr, "%s: dblock_addr = %a\n", FUNC, dblock_addr); +HDfprintf(stderr, "%s: shared->man_dtable.next_dir_block = %Hu\n", FUNC, shared->man_dtable.next_dir_block); +#endif /* QAK */ + + /* Check if this is the first block in the heap */ + if(shared->man_dtable.next_dir_block == 0) { + /* Point root at new direct block */ + shared->man_dtable.curr_root_rows = 0; + shared->man_dtable.table_addr = dblock_addr; + } /* end if */ + /* Check for the second block in the heap */ + else if(shared->man_dtable.curr_root_rows == 0) { + H5HF_indirect_t *iblock = NULL; /* Pointer to indirect block to create */ + H5HF_direct_t *dblock = NULL; /* Pointer to direct block to query */ + haddr_t iblock_addr; /* Indirect block's address */ + unsigned nrows; /* Number of rows for root indirect block */ + + /* Check for allocating entire root indirect block initially */ + if(shared->man_dtable.cparam.start_root_rows == 0) + nrows = shared->man_dtable.max_root_indirect_rows; + else + nrows = shared->man_dtable.cparam.start_root_rows; + + /* Allocate root indirect block */ + if(H5HF_man_iblock_create(fh_shared, dxpl_id, (hsize_t)0, nrows, &iblock_addr) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "can't allocate fractal heap indirect block") +#ifdef QAK +HDfprintf(stderr, "%s: iblock_addr = %a\n", FUNC, iblock_addr); +#endif /* QAK */ + + /* Lock indirect block */ + if(NULL == (iblock = H5AC_protect(shared->f, dxpl_id, H5AC_FHEAP_IBLOCK, iblock_addr, &nrows, fh_shared, H5AC_WRITE))) + HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap indirect block") + + /* Lock first (root) direct block */ + if(NULL == (dblock = H5AC_protect(shared->f, dxpl_id, H5AC_FHEAP_DBLOCK, shared->man_dtable.table_addr, &shared->man_dtable.cparam.start_block_size, fh_shared, H5AC_READ))) + HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap direct block") + + /* Point indirect block at direct block to add */ + iblock->dblock_ents[0].addr = shared->man_dtable.table_addr; + iblock->dblock_ents[0].free_space = dblock->blk_free_space; + + /* Unlock first (root) direct block */ + if(H5AC_unprotect(shared->f, dxpl_id, H5AC_FHEAP_DBLOCK, shared->man_dtable.table_addr, dblock, H5AC__NO_FLAGS_SET) < 0) + HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release fractal heap direct block") + dblock = NULL; + + /* Lock new direct block */ + if(NULL == (dblock = H5AC_protect(shared->f, dxpl_id, H5AC_FHEAP_DBLOCK, dblock_addr, &shared->man_dtable.cparam.start_block_size, fh_shared, H5AC_READ))) + HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap direct block") + + /* Point indirect block at new direct block */ + iblock->dblock_ents[1].addr = dblock_addr; + iblock->dblock_ents[1].free_space = dblock->blk_free_space; + + /* Unlock new direct block */ + if(H5AC_unprotect(shared->f, dxpl_id, H5AC_FHEAP_DBLOCK, dblock_addr, dblock, H5AC__NO_FLAGS_SET) < 0) + HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release fractal heap direct block") + dblock = NULL; + + /* Point heap header at new indirect block */ + shared->man_dtable.curr_root_rows = nrows; + shared->man_dtable.table_addr = iblock_addr; + + /* Mark heap header as modified */ + shared->dirty = TRUE; + + /* Release the indirect block (marked as dirty) */ + if(H5AC_unprotect(shared->f, dxpl_id, H5AC_FHEAP_IBLOCK, iblock_addr, iblock, H5AC__DIRTIED_FLAG) < 0) + HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release fractal heap indirect block") + } /* end if */ + else { +HDfprintf(stderr, "%s: Adding >2nd direct block to heap not supported\n", FUNC); +HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "allocating objects from non root block not supported yet") + } /* end else */ + + /* Update shared info */ + shared->man_dtable.next_dir_block += dblock_size; + + /* Increment size of next block */ + H5HF_man_dblock_inc_size(shared); + } /* end if */ + else { +HDfprintf(stderr, "%s: Skipping direct block sizes not supported\n", FUNC); +HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "allocating objects from non root block not supported yet") + } /* end else */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5HF_man_dblock_new() */ + + +/*------------------------------------------------------------------------- + * Function: H5HF_man_find + * + * Purpose: Find space for an object in a managed obj. heap + * + * Return: Non-negative on success (with direct block info + * filled in), negative on failure + * + * Programmer: Quincey Koziol + * koziol@ncsa.uiuc.edu + * Mar 13 2006 + * + *------------------------------------------------------------------------- + */ +herr_t +H5HF_man_find(H5RC_t *fh_shared, hid_t dxpl_id, size_t request, + H5HF_section_free_node_t **sec_node/*out*/) +{ + H5HF_shared_t *shared; /* Shared heap information */ + htri_t node_found; /* Whether an existing free list node was found */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT(H5HF_man_find) +#ifdef QAK +HDfprintf(stderr, "%s: request = %Zu\n", FUNC, request); +#endif /* QAK */ + + /* + * Check arguments. + */ + HDassert(fh_shared); + HDassert(request > 0); + HDassert(sec_node); + + /* Get the pointer to the shared heap info */ + shared = H5RC_GET_OBJ(fh_shared); + HDassert(shared); + + /* Look for free space in global free list */ + if((node_found = H5HF_flist_find(shared->flist, request, (void **)sec_node)) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "can't locate free space in fractal heap direct block") + +/* XXX: Make certain we've loaded all the direct blocks in the heap */ + + /* If we didn't find a node, go make one big enough to hold the requested block */ + if(!node_found) { + /* Allocate direct block big enough to hold requested size */ + if(H5HF_man_dblock_new(fh_shared, dxpl_id, request) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTCREATE, FAIL, "can't create fractal heap direct block") + + /* Request space from the free list */ + /* (Ought to be able to be filled, now) */ + if(H5HF_flist_find(shared->flist, request, (void **)sec_node) <= 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "can't locate free space in fractal heap direct block") + } /* end if */ + HDassert(*sec_node); +#ifdef QAK +HDfprintf(stderr, "%s: (*sec_node)->block_addr = %a\n", FUNC, (*sec_node)->block_addr); +HDfprintf(stderr, "%s: (*sec_node)->block_size = %Zu\n", FUNC, (*sec_node)->block_size); +HDfprintf(stderr, "%s: (*sec_node)->sect_addr = %a\n", FUNC, (*sec_node)->sect_addr); +HDfprintf(stderr, "%s: (*sec_node)->sect_size = %Zu\n", FUNC, (*sec_node)->sect_size); +#endif /* QAK */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5HF_man_find() */ + + +/*------------------------------------------------------------------------- + * Function: H5HF_man_insert + * + * Purpose: Insert an object in a managed direct block + * + * Return: SUCCEED/FAIL + * + * Programmer: Quincey Koziol + * koziol@ncsa.uiuc.edu + * Mar 13 2006 + * + *------------------------------------------------------------------------- + */ +herr_t +H5HF_man_insert(H5RC_t *fh_shared, hid_t dxpl_id, H5HF_section_free_node_t *sec_node, + size_t obj_size, const void *obj, void *id) { - H5HF_direct_t *dblock = NULL; /* Pointer to direct block to modify */ H5HF_shared_t *shared; /* Pointer to shared heap info */ + H5HF_direct_t *dblock = NULL; /* Pointer to direct block to modify */ + haddr_t dblock_addr; /* Direct block address */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT(H5HF_man_dblock_insert) + FUNC_ENTER_NOAPI_NOINIT(H5HF_man_insert) /* * Check arguments. */ HDassert(fh_shared); - HDassert(H5F_addr_defined(block_addr)); - HDassert(block_size > 0); HDassert(obj_size > 0); HDassert(obj); HDassert(id); @@ -596,127 +1033,268 @@ H5HF_man_dblock_insert(H5RC_t *fh_shared, hid_t dxpl_id, haddr_t block_addr, HDassert(shared); /* Lock direct block */ - if(NULL == (dblock = H5AC_protect(shared->f, dxpl_id, H5AC_FHEAP_DBLOCK, block_addr, &block_size, fh_shared, H5AC_WRITE))) + dblock_addr = sec_node->block_addr; + if(NULL == (dblock = H5AC_protect(shared->f, dxpl_id, H5AC_FHEAP_DBLOCK, dblock_addr, &sec_node->block_size, fh_shared, H5AC_WRITE))) HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to load fractal heap direct block") + /* Insert object into block */ + /* Check for address mapping type */ if(shared->addrmap == H5HF_ABSOLUTE) { - H5HF_direct_free_node_t *node; /* Pointer to free list node for block */ - size_t full_obj_size; /* Size of object including metadata */ - size_t obj_off; /* Offset of object within block */ - hbool_t found; /* Flag to indicate we found a node with enough free space */ + H5HF_direct_free_node_t *node; /* Block's free list node */ + uint8_t *p; /* Temporary pointer to obj info in block */ + size_t obj_off; /* Offset of object within block */ + size_t full_obj_size; /* Size of object including metadata */ + size_t alloc_obj_size; /* Size of object including metadata & any free space fragment */ + unsigned char free_frag_size; /* Size of free space fragment */ + + /* Locate "local" free list node for section */ +/* XXX: Change to using skip list */ + obj_off = sec_node->sect_addr - sec_node->block_addr; + node = dblock->free_list->first; + while(node->my_offset != obj_off) + node = node->next; /* Compute full object size, with metadata for object */ full_obj_size = obj_size + H5HF_MAN_ABS_DIRECT_OBJ_PREFIX_LEN_DBLOCK(shared, dblock); - /* Sanity check */ + /* Sanity checks */ HDassert(dblock->blk_free_space >= full_obj_size); - - /* Check for valid free list */ - if(!dblock->free_list) - if(H5HF_man_dblock_build_freelist(dblock) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTDECODE, FAIL, "can't decode free list for block") HDassert(dblock->free_list); - - /* Search free list for block large enough to fit object */ - node = dblock->free_list->first; - found = FALSE; - while(node) { - /* Check if this node is large enough to hold object */ - if(node->size >= full_obj_size) { - /* Check for using exact free space available */ - if(node->size == full_obj_size) { - /* Set the offset of the object within the block */ - obj_off = node->my_offset; - - /* Check for allocating from first node in list */ - if(node->prev == NULL) { - /* Make the next node in the free list the list head */ - dblock->free_list->first = node->next; - dblock->free_list_head = node->next_offset; - } /* end if */ - else { - H5HF_direct_free_node_t *prev_node; /* Pointer to previous free list node for block */ - - /* Excise node from list */ - prev_node = node->prev; - prev_node->next = node->next; - if(node->next) { - H5HF_direct_free_node_t *next_node; /* Pointer to next free list node for block */ - - next_node = node->next; - next_node->prev = prev_node; - prev_node->next_offset = next_node->my_offset; - } /* end if */ - else - prev_node->next_offset = 0; - } /* end if */ - - /* Release the memory for the free list node */ - H5FL_FREE(H5HF_direct_free_node_t, node); + HDassert(node->size >= full_obj_size); + + /* Check for using entire node */ + free_frag_size = 0; + if(node->size <= (full_obj_size + H5HF_MAN_ABS_DIRECT_FREE_NODE_SIZE(dblock))) { + /* Set the offset of the object within the block */ + obj_off = node->my_offset; + + /* Check for allocating from first node in list */ + if(node->prev == NULL) { + /* Make the next node in the free list the list head */ + dblock->free_list->first = node->next; + dblock->free_list_head = node->next_offset; + } /* end if */ + else { + H5HF_direct_free_node_t *prev_node; /* Pointer to previous free list node for block */ + + /* Excise node from list */ + prev_node = node->prev; + prev_node->next = node->next; + if(node->next) { + H5HF_direct_free_node_t *next_node; /* Pointer to next free list node for block */ + + next_node = node->next; + next_node->prev = prev_node; + prev_node->next_offset = next_node->my_offset; } /* end if */ - else { - /* Allocate object from end of free space node */ - /* (so we don't have to play with the other node's info */ - obj_off = (node->my_offset + node->size) - full_obj_size; - node->size -= full_obj_size; - } /* end else */ - - /* Reduce space available in block */ - dblock->blk_free_space -= full_obj_size; - - /* Mark free list as dirty */ - dblock->free_list->dirty = TRUE; - found = TRUE; + else + prev_node->next_offset = 0; } /* end if */ - /* Avance to next node */ - node = node->next; - } /* end while */ + /* Set the free fragment size */ + free_frag_size = (unsigned char )(node->size - full_obj_size); + + /* Release the memory for the free list node & section */ + H5FL_FREE(H5HF_direct_free_node_t, node); + H5FL_FREE(H5HF_section_free_node_t, sec_node); + } /* end if */ + else { + /* Allocate object from end of free space node */ + /* (so we don't have to adjust with any other node's info */ + obj_off = (node->my_offset + node->size) - full_obj_size; + node->size -= full_obj_size; + + /* Adjust information for section node */ + sec_node->sect_size -= full_obj_size; + + /* Re-insert section node onto global list */ + if(H5HF_flist_add(shared->flist, sec_node, &sec_node->sect_size, &sec_node->sect_addr) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't add direct block free space to global list") + } /* end else */ + + /* Compute the size of the space to actually allocate */ + /* (includes the metadata for the object & the free space fragment) */ + alloc_obj_size = full_obj_size + free_frag_size; - /* Encode metadata & copy object into block */ - if(found) { - uint8_t *p; /* Temporary pointer to obj info */ + /* Reduce space available in block */ + dblock->blk_free_space -= alloc_obj_size; - /* Point to location for object */ + /* Mark free list as dirty */ + dblock->free_list->dirty = TRUE; + + /* Point to location for object */ +#ifdef QAK HDfprintf(stderr, "%s: obj_off = %Zu\n", FUNC, obj_off); +HDfprintf(stderr, "%s: free_frag_size = %Zu\n", FUNC, free_frag_size); HDfprintf(stderr, "%s: full_obj_size = %Zu\n", FUNC, full_obj_size); - p = dblock->blk + obj_off; +HDfprintf(stderr, "%s: alloc_obj_size = %Zu\n", FUNC, alloc_obj_size); +#endif /* QAK */ + p = dblock->blk + obj_off; + + /* Encode the length */ + UINT64ENCODE_VAR(p, obj_size, dblock->blk_off_size); - /* Encode the length, if required */ - if(!shared->fixed_len_obj) - UINT64ENCODE_VAR(p, obj_size, dblock->blk_off_size); + /* Encode the free fragment size */ + *p++ = free_frag_size; - /* Encode a ref. count (of 1), if required */ - if(shared->ref_count_obj) - UINT64ENCODE_VAR(p, 1, shared->ref_count_size); + /* Encode a ref. count (of 1), if required */ + if(shared->ref_count_obj) + UINT64ENCODE_VAR(p, 1, shared->ref_count_size); - /* Copy the object's data into the heap */ - HDmemcpy(p, obj, obj_size); + /* Copy the object's data into the heap */ + HDmemcpy(p, obj, obj_size); + p += obj_size; + +#ifdef H5_USING_PURIFY + /* Zero out the free space fragment */ + HDmemset(p, 0, free_frag_size); +#endif /* H5_USING_PURIFY */ #ifndef NDEBUG - p += obj_size; + p += free_frag_size; #endif /* NDEBUG */ - /* Sanity check */ - HDassert((size_t)(p - (dblock->blk + obj_off)) == full_obj_size); + /* Sanity check */ + HDassert((size_t)(p - (dblock->blk + obj_off)) == alloc_obj_size); - /* Set the head ID for the new object */ + /* Set the heap ID for the new object */ +#ifdef QAK HDfprintf(stderr, "%s: dblock->block_off = %Hu\n", FUNC, dblock->block_off); - UINT64ENCODE_VAR(id, (dblock->block_off + obj_off), shared->heap_off_size); - } /* end if */ - else - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "no space for object in block") +#endif /* QAK */ + UINT64ENCODE_VAR(id, (dblock->block_off + obj_off), shared->heap_off_size); + + /* Update shared heap info */ + shared->total_man_free -= alloc_obj_size; } /* end if */ else { HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "inserting within mapped managed blocks not supported yet") } /* end else */ + /* Update statistics about heap */ + shared->nobjs++; + + /* Mark heap header as modified */ + shared->dirty = TRUE; + done: /* Release the direct block (marked as dirty) */ - if(dblock && H5AC_unprotect(shared->f, dxpl_id, H5AC_FHEAP_DBLOCK, block_addr, dblock, H5AC__DIRTIED_FLAG) < 0) + if(dblock && H5AC_unprotect(shared->f, dxpl_id, H5AC_FHEAP_DBLOCK, dblock_addr, dblock, H5AC__DIRTIED_FLAG) < 0) HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release fractal heap direct block") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HF_man_dblock_insert() */ +} /* end H5HF_man_insert() */ + + +/*------------------------------------------------------------------------- + * Function: H5HF_man_iblock_create + * + * Purpose: Allocate & initialize a managed indirect block + * + * Return: Pointer to new direct block on success, NULL on failure + * + * Programmer: Quincey Koziol + * koziol@ncsa.uiuc.edu + * Mar 6 2006 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5HF_man_iblock_create(H5RC_t *fh_shared, hid_t dxpl_id, + hsize_t block_off, unsigned nrows, haddr_t *addr_p) +{ + H5HF_shared_t *shared; /* Pointer to shared heap info */ + H5HF_indirect_t *iblock = NULL; /* Pointer to indirect block */ + size_t u; /* Local index variable */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT(H5HF_man_iblock_create) + + /* + * Check arguments. + */ + HDassert(fh_shared); + HDassert(nrows > 0); + HDassert(addr_p); + + /* + * Allocate file and memory data structures. + */ + if(NULL == (iblock = H5FL_MALLOC(H5HF_indirect_t))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for fractal heap indirect block") + + /* Reset the metadata cache info for the heap header */ + HDmemset(&iblock->cache_info, 0, sizeof(H5AC_info_t)); + + /* Share common heap information */ + iblock->shared = fh_shared; + H5RC_INC(iblock->shared); + + /* Get the pointer to the shared B-tree info */ + shared = H5RC_GET_OBJ(iblock->shared); + HDassert(shared); + +#ifdef QAK +HDfprintf(stderr, "%s: nrows = %u\n", FUNC, nrows); +#endif /* QAK */ + /* Set info for direct block */ + iblock->block_off = block_off; + iblock->nrows = nrows; + if(iblock->nrows > shared->man_dtable.max_direct_rows) { + iblock->ndir_rows = shared->man_dtable.max_direct_rows; + iblock->nindir_rows = iblock->nrows - iblock->ndir_rows; + } /* end if */ + else { + iblock->ndir_rows = iblock->nrows; + iblock->nindir_rows = 0; + } /* end else */ + + /* Compute size of buffer needed for indirect block */ + iblock->size = H5HF_MAN_INDIRECT_SIZE(shared, iblock); + + /* Allocate indirect block entry tables */ + if(NULL == (iblock->dblock_ents = H5FL_SEQ_MALLOC(H5HF_indirect_dblock_ent_t, (iblock->ndir_rows * shared->man_dtable.cparam.width)))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for direct entries") + if(iblock->nindir_rows > 0) { + if(NULL == (iblock->iblock_ents = H5FL_SEQ_MALLOC(H5HF_indirect_iblock_ent_t, (iblock->nindir_rows * shared->man_dtable.cparam.width)))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for indirect entries") + } /* end if */ + else + iblock->iblock_ents = NULL; + + /* Initialize indirect block entry tables */ + for(u = 0; u < (iblock->ndir_rows * shared->man_dtable.cparam.width); u++) { + iblock->dblock_ents[u].addr = HADDR_UNDEF; + iblock->dblock_ents[u].free_space = 0; + } /* end for */ + for(u = 0; u < (iblock->nindir_rows * shared->man_dtable.cparam.width); u++) + iblock->iblock_ents[u].addr = HADDR_UNDEF; + + /* Allocate space for the header on disk */ + if(HADDR_UNDEF == (*addr_p = H5MF_alloc(shared->f, H5FD_MEM_FHEAP_IBLOCK, dxpl_id, (hsize_t)iblock->size))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "file allocation failed for fractal heap header") + +/* XXX: Update indirect statistics when they are added */ +#ifdef LATER + /* Update shared heap info */ + shared->total_man_free += dblock->blk_free_space; + shared->man_dtable.next_dir_block += dblock->size; + shared->total_size += dblock->size; + shared->man_size += dblock->size; + + /* Mark heap header as modified */ + shared->dirty = TRUE; +#endif /* LATER */ + + /* Cache the new fractal heap header */ + if(H5AC_set(shared->f, dxpl_id, H5AC_FHEAP_IBLOCK, *addr_p, iblock, H5AC__NO_FLAGS_SET) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't add fractal heap indirect block to cache") + +done: + if(ret_value < 0) + if(iblock) + (void)H5HF_cache_iblock_dest(shared->f, iblock); + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5HF_man_iblock_create() */ diff --git a/src/H5HFpkg.h b/src/H5HFpkg.h index c633919..27085fd 100644 --- a/src/H5HFpkg.h +++ b/src/H5HFpkg.h @@ -34,6 +34,7 @@ #include "H5ACprivate.h" /* Metadata cache */ #include "H5FLprivate.h" /* Free Lists */ #include "H5RCprivate.h" /* Reference counted object functions */ +#include "H5SLprivate.h" /* Skip lists */ /**************************/ /* Package Private Macros */ @@ -45,6 +46,7 @@ /* Fractal heap signatures */ #define H5HF_HDR_MAGIC "FRHP" /* Header */ #define H5HF_DBLOCK_MAGIC "FHDB" /* Direct block */ +#define H5HF_IBLOCK_MAGIC "FHIB" /* Indirect block */ /* "Standard" size of prefix information for fractal heap metadata */ #define H5HF_METADATA_PREFIX_SIZE ( \ @@ -63,6 +65,9 @@ + 2 /* Starting # of rows in root indirect block */ \ + H5F_SIZEOF_ADDR(f) /* File address of table managed */ \ + 2 /* Current # of rows in root indirect block */ \ + + H5F_SIZEOF_SIZE(f) /* Next direct block's heap offset */ \ + + H5F_SIZEOF_SIZE(f) /* Next direct block's size */ \ + + 2 /* Next direct block's column */ \ ) /* Size of the fractal heap header on disk */ @@ -73,18 +78,28 @@ /* Fractal heap header specific fields */ \ + 1 /* Address mapping */ \ + 4 /* Min. size of standalone object */ \ - + 4 /* Length of fixed-size objects */ \ + 1 /* Size of ref. count for objects */ \ + + H5F_SIZEOF_SIZE(f) /* Total man. free space */ \ + + H5F_SIZEOF_SIZE(f) /* Total std. free entries */ \ + + H5F_SIZEOF_SIZE(f) /* Total size of heap */ \ + + H5F_SIZEOF_SIZE(f) /* Size of man. space in heap */ \ + + H5F_SIZEOF_SIZE(f) /* Size of std. space in heap */ \ + + H5F_SIZEOF_SIZE(f) /* Number of objects in heap */ \ + H5HF_DTABLE_INFO_SIZE(f) /* Size of managed obj. doubling-table info */ \ ) +/* Size of free space description in an absolute managed direct block */ +#define H5HF_MAN_ABS_DIRECT_FREE_NODE_SIZE(d) (2 * (d)->blk_off_size) + /* Size of header for each object in an absolute managed direct block */ #define H5HF_MAN_ABS_DIRECT_OBJ_PREFIX_LEN_SIZE(s, o) ( \ - ((s)->fixed_len_obj ? 0 : H5HF_SIZEOF_OFFSET_LEN(o)) /* Length of object in block */ \ + H5HF_SIZEOF_OFFSET_LEN(o) /* Length of object in block */ \ + + 1 /* Free space fragment length */ \ + (s)->ref_count_size /* Ref. count of object in block */ \ ) #define H5HF_MAN_ABS_DIRECT_OBJ_PREFIX_LEN_DBLOCK(s, d) ( \ - ((s)->fixed_len_obj ? 0 : (d)->blk_off_size) /* Length of object in block */ \ + (d)->blk_off_size /* Length of object in block */ \ + + 1 /* Free space fragment length */ \ + (s)->ref_count_size /* Ref. count of object in block */ \ ) @@ -110,6 +125,19 @@ + (d)->blk_off_size /* Offset of first descriptor in free list */ \ ) +/* Size of managed indirect block (absolute & mapped) */ +#define H5HF_MAN_INDIRECT_SIZE(s, i) ( \ + /* General metadata fields */ \ + H5HF_METADATA_PREFIX_SIZE \ + \ + /* Fractal heap managed, absolutely mapped indirect block specific fields */ \ + + H5F_SIZEOF_ADDR((s)->f) /* File address of heap owning the block */ \ + + (s)->heap_off_size /* Offset of the block in the heap */ \ + + ((i)->ndir_rows * (s)->man_dtable.cparam.width * (H5F_SIZEOF_ADDR((s)->f) + (s)->man_dtable.max_dir_blk_off_size)) /* Size of entries for direct blocks */ \ + + ((i)->nindir_rows * (s)->man_dtable.cparam.width * H5F_SIZEOF_ADDR((s)->f)) /* Size of entries for indirect blocks */ \ + ) + + /* Compute the # of bytes required to store an offset into a given buffer size */ #define H5HF_SIZEOF_OFFSET_BITS(b) (((b) + 7) / 8) #define H5HF_SIZEOF_OFFSET_LEN(l) H5HF_SIZEOF_OFFSET_BITS(H5V_log2_of2((unsigned)(l))) @@ -119,11 +147,11 @@ /****************************/ /* Doubling-table info */ -typedef struct H5HF_dtable_param_t { +typedef struct H5HF_dtable_t { /* Immutable, pre-set information for table */ H5HF_dtable_cparam_t cparam; /* Creation parameters for table */ - /* Derived information (varies during lifetime of table) */ + /* Derived information (stored, vary during lifetime of table) */ haddr_t table_addr; /* Address of first block for table */ /* Undefined if no space allocated for table */ unsigned curr_root_rows; /* Current number of rows in the root indirect block */ @@ -131,39 +159,60 @@ typedef struct H5HF_dtable_param_t { * to direct block (of START_BLOCK_SIZE) instead * of indirect root block. */ -} H5HF_dtable_param_t; + hsize_t next_dir_block; /* Offset of next direct managed block */ + size_t next_dir_size; /* Size of next managed direct block */ + unsigned next_dir_col; /* "Column" of next managed direct block (in doubling table) */ + + /* Computed information (not stored) */ + unsigned max_root_indirect_rows; /* Maximum # of rows in root indirect block */ + unsigned max_direct_rows; /* Maximum # of direct rows in any indirect block */ + unsigned max_dir_blk_off_size; /* Max. size of offsets in direct blocks */ + unsigned first_row_bits; /* # of bits in address of first row */ + hsize_t num_id_first_row; /* Number of IDs in first row of table */ + hsize_t *row_block_size; /* Block size per row of indirect block */ +} H5HF_dtable_t; + +/* Fractal heap free list info (forward decl - defined in H5HFflist.c) */ +typedef struct H5HF_freelist_t H5HF_freelist_t; + +/* Fractal heap free list section info (forward decl - defined in H5HFint.c) */ +typedef struct H5HF_section_free_node_t H5HF_section_free_node_t; /* Each fractal heap has certain information that can be shared across all * the instances of blocks in that fractal heap. */ typedef struct H5HF_shared_t { /* Shared internal information (varies during lifetime of heap) */ - hsize_t next_man_block; /* Offset of next direct managed block */ - hsize_t next_std_block; /* Offset of next direct standalone block */ hsize_t total_man_free; /* Total amount of free space in managed blocks */ hsize_t total_std_free; /* Total # of free standalone ID entries */ - /* Cached/computed values */ + /* Statistics for heap */ + hsize_t total_size; /* Total amount of space used by heap (managed & standalone) */ + hsize_t man_size; /* Total amount of managed space in heap */ + hsize_t std_size; /* Total amount of standalone space in heap */ + hsize_t nobjs; /* Number of objects in heap */ + + /* Cached/computed values (not stored in header) */ + hbool_t dirty; /* Shared info is modified */ haddr_t heap_addr; /* Address of heap header in the file */ H5F_t *f; /* Pointer to file for heap */ + H5HF_freelist_t *flist; /* Free list for objects in heap */ /* Doubling table information */ /* (Partially set by user, partially derived/updated internally) */ - H5HF_dtable_param_t man_dtable_info; /* Doubling-table info for managed objects */ - H5HF_dtable_param_t std_dtable_info; /* Doubling-table info for standalone objects */ + H5HF_dtable_t man_dtable; /* Doubling-table info for managed objects */ + H5HF_dtable_t std_dtable; /* Doubling-table info for standalone objects */ /* Information set by user */ H5HF_addrmap_t addrmap; /* Type of address mapping */ uint32_t standalone_size; /* Size of object to store standalone */ - uint32_t fixed_len_size; /* Size of objects (only for heaps w/fixed-length objects) */ unsigned char ref_count_size; /* Size of ref. count for objects (only for heaps w/ref. counted objects) */ - /* Information derived from user parameters */ - hbool_t fixed_len_obj; /* Are objects in the heap fixed length? */ + /* Information derived from user parameters (not stored in header) */ + unsigned char heap_off_size; /* Size of heap offsets (in bytes) */ hbool_t ref_count_obj; /* Are objects in the heap ref. counted? */ hbool_t have_io_filter; /* Does the heap have I/O filters for the direct blocks? */ hbool_t write_once; /* Is heap being written in "write once" mode? */ - unsigned char heap_off_size; /* Size of heap offsets (in bytes) */ } H5HF_shared_t; /* The fractal heap header information */ @@ -177,6 +226,7 @@ typedef struct H5HF_t { /* Direct block free list node */ typedef struct H5HF_direct_free_node_t { + /* Direct block free list info */ size_t size; /* Size of free space */ size_t my_offset; /* Offset of free space in block */ size_t next_offset; /* Offset of next free space in block */ @@ -198,7 +248,7 @@ typedef struct H5HF_direct_t { /* Internal heap information */ H5RC_t *shared; /* Ref-counted shared info */ size_t size; /* Size of direct block */ - size_t blk_off_size; /* Size of offsets in the block */ + unsigned blk_off_size; /* Size of offsets in the block */ H5HF_direct_free_head_t *free_list; /* Pointer to free list for block */ uint8_t *blk; /* Pointer to buffer containing block data */ @@ -208,6 +258,45 @@ typedef struct H5HF_direct_t { size_t free_list_head; /* Offset of head of free list in block */ } H5HF_direct_t; +/* Indirect block direct block entry */ +typedef struct H5HF_indirect_dblock_ent_t { + haddr_t addr; /* Direct block's address */ + size_t free_space; /* Amount of free space in direct block */ +/* XXX: Will need space for block size, for blocks with I/O filters */ +} H5HF_indirect_dblock_ent_t; + +/* Indirect block indirect block entry */ +typedef struct H5HF_indirect_iblock_ent_t { + haddr_t addr; /* Indirect block's address */ +} H5HF_indirect_iblock_ent_t; + +/* Fractal heap indirect block */ +typedef struct H5HF_indirect_t { + /* Information for H5AC cache functions, _must_ be first field in structure */ + H5AC_info_t cache_info; + + /* Internal heap information */ + H5RC_t *shared; /* Ref-counted shared info */ + unsigned nrows; /* Total # of rows in indirect block */ + unsigned ndir_rows; /* # of direct rows in indirect block */ + unsigned nindir_rows; /* # of indirect rows in indirect block */ + size_t size; /* Size of indirect block on disk */ + H5HF_indirect_dblock_ent_t *dblock_ents; /* Pointer to direct block entry table */ + H5HF_indirect_iblock_ent_t *iblock_ents; /* Pointer to indirect block entry table */ + + /* Stored values */ + hsize_t block_off; /* Offset of the block within the heap's address space */ +} H5HF_indirect_t; + +/* Fractal heap metadata statistics info */ +typedef struct H5HF_stat_t { + hsize_t total_size; /* Total size of heap allocated (man & std) */ + hsize_t man_size; /* Total size of managed space in heap */ + hsize_t std_size; /* Total size of standalone space in heap */ + hsize_t man_free_space; /* Free space within heap */ + hsize_t nobjs; /* Number of objects in heap */ +} H5HF_stat_t; + /*****************************/ /* Package Private Variables */ @@ -219,6 +308,9 @@ H5_DLLVAR const H5AC_class_t H5AC_FHEAP_HDR[1]; /* H5HF direct block inherits cache-like properties from H5AC */ H5_DLLVAR const H5AC_class_t H5AC_FHEAP_DBLOCK[1]; +/* H5HF indirect block inherits cache-like properties from H5AC */ +H5_DLLVAR const H5AC_class_t H5AC_FHEAP_IBLOCK[1]; + /* Declare a free list to manage the H5HF_t struct */ H5FL_EXTERN(H5HF_t); @@ -234,6 +326,14 @@ H5FL_EXTERN(H5HF_direct_free_node_t); /* Declare a free list to manage heap direct block data to/from disk */ H5FL_BLK_EXTERN(direct_block); +/* Declare a free list to manage the H5HF_indirect_t struct */ +H5FL_EXTERN(H5HF_indirect_t); + +/* Declare a free list to manage the H5HF_indirect_dblock_ent_t sequence information */ +H5FL_SEQ_EXTERN(H5HF_indirect_dblock_ent_t); + +/* Declare a free list to manage the H5HF_indirect_iblock_ent_t sequence information */ +H5FL_SEQ_EXTERN(H5HF_indirect_iblock_ent_t); /******************************/ @@ -246,19 +346,38 @@ H5_DLL herr_t H5HF_shared_create(H5F_t *f, H5HF_t *fh, haddr_t heap_addr, H5HF_c H5_DLL herr_t H5HF_shared_own(H5HF_t *fh, H5HF_shared_t *shared); /* Routines for allocating space */ -H5_DLL herr_t H5HF_man_alloc_end(H5RC_t *fh_shared, hid_t dxpl_id, unsigned *fh_flags_ptr, - size_t size, const void *obj, void *id/*out*/); -H5_DLL herr_t H5HF_man_dblock_build_freelist(H5HF_direct_t *dblock); +H5_DLL herr_t H5HF_man_dblock_build_freelist(H5HF_direct_t *dblock, haddr_t dblock_addr); +H5_DLL herr_t H5HF_man_find(H5RC_t *fh_shared, hid_t dxpl_id, size_t request, + H5HF_section_free_node_t **sec_node/*out*/); +H5_DLL herr_t H5HF_man_insert(H5RC_t *fh_shared, hid_t dxpl_id, + H5HF_section_free_node_t *sec_node, size_t obj_size, const void *obj, + void *id); /* Metadata cache callbacks */ H5_DLL herr_t H5HF_cache_hdr_dest(H5F_t *f, H5HF_t *fh); H5_DLL herr_t H5HF_cache_dblock_dest(H5F_t *f, H5HF_direct_t *dblock); +H5_DLL herr_t H5HF_cache_iblock_dest(H5F_t *f, H5HF_indirect_t *iblock); /* Debugging routines for dumping file structures */ H5_DLL herr_t H5HF_hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int fwidth); H5_DLL herr_t H5HF_dblock_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int fwidth, haddr_t hdr_addr, size_t nrec); +H5_DLL herr_t H5HF_iblock_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, + FILE *stream, int indent, int fwidth, haddr_t hdr_addr, unsigned nrows); + +/* Statistics routines */ +H5_DLL herr_t H5HF_stat_info(H5F_t *f, hid_t dxpl_id, haddr_t fh_addr, + H5HF_stat_t *stats); + +/* Free list routines */ +H5_DLL H5HF_freelist_t * H5HF_flist_create(size_t max_block_size, + H5SL_operator_t node_free_op); +H5_DLL herr_t H5HF_flist_add(H5HF_freelist_t *flist, void *node, size_t *size_key, + haddr_t *addr_key); +H5_DLL htri_t H5HF_flist_find(H5HF_freelist_t *flist, size_t request, + void **node); +H5_DLL herr_t H5HF_flist_free(H5HF_freelist_t *flist); /* Testing routines */ #ifdef H5HF_TESTING diff --git a/src/H5HFprivate.h b/src/H5HFprivate.h index 984d717..b5abe9e 100644 --- a/src/H5HFprivate.h +++ b/src/H5HFprivate.h @@ -65,8 +65,6 @@ typedef struct H5HF_create_t { H5HF_addrmap_t addrmap; /* Type of address mapping for objects in heap */ uint32_t standalone_size; /* Size of object to store standalone */ /* (i.e. max. size of object to manage) */ - uint32_t fixed_len_size; /* Size of objects, in bytes (0 means variable-sized objects) */ - /* (only for heaps w/fixed-length objects) */ unsigned char ref_count_size; /* Size of ref. count field for objects, in bytes (0 means no ref. counts for objects) */ /* (only for heaps w/ref. counted objects) */ } H5HF_create_t; diff --git a/src/H5HFstat.c b/src/H5HFstat.c new file mode 100644 index 0000000..78be450 --- /dev/null +++ b/src/H5HFstat.c @@ -0,0 +1,117 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu> + * Monday, March 6, 2006 + * + * Purpose: Fractal heap metadata statistics functions. + * + */ + +/****************/ +/* Module Setup */ +/****************/ + +#define H5HF_PACKAGE /*suppress error about including H5HFpkg */ + +/***********/ +/* Headers */ +/***********/ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5HFpkg.h" /* Fractal heaps */ + +/****************/ +/* Local Macros */ +/****************/ + + +/******************/ +/* Local Typedefs */ +/******************/ + + +/********************/ +/* Local Prototypes */ +/********************/ + + +/*********************/ +/* Package Variables */ +/*********************/ + + +/*****************************/ +/* Library Private Variables */ +/*****************************/ + + +/*******************/ +/* Local Variables */ +/*******************/ + + + +/*------------------------------------------------------------------------- + * Function: H5HF_stat_info + * + * Purpose: Retrieve metadata statistics for the fractal heap + * + * Return: Success: non-negative + * + * Failure: negative + * + * Programmer: Quincey Koziol + * Monday, March 6, 2006 + * + *------------------------------------------------------------------------- + */ +herr_t +H5HF_stat_info(H5F_t *f, hid_t dxpl_id, haddr_t fh_addr, H5HF_stat_t *stats) +{ + H5HF_t *fh = NULL; /* Pointer to the B-tree header */ + H5HF_shared_t *shared; /* Shared fractal heap information */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT(H5HF_stat_info) + + /* Check arguments. */ + HDassert(f); + HDassert(H5F_addr_defined(fh_addr)); + HDassert(stats); + + /* Look up the fractal heap header */ + if(NULL == (fh = H5AC_protect(f, dxpl_id, H5AC_FHEAP_HDR, fh_addr, NULL, NULL, H5AC_READ))) + HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to load fractal heap header") + + /* Get the pointer to the shared fractal heap info */ + shared = H5RC_GET_OBJ(fh->shared); + HDassert(shared); + + /* Report statistics for fractal heap */ + stats->total_size = shared->total_size; + stats->man_size = shared->man_size; + stats->std_size = shared->std_size; + stats->man_free_space = shared->total_man_free; + stats->nobjs = shared->nobjs; +/* XXX: Add more metadata statistics for the heap */ + +done: + /* Release fractal heap header node */ + if(fh && H5AC_unprotect(f, dxpl_id, H5AC_FHEAP_HDR, fh_addr, fh, H5AC__NO_FLAGS_SET) < 0) + HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release fractal heap header info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* H5HF_stat_info() */ + diff --git a/src/H5HFtest.c b/src/H5HFtest.c index d17f804..43c9573 100644 --- a/src/H5HFtest.c +++ b/src/H5HFtest.c @@ -13,9 +13,10 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu> - * Thursday, February 3, 2005 + * Thursday, February 3, 2006 * * Purpose: Fractal heap testing functions. + * */ /****************/ @@ -29,8 +30,8 @@ /* Headers */ /***********/ #include "H5private.h" /* Generic Functions */ -#include "H5HFpkg.h" /* Fractal heaps */ #include "H5Eprivate.h" /* Error handling */ +#include "H5HFpkg.h" /* Fractal heaps */ /****************/ /* Local Macros */ @@ -102,9 +103,8 @@ H5HF_get_cparam_test(H5F_t *f, hid_t dxpl_id, haddr_t fh_addr, H5HF_create_t *cp /* Get fractal heap creation parameters */ cparam->addrmap = shared->addrmap; cparam->standalone_size = shared->standalone_size; - cparam->fixed_len_size = shared->fixed_len_size; cparam->ref_count_size = shared->ref_count_size; - HDmemcpy(&(cparam->managed), &(shared->man_dtable_info.cparam), sizeof(H5HF_dtable_cparam_t)); + HDmemcpy(&(cparam->managed), &(shared->man_dtable.cparam), sizeof(H5HF_dtable_cparam_t)); done: /* Release fractal heap header node */ diff --git a/src/Makefile.am b/src/Makefile.am index d6ebcfb..32e4ed5 100755 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -38,7 +38,7 @@ MOSTLYCLEANFILES=H5Tinit.c # library sources libhdf5_la_SOURCES= H5.c H5dbg.c H5A.c H5AC.c H5B.c H5Bcache.c \ - H5B2.c H5B2cache.c H5B2dbg.c H5B2int.c H5B2test.c \ + H5B2.c H5B2cache.c H5B2dbg.c H5B2int.c H5B2stat.c H5B2test.c \ H5C.c \ H5D.c \ H5Dcompact.c \ @@ -54,7 +54,7 @@ libhdf5_la_SOURCES= H5.c H5dbg.c H5A.c H5AC.c H5B.c H5Bcache.c \ H5Gstab.c \ H5Gtest.c \ H5Gtraverse.c \ - H5HF.c H5HFcache.c H5HFdbg.c H5HFint.c H5HFtest.c \ + H5HF.c H5HFcache.c H5HFdbg.c H5HFflist.c H5HFint.c H5HFstat.c H5HFtest.c \ H5HG.c H5HGdbg.c H5HL.c H5HLdbg.c H5HP.c H5I.c H5MF.c H5MM.c \ H5MP.c H5MPtest.c \ H5O.c \ diff --git a/src/Makefile.in b/src/Makefile.in index 2ac3a81..abd3096 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -83,7 +83,7 @@ libLTLIBRARIES_INSTALL = $(INSTALL) LTLIBRARIES = $(lib_LTLIBRARIES) libhdf5_la_LIBADD = am_libhdf5_la_OBJECTS = H5.lo H5dbg.lo H5A.lo H5AC.lo H5B.lo \ - H5Bcache.lo H5B2.lo H5B2cache.lo H5B2dbg.lo H5B2int.lo \ + H5Bcache.lo H5B2.lo H5B2cache.lo H5B2dbg.lo H5B2int.lo H5B2stat.lo \ H5B2test.lo H5C.lo H5D.lo H5Dcompact.lo H5Dcontig.lo H5Defl.lo \ H5Dio.lo H5Distore.lo H5Dmpio.lo H5Doh.lo H5Dselect.lo \ H5Dtest.lo H5E.lo H5F.lo H5Fdbg.lo H5Fmount.lo H5Fsfile.lo \ @@ -93,7 +93,7 @@ am_libhdf5_la_OBJECTS = H5.lo H5dbg.lo H5A.lo H5AC.lo H5B.lo \ H5FPclient.lo H5FPserver.lo H5FS.lo H5G.lo H5Gent.lo \ H5Glink.lo H5Gloc.lo H5Gname.lo H5Gnode.lo H5Gobj.lo H5Goh.lo \ H5Gstab.lo H5Gtest.lo H5Gtraverse.lo H5HF.lo H5HFcache.lo \ - H5HFdbg.lo H5HFint.lo H5HFtest.lo H5HG.lo H5HGdbg.lo H5HL.lo \ + H5HFdbg.lo H5HFflist.lo H5HFint.lo H5HFstat.lo H5HFtest.lo H5HG.lo H5HGdbg.lo H5HL.lo \ H5HLdbg.lo H5HP.lo H5I.lo H5MF.lo H5MM.lo H5MP.lo H5MPtest.lo \ H5O.lo H5Oattr.lo H5Obogus.lo H5Ocache.lo H5Ocont.lo \ H5Odtype.lo H5Oefl.lo H5Ofill.lo H5Oginfo.lo H5Olayout.lo \ @@ -390,7 +390,7 @@ MOSTLYCLEANFILES = H5Tinit.c # library sources libhdf5_la_SOURCES = H5.c H5dbg.c H5A.c H5AC.c H5B.c H5Bcache.c \ - H5B2.c H5B2cache.c H5B2dbg.c H5B2int.c H5B2test.c \ + H5B2.c H5B2cache.c H5B2dbg.c H5B2int.c H5B2stat.c H5B2test.c \ H5C.c \ H5D.c \ H5Dcompact.c \ @@ -406,7 +406,7 @@ libhdf5_la_SOURCES = H5.c H5dbg.c H5A.c H5AC.c H5B.c H5Bcache.c \ H5Gstab.c \ H5Gtest.c \ H5Gtraverse.c \ - H5HF.c H5HFcache.c H5HFdbg.c H5HFint.c H5HFtest.c \ + H5HF.c H5HFcache.c H5HFdbg.c H5HFflist.c H5HFint.c H5HFstat.c H5HFtest.c \ H5HG.c H5HGdbg.c H5HL.c H5HLdbg.c H5HP.c H5I.c H5MF.c H5MM.c \ H5MP.c H5MPtest.c \ H5O.c \ @@ -567,6 +567,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5B2cache.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5B2dbg.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5B2int.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5B2stat.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5B2test.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Bcache.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5C.Plo@am__quote@ @@ -618,7 +619,9 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5HF.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5HFcache.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5HFdbg.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5HFflist.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5HFint.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5HFstat.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5HFtest.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5HG.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5HGdbg.Plo@am__quote@ |