diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2006-08-10 03:45:06 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2006-08-10 03:45:06 (GMT) |
commit | b648c14f13498349a743e9ef925399a8e6b592de (patch) | |
tree | d57c6f51cd835e055d8e75740e3c340edf1e5ef0 /src | |
parent | f06e8744a54fdf7454fd5f4d76e9b10f16076d22 (diff) | |
download | hdf5-b648c14f13498349a743e9ef925399a8e6b592de.zip hdf5-b648c14f13498349a743e9ef925399a8e6b592de.tar.gz hdf5-b648c14f13498349a743e9ef925399a8e6b592de.tar.bz2 |
[svn-r12562] Description:
Initial revision to add support for "huge" objects in the heap (which are
actually stored directly in the file, but are tracked with v2 B-tree that is
accessed through heap header).
Testing:
FreeBSD 4.11 (sleipnir)
Linux/64 2.4 (mir)
Linux/32 2.4 (heping)
Mac OS X.4 (amazon)
Diffstat (limited to 'src')
-rw-r--r-- | src/H5FDpublic.h | 4 | ||||
-rw-r--r-- | src/H5HF.c | 93 | ||||
-rw-r--r-- | src/H5HFbtree2.c | 370 | ||||
-rw-r--r-- | src/H5HFcache.c | 4 | ||||
-rw-r--r-- | src/H5HFdbg.c | 2 | ||||
-rw-r--r-- | src/H5HFhdr.c | 8 | ||||
-rw-r--r-- | src/H5HFhuge.c | 574 | ||||
-rw-r--r-- | src/H5HFint.c | 116 | ||||
-rw-r--r-- | src/H5HFpkg.h | 55 | ||||
-rw-r--r-- | src/H5HFprivate.h | 3 | ||||
-rw-r--r-- | src/H5HFsection.c | 14 | ||||
-rw-r--r-- | src/H5HFspace.c | 2 | ||||
-rwxr-xr-x | src/Makefile.am | 4 | ||||
-rw-r--r-- | src/Makefile.in | 12 |
14 files changed, 1108 insertions, 153 deletions
diff --git a/src/H5FDpublic.h b/src/H5FDpublic.h index f50a7fa..4a1e084 100644 --- a/src/H5FDpublic.h +++ b/src/H5FDpublic.h @@ -53,11 +53,15 @@ typedef enum H5FD_mem_t { * Map "fractal heap" direct blocks to 'lheap' type file memory, since they * will be replacing local heaps. * + * Map "fractal heap" 'huge' objects to 'draw' type file memory, since they + * represent large objects that are directly stored in the file. + * * -QAK */ #define H5FD_MEM_FHEAP_HDR H5FD_MEM_OHDR #define H5FD_MEM_FHEAP_IBLOCK H5FD_MEM_OHDR #define H5FD_MEM_FHEAP_DBLOCK H5FD_MEM_LHEAP +#define H5FD_MEM_FHEAP_HUGE_OBJ H5FD_MEM_DRAW /* Map "free space" header blocks to 'ohdr' type file memory, since its * a fair amount of work to add a new kind of file memory and they are similar @@ -355,7 +355,9 @@ HDfprintf(stderr, "%s: size = %Zu\n", FUNC, size); /* Check if object is large enough to be standalone */ if(size > hdr->max_man_size) { -HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "standalone blocks not supported yet") + /* Store 'huge' object in heap */ + if(H5HF_huge_insert(hdr, dxpl_id, size, obj, id) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "can't allocate space for 'managed' object in fractal heap") } /* end if */ else { /* Check if we are in "append only" mode, or if there's enough room for the object */ @@ -363,15 +365,9 @@ HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "standalone blocks not supported ye HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "'write once' managed blocks not supported yet") } /* end if */ else { - H5HF_free_section_t *sec_node; /* Pointer to free space section */ - - /* Find free space in heap */ - if(H5HF_man_find(hdr, 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(hdr, dxpl_id, sec_node, size, obj, id) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "can't allocate space for object in fractal heap") + /* Allocate space for object in 'managed' heap */ + if(H5HF_man_insert(hdr, dxpl_id, size, obj, id) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "can't allocate space for 'managed' object in fractal heap") } /* end else */ } /* end else */ @@ -397,7 +393,7 @@ HDfprintf(stderr, "%s: Leaving, ret_value = %d\n", FUNC, ret_value); *------------------------------------------------------------------------- */ herr_t -H5HF_get_obj_len(H5HF_t *fh, const void *_id, size_t *obj_len_p) +H5HF_get_obj_len(H5HF_t *fh, hid_t dxpl_id, const void *_id, size_t *obj_len_p) { const uint8_t *id = (const uint8_t *)_id; /* Object ID */ uint8_t id_flags; /* Heap ID flag bits */ @@ -419,7 +415,7 @@ H5HF_get_obj_len(H5HF_t *fh, const void *_id, size_t *obj_len_p) if((id_flags & H5HF_ID_VERS_MASK) != H5HF_ID_VERS_CURR) HGOTO_ERROR(H5E_HEAP, H5E_VERSION, FAIL, "incorrect heap ID version") - /* Check for managed object */ + /* Check type of object in heap */ if((id_flags & H5HF_ID_TYPE_MASK) == H5HF_ID_TYPE_MAN) { /* Skip over object offset */ id += fh->hdr->heap_off_size; @@ -427,6 +423,10 @@ H5HF_get_obj_len(H5HF_t *fh, const void *_id, size_t *obj_len_p) /* Retrieve the entry length */ UINT64DECODE_VAR(id, *obj_len_p, fh->hdr->heap_len_size); } /* end if */ + else if((id_flags & H5HF_ID_TYPE_MASK) == H5HF_ID_TYPE_HUGE) { + if(H5HF_huge_get_obj_len(fh->hdr, dxpl_id, id, obj_len_p) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't get 'huge' object's length") + } /* end if */ else { HDfprintf(stderr, "%s: Heap ID type not supported yet!\n", FUNC); HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "heap ID type not supported yet") @@ -473,22 +473,17 @@ H5HF_read(H5HF_t *fh, hid_t dxpl_id, const void *_id, void *obj/*out*/) if((id_flags & H5HF_ID_VERS_MASK) != H5HF_ID_VERS_CURR) HGOTO_ERROR(H5E_HEAP, H5E_VERSION, FAIL, "incorrect heap ID version") - /* Check for managed object */ + /* Check type of object in heap */ if((id_flags & H5HF_ID_TYPE_MASK) == H5HF_ID_TYPE_MAN) { - hsize_t obj_off; /* Object's offset in heap */ - size_t obj_len; /* Object's length in heap */ - - /* Decode the object offset within the heap & it's length */ - UINT64DECODE_VAR(id, obj_off, fh->hdr->heap_off_size); - UINT64DECODE_VAR(id, obj_len, fh->hdr->heap_len_size); -#ifdef QAK -HDfprintf(stderr, "%s: obj_off = %Hu, obj_len = %Zu\n", FUNC, obj_off, obj_len); -#endif /* QAK */ - /* Read object from managed heap blocks */ - if(H5HF_man_read(fh->hdr, dxpl_id, obj_off, obj_len, obj) < 0) + if(H5HF_man_read(fh->hdr, dxpl_id, id, obj) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't read object from fractal heap") } /* end if */ + else if((id_flags & H5HF_ID_TYPE_MASK) == H5HF_ID_TYPE_HUGE) { + /* Read 'huge' object from file */ + if(H5HF_huge_read(fh->hdr, dxpl_id, id, obj) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't read 'huge' object from fractal heap") + } /* end if */ else { HDfprintf(stderr, "%s: Heap ID type not supported yet!\n", FUNC); HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "heap ID type not supported yet") @@ -535,29 +530,17 @@ H5HF_remove(H5HF_t *fh, hid_t dxpl_id, const void *_id) if((id_flags & H5HF_ID_VERS_MASK) != H5HF_ID_VERS_CURR) HGOTO_ERROR(H5E_HEAP, H5E_VERSION, FAIL, "incorrect heap ID version") - /* Check for managed object */ + /* Check type of object in heap */ if((id_flags & H5HF_ID_TYPE_MASK) == H5HF_ID_TYPE_MAN) { - hsize_t obj_off; /* Object's offset in heap */ - size_t obj_len; /* Object's length in heap */ - - /* Decode the object offset within the heap & it's length */ -#ifdef QAK -HDfprintf(stderr, "%s: fh->hdr->heap_off_size = %u, fh->hdr->heap_len_size = %u\n", FUNC, (unsigned)fh->hdr->heap_off_size, (unsigned)fh->hdr->heap_len_size); -#endif /* QAK */ - UINT64DECODE_VAR(id, obj_off, fh->hdr->heap_off_size); - UINT64DECODE_VAR(id, obj_len, fh->hdr->heap_len_size); -#ifdef QAK -HDfprintf(stderr, "%s: obj_off = %Hu, obj_len = %Zu\n", FUNC, obj_off, obj_len); -#endif /* QAK */ - - /* Sanity check parameters */ - HDassert(obj_off); - HDassert(obj_len); - /* Remove object from managed heap blocks */ - if(H5HF_man_remove(fh->hdr, dxpl_id, obj_off, obj_len) < 0) + if(H5HF_man_remove(fh->hdr, dxpl_id, id) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTREMOVE, FAIL, "can't remove object from fractal heap") } /* end if */ + else if((id_flags & H5HF_ID_TYPE_MASK) == H5HF_ID_TYPE_HUGE) { + /* Remove 'huge' object from file & v2 B-tree tracker */ + if(H5HF_huge_remove(fh->hdr, dxpl_id, id) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTREMOVE, FAIL, "can't remove 'huge' object from fractal heap") + } /* end if */ else { HDfprintf(stderr, "%s: Heap ID type not supported yet!\n", FUNC); HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "heap ID type not supported yet") @@ -611,7 +594,7 @@ H5HF_close(H5HF_t *fh, hid_t dxpl_id) if(H5HF_space_close(fh->hdr, dxpl_id) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't release free space info") - /* Reset the block iterator */ + /* Reset the block iterator, if necessary */ /* (Can't put this in header "destroy" routine, because it has * pointers to indirect blocks in the heap, which would create * a reference loop and the objects couldn't be removed from @@ -622,15 +605,21 @@ HDfprintf(stderr, "%s; fh->hdr->man_iter_off = %Hu\n", FUNC, fh->hdr->man_iter_o HDfprintf(stderr, "%s; fh->hdr->man_size = %Hu\n", FUNC, fh->hdr->man_size); HDfprintf(stderr, "%s; fh->hdr->rc = %Zu\n", FUNC, fh->hdr->rc); #endif /* QAK */ - /* Reset block iterator, if necessary */ - if(H5HF_man_iter_ready(&fh->hdr->next_block)) { + if(H5HF_man_iter_ready(&fh->hdr->next_block)) if(H5HF_man_iter_reset(&fh->hdr->next_block) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't reset block iterator") - } /* end if */ #ifdef QAK HDfprintf(stderr, "%s; After iterator reset fh->hdr->rc = %Zu\n", FUNC, fh->hdr->rc); #endif /* QAK */ + /* Shut down the huge object information */ + /* (Can't put this in header "destroy" routine, because it has + * has the address of an object in the file, which might be + * by the shutdown routine - QAK) + */ + if(H5HF_huge_term(fh->hdr, dxpl_id) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't release 'huge' object info") + /* Decrement the reference count on the heap header */ if(H5HF_hdr_decr(fh->hdr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't decrement reference count on shared heap header") @@ -712,6 +701,16 @@ HDfprintf(stderr, "%s: hdr->man_dtable.table_addr = %a\n", FUNC, hdr->man_dtable } /* end else */ } /* end if */ + /* Check for 'huge' objects in heap */ + if(H5F_addr_defined(hdr->huge_bt2_addr)) { +#ifdef QAK +HDfprintf(stderr, "%s: hdr->huge_bt2_addr = %a\n", FUNC, hdr->huge_bt2_addr); +#endif /* QAK */ + /* Delete huge objects in heap and their tracker */ + if(H5HF_huge_delete(hdr, dxpl_id) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to release fractal heap 'huge' objects and tracker") + } /* end if */ + /* Release header's disk space */ if(H5MF_xfree(f, H5FD_MEM_FHEAP_HDR, dxpl_id, fh_addr, (hsize_t)H5HF_HEADER_SIZE(hdr)) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to release fractal heap header") diff --git a/src/H5HFbtree2.c b/src/H5HFbtree2.c new file mode 100644 index 0000000..4a324aa --- /dev/null +++ b/src/H5HFbtree2.c @@ -0,0 +1,370 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/*------------------------------------------------------------------------- + * + * Created: H5HFbtree2.c + * Aug 7 2006 + * Quincey Koziol <koziol@hdfgroup.org> + * + * Purpose: v2 B-tree callbacks for "huge" object tracker + * + *------------------------------------------------------------------------- + */ + +/****************/ +/* 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 "H5MFprivate.h" /* File memory management */ + + +/****************/ +/* Local Macros */ +/****************/ + + +/******************/ +/* Local Typedefs */ +/******************/ + + +/********************/ +/* Package Typedefs */ +/********************/ + + +/********************/ +/* Local Prototypes */ +/********************/ + +/* v2 B-tree function callbacks */ +herr_t H5HF_huge_bt2_found(const void *nrecord, void *op_data); +herr_t H5HF_huge_bt2_remove(const void *nrecord, void *op_data); + +/* v2 B-tree driver callbacks */ +static herr_t H5HF_huge_btree2_store(const H5B2_class_t *cls, void *native, const void *udata); +static herr_t H5HF_huge_btree2_retrieve(const H5B2_class_t *cls, void *udata, const void *native); +static herr_t H5HF_huge_btree2_compare(const H5B2_class_t *cls, const void *rec1, const void *rec2); +static herr_t H5HF_huge_btree2_encode(const H5F_t *f, const H5B2_class_t *cls, uint8_t *raw, + const void *native); +static herr_t H5HF_huge_btree2_decode(const H5F_t *f, const H5B2_class_t *cls, const uint8_t *raw, + void *native); +static herr_t H5HF_huge_btree2_debug(FILE *stream, const H5F_t *f, hid_t dxpl_id, + int indent, int fwidth, const H5B2_class_t *cls, const void *record, const void *_udata); + +/*********************/ +/* Package Variables */ +/*********************/ +const H5B2_class_t H5HF_BTREE2[1]={{ /* B-tree class information */ + H5B2_FHEAP_ID, /* Type of B-tree */ + 0, /* Size of native record */ + /* (computed at run-time for each heap) */ + NULL, /* Class private information */ + H5HF_huge_btree2_store, /* Record storage callback */ + H5HF_huge_btree2_retrieve, /* Record retrieval callback */ + H5HF_huge_btree2_compare, /* Record comparison callback */ + H5HF_huge_btree2_encode, /* Record encoding callback */ + H5HF_huge_btree2_decode, /* Record decoding callback */ + H5HF_huge_btree2_debug /* Record debugging callback */ +}}; + +/*****************************/ +/* Library Private Variables */ +/*****************************/ + + +/*******************/ +/* Local Variables */ +/*******************/ + + +/*------------------------------------------------------------------------- + * Function: H5HF_huge_bt2_found + * + * Purpose: Retrieve record for 'huge' object, when it's found in the + * v2 B-tree + * + * Return: Success: non-negative + * Failure: negative + * + * Programmer: Quincey Koziol + * Tuesday, August 8, 2006 + * + *------------------------------------------------------------------------- + */ +herr_t +H5HF_huge_bt2_found(const void *nrecord, void *op_data) +{ + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_huge_bt2_found) + +#ifdef QAK +HDfprintf(stderr, "%s: nrecord = {%a, %Hu, %Hu}\n", "H5HF_huge_bt2_store", + ((const H5HF_huge_bt2_rec_t *)nrecord)->addr, + ((const H5HF_huge_bt2_rec_t *)nrecord)->len, + ((const H5HF_huge_bt2_rec_t *)nrecord)->id); +#endif /* QAK */ + *(H5HF_huge_bt2_rec_t *)op_data = *(const H5HF_huge_bt2_rec_t *)nrecord; + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* H5HF_huge_bt2_found() */ + + +/*------------------------------------------------------------------------- + * Function: H5HF_huge_bt2_remove + * + * Purpose: Free space for 'huge' object, as v2 B-tree is being deleted + * + * Return: Success: non-negative + * Failure: negative + * + * Programmer: Quincey Koziol + * Tuesday, August 8, 2006 + * + *------------------------------------------------------------------------- + */ +herr_t +H5HF_huge_bt2_remove(const void *nrecord, void *_udata) +{ + H5HF_huge_remove_ud1_t *udata = (H5HF_huge_remove_ud1_t *)_udata; /* User callback data */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT(H5HF_huge_bt2_remove) + + /* Free the space in the file for the object being removed */ + if(H5MF_xfree(udata->hdr->f, H5FD_MEM_FHEAP_HUGE_OBJ, udata->dxpl_id, ((const H5HF_huge_bt2_rec_t *)nrecord)->addr, ((const H5HF_huge_bt2_rec_t *)nrecord)->len) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to free space for huge object on disk") + + /* Set the length of the object removed */ + udata->obj_len = ((const H5HF_huge_bt2_rec_t *)nrecord)->len; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5HF_huge_bt2_remove() */ + + +/*------------------------------------------------------------------------- + * Function: H5HF_huge_btree2_store + * + * Purpose: Store native information into record for v2 B-tree + * + * Return: Success: non-negative + * + * Failure: negative + * + * Programmer: Quincey Koziol + * Monday, August 7, 2006 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5HF_huge_btree2_store(const H5B2_class_t UNUSED *cls, void *nrecord, const void *udata) +{ + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_huge_btree2_store) + + *(H5HF_huge_bt2_rec_t *)nrecord = *(const H5HF_huge_bt2_rec_t *)udata; + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* H5HF_huge_btree2_store() */ + + +/*------------------------------------------------------------------------- + * Function: H5HF_huge_btree2_retrieve + * + * Purpose: Retrieve native information from record for v2 B-tree + * + * Return: Success: non-negative + * + * Failure: negative + * + * Programmer: Quincey Koziol + * Monday, August 7, 2006 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5HF_huge_btree2_retrieve(const H5B2_class_t UNUSED *cls, void *udata, const void *nrecord) +{ + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_huge_btree2_retrieve) + + *(H5HF_huge_bt2_rec_t *)udata = *(const H5HF_huge_bt2_rec_t *)nrecord; + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* H5HF_huge_btree2_retrieve() */ + + +/*------------------------------------------------------------------------- + * Function: H5HF_huge_btree2_compare + * + * Purpose: Compare two native information records, according to some key + * + * Return: <0 if rec1 < rec2 + * =0 if rec1 == rec2 + * >0 if rec1 > rec2 + * + * Programmer: Quincey Koziol + * Monday, August 7, 2006 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5HF_huge_btree2_compare(const H5B2_class_t *cls, const void *_rec1, const void *_rec2) +{ + const H5HF_huge_bt2_rec_t *rec1 = (const H5HF_huge_bt2_rec_t *)_rec1; + const H5HF_huge_bt2_rec_t *rec2 = (const H5HF_huge_bt2_rec_t *)_rec2; + const H5HF_hdr_t *hdr = (const H5HF_hdr_t *)cls->cls_private; + herr_t ret_value; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_huge_btree2_compare) + +#ifdef QAK +HDfprintf(stderr, "%s: hdr->huge_ids_direct = %t\n", "H5HF_huge_btree2_compare", hdr->huge_ids_direct); +HDfprintf(stderr, "%s: rec1 = {%a, %Hu, %Hu}\n", "H5HF_huge_btree2_compare", rec1->addr, rec1->len, rec1->id); +HDfprintf(stderr, "%s: rec2 = {%a, %Hu, %Hu}\n", "H5HF_huge_btree2_compare", rec2->addr, rec2->len, rec2->id); +#endif /* QAK */ + /* Sort differently, depending on whether 'huge' object directly reference disk */ + if(hdr->huge_ids_direct) { + if(rec1->addr < rec2->addr) + ret_value = -1; + else if(rec1->addr > rec2->addr) + ret_value = 1; + else if(rec1->len < rec2->len) + ret_value = -1; + else if(rec1->len > rec2->len) + ret_value = 1; + else + ret_value = 0; + } /* end if */ + else + ret_value = (herr_t)(rec1->id - rec2->id); + + FUNC_LEAVE_NOAPI(ret_value); +} /* H5HF_huge_btree2_compare() */ + + +/*------------------------------------------------------------------------- + * Function: H5HF_huge_btree2_encode + * + * Purpose: Encode native information into raw form for storing on disk + * + * Return: Success: non-negative + * + * Failure: negative + * + * Programmer: Quincey Koziol + * Monday, August 7, 2006 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5HF_huge_btree2_encode(const H5F_t *f, const H5B2_class_t *cls, uint8_t *raw, const void *_nrecord) +{ + const H5HF_huge_bt2_rec_t *nrecord = (const H5HF_huge_bt2_rec_t *)_nrecord; + const H5HF_hdr_t *hdr = (const H5HF_hdr_t *)cls->cls_private; + + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_huge_btree2_encode) + + /* Encode the record's common fields */ + H5F_addr_encode(f, &raw, nrecord->addr); + H5F_ENCODE_LENGTH(f, raw, nrecord->len); + + /* If 'huge' objects in this heap are not accessed directly, encode the ID also */ + if(!hdr->huge_ids_direct) + UINT64ENCODE_VAR(raw, nrecord->id, hdr->huge_id_size) + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* H5HF_huge_btree2_encode() */ + + +/*------------------------------------------------------------------------- + * Function: H5HF_huge_btree2_decode + * + * Purpose: Decode raw disk form of record into native form + * + * Return: Success: non-negative + * + * Failure: negative + * + * Programmer: Quincey Koziol + * Monday, August 7, 2006 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5HF_huge_btree2_decode(const H5F_t *f, const H5B2_class_t *cls, const uint8_t *raw, void *_nrecord) +{ + H5HF_huge_bt2_rec_t *nrecord = (H5HF_huge_bt2_rec_t *)_nrecord; + const H5HF_hdr_t *hdr = (const H5HF_hdr_t *)cls->cls_private; + + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_huge_btree2_decode) + + /* Decode the record's common fields */ + H5F_addr_decode(f, &raw, &nrecord->addr); + H5F_DECODE_LENGTH(f, raw, nrecord->len); + + /* If 'huge' objects in this heap are not accessed directly, decode the ID also */ + if(!hdr->huge_ids_direct) + UINT64DECODE_VAR(raw, nrecord->id, hdr->huge_id_size) + else + nrecord->id = 0; + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* H5HF_huge_btree2_decode() */ + + +/*------------------------------------------------------------------------- + * Function: H5HF_huge_btree2_debug + * + * Purpose: Debug native form of record + * + * Return: Success: non-negative + * + * Failure: negative + * + * Programmer: Quincey Koziol + * Monday, August 7, 2006 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5HF_huge_btree2_debug(FILE *stream, const H5F_t UNUSED *f, hid_t UNUSED dxpl_id, + int indent, int fwidth, const H5B2_class_t *cls, const void *_nrecord, + const void UNUSED *_udata) +{ + const H5HF_huge_bt2_rec_t *nrecord = (const H5HF_huge_bt2_rec_t *)_nrecord; + const H5HF_hdr_t *hdr = (const H5HF_hdr_t *)cls->cls_private; + + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_huge_btree2_debug) + + HDassert(nrecord); + + if(hdr->huge_ids_direct) + HDfprintf(stream, "%*s%-*s {%a, %Hu}\n", indent, "", fwidth, "Record:", + nrecord->addr, nrecord->len); + else + HDfprintf(stream, "%*s%-*s {%a, %Hu, %Hu}\n", indent, "", fwidth, "Record:", + nrecord->addr, nrecord->len, nrecord->id); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* H5HF_huge_btree2_debug() */ + diff --git a/src/H5HFcache.c b/src/H5HFcache.c index 53bf5ea..4915533 100644 --- a/src/H5HFcache.c +++ b/src/H5HFcache.c @@ -317,7 +317,7 @@ HDfprintf(stderr, "%s: Load heap header, addr = %a\n", FUNC, addr); /* "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 */ + H5F_addr_decode(f, &p, &hdr->huge_bt2_addr); /* Address of "huge" object tracker B-tree */ /* "Managed" object free space information */ H5F_DECODE_LENGTH(f, p, hdr->total_man_free); /* Internal free space in managed direct blocks */ @@ -428,7 +428,7 @@ HDfprintf(stderr, "%s: Flushing heap header, addr = %a, destroy = %u\n", FUNC, a /* "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 */ + H5F_addr_encode(f, &p, hdr->huge_bt2_addr); /* Address of "huge" object tracker B-tree */ /* "Managed" object free space information */ H5F_ENCODE_LENGTH(f, p, hdr->total_man_free); /* Internal free space in managed direct blocks */ diff --git a/src/H5HFdbg.c b/src/H5HFdbg.c index b603f0a..cfff2ca 100644 --- a/src/H5HFdbg.c +++ b/src/H5HFdbg.c @@ -256,7 +256,7 @@ H5HF_hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, hdr->huge_next_id); HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, "Address of v2 B-tree for 'huge' objects:", - hdr->huge_bt_addr); + hdr->huge_bt2_addr); HDfprintf(stream, "%*sManaged Objects Doubling-Table Info...\n", indent, ""); H5HF_dtable_debug(&hdr->man_dtable, stream, indent + 3, MAX(0, fwidth -3)); diff --git a/src/H5HFhdr.c b/src/H5HFhdr.c index b93b8bf..3b09d81 100644 --- a/src/H5HFhdr.c +++ b/src/H5HFhdr.c @@ -249,6 +249,10 @@ HDfprintf(stderr, "%s: row_max_dblock_free[%Zu] = %Zu\n", FUNC, u, hdr->man_dtab if(H5HF_man_iter_init(&hdr->next_block) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't initialize space search block iterator") + /* Initialize the information for tracking 'huge' objects */ + if(H5HF_huge_init(hdr) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't informan for tracking huge objects") + done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5HF_hdr_finish_init() */ @@ -318,8 +322,8 @@ 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; + /* Set "huge" object tracker v2 B-tree address to indicate that there aren't any yet */ + hdr->huge_bt2_addr = HADDR_UNDEF; /* Note that the shared info is dirty (it's not written to the file yet) */ hdr->dirty = TRUE; diff --git a/src/H5HFhuge.c b/src/H5HFhuge.c new file mode 100644 index 0000000..517367b --- /dev/null +++ b/src/H5HFhuge.c @@ -0,0 +1,574 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/*------------------------------------------------------------------------- + * + * Created: H5HFhuge.c + * Aug 7 2006 + * Quincey Koziol <koziol@hdfgroup.org> + * + * Purpose: Routines for "huge" objects in fractal heap + * + *------------------------------------------------------------------------- + */ + +/****************/ +/* 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 "H5MFprivate.h" /* File memory management */ + + +/****************/ +/* Local Macros */ +/****************/ + +/* v2 B-tree creation macros */ +#define H5HF_HUGE_BT2_NODE_SIZE 512 +#define H5HF_HUGE_BT2_SPLIT_PERC 100 +#define H5HF_HUGE_BT2_MERGE_PERC 40 + + +/******************/ +/* Local Typedefs */ +/******************/ + + +/********************/ +/* Package Typedefs */ +/********************/ + + +/********************/ +/* Local Prototypes */ +/********************/ + +/* local v2 B-tree operations */ +static herr_t H5HF_huge_bt2_create(H5HF_hdr_t *hdr, hid_t dxpl_id); + +/* v2 B-tree function callbacks (in H5HFbtree2.c) */ +herr_t H5HF_huge_bt2_found(const void *nrecord, void *op_data); +herr_t H5HF_huge_bt2_remove(const void *nrecord, void *op_data); + +/*********************/ +/* Package Variables */ +/*********************/ + +/* The v2 B-tree class for tracking huge objects */ +H5_DLLVAR const H5B2_class_t H5HF_BTREE2[1]; + + +/*****************************/ +/* Library Private Variables */ +/*****************************/ + + +/*******************/ +/* Local Variables */ +/*******************/ + + +/*------------------------------------------------------------------------- + * Function: H5HF_huge_bt2_create + * + * Purpose: Create the v2 B-tree for tracking the huge objects in the heap + * + * Return: SUCCEED/FAIL + * + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Aug 7 2006 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5HF_huge_bt2_create(H5HF_hdr_t *hdr, hid_t dxpl_id) +{ + size_t rrec_size; /* Size of 'raw' records on disk */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT(H5HF_huge_bt2_create) + + /* + * Check arguments. + */ + HDassert(hdr); + + /* Compute the size of 'raw' records on disk */ + if(hdr->huge_ids_direct) + rrec_size = hdr->sizeof_addr + hdr->sizeof_size; + else + rrec_size = hdr->sizeof_addr + hdr->sizeof_size + hdr->huge_id_size; + + /* Create v2 B-tree for tracking 'huge' objects */ + if(H5B2_create(hdr->f, dxpl_id, &hdr->huge_bt2_class, H5HF_HUGE_BT2_NODE_SIZE, rrec_size, + H5HF_HUGE_BT2_SPLIT_PERC, H5HF_HUGE_BT2_MERGE_PERC, &hdr->huge_bt2_addr/*out*/) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTCREATE, FAIL, "can't create v2 B-tree for tracking 'huge' heap objects") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5HF_huge_bt2_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5HF_huge_init + * + * Purpose: Initialize information for tracking 'huge' objects + * + * Return: SUCCEED/FAIL + * + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Aug 7 2006 + * + *------------------------------------------------------------------------- + */ +herr_t +H5HF_huge_init(H5HF_hdr_t *hdr) +{ + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_huge_init) + + /* + * Check arguments. + */ + HDassert(hdr); + + /* Compute information about 'huge' objects for the heap */ + + /* Check if we can completely hold the 'huge' object's offset & length in + * the file in the heap ID (which will speed up accessing it) + */ + if((hdr->sizeof_addr + hdr->sizeof_size) <= (hdr->id_len - 1)) { + /* Indicate that v2 B-tree doesn't have to be used to locate object */ + hdr->huge_ids_direct = TRUE; + + /* Set the size of 'huge' object IDs */ + hdr->huge_id_size = hdr->sizeof_addr + hdr->sizeof_size; + } /* end if */ + else { + /* Indicate that v2 B-tree must be used to locate object */ + hdr->huge_ids_direct = FALSE; + + /* Set the size and maximum value of 'huge' object ID */ + if((hdr->id_len - 1) < sizeof(hsize_t)) { + hdr->huge_id_size = hdr->id_len - 1; + hdr->huge_max_id = ((hsize_t)1 << (hdr->huge_id_size * 8)) - 1; + } /*end if */ + else { + hdr->huge_id_size = sizeof(hsize_t); + hdr->huge_max_id = HSIZET_MAX; + } /* end else */ + } /* end else */ + + + /* Set up the v2 B-tree for tracking 'huge' objects in the heap */ + + /* Copy the standard v2 B-tree class */ + HDmemcpy(&hdr->huge_bt2_class, H5HF_BTREE2, sizeof(H5B2_class_t)); + + /* Set the native record size for the v2 B-tree */ + hdr->huge_bt2_class.nrec_size = sizeof(H5HF_huge_bt2_rec_t); + + /* Set v2 B-tree class's "class private" pointer to the heap header */ + hdr->huge_bt2_class.cls_private = hdr; + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5HF_huge_init() */ + + +/*------------------------------------------------------------------------- + * Function: H5HF_huge_insert + * + * Purpose: Insert a huge object into the file and track it + * + * Return: SUCCEED/FAIL + * + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Aug 7 2006 + * + *------------------------------------------------------------------------- + */ +herr_t +H5HF_huge_insert(H5HF_hdr_t *hdr, hid_t dxpl_id, size_t obj_size, const void *obj, + void *_id) +{ + H5HF_huge_bt2_rec_t obj_rec; /* Record for tracking object */ + uint8_t *id = (uint8_t *)_id; /* Pointer to ID buffer */ + haddr_t obj_addr; /* Address of object in the file */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT(H5HF_huge_insert) +#ifdef QAK +HDfprintf(stderr, "%s: obj_size = %Zu\n", FUNC, obj_size); +#endif /* QAK */ + + /* + * Check arguments. + */ + HDassert(hdr); + HDassert(obj_size > hdr->max_man_size); + HDassert(obj); + HDassert(id); + + /* Check if the v2 B-tree for tracking 'huge' heap objects has been created yet */ + if(!H5F_addr_defined(hdr->huge_bt2_addr)) + if(H5HF_huge_bt2_create(hdr, dxpl_id) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTCREATE, FAIL, "can't create v2 B-tree for tracking 'huge' heap objects") + + /* Allocate space in the file for storing the 'huge' object */ + if(HADDR_UNDEF == (obj_addr = H5MF_alloc(hdr->f, H5FD_MEM_FHEAP_HUGE_OBJ, dxpl_id, (hsize_t)obj_size))) + HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, "file allocation failed for fractal heap huge object") + + /* Write the object's data to disk */ + if(H5F_block_write(hdr->f, H5FD_MEM_FHEAP_HUGE_OBJ, obj_addr, obj_size, dxpl_id, obj) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_WRITEERROR, FAIL, "writing 'huge' object to file failed") + + /* Initialize shared part of record for tracking object in v2 B-tree */ + obj_rec.addr = obj_addr; + obj_rec.len = obj_size; + + /* If the 'huge' object will be indirectly accessed, through the v2 B-tree, + * create an ID for it, otherwise put a zero in for ID + */ + if(hdr->huge_ids_direct) + obj_rec.id = 0; + else { + /* Check for wrapping around 'huge' object ID space */ + if(hdr->huge_ids_wrapped) + /* Fail for now - eventually should iterate through v2 B-tree, looking for available ID */ + HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "wrapping 'huge' object IDs not supported yet") + else { + /* Get new 'huge' object ID to use for object */ + /* (avoid using ID 0) */ + obj_rec.id = ++hdr->huge_next_id; + + /* Check for wrapping 'huge' object IDs around */ + if(hdr->huge_next_id == hdr->huge_max_id) + hdr->huge_ids_wrapped = TRUE; + } /* end else */ + } /* end else */ +#ifdef QAK +HDfprintf(stderr, "%s: obj_rec = {%a, %Hu, %Hu}\n", FUNC, obj_rec.addr, obj_rec.len, obj_rec.id); +#endif /* QAK */ + + /* Insert record for object in v2 B-tree */ + if(H5B2_insert(hdr->f, dxpl_id, &hdr->huge_bt2_class, hdr->huge_bt2_addr, &obj_rec) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTINSERT, FAIL, "couldn't insert object tracking record in v2 B-tree") + + /* Encode ID for user */ + *id++ = H5HF_ID_VERS_CURR | H5HF_ID_TYPE_HUGE; + if(hdr->huge_ids_direct) { + H5F_addr_encode(hdr->f, &id, obj_addr); + H5F_ENCODE_LENGTH(hdr->f, id, (hsize_t)obj_size); + } /* end if */ + else + UINT64ENCODE_VAR(id, obj_rec.id, hdr->huge_id_size) + + /* Update statistics about heap */ + hdr->huge_size += obj_size; + hdr->huge_nobjs++; + + /* Mark heap header as modified */ + if(H5HF_hdr_dirty(hdr) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark heap header as dirty") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5HF_huge_insert() */ + + +/*------------------------------------------------------------------------- + * Function: H5HF_huge_get_obj_len + * + * Purpose: Get the size of a 'huge' object in a fractal heap + * + * Return: SUCCEED/FAIL + * + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Aug 8 2006 + * + *------------------------------------------------------------------------- + */ +herr_t +H5HF_huge_get_obj_len(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id, + size_t *obj_len_p) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(H5HF_huge_get_obj_len, FAIL) + + /* + * Check arguments. + */ + HDassert(hdr); + HDassert(H5F_addr_defined(hdr->huge_bt2_addr)); + HDassert(id); + HDassert(obj_len_p); + + /* Check if 'huge' object ID encodes address & length directly */ + if(hdr->huge_ids_direct) { + /* Skip over object offset in file */ + id += hdr->sizeof_addr; + + /* Retrieve the object's length */ + H5F_DECODE_LENGTH(hdr->f, id, *obj_len_p); + } /* end if */ + else { + H5HF_huge_bt2_rec_t found_rec; /* Record found from tracking object */ + H5HF_huge_bt2_rec_t search_rec; /* Record for searching for object */ + + /* Get ID for looking up 'huge' object in v2 B-tree */ + UINT64DECODE_VAR(id, search_rec.id, hdr->huge_id_size) + + /* Look up object in v2 B-tree */ + if(H5B2_find(hdr->f, dxpl_id, &hdr->huge_bt2_class, hdr->huge_bt2_addr, + &search_rec, H5HF_huge_bt2_found, &found_rec) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_NOTFOUND, FAIL, "can't find object in B-tree") + + /* Retrieve the object's length */ + *obj_len_p = (size_t)found_rec.len; + } /* end else */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5HF_huge_get_obj_len() */ + + +/*------------------------------------------------------------------------- + * Function: H5HF_huge_read + * + * Purpose: Read a 'huge' object from the heap + * + * Return: SUCCEED/FAIL + * + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Aug 8 2006 + * + *------------------------------------------------------------------------- + */ +herr_t +H5HF_huge_read(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id, void *obj) +{ + haddr_t obj_addr; /* Object's address in the file */ + hsize_t obj_size; /* Object's size in the file */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT(H5HF_huge_read) + + /* + * Check arguments. + */ + HDassert(hdr); + HDassert(id); + HDassert(obj); + + /* Check for 'huge' object ID that encodes address & length directly */ + if(hdr->huge_ids_direct) { + /* Retrieve the object's address and length */ + H5F_addr_decode(hdr->f, &id, &obj_addr); + H5F_DECODE_LENGTH(hdr->f, id, obj_size); + } /* end if */ + else { + H5HF_huge_bt2_rec_t found_rec; /* Record found from tracking object */ + H5HF_huge_bt2_rec_t search_rec; /* Record for searching for object */ + + /* Get ID for looking up 'huge' object in v2 B-tree */ + UINT64DECODE_VAR(id, search_rec.id, hdr->huge_id_size) + + /* Look up object in v2 B-tree */ + if(H5B2_find(hdr->f, dxpl_id, &hdr->huge_bt2_class, hdr->huge_bt2_addr, + &search_rec, H5HF_huge_bt2_found, &found_rec) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_NOTFOUND, FAIL, "can't find object in B-tree") + + /* Retrieve the object's address & length */ + obj_addr = found_rec.addr; + obj_size = found_rec.len; + } /* end else */ + + /* Read the object's data from the file */ + if (H5F_block_read(hdr->f, H5FD_MEM_FHEAP_HUGE_OBJ, obj_addr, (size_t)obj_size, dxpl_id, obj) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_READERROR, FAIL, "can't read 'huge' object's data from the file") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5HF_huge_read() */ + + +/*------------------------------------------------------------------------- + * Function: H5HF_huge_remove + * + * Purpose: Remove a 'huge' object from the file and the v2 B-tree tracker + * + * Return: SUCCEED/FAIL + * + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Aug 8 2006 + * + *------------------------------------------------------------------------- + */ +herr_t +H5HF_huge_remove(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id) +{ + H5HF_huge_bt2_rec_t search_rec; /* Record for searching for object */ + H5HF_huge_remove_ud1_t udata; /* User callback data for v2 B-tree remove call */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT(H5HF_huge_remove) + + /* + * Check arguments. + */ + HDassert(hdr); + HDassert(id); + + /* Check for 'huge' object ID that encodes address & length directly */ + if(hdr->huge_ids_direct) { + /* Retrieve the object's address and length */ + /* (used as key in v2 B-tree record) */ + H5F_addr_decode(hdr->f, &id, &search_rec.addr); + H5F_DECODE_LENGTH(hdr->f, id, search_rec.len); + } /* end if */ + else + /* Get ID for looking up 'huge' object in v2 B-tree */ + UINT64DECODE_VAR(id, search_rec.id, hdr->huge_id_size) + + /* Set up the callback info */ + udata.hdr = hdr; + udata.dxpl_id = dxpl_id; + + /* Remove the record for tracking the 'huge' object from the v2 B-tree */ + /* (space in the file for the object is freed in the 'remove' callback) */ + if(H5B2_remove(hdr->f, dxpl_id, &hdr->huge_bt2_class, hdr->huge_bt2_addr, + &search_rec, H5HF_huge_bt2_remove, &udata) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTREMOVE, FAIL, "can't remove object from B-tree") + + /* Update statistics about heap */ + hdr->huge_size -= udata.obj_len; + hdr->huge_nobjs--; + + /* Mark heap header as modified */ + if(H5HF_hdr_dirty(hdr) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark heap header as dirty") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5HF_huge_remove() */ + + +/*------------------------------------------------------------------------- + * Function: H5HF_huge_term + * + * Purpose: Shut down the information for tracking 'huge' objects + * + * Return: SUCCEED/FAIL + * + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Aug 8 2006 + * + *------------------------------------------------------------------------- + */ +herr_t +H5HF_huge_term(H5HF_hdr_t *hdr, hid_t dxpl_id) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT(H5HF_huge_term) + + /* + * Check arguments. + */ + HDassert(hdr); + + /* Check if there are no more 'huge' objects in the heap and delete the + * v2 B-tree that tracks them, if so + */ + if(H5F_addr_defined(hdr->huge_bt2_addr) && hdr->huge_nobjs == 0) { + /* Sanity check */ + HDassert(hdr->huge_size == 0); + + /* Delete the v2 B-tree */ + if(H5B2_delete(hdr->f, dxpl_id, &hdr->huge_bt2_class, hdr->huge_bt2_addr, NULL, NULL) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTDELETE, FAIL, "can't delete v2 B-tree") + + /* Reset the information about 'huge' objects in the file */ + hdr->huge_bt2_addr = HADDR_UNDEF; + hdr->huge_next_id = 0; + hdr->huge_ids_wrapped = FALSE; + + /* Mark heap header as modified */ + if(H5HF_hdr_dirty(hdr) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark heap header as dirty") + } /* end if */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5HF_huge_term() */ + + +/*------------------------------------------------------------------------- + * Function: H5HF_huge_delete + * + * Purpose: Delete all the 'huge' objects in the heap, and the v2 B-tree + * tracker for them + * + * Return: SUCCEED/FAIL + * + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Aug 8 2006 + * + *------------------------------------------------------------------------- + */ +herr_t +H5HF_huge_delete(H5HF_hdr_t *hdr, hid_t dxpl_id) +{ + H5HF_huge_remove_ud1_t udata; /* User callback data for v2 B-tree remove call */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT(H5HF_huge_delete) + + /* + * Check arguments. + */ + HDassert(hdr); + HDassert(H5F_addr_defined(hdr->huge_bt2_addr)); + HDassert(hdr->huge_nobjs); + HDassert(hdr->huge_size); + + /* Set up the callback info */ + udata.hdr = hdr; + udata.dxpl_id = dxpl_id; + + /* Delete the v2 B-tree */ + if(H5B2_delete(hdr->f, dxpl_id, &hdr->huge_bt2_class, hdr->huge_bt2_addr, H5HF_huge_bt2_remove, &udata) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTDELETE, FAIL, "can't delete v2 B-tree") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5HF_huge_delete() */ + diff --git a/src/H5HFint.c b/src/H5HFint.c index a8441ea..5fae177 100644 --- a/src/H5HFint.c +++ b/src/H5HFint.c @@ -14,7 +14,7 @@ /*------------------------------------------------------------------------- * - * Created: H5HFint.c + * Created: H5HFman.c * Feb 24 2006 * Quincey Koziol <koziol@ncsa.uiuc.edu> * @@ -206,64 +206,6 @@ done: /*------------------------------------------------------------------------- - * 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(H5HF_hdr_t *hdr, hid_t dxpl_id, size_t request, - H5HF_free_section_t **sec_node/*out*/) -{ - 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(hdr); - HDassert(request > 0); - HDassert(sec_node); - - /* Look for free space */ - if((node_found = H5HF_space_find(hdr, dxpl_id, (hsize_t)request, sec_node)) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "can't locate free space in fractal heap") -#ifdef QAK -HDfprintf(stderr, "%s: After H5HF_space_find(), node_found = %t\n", FUNC, node_found); -#endif /* QAK */ - - /* If we didn't find a node, go create a direct block big enough to hold the requested block */ - if(!node_found) - /* Allocate direct block big enough to hold requested size */ - if(H5HF_man_dblock_new(hdr, dxpl_id, request, sec_node) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTCREATE, FAIL, "can't create fractal heap direct block") - - HDassert(*sec_node); -#ifdef QAK -HDfprintf(stderr, "%s: (*sec_node)->sect_info.addr = %a\n", FUNC, (*sec_node)->sect_info.addr); -HDfprintf(stderr, "%s: (*sec_node)->sect_info.size = %Hu\n", FUNC, (*sec_node)->sect_info.size); -HDfprintf(stderr, "%s: (*sec_node)->sect_info.type = %u\n", FUNC, (*sec_node)->sect_info.type); -#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 @@ -277,13 +219,15 @@ done: *------------------------------------------------------------------------- */ herr_t -H5HF_man_insert(H5HF_hdr_t *hdr, hid_t dxpl_id, H5HF_free_section_t *sec_node, - size_t obj_size, const void *obj, void *_id) +H5HF_man_insert(H5HF_hdr_t *hdr, hid_t dxpl_id, size_t obj_size, const void *obj, + void *_id) { + H5HF_free_section_t *sec_node; /* Pointer to free space section */ H5HF_direct_t *dblock = NULL; /* Pointer to direct block to modify */ haddr_t dblock_addr = HADDR_UNDEF; /* Direct block address */ uint8_t *id = (uint8_t *)_id; /* Pointer to ID buffer */ size_t blk_off; /* Offset of object within block */ + 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_insert) @@ -299,6 +243,19 @@ HDfprintf(stderr, "%s: obj_size = %Zu\n", FUNC, obj_size); HDassert(obj); HDassert(id); + /* Look for free space */ + if((node_found = H5HF_space_find(hdr, dxpl_id, (hsize_t)obj_size, &sec_node)) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "can't locate free space in fractal heap") +#ifdef QAK +HDfprintf(stderr, "%s: After H5HF_space_find(), node_found = %t\n", FUNC, node_found); +#endif /* QAK */ + + /* If we didn't find a node, go create a direct block big enough to hold the requested block */ + if(!node_found) + /* Allocate direct block big enough to hold requested size */ + if(H5HF_man_dblock_new(hdr, dxpl_id, obj_size, &sec_node) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTCREATE, FAIL, "can't create fractal heap direct block") + /* Check for row section */ if(sec_node->sect_info.type == H5HF_FSPACE_SECT_FIRST_ROW || sec_node->sect_info.type == H5HF_FSPACE_SECT_NORMAL_ROW) { @@ -318,7 +275,7 @@ HDfprintf(stderr, "%s: sec_node->u.row.num_entries = %u\n", FUNC, sec_node->u.ro } /* end if */ HDassert(sec_node->sect_info.type == H5HF_FSPACE_SECT_SINGLE); - /* Check for serialized 'single' section */ + /* Check for 'single' section being serialized */ if(sec_node->sect_info.state == H5FS_SECT_SERIALIZED) { if(H5HF_sect_single_revive(hdr, dxpl_id, sec_node) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't revive single free section") @@ -417,9 +374,11 @@ done: *------------------------------------------------------------------------- */ herr_t -H5HF_man_read(H5HF_hdr_t *hdr, hid_t dxpl_id, hsize_t obj_off, size_t obj_len, void *obj) +H5HF_man_read(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id, void *obj) { H5HF_direct_t *dblock; /* Pointer to direct block to query */ + hsize_t obj_off; /* Object's offset in heap */ + size_t obj_len; /* Object's length in heap */ size_t blk_off; /* Offset of object in block */ uint8_t *p; /* Temporary pointer to obj info in block */ haddr_t dblock_addr; /* Direct block address */ @@ -427,17 +386,22 @@ H5HF_man_read(H5HF_hdr_t *hdr, hid_t dxpl_id, hsize_t obj_off, size_t obj_len, v herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5HF_man_read) -#ifdef QAK -HDfprintf(stderr, "%s: obj_off = %Hu, obj_len = %Zu\n", FUNC, obj_off, obj_len); -#endif /* QAK */ /* * Check arguments. */ HDassert(hdr); + HDassert(id); + HDassert(obj); + + /* Decode the object offset within the heap & it's length */ + UINT64DECODE_VAR(id, obj_off, hdr->heap_off_size); + UINT64DECODE_VAR(id, obj_len, hdr->heap_len_size); +#ifdef QAK +HDfprintf(stderr, "%s: obj_off = %Hu, obj_len = %Zu\n", FUNC, obj_off, obj_len); +#endif /* QAK */ HDassert(obj_off > 0); HDassert(obj_len > 0); - HDassert(obj); /* Check for root direct block */ if(hdr->man_dtable.curr_root_rows == 0) { @@ -511,24 +475,34 @@ done: *------------------------------------------------------------------------- */ herr_t -H5HF_man_remove(H5HF_hdr_t *hdr, hid_t dxpl_id, hsize_t obj_off, size_t obj_len) +H5HF_man_remove(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id) { H5HF_free_section_t *sec_node; /* Pointer to free space section for block */ H5HF_direct_t *dblock; /* Pointer to direct block to query */ + hsize_t obj_off; /* Object's offset in heap */ + size_t obj_len; /* Object's length in heap */ haddr_t dblock_addr; /* Direct block address */ size_t dblock_size; /* Direct block size */ size_t blk_off; /* Offset of object in block */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5HF_man_remove) -#ifdef QAK -HDfprintf(stderr, "%s: obj_off = %Hu, obj_len = %Zu\n", FUNC, obj_off, obj_len); -#endif /* QAK */ /* * Check arguments. */ HDassert(hdr); + HDassert(id); + + /* Decode the object offset within the heap & it's length */ +#ifdef QAK +HDfprintf(stderr, "%s: fh->hdr->heap_off_size = %u, fh->hdr->heap_len_size = %u\n", FUNC, (unsigned)fh->hdr->heap_off_size, (unsigned)fh->hdr->heap_len_size); +#endif /* QAK */ + UINT64DECODE_VAR(id, obj_off, hdr->heap_off_size); + UINT64DECODE_VAR(id, obj_len, hdr->heap_len_size); +#ifdef QAK +HDfprintf(stderr, "%s: obj_off = %Hu, obj_len = %Zu\n", FUNC, obj_off, obj_len); +#endif /* QAK */ HDassert(obj_off > 0); HDassert(obj_len > 0); diff --git a/src/H5HFpkg.h b/src/H5HFpkg.h index cddf981..14d16ea 100644 --- a/src/H5HFpkg.h +++ b/src/H5HFpkg.h @@ -32,6 +32,7 @@ /* Other private headers needed by this file */ #include "H5ACprivate.h" /* Metadata cache */ +#include "H5B2private.h" /* v2 B-trees */ #include "H5FLprivate.h" /* Free Lists */ #include "H5FSprivate.h" /* File free space */ #include "H5SLprivate.h" /* Skip lists */ @@ -296,7 +297,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? */ + hbool_t huge_ids_wrapped; /* Have "huge" object IDs wrapped around? */ /* Doubling table information (partially stored in header) */ /* (Partially set by user, partially derived/updated internally) */ @@ -308,8 +309,8 @@ typedef struct H5HF_hdr_t { /* "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 */ + hsize_t huge_next_id; /* Next ID to use for indirectly tracked 'huge' object */ + haddr_t huge_bt2_addr; /* Address of v2 B-tree for tracking "huge" object info */ /* Statistics for heap (stored in header) */ hsize_t man_size; /* Total amount of managed space in heap */ @@ -330,6 +331,10 @@ typedef struct H5HF_hdr_t { size_t id_len; /* Size of heap IDs (in bytes) */ H5FS_t *fspace; /* Free space list for objects in heap */ H5HF_block_iter_t next_block; /* Block iterator for searching for next block with space */ + H5B2_class_t huge_bt2_class; /* v2 B-tree class information for "huge" object tracking */ + hsize_t huge_max_id; /* Max. 'huge' heap ID before rolling 'huge' heap IDs over */ + hbool_t huge_ids_direct; /* Flag to indicate that 'huge' object's offset & length are stored directly in heap ID */ + unsigned char huge_id_size; /* Size of 'huge' heap IDs (in bytes) */ unsigned char heap_off_size; /* Size of heap offsets (in bytes) */ unsigned char heap_len_size; /* Size of heap ID lengths (in bytes) */ } H5HF_hdr_t; @@ -396,7 +401,21 @@ typedef struct H5HF_parent_t { typedef struct { H5HF_hdr_t *hdr; /* Fractal heap header */ hid_t dxpl_id; /* DXPL ID for operation */ -} H5HF_add_ud1_t; +} H5HF_sect_add_ud1_t; + +/* User data for v2 B-tree 'remove' callback on 'huge' objects */ +typedef struct { + H5HF_hdr_t *hdr; /* Fractal heap header (in) */ + hid_t dxpl_id; /* DXPL ID for operation (in) */ + hsize_t obj_len; /* Length of object removed (out) */ +} H5HF_huge_remove_ud1_t; + +/* Typedef for 'huge' object's records in the v2 B-tree */ +typedef struct H5HF_huge_bt2_rec_t { + haddr_t addr; /* Address of the object in the file */ + hsize_t len; /* Length of the object in the file */ + hsize_t id; /* ID used for object (not used for 'huge' objects directly accessed) */ +} H5HF_huge_bt2_rec_t; /*****************************/ /* Package Private Variables */ @@ -516,19 +535,27 @@ H5_DLL H5HF_direct_t *H5HF_man_dblock_protect(H5HF_hdr_t *hdr, hid_t dxpl_id, H5_DLL herr_t H5HF_man_dblock_delete(H5F_t *f, hid_t dxpl_id, haddr_t dblock_addr, hsize_t dblock_size); -/* Routines for internal operations */ +/* Managed object routines */ H5_DLL herr_t H5HF_man_locate_block(H5HF_hdr_t *hdr, hid_t dxpl_id, hsize_t obj_off, hbool_t locate_indirect, H5HF_indirect_t **par_iblock, unsigned *par_entry, H5AC_protect_t rw); -H5_DLL herr_t H5HF_man_find(H5HF_hdr_t *fh, hid_t dxpl_id, size_t request, - H5HF_free_section_t **sec_node/*out*/); -H5_DLL herr_t H5HF_man_insert(H5HF_hdr_t *fh, hid_t dxpl_id, - H5HF_free_section_t *sec_node, size_t obj_size, const void *obj, - void *id); -H5_DLL herr_t H5HF_man_read(H5HF_hdr_t *fh, hid_t dxpl_id, hsize_t obj_off, - size_t obj_len, void *obj); -H5_DLL herr_t H5HF_man_remove(H5HF_hdr_t *hdr, hid_t dxpl_id, hsize_t obj_off, - size_t obj_len); +H5_DLL herr_t H5HF_man_insert(H5HF_hdr_t *fh, hid_t dxpl_id, size_t obj_size, + const void *obj, void *id); +H5_DLL herr_t H5HF_man_read(H5HF_hdr_t *fh, hid_t dxpl_id, const uint8_t *id, + void *obj); +H5_DLL herr_t H5HF_man_remove(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id); + +/* "Huge" object routines */ +H5_DLL herr_t H5HF_huge_init(H5HF_hdr_t *hdr); +H5_DLL herr_t H5HF_huge_insert(H5HF_hdr_t *hdr, hid_t dxpl_id, size_t obj_size, + const void *obj, void *id); +H5_DLL herr_t H5HF_huge_get_obj_len(H5HF_hdr_t *hdr, hid_t dxpl_id, + const uint8_t *id, size_t *obj_len_p); +H5_DLL herr_t H5HF_huge_read(H5HF_hdr_t *fh, hid_t dxpl_id, const uint8_t *id, + void *obj); +H5_DLL herr_t H5HF_huge_remove(H5HF_hdr_t *fh, hid_t dxpl_id, const uint8_t *id); +H5_DLL herr_t H5HF_huge_term(H5HF_hdr_t *hdr, hid_t dxpl_id); +H5_DLL herr_t H5HF_huge_delete(H5HF_hdr_t *hdr, hid_t dxpl_id); /* Metadata cache callbacks */ H5_DLL herr_t H5HF_cache_hdr_dest(H5F_t *f, H5HF_hdr_t *hdr); diff --git a/src/H5HFprivate.h b/src/H5HFprivate.h index 85e0cf6..3461500 100644 --- a/src/H5HFprivate.h +++ b/src/H5HFprivate.h @@ -91,7 +91,8 @@ H5_DLL herr_t H5HF_get_id_len(H5HF_t *fh, size_t *id_len_p/*out*/); H5_DLL herr_t H5HF_get_heap_addr(H5HF_t *fh, haddr_t *heap_addr); H5_DLL herr_t H5HF_insert(H5HF_t *fh, hid_t dxpl_id, size_t size, const void *obj, void *id/*out*/); -H5_DLL herr_t H5HF_get_obj_len(H5HF_t *fh, const void *id, size_t *obj_len_p/*out*/); +H5_DLL herr_t H5HF_get_obj_len(H5HF_t *fh, hid_t dxpl_id, const void *id, + size_t *obj_len_p/*out*/); H5_DLL herr_t H5HF_read(H5HF_t *fh, hid_t dxpl_id, const void *id, void *obj/*out*/); H5_DLL herr_t H5HF_remove(H5HF_t *fh, hid_t dxpl_id, const void *id); diff --git a/src/H5HFsection.c b/src/H5HFsection.c index 8550a47..2614f8b 100644 --- a/src/H5HFsection.c +++ b/src/H5HFsection.c @@ -758,7 +758,7 @@ H5HF_sect_single_add(H5FS_section_info_t *_sect, unsigned *flags, void *_udata) */ if(!(*flags & H5FS_ADD_DESERIALIZING)) { H5HF_free_section_t *sect = (H5HF_free_section_t *)_sect; /* Fractal heap free section */ - H5HF_add_ud1_t *udata = (H5HF_add_ud1_t *)_udata; /* User callback data */ + H5HF_sect_add_ud1_t *udata = (H5HF_sect_add_ud1_t *)_udata; /* User callback data */ H5HF_hdr_t *hdr = udata->hdr; /* Fractal heap header */ hid_t dxpl_id = udata->dxpl_id; /* DXPL ID for operation */ @@ -899,7 +899,7 @@ H5HF_sect_single_merge(H5FS_section_info_t *_sect1, H5FS_section_info_t *_sect2, { H5HF_free_section_t *sect1 = (H5HF_free_section_t *)_sect1; /* Fractal heap free section */ H5HF_free_section_t *sect2 = (H5HF_free_section_t *)_sect2; /* Fractal heap free section */ - H5HF_add_ud1_t *udata = (H5HF_add_ud1_t *)_udata; /* User callback data */ + H5HF_sect_add_ud1_t *udata = (H5HF_sect_add_ud1_t *)_udata; /* User callback data */ H5HF_hdr_t *hdr = udata->hdr; /* Fractal heap header */ hid_t dxpl_id = udata->dxpl_id; /* DXPL ID for operation */ herr_t ret_value = SUCCEED; /* Return value */ @@ -962,7 +962,7 @@ static htri_t H5HF_sect_single_can_shrink(const H5FS_section_info_t *_sect, void *_udata) { const H5HF_free_section_t *sect = (const H5HF_free_section_t *)_sect; /* Fractal heap free section */ - H5HF_add_ud1_t *udata = (H5HF_add_ud1_t *)_udata; /* User callback data */ + H5HF_sect_add_ud1_t *udata = (H5HF_sect_add_ud1_t *)_udata; /* User callback data */ H5HF_hdr_t *hdr = udata->hdr; /* Fractal heap header */ htri_t ret_value = FALSE; /* Return value */ @@ -1026,7 +1026,7 @@ static herr_t H5HF_sect_single_shrink(H5FS_section_info_t **_sect, void UNUSED *_udata) { H5HF_free_section_t **sect = (H5HF_free_section_t **)_sect; /* Fractal heap free section */ - H5HF_add_ud1_t *udata = (H5HF_add_ud1_t *)_udata; /* User callback data */ + H5HF_sect_add_ud1_t *udata = (H5HF_sect_add_ud1_t *)_udata; /* User callback data */ H5HF_hdr_t *hdr = udata->hdr; /* Fractal heap header */ hid_t dxpl_id = udata->dxpl_id; /* DXPL ID for operation */ H5HF_direct_t *dblock; /* Pointer to direct block for section */ @@ -1768,7 +1768,7 @@ H5HF_sect_row_merge(H5FS_section_info_t *_sect1, H5FS_section_info_t *_sect2, { H5HF_free_section_t *sect1 = (H5HF_free_section_t *)_sect1; /* Fractal heap free section */ H5HF_free_section_t *sect2 = (H5HF_free_section_t *)_sect2; /* Fractal heap free section */ - H5HF_add_ud1_t *udata = (H5HF_add_ud1_t *)_udata; /* User callback data */ + H5HF_sect_add_ud1_t *udata = (H5HF_sect_add_ud1_t *)_udata; /* User callback data */ H5HF_hdr_t *hdr = udata->hdr; /* Fractal heap header */ hid_t dxpl_id = udata->dxpl_id; /* DXPL ID for operation */ herr_t ret_value = SUCCEED; /* Return value */ @@ -1847,7 +1847,7 @@ static htri_t H5HF_sect_row_can_shrink(const H5FS_section_info_t *_sect, void UNUSED *_udata) { const H5HF_free_section_t *sect = (const H5HF_free_section_t *)_sect; /* Fractal heap free section */ - H5HF_add_ud1_t *udata = (H5HF_add_ud1_t *)_udata; /* User callback data */ + H5HF_sect_add_ud1_t *udata = (H5HF_sect_add_ud1_t *)_udata; /* User callback data */ H5HF_hdr_t *hdr = udata->hdr; /* Fractal heap header */ htri_t ret_value = FALSE; /* Return value */ @@ -1893,7 +1893,7 @@ H5HF_sect_row_shrink(H5FS_section_info_t **_sect, void *_udata) { H5HF_free_section_t **sect = (H5HF_free_section_t **)_sect; /* Fractal heap free section */ H5HF_free_section_t *top_indir_sect; /* Top indirect section for row */ - H5HF_add_ud1_t *udata = (H5HF_add_ud1_t *)_udata; /* User callback data */ + H5HF_sect_add_ud1_t *udata = (H5HF_sect_add_ud1_t *)_udata; /* User callback data */ H5HF_hdr_t *hdr = udata->hdr; /* Fractal heap header */ hid_t dxpl_id = udata->dxpl_id; /* DXPL ID for operation */ herr_t ret_value = SUCCEED; /* Return value */ diff --git a/src/H5HFspace.c b/src/H5HFspace.c index 0cc6c12..65f427f 100644 --- a/src/H5HFspace.c +++ b/src/H5HFspace.c @@ -156,7 +156,7 @@ herr_t H5HF_space_add(H5HF_hdr_t *hdr, hid_t dxpl_id, H5HF_free_section_t *node, unsigned flags) { - H5HF_add_ud1_t udata; /* User data for free space manager 'add' */ + H5HF_sect_add_ud1_t udata; /* User data for free space manager 'add' */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5HF_space_add) diff --git a/src/Makefile.am b/src/Makefile.am index 4b7995d..ff9165a 100755 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -51,8 +51,8 @@ libhdf5_la_SOURCES= H5.c H5dbg.c H5A.c H5AC.c H5B.c H5Bcache.c \ H5FDstream.c H5FL.c H5FO.c H5FS.c H5FScache.c H5FSdbg.c H5FSsection.c \ H5G.c H5Gdeprec.c H5Gent.c H5Glink.c H5Gloc.c H5Gname.c H5Gnode.c \ H5Gobj.c H5Goh.c H5Gstab.c H5Gtest.c H5Gtraverse.c \ - H5HF.c H5HFcache.c H5HFdbg.c H5HFdblock.c H5HFdtable.c \ - H5HFhdr.c H5HFiblock.c H5HFint.c H5HFiter.c H5HFsection.c \ + H5HF.c H5HFbtree2.c H5HFcache.c H5HFdbg.c H5HFdblock.c H5HFdtable.c \ + H5HFhdr.c H5HFhuge.c H5HFiblock.c H5HFiter.c H5HFint.c H5HFsection.c \ H5HFspace.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 H5L.c H5Lexternal.c H5O.c H5Oattr.c H5Obogus.c H5Ocache.c \ diff --git a/src/Makefile.in b/src/Makefile.in index fe6bfd5..bda2c99 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -93,9 +93,9 @@ am_libhdf5_la_OBJECTS = H5.lo H5dbg.lo H5A.lo H5AC.lo H5B.lo \ H5FDstream.lo H5FL.lo H5FO.lo H5FS.lo H5FScache.lo H5FSdbg.lo \ H5FSsection.lo H5G.lo H5Gdeprec.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 \ - H5HFdblock.lo H5HFdtable.lo H5HFhdr.lo H5HFiblock.lo \ - H5HFint.lo H5HFiter.lo H5HFsection.lo H5HFspace.lo H5HFstat.lo \ + H5Gtest.lo H5Gtraverse.lo H5HF.lo H5HFbtree2.lo H5HFcache.lo H5HFdbg.lo \ + H5HFdblock.lo H5HFdtable.lo H5HFhdr.lo H5HFhuge.lo H5HFiblock.lo \ + H5HFiter.lo H5HFint.lo H5HFsection.lo H5HFspace.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 H5L.lo \ H5Lexternal.lo H5O.lo H5Oattr.lo H5Obogus.lo H5Ocache.lo \ @@ -399,8 +399,8 @@ libhdf5_la_SOURCES = H5.c H5dbg.c H5A.c H5AC.c H5B.c H5Bcache.c \ H5FDstream.c H5FL.c H5FO.c H5FS.c H5FScache.c H5FSdbg.c H5FSsection.c \ H5G.c H5Gdeprec.c H5Gent.c H5Glink.c H5Gloc.c H5Gname.c H5Gnode.c \ H5Gobj.c H5Goh.c H5Gstab.c H5Gtest.c H5Gtraverse.c \ - H5HF.c H5HFcache.c H5HFdbg.c H5HFdblock.c H5HFdtable.c \ - H5HFhdr.c H5HFiblock.c H5HFint.c H5HFiter.c H5HFsection.c \ + H5HF.c H5HFbtree2.c H5HFcache.c H5HFdbg.c H5HFdblock.c H5HFdtable.c \ + H5HFhdr.c H5HFhuge.c H5HFiblock.c H5HFint.c H5HFiter.c H5HFsection.c \ H5HFspace.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 H5L.c H5Lexternal.c H5O.c H5Oattr.c H5Obogus.c H5Ocache.c \ @@ -609,11 +609,13 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Gtest.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Gtraverse.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5HF.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5HFbtree2.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)/H5HFdblock.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5HFdtable.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5HFhdr.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5HFhuge.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5HFiblock.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5HFint.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5HFiter.Plo@am__quote@ |