summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2006-08-07 19:51:59 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2006-08-07 19:51:59 (GMT)
commit4f289e5b9240807d9fa5561fd793981334a9f086 (patch)
tree8a22e083cdab59a3af1577fe5c50f6054b22e958 /src
parent80b1c44327f56c2e7edd75389e5b3b5a9b5ea833 (diff)
downloadhdf5-4f289e5b9240807d9fa5561fd793981334a9f086.zip
hdf5-4f289e5b9240807d9fa5561fd793981334a9f086.tar.gz
hdf5-4f289e5b9240807d9fa5561fd793981334a9f086.tar.bz2
[svn-r12551] Description:
Refactor fields in heap header to clean out information from dropped features and also group related fields together more nicely. Add fields to heap header for storing information about "huge" objects. Platforms tested: Linux/32 2.6 (chicago) Linux/64 2.6 (chicago)
Diffstat (limited to 'src')
-rw-r--r--src/H5HF.c2
-rw-r--r--src/H5HFcache.c58
-rw-r--r--src/H5HFdbg.c12
-rw-r--r--src/H5HFhdr.c14
-rw-r--r--src/H5HFint.c50
-rw-r--r--src/H5HFpkg.h31
-rw-r--r--src/H5HFprivate.h11
-rw-r--r--src/H5HFtest.c3
8 files changed, 86 insertions, 95 deletions
diff --git a/src/H5HF.c b/src/H5HF.c
index c241cac..85fb7dc 100644
--- a/src/H5HF.c
+++ b/src/H5HF.c
@@ -354,7 +354,7 @@ HDfprintf(stderr, "%s: size = %Zu\n", FUNC, size);
hdr = fh->hdr;
/* Check if object is large enough to be standalone */
- if(size > hdr->standalone_size) {
+ if(size > hdr->max_man_size) {
HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "standalone blocks not supported yet")
} /* end if */
else {
diff --git a/src/H5HFcache.c b/src/H5HFcache.c
index bd96604..8c64a51 100644
--- a/src/H5HFcache.c
+++ b/src/H5HFcache.c
@@ -257,6 +257,7 @@ H5HF_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *ud
uint8_t *buf = NULL; /* Temporary buffer */
const uint8_t *p; /* Pointer into raw data buffer */
uint32_t metadata_chksum; /* Metadata checksum value */
+ uint8_t heap_flags; /* Status flags for heap */
H5HF_hdr_t *ret_value; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5HF_cache_hdr_load)
@@ -308,21 +309,19 @@ HDfprintf(stderr, "%s: Load heap header, addr = %a\n", FUNC, addr);
if(metadata_chksum != 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, NULL, "incorrect metadata checksum for fractal heap header")
- /* Heap address mapping */
- hdr->addrmap = *p++;
- HDassert(H5HF_ABSOLUTE == 0);
- if(hdr->addrmap > H5HF_MAPPED)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, NULL, "incorrect fractal heap address mapping")
+ /* Heap status flags */
+ /* (bit 0: "huge" object IDs have wrapped) */
+ heap_flags = *p++;
+ hdr->huge_ids_wrapped = heap_flags & H5HF_HDR_FLAGS_HUGE_ID_WRAPPED;
- /* Min. size of standalone objects */
- UINT32DECODE(p, hdr->standalone_size);
+ /* "Huge" object information */
+ UINT32DECODE(p, hdr->max_man_size); /* Max. size of "managed" objects */
+ H5F_DECODE_LENGTH(f, p, hdr->huge_next_id); /* Next ID to use for "huge" object */
+ H5F_addr_decode(f, &p, &hdr->huge_bt_addr); /* Address of "huge" object tracker B-tree */
- /* Internal management information */
- H5F_DECODE_LENGTH(f, p, hdr->total_man_free);
- H5F_DECODE_LENGTH(f, p, hdr->total_std_free);
-
- /* Address of free section header */
- H5F_addr_decode(f, &p, &(hdr->fs_addr));
+ /* "Managed" object free space information */
+ H5F_DECODE_LENGTH(f, p, hdr->total_man_free); /* Internal free space in managed direct blocks */
+ H5F_addr_decode(f, &p, &hdr->fs_addr); /* Address of free section header */
/* Statistics information */
H5F_DECODE_LENGTH(f, p, hdr->total_size);
@@ -387,9 +386,10 @@ HDfprintf(stderr, "%s: Flushing heap header, addr = %a, destroy = %u\n", FUNC, a
HDassert(hdr);
if(hdr->cache_info.is_dirty) {
- uint8_t *buf = NULL; /* Temporary raw data buffer */
- uint8_t *p; /* Pointer into raw data buffer */
- size_t size; /* Header size on disk */
+ uint8_t *buf; /* Temporary raw data buffer */
+ uint8_t *p; /* Pointer into raw data buffer */
+ size_t size; /* Header size on disk */
+ uint8_t heap_flags; /* Status flags for heap */
/* Sanity check */
HDassert(hdr->dirty);
@@ -419,18 +419,20 @@ HDfprintf(stderr, "%s: Flushing heap header, addr = %a, destroy = %u\n", FUNC, a
HDmemset(p, 0, 4);
p += 4;
- /* Heap address mapping */
- *p++ = hdr->addrmap;
+ /* Heap status flags */
+ /* (bit 0: "huge" object IDs have wrapped) */
+ heap_flags = 0;
+ heap_flags |= (hdr->huge_ids_wrapped ? H5HF_HDR_FLAGS_HUGE_ID_WRAPPED : 0);
+ *p++ = heap_flags;
- /* Min. size of standalone objects */
- UINT32ENCODE(p, hdr->standalone_size);
+ /* "Huge" object information */
+ UINT32ENCODE(p, hdr->max_man_size); /* Max. size of "managed" objects */
+ H5F_ENCODE_LENGTH(f, p, hdr->huge_next_id); /* Next ID to use for "huge" object */
+ H5F_addr_encode(f, &p, hdr->huge_bt_addr); /* Address of "huge" object tracker B-tree */
- /* Internal management information */
- H5F_ENCODE_LENGTH(f, p, hdr->total_man_free);
- H5F_ENCODE_LENGTH(f, p, hdr->total_std_free);
-
- /* Address of free section header */
- H5F_addr_encode(f, &p, hdr->fs_addr);
+ /* "Managed" object free space information */
+ H5F_ENCODE_LENGTH(f, p, hdr->total_man_free); /* Internal free space in managed direct blocks */
+ H5F_addr_encode(f, &p, hdr->fs_addr); /* Address of free section header */
/* Statistics information */
H5F_ENCODE_LENGTH(f, p, hdr->total_size);
@@ -731,10 +733,6 @@ H5HF_cache_dblock_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr,
/* Offset of block in heap */
UINT64ENCODE_VAR(p, dblock->block_off, hdr->heap_off_size);
- /* Check for (currently) unsupported address mapping */
- if(hdr->addrmap != H5HF_ABSOLUTE)
- HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "encoding mapped direct blocks not supported currently")
-
/* Sanity check */
HDassert((size_t)(p - dblock->blk) == H5HF_MAN_ABS_DIRECT_OVERHEAD(hdr));
diff --git a/src/H5HFdbg.c b/src/H5HFdbg.c
index 1fc6b0f..452401a 100644
--- a/src/H5HFdbg.c
+++ b/src/H5HFdbg.c
@@ -212,21 +212,13 @@ H5HF_hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent,
/*
* Print the values.
*/
- HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
- "Heap address mapping method:",
- ((hdr->addrmap) == H5HF_ABSOLUTE ? "Absolute" :
- ((hdr->addrmap) == H5HF_MAPPED ? "Mapped" :
- "Unknown!")));
HDfprintf(stream, "%*s%-*s %lu\n", indent, "", fwidth,
- "Min. size of standalone object:",
- (unsigned long)hdr->standalone_size);
+ "Max. size of managed object:",
+ (unsigned long)hdr->max_man_size);
HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth,
"Total free space in managed blocks:",
hdr->total_man_free);
HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth,
- "Total # of free entries for standalone blocks:",
- hdr->total_std_free);
- HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth,
"Total data block size:",
hdr->total_size);
HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth,
diff --git a/src/H5HFhdr.c b/src/H5HFhdr.c
index 3628bd8..1f3c79f 100644
--- a/src/H5HFhdr.c
+++ b/src/H5HFhdr.c
@@ -224,7 +224,7 @@ H5HF_hdr_finish_init(H5HF_hdr_t *hdr)
/* Set the size of heap IDs */
hdr->heap_len_size = MIN(hdr->man_dtable.max_dir_blk_off_size,
- ((H5V_log2_gen((hsize_t)hdr->standalone_size) + 7) / 8));
+ ((H5V_log2_gen((hsize_t)hdr->max_man_size) + 7) / 8));
hdr->id_len = H5HF_ID_SIZE(hdr);
/* Set the free space in direct blocks */
@@ -299,7 +299,7 @@ H5HF_hdr_init(H5HF_hdr_t *hdr, haddr_t fh_addr, const H5HF_create_t *cparam)
HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, FAIL, "max. direct block size too large")
if(!POWER_OF_TWO(cparam->managed.max_direct_size))
HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, FAIL, "max. direct block size not power of two")
- if(cparam->managed.max_direct_size < cparam->standalone_size)
+ if(cparam->managed.max_direct_size < cparam->max_man_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 == 0)
HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, FAIL, "max. heap size must be greater than zero")
@@ -309,8 +309,7 @@ H5HF_hdr_init(H5HF_hdr_t *hdr, haddr_t fh_addr, const H5HF_create_t *cparam)
/* Set the creation parameters for the heap */
hdr->heap_addr = fh_addr;
- hdr->addrmap = cparam->addrmap;
- hdr->standalone_size = cparam->standalone_size;
+ hdr->max_man_size = cparam->max_man_size;
HDmemcpy(&(hdr->man_dtable.cparam), &(cparam->managed), sizeof(H5HF_dtable_cparam_t));
/* Set root table address to indicate that the heap is empty currently */
@@ -319,6 +318,9 @@ H5HF_hdr_init(H5HF_hdr_t *hdr, haddr_t fh_addr, const H5HF_create_t *cparam)
/* Set free list header address to indicate that the heap is empty currently */
hdr->fs_addr = HADDR_UNDEF;
+ /* Set "huge" object tracker B-tree address to indicate that there aren't any yet */
+ hdr->huge_bt_addr = HADDR_UNDEF;
+
/* Note that the shared info is dirty (it's not written to the file yet) */
hdr->dirty = TRUE;
@@ -327,9 +329,9 @@ H5HF_hdr_init(H5HF_hdr_t *hdr, haddr_t fh_addr, const H5HF_create_t *cparam)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't create ref-count wrapper for shared fractal heap header")
/* Extra checking for possible gap between max. direct block size minus
- * overhead and standalone object size */
+ * overhead and "huge" object size */
dblock_overhead = H5HF_MAN_ABS_DIRECT_OVERHEAD(hdr);
- if((cparam->managed.max_direct_size - dblock_overhead) < cparam->standalone_size)
+ if((cparam->managed.max_direct_size - dblock_overhead) < cparam->max_man_size)
HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, FAIL, "max. direct block size not large enough to hold all managed blocks")
done:
diff --git a/src/H5HFint.c b/src/H5HFint.c
index 9274b4d..ce6d64a 100644
--- a/src/H5HFint.c
+++ b/src/H5HFint.c
@@ -282,6 +282,7 @@ H5HF_man_insert(H5HF_hdr_t *hdr, hid_t dxpl_id, H5HF_free_section_t *sec_node,
{
H5HF_direct_t *dblock = NULL; /* Pointer to direct block to modify */
haddr_t dblock_addr = HADDR_UNDEF; /* Direct block address */
+ size_t blk_off; /* Offset of object within block */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5HF_man_insert)
@@ -340,36 +341,30 @@ HDfprintf(stderr, "%s: sec_node->u.single.dblock_size = %Zu\n", FUNC, sec_node->
/* Insert object into block */
- /* Check for address mapping type */
- if(hdr->addrmap == H5HF_ABSOLUTE) {
- uint8_t *p; /* Temporary pointer to obj info in block */
- size_t blk_off; /* Offset of object within block */
-
- /* Set the offset of the object within the block */
- blk_off = sec_node->sect_info.addr - dblock->block_off;
+ /* Get the offset of the object within the block */
+ blk_off = sec_node->sect_info.addr - dblock->block_off;
+#ifdef QAK
+HDfprintf(stderr, "%s: blk_off = %Zu\n", FUNC, blk_off);
+#endif /* QAK */
- /* Sanity checks */
+ /* Sanity checks */
#ifdef QAK
HDfprintf(stderr, "%s: hdr->total_man_free = %Hu\n", FUNC, hdr->total_man_free);
HDfprintf(stderr, "%s: dblock->block_off = %Hu\n", FUNC, dblock->block_off);
#endif /* QAK */
- HDassert(sec_node->sect_info.size >= obj_size);
+ HDassert(sec_node->sect_info.size >= obj_size);
-#ifdef QAK
-HDfprintf(stderr, "%s: sec_node->sect_info.size = %Hu\n", FUNC, sec_node->sect_info.size);
-#endif /* QAK */
- /* Reduce (& possibly re-add) single section */
- if(H5HF_sect_single_reduce(hdr, dxpl_id, sec_node, obj_size) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTSHRINK, FAIL, "can't reduce single section node")
+ /* Reduce (& possibly re-add) single section */
+ if(H5HF_sect_single_reduce(hdr, dxpl_id, sec_node, obj_size) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTSHRINK, FAIL, "can't reduce single section node")
-#ifdef QAK
-HDfprintf(stderr, "%s: blk_off = %Zu\n", FUNC, blk_off);
-#endif /* QAK */
- /* Reduce space available in heap */
- if(H5HF_hdr_adj_free(hdr, -(ssize_t)obj_size) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't adjust free space for heap")
+ /* Reduce space available in heap */
+ if(H5HF_hdr_adj_free(hdr, -(ssize_t)obj_size) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't adjust free space for heap")
- /* Encode the object in the block */
+ /* Encode the object in the block */
+ {
+ uint8_t *p; /* Temporary pointer to obj info in block */
/* Point to location for object */
p = dblock->blk + blk_off;
@@ -380,19 +375,16 @@ HDfprintf(stderr, "%s: blk_off = %Zu\n", FUNC, blk_off);
/* Sanity check */
HDassert((size_t)(p - (dblock->blk + blk_off)) == obj_size);
+ } /* end block */
- /* Set the heap ID for the new object (heap offset & obj length) */
+ /* Set the heap ID for the new object (heap offset & obj length) */
#ifdef QAK
HDfprintf(stderr, "%s: dblock->block_off = %Hu\n", FUNC, dblock->block_off);
#endif /* QAK */
- H5HF_MAN_ID_ENCODE(id, hdr, (dblock->block_off + blk_off), obj_size);
+ H5HF_MAN_ID_ENCODE(id, hdr, (dblock->block_off + blk_off), obj_size);
#ifdef QAK
HDfprintf(stderr, "%s: obj_off = %Hu, obj_len = %Zu\n", FUNC, (dblock->block_off + blk_off), obj_size);
#endif /* QAK */
- } /* end if */
- else {
-HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "inserting within mapped managed blocks not supported yet")
- } /* end else */
/* Update statistics about heap */
hdr->nobjs++;
@@ -544,7 +536,7 @@ HDfprintf(stderr, "%s: obj_off = %Hu, obj_len = %Zu\n", FUNC, obj_off, obj_len);
HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "fractal heap object offset too large")
if(obj_len > hdr->man_dtable.cparam.max_direct_size)
HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "fractal heap object size too large for direct block")
- if(obj_len > hdr->standalone_size)
+ if(obj_len > hdr->max_man_size)
HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "fractal heap object should be standalone")
/* Check for root direct block */
diff --git a/src/H5HFpkg.h b/src/H5HFpkg.h
index b3b0951..25616f8 100644
--- a/src/H5HFpkg.h
+++ b/src/H5HFpkg.h
@@ -67,23 +67,37 @@
+ 2 /* Current # of rows in root indirect block */ \
)
+/* Flags for status byte */
+#define H5HF_HDR_FLAGS_HUGE_ID_WRAPPED 0x01
+
/* Size of the fractal heap header on disk */
#define H5HF_HEADER_SIZE(h) ( \
/* General metadata fields */ \
H5HF_METADATA_PREFIX_SIZE \
\
- /* Fractal heap header specific fields */ \
- + 1 /* Address mapping mode */ \
- + 4 /* Min. size of standalone object */ \
+ /* Fractal Heap Header specific fields */ \
+ \
+ /* General heap information */ \
+ + 1 /* Status flags */ \
+ \
+ /* "Huge" object fields */ \
+ + 4 /* Max. size of "managed" object */ \
+ + (h)->sizeof_size /* Next ID for "huge" object */ \
+ + (h)->sizeof_addr /* File address of "huge" object tracker B-tree */ \
+ \
+ /* "Managed" object free space fields */ \
+ (h)->sizeof_size /* Total man. free space */ \
- + (h)->sizeof_size /* Total std. free entries */ \
+ (h)->sizeof_addr /* File address of free section header */ \
+ \
+ /* Statistics fields */ \
+ (h)->sizeof_size /* Total size of heap */ \
+ (h)->sizeof_size /* Size of man. space in heap */ \
+ (h)->sizeof_size /* Size of man. space iterator offset in heap */ \
+ (h)->sizeof_size /* Size of alloacted man. space in heap */ \
+ (h)->sizeof_size /* Size of std. space in heap */ \
+ (h)->sizeof_size /* Number of objects in heap */ \
+ \
+ /* "Managed" object doubling table info */ \
+ H5HF_DTABLE_INFO_SIZE(h) /* Size of managed obj. doubling-table info */ \
)
@@ -279,7 +293,6 @@ typedef struct H5HF_hdr_t {
/* Shared internal information (varies during lifetime of heap) */
hsize_t total_man_free; /* Total amount of free space in managed blocks */
- hsize_t total_std_free; /* Total # of free standalone ID entries */
haddr_t fs_addr; /* Address of free space header on disk */
/* Statistics for heap */
@@ -306,9 +319,10 @@ typedef struct H5HF_hdr_t {
/* (Partially set by user, partially derived/updated internally) */
H5HF_dtable_t man_dtable; /* Doubling-table info for managed objects */
- /* Information set by user */
- H5HF_addrmap_t addrmap; /* Type of address mapping */
- uint32_t standalone_size; /* Size of object to store standalone */
+ /* "Huge" object support (stored in header) */
+ uint32_t max_man_size; /* Max. size of object to manage in doubling table */
+ hsize_t huge_next_id; /* Next ID to use for "huge" object */
+ haddr_t huge_bt_addr; /* Address of B-tree for storing "huge" object info */
/* Information derived from user parameters (not stored in header) */
unsigned char heap_off_size; /* Size of heap offsets (in bytes) */
@@ -316,6 +330,7 @@ typedef struct H5HF_hdr_t {
hbool_t debug_objs; /* Is the heap storing objects in 'debug' format */
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? */
+ hbool_t huge_ids_wrapped; /* Have "huge" object IDs wrapped around? */
} H5HF_hdr_t;
/* Indirect block entry */
diff --git a/src/H5HFprivate.h b/src/H5HFprivate.h
index 4490ec2..32b6f41 100644
--- a/src/H5HFprivate.h
+++ b/src/H5HFprivate.h
@@ -41,12 +41,6 @@
/* Library Private Typedefs */
/****************************/
-/* Types of heaps */
-typedef enum {
- H5HF_ABSOLUTE, /* The heap uses absolute internal addressing */
- H5HF_MAPPED /* The heap maps internal addresses to allow compaction */
-} H5HF_addrmap_t;
-
/* Creation parameters for doubling-tables */
typedef struct H5HF_dtable_cparam_t {
unsigned width; /* Number of columns in the table (must be power of 2) */
@@ -62,9 +56,8 @@ typedef struct H5HF_dtable_cparam_t {
/* Fractal heap creation parameters */
typedef struct H5HF_create_t {
H5HF_dtable_cparam_t managed;/* Mapped object doubling-table creation parameters */
- 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 max_man_size; /* Max. size of object to manage in doubling table */
+ /* (i.e. min. size of object to store standalone) */
} H5HF_create_t;
/* Fractal heap metadata statistics info */
diff --git a/src/H5HFtest.c b/src/H5HFtest.c
index fb25c48..1eeb15e 100644
--- a/src/H5HFtest.c
+++ b/src/H5HFtest.c
@@ -93,8 +93,7 @@ H5HF_get_cparam_test(const H5HF_t *fh, H5HF_create_t *cparam)
HDassert(cparam);
/* Get fractal heap creation parameters */
- cparam->addrmap = fh->hdr->addrmap;
- cparam->standalone_size = fh->hdr->standalone_size;
+ cparam->max_man_size = fh->hdr->max_man_size;
HDmemcpy(&(cparam->managed), &(fh->hdr->man_dtable.cparam), sizeof(H5HF_dtable_cparam_t));
FUNC_LEAVE_NOAPI(SUCCEED)