mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-04-18 17:40:55 +08:00
[svn-r12362] Purpose:
Code checkpoint Description: Update fractal heap code to allow objects to be deleted Fix bugs in fractal heap object insertion Improve free space manager code to allow sections to be merged and shrink the container Another try at making the Windows compilers happy... Platforms tested: FreeBSD 4.11 (sleipnir) Mac OS X.4/PPC (amazon) Linux 2.4 (chicago & heping) Solaris 2.9 (shanti) AIX 5.? (copper) w/parallel
This commit is contained in:
parent
4d3390afd9
commit
5d2bddcd06
@ -46,7 +46,7 @@ hid_t H5E_TST_g = FAIL; /* Ternary Search Trees */
|
||||
hid_t H5E_ARGS_g = FAIL; /* Invalid arguments to routine */
|
||||
hid_t H5E_ERROR_g = FAIL; /* Error API */
|
||||
hid_t H5E_PLINE_g = FAIL; /* Data filters */
|
||||
hid_t H5E_FSPACE_g = FAIL; /* File Free Space */
|
||||
hid_t H5E_FSPACE_g = FAIL; /* Free Space Manager */
|
||||
hid_t H5E_CACHE_g = FAIL; /* Object cache */
|
||||
|
||||
/* Minor error IDs */
|
||||
@ -85,6 +85,11 @@ hid_t H5E_CANTGET_g = FAIL; /* Can't get value */
|
||||
hid_t H5E_CANTSET_g = FAIL; /* Can't set value */
|
||||
hid_t H5E_DUPCLASS_g = FAIL; /* Duplicate class name in parent class */
|
||||
|
||||
/* Free space errors */
|
||||
hid_t H5E_CANTMERGE_g = FAIL; /* Can't merge objects */
|
||||
hid_t H5E_CANTREVIVE_g = FAIL; /* Can't revive object */
|
||||
hid_t H5E_CANTSHRINK_g = FAIL; /* Can't shrink container */
|
||||
|
||||
/* Object header related errors */
|
||||
hid_t H5E_LINKCOUNT_g = FAIL; /* Bad object header link count */
|
||||
hid_t H5E_VERSION_g = FAIL; /* Wrong version number */
|
||||
@ -174,6 +179,7 @@ hid_t H5E_CANTSWAP_g = FAIL; /* Unable to swap records */
|
||||
hid_t H5E_CANTINSERT_g = FAIL; /* Unable to insert object */
|
||||
hid_t H5E_CANTLIST_g = FAIL; /* Unable to list node */
|
||||
hid_t H5E_CANTMODIFY_g = FAIL; /* Unable to modify record */
|
||||
hid_t H5E_CANTREMOVE_g = FAIL; /* Unable to remove object */
|
||||
|
||||
/* Argument errors */
|
||||
hid_t H5E_UNINITIALIZED_g = FAIL; /* Information is uinitialized */
|
||||
|
@ -154,7 +154,7 @@ if((msg = H5E_create_msg(cls, H5E_MAJOR, "Data filters"))==NULL)
|
||||
if((H5E_PLINE_g = H5I_register(H5I_ERROR_MSG, msg))<0)
|
||||
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
|
||||
assert(H5E_FSPACE_g==(-1));
|
||||
if((msg = H5E_create_msg(cls, H5E_MAJOR, "File Free Space"))==NULL)
|
||||
if((msg = H5E_create_msg(cls, H5E_MAJOR, "Free Space Manager"))==NULL)
|
||||
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
|
||||
if((H5E_FSPACE_g = H5I_register(H5I_ERROR_MSG, msg))<0)
|
||||
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
|
||||
@ -299,6 +299,23 @@ if((msg = H5E_create_msg(cls, H5E_MINOR, "Duplicate class name in parent class")
|
||||
if((H5E_DUPCLASS_g = H5I_register(H5I_ERROR_MSG, msg))<0)
|
||||
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
|
||||
|
||||
/* Free space errors */
|
||||
assert(H5E_CANTMERGE_g==(-1));
|
||||
if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't merge objects"))==NULL)
|
||||
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
|
||||
if((H5E_CANTMERGE_g = H5I_register(H5I_ERROR_MSG, msg))<0)
|
||||
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
|
||||
assert(H5E_CANTREVIVE_g==(-1));
|
||||
if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't revive object"))==NULL)
|
||||
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
|
||||
if((H5E_CANTREVIVE_g = H5I_register(H5I_ERROR_MSG, msg))<0)
|
||||
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
|
||||
assert(H5E_CANTSHRINK_g==(-1));
|
||||
if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't shrink container"))==NULL)
|
||||
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
|
||||
if((H5E_CANTSHRINK_g = H5I_register(H5I_ERROR_MSG, msg))<0)
|
||||
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
|
||||
|
||||
/* Object header related errors */
|
||||
assert(H5E_LINKCOUNT_g==(-1));
|
||||
if((msg = H5E_create_msg(cls, H5E_MINOR, "Bad object header link count"))==NULL)
|
||||
@ -660,6 +677,11 @@ if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to modify record"))==NULL)
|
||||
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
|
||||
if((H5E_CANTMODIFY_g = H5I_register(H5I_ERROR_MSG, msg))<0)
|
||||
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
|
||||
assert(H5E_CANTREMOVE_g==(-1));
|
||||
if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to remove object"))==NULL)
|
||||
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
|
||||
if((H5E_CANTREMOVE_g = H5I_register(H5I_ERROR_MSG, msg))<0)
|
||||
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
|
||||
|
||||
/* Argument errors */
|
||||
assert(H5E_UNINITIALIZED_g==(-1));
|
||||
|
@ -77,7 +77,7 @@ H5_DLLVAR hid_t H5E_TST_g; /* Ternary Search Trees */
|
||||
H5_DLLVAR hid_t H5E_ARGS_g; /* Invalid arguments to routine */
|
||||
H5_DLLVAR hid_t H5E_ERROR_g; /* Error API */
|
||||
H5_DLLVAR hid_t H5E_PLINE_g; /* Data filters */
|
||||
H5_DLLVAR hid_t H5E_FSPACE_g; /* File Free Space */
|
||||
H5_DLLVAR hid_t H5E_FSPACE_g; /* Free Space Manager */
|
||||
H5_DLLVAR hid_t H5E_CACHE_g; /* Object cache */
|
||||
|
||||
/*********************/
|
||||
@ -142,6 +142,14 @@ H5_DLLVAR hid_t H5E_CANTGET_g; /* Can't get value */
|
||||
H5_DLLVAR hid_t H5E_CANTSET_g; /* Can't set value */
|
||||
H5_DLLVAR hid_t H5E_DUPCLASS_g; /* Duplicate class name in parent class */
|
||||
|
||||
/* Free space errors */
|
||||
#define H5E_CANTMERGE (H5OPEN H5E_CANTMERGE_g)
|
||||
#define H5E_CANTREVIVE (H5OPEN H5E_CANTREVIVE_g)
|
||||
#define H5E_CANTSHRINK (H5OPEN H5E_CANTSHRINK_g)
|
||||
H5_DLLVAR hid_t H5E_CANTMERGE_g; /* Can't merge objects */
|
||||
H5_DLLVAR hid_t H5E_CANTREVIVE_g; /* Can't revive object */
|
||||
H5_DLLVAR hid_t H5E_CANTSHRINK_g; /* Can't shrink container */
|
||||
|
||||
/* Object header related errors */
|
||||
#define H5E_LINKCOUNT (H5OPEN H5E_LINKCOUNT_g)
|
||||
#define H5E_VERSION (H5OPEN H5E_VERSION_g)
|
||||
@ -289,6 +297,7 @@ H5_DLLVAR hid_t H5E_CANTCOMPARE_g; /* Can't compare objects */
|
||||
#define H5E_CANTINSERT (H5OPEN H5E_CANTINSERT_g)
|
||||
#define H5E_CANTLIST (H5OPEN H5E_CANTLIST_g)
|
||||
#define H5E_CANTMODIFY (H5OPEN H5E_CANTMODIFY_g)
|
||||
#define H5E_CANTREMOVE (H5OPEN H5E_CANTREMOVE_g)
|
||||
H5_DLLVAR hid_t H5E_NOTFOUND_g; /* Object not found */
|
||||
H5_DLLVAR hid_t H5E_EXISTS_g; /* Object already exists */
|
||||
H5_DLLVAR hid_t H5E_CANTENCODE_g; /* Unable to encode value */
|
||||
@ -299,6 +308,7 @@ H5_DLLVAR hid_t H5E_CANTSWAP_g; /* Unable to swap records */
|
||||
H5_DLLVAR hid_t H5E_CANTINSERT_g; /* Unable to insert object */
|
||||
H5_DLLVAR hid_t H5E_CANTLIST_g; /* Unable to list node */
|
||||
H5_DLLVAR hid_t H5E_CANTMODIFY_g; /* Unable to modify record */
|
||||
H5_DLLVAR hid_t H5E_CANTREMOVE_g; /* Unable to remove object */
|
||||
|
||||
/* Argument errors */
|
||||
#define H5E_UNINITIALIZED (H5OPEN H5E_UNINITIALIZED_g)
|
||||
|
@ -87,6 +87,11 @@ H5E_CANTGET_g=
|
||||
H5E_CANTSET_g=
|
||||
H5E_DUPCLASS_g=
|
||||
|
||||
/* Free space errors */
|
||||
H5E_CANTMERGE_g=
|
||||
H5E_CANTREVIVE_g=
|
||||
H5E_CANTSHRINK_g=
|
||||
|
||||
/* Object header related errors */
|
||||
H5E_LINKCOUNT_g=
|
||||
H5E_VERSION_g=
|
||||
@ -175,7 +180,8 @@ H5E_CANTREDISTRIBUTE_g=
|
||||
H5E_CANTSWAP_g=
|
||||
H5E_CANTINSERT_g=
|
||||
H5E_CANTLIST_g=
|
||||
H5E_CANTMODIFY_g=
|
||||
H5E_CANTMODIFY_g=
|
||||
H5E_CANTREMOVE_g=
|
||||
|
||||
/* Argument errors */
|
||||
H5E_UNINITIALIZED_g=
|
||||
|
1093
src/H5FS.c
1093
src/H5FS.c
File diff suppressed because it is too large
Load Diff
@ -38,6 +38,17 @@
|
||||
/* Library Private Macros */
|
||||
/**************************/
|
||||
|
||||
/* Flags for H5FS_add() */
|
||||
#define H5FS_ADD_DESERIALIZING 0x01 /* Free space is being deserialized
|
||||
* (for package use only)
|
||||
*/
|
||||
#define H5FS_ADD_RETURNED_SPACE 0x02 /* Section was previously allocated
|
||||
* and is being returned to the
|
||||
* free space manager (usually
|
||||
* as a result of freeing an
|
||||
* object)
|
||||
*/
|
||||
|
||||
|
||||
/****************************/
|
||||
/* Library Private Typedefs */
|
||||
@ -51,12 +62,23 @@ typedef struct H5FS_section_info_t H5FS_section_info_t;
|
||||
|
||||
/* Free space section class info */
|
||||
typedef struct H5FS_section_class_t {
|
||||
unsigned type; /* Type of free space section */
|
||||
/* Class variables */
|
||||
const unsigned type; /* Type of free space section */
|
||||
size_t serial_size; /* Size of serialized form of section */
|
||||
herr_t (*init)(struct H5FS_section_class_t *, const void *); /* Routine to initialize class-specific settings */
|
||||
herr_t (*serialize)(const H5FS_section_info_t *, uint8_t *); /* Routine to serialize a "live" section into a buffer */
|
||||
|
||||
/* Class methods */
|
||||
herr_t (*init_cls)(struct H5FS_section_class_t *, const void *); /* Routine to initialize class-specific settings */
|
||||
|
||||
/* Object methods */
|
||||
herr_t (*serialize)(const H5FS_section_info_t *, uint8_t *); /* Routine to serialize a "live" section into a buffer */
|
||||
herr_t (*deserialize)(struct H5FS_section_class_t *cls, const uint8_t *,
|
||||
haddr_t, hsize_t, H5FS_section_info_t **); /* Routine to deserialize a buffer into a "live" section */
|
||||
htri_t (*can_merge)(const H5FS_section_info_t *, const H5FS_section_info_t *,
|
||||
void *); /* Routine to determine if two nodes are mergable */
|
||||
herr_t (*merge)(H5FS_section_info_t *, H5FS_section_info_t *, void *); /* Routine to merge two nodes */
|
||||
htri_t (*can_shrink)(H5FS_section_info_t *, void *); /* Routine to determine if node can shrink container */
|
||||
herr_t (*shrink)(H5FS_section_info_t **, void *); /* Routine to shrink container */
|
||||
herr_t (*free)(H5FS_section_info_t *); /* Routine to free node */
|
||||
herr_t (*debug)(const H5FS_section_info_t *, FILE *,
|
||||
int , int ); /* Routine to dump debugging information about a section */
|
||||
} H5FS_section_class_t;
|
||||
@ -105,13 +127,14 @@ H5FL_SEQ_EXTERN(H5FS_section_class_t);
|
||||
/* Library-private Function Prototypes */
|
||||
/***************************************/
|
||||
H5_DLL H5FS_t *H5FS_create(H5F_t *f, hid_t dxpl_id, haddr_t *fs_addr,
|
||||
const H5FS_create_t *fs_create, H5SL_operator_t node_free_op,
|
||||
size_t nclasses, H5FS_section_class_t *classes, const void *cls_init_udata);
|
||||
H5_DLL H5FS_t *H5FS_open(H5F_t *f, hid_t dxpl_id, haddr_t fs_addr,
|
||||
H5SL_operator_t node_free_op, size_t nclasses,
|
||||
const H5FS_create_t *fs_create, size_t nclasses,
|
||||
H5FS_section_class_t *classes, const void *cls_init_udata);
|
||||
H5_DLL herr_t H5FS_add(H5F_t *f, hid_t dxpl_id, H5FS_t *fspace, H5FS_section_info_t *node);
|
||||
H5_DLL htri_t H5FS_find(H5F_t *f, hid_t dxpl_id, H5FS_t *fspace, hsize_t request, H5FS_section_info_t **node);
|
||||
H5_DLL H5FS_t *H5FS_open(H5F_t *f, hid_t dxpl_id, haddr_t fs_addr,
|
||||
size_t nclasses, H5FS_section_class_t *classes, const void *cls_init_udata);
|
||||
H5_DLL herr_t H5FS_add(H5F_t *f, hid_t dxpl_id, H5FS_t *fspace,
|
||||
H5FS_section_info_t *node, unsigned flags, void *op_data);
|
||||
H5_DLL htri_t H5FS_find(H5F_t *f, hid_t dxpl_id, H5FS_t *fspace,
|
||||
hsize_t request, H5FS_section_info_t **node);
|
||||
H5_DLL herr_t H5FS_iterate(H5FS_t *fspace, H5FS_operator_t op, void *op_data);
|
||||
H5_DLL herr_t H5FS_flush(H5F_t *f, hid_t dxpl_id, unsigned flags);
|
||||
H5_DLL herr_t H5FS_close(H5F_t *f, hid_t dxpl_id, H5FS_t *fspace);
|
||||
|
@ -90,6 +90,7 @@ typedef struct H5F_t H5F_t;
|
||||
int64_t _n = (n); \
|
||||
size_t _i; \
|
||||
uint8_t *_p = (uint8_t*)(p); \
|
||||
\
|
||||
for (_i = 0; _i < sizeof(int64_t); _i++, _n >>= 8) \
|
||||
*_p++ = (uint8_t)(_n & 0xff); \
|
||||
for (/*void*/; _i < 8; _i++) \
|
||||
@ -101,6 +102,7 @@ typedef struct H5F_t H5F_t;
|
||||
uint64_t _n = (n); \
|
||||
size_t _i; \
|
||||
uint8_t *_p = (uint8_t*)(p); \
|
||||
\
|
||||
for (_i = 0; _i < sizeof(uint64_t); _i++, _n >>= 8) \
|
||||
*_p++ = (uint8_t)(_n & 0xff); \
|
||||
for (/*void*/; _i < 8; _i++) \
|
||||
@ -172,6 +174,7 @@ typedef struct H5F_t H5F_t;
|
||||
# define INT64DECODE(p, n) { \
|
||||
/* WE DON'T CHECK FOR OVERFLOW! */ \
|
||||
size_t _i; \
|
||||
\
|
||||
n = 0; \
|
||||
(p) += 8; \
|
||||
for (_i = 0; _i < sizeof(int64_t); _i++) \
|
||||
@ -182,6 +185,7 @@ typedef struct H5F_t H5F_t;
|
||||
# define UINT64DECODE(p, n) { \
|
||||
/* WE DON'T CHECK FOR OVERFLOW! */ \
|
||||
size_t _i; \
|
||||
\
|
||||
n = 0; \
|
||||
(p) += 8; \
|
||||
for (_i = 0; _i < sizeof(uint64_t); _i++) \
|
||||
|
68
src/H5HF.c
68
src/H5HF.c
@ -376,6 +376,9 @@ HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "'write once' managed blocks not su
|
||||
} /* end else */
|
||||
|
||||
done:
|
||||
#ifdef QAK
|
||||
HDfprintf(stderr, "%s: Leaving, ret_value = %d\n", FUNC, ret_value);
|
||||
#endif /* QAK */
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5HF_insert() */
|
||||
|
||||
@ -411,7 +414,7 @@ H5HF_get_obj_len(H5HF_t *fh, const void *_id, size_t *obj_len_p)
|
||||
id += fh->hdr->heap_off_size;
|
||||
|
||||
/* Retrieve the entry length */
|
||||
UINT64DECODE_VAR(id, *obj_len_p, fh->hdr->id_len);
|
||||
UINT64DECODE_VAR(id, *obj_len_p, fh->hdr->heap_len_size);
|
||||
|
||||
FUNC_LEAVE_NOAPI(SUCCEED)
|
||||
} /* end H5HF_get_obj_len() */
|
||||
@ -452,8 +455,7 @@ H5HF_read(H5HF_t *fh, hid_t dxpl_id, const void *_id, void *obj/*out*/)
|
||||
hdr = fh->hdr;
|
||||
|
||||
/* 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->id_len);
|
||||
H5HF_ID_DECODE(id, hdr, obj_off, obj_len);
|
||||
#ifdef QAK
|
||||
HDfprintf(stderr, "%s: obj_off = %Hu, obj_len = %Zu\n", FUNC, obj_off, obj_len);
|
||||
#endif /* QAK */
|
||||
@ -465,13 +467,71 @@ HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "standalone blocks not supported ye
|
||||
else {
|
||||
/* Read object from managed heap blocks */
|
||||
if(H5HF_man_read(hdr, dxpl_id, obj_off, obj_len, obj) < 0)
|
||||
HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "can't read object from fractal heap")
|
||||
HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't read object from fractal heap")
|
||||
} /* end else */
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5HF_read() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5HF_remove
|
||||
*
|
||||
* Purpose: Remove an object from a fractal heap
|
||||
*
|
||||
* Return: SUCCEED/FAIL
|
||||
*
|
||||
* Programmer: Quincey Koziol
|
||||
* koziol@ncsa.uiuc.edu
|
||||
* May 15 2006
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
herr_t
|
||||
H5HF_remove(H5HF_t *fh, hid_t dxpl_id, const void *_id)
|
||||
{
|
||||
const uint8_t *id = (const uint8_t *)_id; /* Object ID */
|
||||
hsize_t obj_off; /* Object's offset in heap */
|
||||
size_t obj_len; /* Object's length in heap */
|
||||
herr_t ret_value = SUCCEED;
|
||||
|
||||
FUNC_ENTER_NOAPI(H5HF_remove, FAIL)
|
||||
|
||||
/*
|
||||
* Check arguments.
|
||||
*/
|
||||
HDassert(fh);
|
||||
HDassert(fh->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 */
|
||||
H5HF_ID_DECODE(id, fh->hdr, obj_off, obj_len);
|
||||
#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);
|
||||
|
||||
/* Check for standalone object */
|
||||
if(obj_off & 0) {
|
||||
HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "standalone blocks not supported yet")
|
||||
} /* end if */
|
||||
else {
|
||||
/* Remove object from managed heap blocks */
|
||||
if(H5HF_man_remove(fh->hdr, dxpl_id, obj_off, obj_len) < 0)
|
||||
HGOTO_ERROR(H5E_HEAP, H5E_CANTREMOVE, FAIL, "can't remove object from fractal heap")
|
||||
} /* end else */
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5HF_remove() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5HF_close
|
||||
|
@ -698,12 +698,13 @@ H5HF_cache_dblock_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr,
|
||||
HDassert(dblock);
|
||||
|
||||
if(dblock->cache_info.is_dirty) {
|
||||
H5HF_hdr_t *hdr; /* Shared fractal heap information */
|
||||
H5HF_hdr_t *hdr; /* Shared fractal heap information */
|
||||
uint8_t *p; /* Pointer into raw data buffer */
|
||||
|
||||
/* Get the pointer to the shared heap header */
|
||||
hdr = dblock->hdr;
|
||||
|
||||
HDassert(dblock->blk);
|
||||
p = dblock->blk;
|
||||
|
||||
/* Magic number */
|
||||
|
@ -311,7 +311,7 @@ H5HF_dblock_debug_cb(const H5FS_section_info_t *_sect, void *_udata)
|
||||
/* Calculate the length */
|
||||
len = end - start;
|
||||
|
||||
sprintf(temp_str, "Section #%u:", udata->sect_count);
|
||||
sprintf(temp_str, "Section #%u:", (unsigned)udata->sect_count);
|
||||
HDfprintf(udata->stream, "%*s%-*s %8Zu, %8Zu\n", udata->indent + 3, "", MAX(0, udata->fwidth - 9),
|
||||
temp_str,
|
||||
start, len);
|
||||
|
@ -95,7 +95,7 @@ H5HF_man_dblock_create(hid_t dxpl_id, H5HF_hdr_t *hdr, H5HF_indirect_t *par_iblo
|
||||
unsigned par_entry, size_t block_size, hsize_t block_off, haddr_t *addr_p,
|
||||
H5HF_free_section_t **ret_sec_node)
|
||||
{
|
||||
H5HF_free_section_t *sec_node; /* Pointer to free list section for block */
|
||||
H5HF_free_section_t *sec_node; /* Pointer to free space section for block */
|
||||
H5HF_direct_t *dblock = NULL; /* Pointer to direct block */
|
||||
size_t free_space; /* Free space in new block */
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
@ -173,7 +173,7 @@ HDmemset(dblock->blk, 0, dblock->size);
|
||||
/* Pass back the pointer to the section instead of adding it to the free list */
|
||||
*ret_sec_node = sec_node;
|
||||
else {
|
||||
/* Add new free space to the global list of space */
|
||||
/* Add new free space to the heap's list of space */
|
||||
if(H5HF_space_add(hdr, dxpl_id, sec_node) < 0)
|
||||
HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't add direct block free space to global list")
|
||||
} /* end else */
|
||||
@ -190,6 +190,77 @@ done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5HF_man_dblock_create() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5HF_man_dblock_destroy
|
||||
*
|
||||
* Purpose: Destroy a managed direct block
|
||||
*
|
||||
* Return: SUCCEED/FAIL
|
||||
*
|
||||
* Programmer: Quincey Koziol
|
||||
* koziol@ncsa.uiuc.edu
|
||||
* May 17 2006
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
herr_t
|
||||
H5HF_man_dblock_destroy(H5HF_hdr_t *hdr, hid_t dxpl_id, H5HF_direct_t *dblock,
|
||||
haddr_t dblock_addr)
|
||||
{
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
|
||||
FUNC_ENTER_NOAPI_NOINIT(H5HF_man_dblock_destroy)
|
||||
|
||||
/*
|
||||
* Check arguments.
|
||||
*/
|
||||
HDassert(hdr);
|
||||
HDassert(dblock);
|
||||
|
||||
/* Check for root direct block */
|
||||
if(hdr->man_dtable.curr_root_rows == 0) {
|
||||
#ifdef QAK
|
||||
HDfprintf(stderr, "%s: root direct block\n", FUNC);
|
||||
#endif /* QAK */
|
||||
/* Sanity check */
|
||||
HDassert(hdr->man_dtable.table_addr == dblock_addr);
|
||||
HDassert(hdr->man_dtable.cparam.start_block_size == dblock->size);
|
||||
|
||||
/* Sanity check block iterator */
|
||||
HDassert(!H5HF_man_iter_ready(&hdr->next_block));
|
||||
|
||||
/* Reset header information back to "empty heap" state */
|
||||
if(H5HF_hdr_empty(hdr) < 0)
|
||||
HGOTO_ERROR(H5E_HEAP, H5E_CANTSHRINK, FAIL, "can't make heap empty")
|
||||
} /* end if */
|
||||
else {
|
||||
#ifdef QAK
|
||||
HDfprintf(stderr, "%s: root indirect block\n", FUNC);
|
||||
#endif /* QAK */
|
||||
|
||||
/* Remove from parent indirect block */
|
||||
|
||||
/* If this is the last block in the heap, move block iterator backwards */
|
||||
|
||||
/* Detect the last direct block (of the starting block size) and make it the root direct block */
|
||||
|
||||
HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "destroying non-root direct block not supported yet")
|
||||
} /* end else */
|
||||
|
||||
/* Release direct block's disk space */
|
||||
if(H5MF_xfree(hdr->f, H5FD_MEM_FHEAP_DBLOCK, dxpl_id, dblock_addr, (hsize_t)dblock->size)<0)
|
||||
HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to free fractal heap direct block")
|
||||
|
||||
/* Remove direct block from metadata cache */
|
||||
if(H5AC_unprotect(hdr->f, dxpl_id, H5AC_FHEAP_DBLOCK, dblock_addr, dblock, H5AC__DELETED_FLAG) < 0)
|
||||
HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release fractal heap direct block")
|
||||
dblock = NULL;
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5HF_man_dblock_destroy() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5HF_man_dblock_new
|
||||
|
@ -216,8 +216,9 @@ H5HF_hdr_finish_init(H5HF_hdr_t *hdr)
|
||||
HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't initialize doubling table info")
|
||||
|
||||
/* Set the size of heap IDs */
|
||||
hdr->id_len = hdr->heap_off_size + MIN(hdr->man_dtable.max_dir_blk_off_size,
|
||||
((H5V_log2_gen((hsize_t)hdr->standalone_size) + 7) / 8));
|
||||
hdr->heap_len_size = MIN(hdr->man_dtable.max_dir_blk_off_size,
|
||||
((H5V_log2_gen((hsize_t)hdr->standalone_size) + 7) / 8));
|
||||
hdr->id_len = hdr->heap_off_size + hdr->heap_len_size;
|
||||
|
||||
/* Set the free space in direct blocks */
|
||||
for(u = 0; u < hdr->man_dtable.max_root_rows; u++) {
|
||||
@ -555,3 +556,49 @@ done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5HF_hdr_inc_alloc() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5HF_hdr_empty
|
||||
*
|
||||
* Purpose: Reset heap header to 'empty heap' state
|
||||
*
|
||||
* Return: Non-negative on success/Negative on failure
|
||||
*
|
||||
* Programmer: Quincey Koziol
|
||||
* koziol@ncsa.uiuc.edu
|
||||
* May 17 2006
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
herr_t
|
||||
H5HF_hdr_empty(H5HF_hdr_t *hdr)
|
||||
{
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
|
||||
FUNC_ENTER_NOAPI_NOINIT(H5HF_hdr_empty)
|
||||
#ifdef QAK
|
||||
HDfprintf(stderr, "%s: Reseting heap header to empty\n", FUNC);
|
||||
#endif /* QAK */
|
||||
|
||||
/* Sanity check */
|
||||
HDassert(hdr);
|
||||
|
||||
/* Reset root pointer information */
|
||||
hdr->man_dtable.curr_root_rows = 0;
|
||||
hdr->man_dtable.table_addr = HADDR_UNDEF;
|
||||
|
||||
/* Shrink heap size */
|
||||
hdr->total_size = hdr->std_size;
|
||||
hdr->man_size = 0;
|
||||
|
||||
/* Reset the free space in direct blocks */
|
||||
hdr->total_man_free = 0;
|
||||
|
||||
/* Mark heap header as modified */
|
||||
if(H5HF_hdr_dirty(hdr) < 0)
|
||||
HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark header as dirty")
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5HF_hdr_empty() */
|
||||
|
||||
|
164
src/H5HFiblock.c
164
src/H5HFiblock.c
@ -444,6 +444,9 @@ HDfprintf(stderr, "%s: acc_row_dblock_free_space = %Zu\n", FUNC, acc_row_dblock_
|
||||
/* Advance outer loop index */
|
||||
u += row_entries;
|
||||
} /* end for */
|
||||
#ifdef QAK
|
||||
HDfprintf(stderr, "%s: sect_off = %Zu\n", FUNC, sect_off);
|
||||
#endif /* QAK */
|
||||
|
||||
/* Advance the allocated heap size/new block iterator */
|
||||
if(H5HF_hdr_inc_alloc(hdr, sect_off, nentries) < 0)
|
||||
@ -658,7 +661,7 @@ HDfprintf(stderr, "%s: Extending root indirect block\n", FUNC);
|
||||
#ifdef QAK
|
||||
HDfprintf(stderr, "%s: min_nrows = %u, new_nrows = %u\n", FUNC, min_nrows, new_nrows);
|
||||
HDfprintf(stderr, "%s: iblock->nrows = %u\n", FUNC, iblock->nrows);
|
||||
HDfprintf(stderr, "%s: old_next_entry = %u, iblock->next_entry = %u\n", FUNC, old_next_entry, iblock->next_entry);
|
||||
HDfprintf(stderr, "%s: new_next_entry = %u\n", FUNC, new_next_entry);
|
||||
#endif /* QAK */
|
||||
|
||||
/* Currently, the old block data is "thrown away" after the space is reallocated,
|
||||
@ -672,7 +675,7 @@ HDfprintf(stderr, "%s: old_next_entry = %u, iblock->next_entry = %u\n", FUNC, ol
|
||||
*/
|
||||
/* Free previous indirect block disk space */
|
||||
if(H5MF_xfree(hdr->f, H5FD_MEM_FHEAP_IBLOCK, dxpl_id, iblock->addr, (hsize_t)iblock->size)<0)
|
||||
HGOTO_ERROR(H5E_STORAGE, H5E_CANTFREE, FAIL, "unable to free fractal heap indirect block")
|
||||
HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to free fractal heap indirect block")
|
||||
|
||||
/* Compute size of buffer needed for new indirect block */
|
||||
iblock->nrows = new_nrows;
|
||||
@ -680,7 +683,7 @@ HDfprintf(stderr, "%s: old_next_entry = %u, iblock->next_entry = %u\n", FUNC, ol
|
||||
|
||||
/* Allocate space for the new indirect block on disk */
|
||||
if(HADDR_UNDEF == (new_addr = H5MF_alloc(hdr->f, H5FD_MEM_FHEAP_IBLOCK, dxpl_id, (hsize_t)iblock->size)))
|
||||
HGOTO_ERROR(H5E_STORAGE, H5E_NOSPACE, FAIL, "file allocation failed for fractal heap indirect block")
|
||||
HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, "file allocation failed for fractal heap indirect block")
|
||||
#ifdef QAK
|
||||
HDfprintf(stderr, "%s: new_addr = %a\n", FUNC, new_addr);
|
||||
#endif /* QAK */
|
||||
@ -710,9 +713,10 @@ HDfprintf(stderr, "%s: new_addr = %a\n", FUNC, new_addr);
|
||||
if(H5HF_iblock_dirty(iblock) < 0)
|
||||
HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark indirect block as dirty")
|
||||
|
||||
/* Move object in cache */
|
||||
if(H5AC_rename(hdr->f, H5AC_FHEAP_IBLOCK, iblock->addr, new_addr) < 0)
|
||||
HGOTO_ERROR(H5E_HEAP, H5E_CANTSPLIT, FAIL, "unable to move fractal heap root indirect block")
|
||||
/* Move object in cache, if it actually was relocated */
|
||||
if(H5F_addr_ne(iblock->addr, new_addr))
|
||||
if(H5AC_rename(hdr->f, H5AC_FHEAP_IBLOCK, iblock->addr, new_addr) < 0)
|
||||
HGOTO_ERROR(H5E_HEAP, H5E_CANTSPLIT, FAIL, "unable to move fractal heap root indirect block")
|
||||
|
||||
/* Update other shared header info */
|
||||
hdr->man_dtable.curr_root_rows = new_nrows;
|
||||
@ -731,11 +735,22 @@ HDfprintf(stderr, "%s: acc_dblock_free = %Hu\n", FUNC, acc_dblock_free);
|
||||
if(H5HF_hdr_dirty(hdr) < 0)
|
||||
HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark header as dirty")
|
||||
|
||||
/* XXX: Sanity check until can rename pinned entry in metadata cache */
|
||||
#ifndef NDEBUG
|
||||
{
|
||||
H5HF_indirect_t *old_root_iblock = iblock;
|
||||
#endif /* NDEBUG */
|
||||
|
||||
/* Lock root indirect block (again) */
|
||||
if(NULL == (iblock = H5HF_man_iblock_protect(hdr, dxpl_id, new_addr, hdr->man_dtable.curr_root_rows, NULL, 0, H5AC_WRITE)))
|
||||
HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap indirect block")
|
||||
iblock->addr = new_addr;
|
||||
|
||||
#ifndef NDEBUG
|
||||
HDassert(old_root_iblock == iblock);
|
||||
}
|
||||
#endif /* NDEBUG */
|
||||
|
||||
/* Update the indirect block pointer in iterator */
|
||||
/* (pins the indirect block after it's in the new location) */
|
||||
if(H5HF_man_iter_update_iblock(&hdr->next_block, iblock) < 0)
|
||||
@ -830,7 +845,7 @@ HDfprintf(stderr, "%s: next_row = %u\n", FUNC, next_row);
|
||||
HDfprintf(stderr, "%s: next_entry = %u\n", FUNC, next_entry);
|
||||
#endif /* QAK */
|
||||
/* Check for skipping over blocks in the current block */
|
||||
if(min_dblock_row > next_row) {
|
||||
if(min_dblock_row > next_row && next_row < iblock->nrows) {
|
||||
unsigned min_entry; /* Min entry for direct block requested */
|
||||
unsigned skip_entries; /* Number of entries to skip in the current block */
|
||||
|
||||
@ -853,6 +868,11 @@ HDfprintf(stderr, "%s: min_entry = %u, skip_entries = %u\n", FUNC, min_entry, sk
|
||||
&next_entry, &iblock) < 0)
|
||||
HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, NULL, "unable to retrieve current block iterator location")
|
||||
} /* end if */
|
||||
|
||||
do {
|
||||
/* Reset conditions for leaving loop */
|
||||
walked_up = walked_down = FALSE;
|
||||
|
||||
#ifdef QAK
|
||||
HDfprintf(stderr, "%s: Check 2.0\n", FUNC);
|
||||
HDfprintf(stderr, "%s: iblock = %p\n", FUNC, iblock);
|
||||
@ -861,10 +881,6 @@ HDfprintf(stderr, "%s: next_row = %u\n", FUNC, next_row);
|
||||
HDfprintf(stderr, "%s: next_entry = %u\n", FUNC, next_entry);
|
||||
#endif /* QAK */
|
||||
|
||||
do {
|
||||
/* Reset conditions for leaving loop */
|
||||
walked_up = walked_down = FALSE;
|
||||
|
||||
/* Check for walking off end of indirect block */
|
||||
/* (walk up iterator) */
|
||||
while(next_row >= iblock->nrows) {
|
||||
@ -899,7 +915,7 @@ HDfprintf(stderr, "%s: Walking up a level\n", FUNC);
|
||||
|
||||
/* Indicate that we walked up */
|
||||
walked_up = TRUE;
|
||||
} /* end if */
|
||||
} /* end while */
|
||||
#ifdef QAK
|
||||
HDfprintf(stderr, "%s: Check 3.0\n", FUNC);
|
||||
HDfprintf(stderr, "%s: iblock = %p\n", FUNC, iblock);
|
||||
@ -946,6 +962,8 @@ HDfprintf(stderr, "%s: Skipping indirect block row that is too small\n", FUNC);
|
||||
child_rows_needed = (H5V_log2_of2(min_dblock_size) - H5V_log2_of2(hdr->man_dtable.cparam.start_block_size)) + 2;
|
||||
HDassert(child_rows_needed > child_nrows);
|
||||
child_entry = (next_row + (child_rows_needed - child_nrows)) * hdr->man_dtable.cparam.width;
|
||||
if(child_entry > (iblock->nrows * hdr->man_dtable.cparam.width))
|
||||
child_entry = iblock->nrows * hdr->man_dtable.cparam.width;
|
||||
#ifdef QAK
|
||||
HDfprintf(stderr, "%s: child_rows_needed = %u\n", FUNC, child_rows_needed);
|
||||
HDfprintf(stderr, "%s: child_entry = %u\n", FUNC, child_entry);
|
||||
@ -1035,7 +1053,7 @@ HDfprintf(stderr, "%s: Skipping rows in new child indirect block - new_entry = %
|
||||
|
||||
/* Indicate that we walked down */
|
||||
walked_down = TRUE;
|
||||
} /* end while */
|
||||
} /* end if */
|
||||
} while(walked_down || walked_up);
|
||||
} /* end else */
|
||||
|
||||
@ -1072,78 +1090,6 @@ done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5HF_man_iblock_place_dblock() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5HF_man_iblock_alloc_single
|
||||
*
|
||||
* Purpose: Update the memory information for a 'single' free section
|
||||
*
|
||||
* Return: Non-negative on success/Negative on failure
|
||||
*
|
||||
* Programmer: Quincey Koziol
|
||||
* koziol@ncsa.uiuc.edu
|
||||
* May 8 2006
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
herr_t
|
||||
H5HF_man_iblock_alloc_single(H5HF_hdr_t *hdr, hid_t dxpl_id,
|
||||
H5HF_free_section_t *sec_node)
|
||||
{
|
||||
H5HF_indirect_t *sec_iblock; /* Pointer to section indirect block */
|
||||
unsigned sec_entry; /* Entry within section indirect block */
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
|
||||
FUNC_ENTER_NOAPI_NOINIT(H5HF_man_iblock_alloc_single)
|
||||
|
||||
/*
|
||||
* Check arguments.
|
||||
*/
|
||||
HDassert(hdr);
|
||||
HDassert(sec_node);
|
||||
HDassert(sec_node->sect_info.state == H5FS_SECT_SERIALIZED);
|
||||
|
||||
/* Check for root direct block */
|
||||
if(hdr->man_dtable.curr_root_rows == 0) {
|
||||
/* Set the information for the section */
|
||||
sec_node->u.single.parent = NULL;
|
||||
sec_node->u.single.par_entry = 0;
|
||||
|
||||
/* Set direct block info */
|
||||
HDassert(H5F_addr_defined(hdr->man_dtable.table_addr));
|
||||
sec_node->u.single.dblock_addr = hdr->man_dtable.table_addr;
|
||||
sec_node->u.single.dblock_size = hdr->man_dtable.cparam.start_block_size;
|
||||
} /* end if */
|
||||
else {
|
||||
/* Look up indirect block containing direct blocks for range */
|
||||
if(H5HF_man_locate_block(hdr, dxpl_id, sec_node->sect_info.addr, FALSE, &sec_iblock, &sec_entry, H5AC_READ) < 0)
|
||||
HGOTO_ERROR(H5E_HEAP, H5E_CANTCOMPUTE, FAIL, "can't compute row & column of section")
|
||||
|
||||
/* Increment reference count on indirect block that free section is in */
|
||||
if(H5HF_iblock_incr(sec_iblock) < 0)
|
||||
HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't decrement reference count on shared indirect block")
|
||||
|
||||
/* Set the information for the section */
|
||||
sec_node->u.single.parent = sec_iblock;
|
||||
sec_node->u.single.par_entry = sec_entry;
|
||||
|
||||
/* Set direct block info */
|
||||
sec_node->u.single.dblock_addr = sec_iblock->ents[sec_entry].addr;
|
||||
sec_node->u.single.dblock_size = hdr->man_dtable.row_block_size[sec_entry / hdr->man_dtable.cparam.width];
|
||||
|
||||
/* Unlock indirect block */
|
||||
if(H5AC_unprotect(hdr->f, dxpl_id, H5AC_FHEAP_IBLOCK, sec_iblock->addr, sec_iblock, H5AC__NO_FLAGS_SET) < 0)
|
||||
HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release fractal heap indirect block")
|
||||
sec_iblock = NULL;
|
||||
} /* end else */
|
||||
|
||||
/* Section is "live" now */
|
||||
sec_node->sect_info.state = H5FS_SECT_LIVE;
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5HF_man_iblock_alloc_single() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5HF_man_iblock_alloc_range
|
||||
@ -1182,27 +1128,9 @@ H5HF_man_iblock_alloc_range(H5HF_hdr_t *hdr, hid_t dxpl_id,
|
||||
|
||||
/* Check for serialized section */
|
||||
if(old_sec_node->sect_info.state == H5FS_SECT_SERIALIZED) {
|
||||
H5HF_indirect_t *sec_iblock; /* Pointer to section indirect block */
|
||||
unsigned sec_entry; /* Entry within section indirect block */
|
||||
|
||||
/* Look up indirect block containing direct blocks for range */
|
||||
if(H5HF_man_locate_block(hdr, dxpl_id, old_sec_node->sect_info.addr, FALSE, &sec_iblock, &sec_entry, H5AC_READ) < 0)
|
||||
HGOTO_ERROR(H5E_HEAP, H5E_CANTCOMPUTE, FAIL, "can't compute row & column of section")
|
||||
|
||||
/* Increment reference count on indirect block that free section is in */
|
||||
if(H5HF_iblock_incr(sec_iblock) < 0)
|
||||
HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't decrement reference count on shared indirect block")
|
||||
|
||||
/* Set the pointer to the section's indirect block */
|
||||
old_sec_node->u.range.iblock = sec_iblock;
|
||||
|
||||
/* Unlock indirect block */
|
||||
if(H5AC_unprotect(hdr->f, dxpl_id, H5AC_FHEAP_IBLOCK, sec_iblock->addr, sec_iblock, H5AC__NO_FLAGS_SET) < 0)
|
||||
HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release fractal heap indirect block")
|
||||
sec_iblock = NULL;
|
||||
|
||||
/* Section is "live" now */
|
||||
old_sec_node->sect_info.state = H5FS_SECT_LIVE;
|
||||
/* Revive range section */
|
||||
if(H5HF_sect_range_revive(hdr, dxpl_id, old_sec_node) < 0)
|
||||
HGOTO_ERROR(H5E_HEAP, H5E_CANTREVIVE, FAIL, "can't revive range section")
|
||||
} /* end if */
|
||||
|
||||
/* Compute info about range */
|
||||
@ -1309,27 +1237,9 @@ H5HF_man_iblock_alloc_indirect(H5HF_hdr_t *hdr, hid_t dxpl_id,
|
||||
|
||||
/* Check for serialized section */
|
||||
if(old_sec_node->sect_info.state == H5FS_SECT_SERIALIZED) {
|
||||
H5HF_indirect_t *sec_iblock; /* Pointer to section indirect block */
|
||||
unsigned sec_entry; /* Entry within section indirect block */
|
||||
|
||||
/* Look up indirect block containing indirect blocks for section */
|
||||
if(H5HF_man_locate_block(hdr, dxpl_id, old_sec_node->sect_info.addr, TRUE, &sec_iblock, &sec_entry, H5AC_READ) < 0)
|
||||
HGOTO_ERROR(H5E_HEAP, H5E_CANTCOMPUTE, FAIL, "can't compute row & column of section")
|
||||
|
||||
/* Increment reference count on indirect block that free section is in */
|
||||
if(H5HF_iblock_incr(sec_iblock) < 0)
|
||||
HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't decrement reference count on shared indirect block")
|
||||
|
||||
/* Set the pointer to the section's indirect block */
|
||||
old_sec_node->u.indirect.iblock = sec_iblock;
|
||||
|
||||
/* Unlock indirect block */
|
||||
if(H5AC_unprotect(hdr->f, dxpl_id, H5AC_FHEAP_IBLOCK, sec_iblock->addr, sec_iblock, H5AC__NO_FLAGS_SET) < 0)
|
||||
HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release fractal heap indirect block")
|
||||
sec_iblock = NULL;
|
||||
|
||||
/* Section is "live" now */
|
||||
old_sec_node->sect_info.state = H5FS_SECT_LIVE;
|
||||
/* Revive indirect section */
|
||||
if(H5HF_sect_indirect_revive(hdr, dxpl_id, old_sec_node) < 0)
|
||||
HGOTO_ERROR(H5E_HEAP, H5E_CANTREVIVE, FAIL, "can't revive indirect section")
|
||||
} /* end if */
|
||||
|
||||
/* Compute info about range */
|
||||
|
141
src/H5HFint.c
141
src/H5HFint.c
@ -327,8 +327,8 @@ HDfprintf(stderr, "%s: sec_node->u.range.num_entries = %u\n", FUNC, sec_node->u.
|
||||
|
||||
/* Check for serialized 'single' section */
|
||||
if(sec_node->sect_info.state == H5FS_SECT_SERIALIZED) {
|
||||
if(H5HF_man_iblock_alloc_single(hdr, dxpl_id, sec_node) < 0)
|
||||
HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't initialize direct block for single free section")
|
||||
if(H5HF_sect_single_revive(hdr, dxpl_id, sec_node) < 0)
|
||||
HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't revive single free section")
|
||||
} /* end if */
|
||||
HDassert(sec_node->sect_info.state == H5FS_SECT_LIVE);
|
||||
|
||||
@ -412,8 +412,7 @@ HDfprintf(stderr, "%s: blk_off = %Zu\n", FUNC, blk_off);
|
||||
#ifdef QAK
|
||||
HDfprintf(stderr, "%s: dblock->block_off = %Hu\n", FUNC, dblock->block_off);
|
||||
#endif /* QAK */
|
||||
UINT64ENCODE_VAR(id, (dblock->block_off + blk_off), hdr->heap_off_size);
|
||||
UINT64ENCODE_VAR(id, obj_size, hdr->id_len);
|
||||
H5HF_ID_ENCODE(id, hdr, (dblock->block_off + blk_off), obj_size);
|
||||
} /* end if */
|
||||
else {
|
||||
HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "inserting within mapped managed blocks not supported yet")
|
||||
@ -468,6 +467,7 @@ HDfprintf(stderr, "%s: obj_off = %Hu, obj_len = %Zu\n", FUNC, obj_off, obj_len);
|
||||
*/
|
||||
HDassert(hdr);
|
||||
HDassert(obj_off > 0);
|
||||
HDassert(obj_len > 0);
|
||||
HDassert(obj);
|
||||
|
||||
/* Check for root direct block */
|
||||
@ -527,3 +527,136 @@ done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5HF_man_read() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5HF_man_remove
|
||||
*
|
||||
* Purpose: Remove an object from a managed heap
|
||||
*
|
||||
* Return: SUCCEED/FAIL
|
||||
*
|
||||
* Programmer: Quincey Koziol
|
||||
* koziol@ncsa.uiuc.edu
|
||||
* May 15 2006
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
herr_t
|
||||
H5HF_man_remove(H5HF_hdr_t *hdr, hid_t dxpl_id, hsize_t obj_off, size_t obj_len)
|
||||
{
|
||||
H5HF_free_section_t *sec_node; /* Pointer to free space section for block */
|
||||
H5HF_direct_t *dblock; /* Pointer to direct block to query */
|
||||
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(obj_off > 0);
|
||||
HDassert(obj_len > 0);
|
||||
|
||||
/* Check for bad offset or length */
|
||||
if(obj_off > hdr->man_alloc_size)
|
||||
HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "fractal heap object offset too large")
|
||||
if(obj_len > hdr->man_dtable.cparam.start_block_size)
|
||||
HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "fractal heap object size too large for direct block")
|
||||
if(obj_len > hdr->standalone_size)
|
||||
HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "fractal heap object should be standalone")
|
||||
|
||||
/* Check for root direct block */
|
||||
if(hdr->man_dtable.curr_root_rows == 0) {
|
||||
#ifdef QAK
|
||||
HDfprintf(stderr, "%s: direct root block\n", FUNC);
|
||||
#endif /* QAK */
|
||||
/* Set direct block info */
|
||||
dblock_addr = hdr->man_dtable.table_addr;
|
||||
dblock_size = hdr->man_dtable.cparam.start_block_size;
|
||||
|
||||
/* Lock direct block */
|
||||
if(NULL == (dblock = H5HF_man_dblock_protect(hdr, dxpl_id, dblock_addr, dblock_size, NULL, 0, H5AC_WRITE)))
|
||||
HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap direct block")
|
||||
} /* end if */
|
||||
else {
|
||||
H5HF_indirect_t *iblock; /* Pointer to indirect block */
|
||||
unsigned entry; /* Entry of block */
|
||||
|
||||
#ifdef QAK
|
||||
HDfprintf(stderr, "%s: indirect root block\n", FUNC);
|
||||
#endif /* QAK */
|
||||
/* Look up indirect block containing direct block */
|
||||
if(H5HF_man_locate_block(hdr, dxpl_id, obj_off, FALSE, &iblock, &entry, H5AC_WRITE) < 0)
|
||||
HGOTO_ERROR(H5E_HEAP, H5E_CANTCOMPUTE, FAIL, "can't compute row & column of section")
|
||||
#ifdef QAK
|
||||
HDfprintf(stderr, "%s: entry address = %a\n", FUNC, iblock->ents[entry].addr);
|
||||
#endif /* QAK */
|
||||
|
||||
/* Set direct block info */
|
||||
dblock_addr = iblock->ents[entry].addr;
|
||||
dblock_size = hdr->man_dtable.row_block_size[entry / hdr->man_dtable.cparam.width];
|
||||
|
||||
/* Lock direct block */
|
||||
if(NULL == (dblock = H5HF_man_dblock_protect(hdr, dxpl_id, dblock_addr, dblock_size, iblock, entry, H5AC_WRITE)))
|
||||
HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap direct block")
|
||||
|
||||
/* Unlock indirect block */
|
||||
if(H5AC_unprotect(hdr->f, dxpl_id, H5AC_FHEAP_IBLOCK, iblock->addr, iblock, H5AC__NO_FLAGS_SET) < 0)
|
||||
HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release fractal heap indirect block")
|
||||
iblock = NULL;
|
||||
} /* end else */
|
||||
#ifdef QAK
|
||||
HDfprintf(stderr, "%s: dblock_addr = %a, dblock_size = %Zu\n", FUNC, dblock_addr, dblock_size);
|
||||
#endif /* QAK */
|
||||
|
||||
/* Compute offset of object within block */
|
||||
HDassert((obj_off - dblock->block_off) < (hsize_t)dblock_size);
|
||||
blk_off = (size_t)(obj_off - dblock->block_off);
|
||||
#ifdef QAK
|
||||
HDfprintf(stderr, "%s: blk_off = %Zu\n", FUNC, blk_off);
|
||||
#endif /* QAK */
|
||||
|
||||
/* Create free space section node */
|
||||
if(NULL == (sec_node = H5FL_MALLOC(H5HF_free_section_t)))
|
||||
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for direct block free list section")
|
||||
|
||||
/* Set section's information */
|
||||
sec_node->sect_info.addr = obj_off;
|
||||
sec_node->sect_info.size = obj_len;
|
||||
sec_node->sect_info.cls = &hdr->sect_cls[H5FS_SECT_FHEAP_SINGLE];
|
||||
sec_node->sect_info.state = H5FS_SECT_LIVE;
|
||||
sec_node->u.single.parent = dblock->parent;
|
||||
if(dblock->parent) {
|
||||
if(H5HF_iblock_incr(dblock->parent) < 0)
|
||||
HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, FAIL, "can't increment reference count on shared indirect block")
|
||||
} /* end if */
|
||||
sec_node->u.single.par_entry = dblock->par_entry;
|
||||
sec_node->u.single.dblock_addr = dblock_addr;
|
||||
sec_node->u.single.dblock_size = dblock_size;
|
||||
|
||||
/* Unlock direct block */
|
||||
if(H5AC_unprotect(hdr->f, dxpl_id, H5AC_FHEAP_DBLOCK, dblock_addr, dblock, H5AC__NO_FLAGS_SET) < 0)
|
||||
HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release fractal heap direct block")
|
||||
dblock = NULL;
|
||||
|
||||
/* Return free space to the heap's list of space */
|
||||
if(H5HF_space_return(hdr, dxpl_id, sec_node) < 0)
|
||||
HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't add direct block free space to global list")
|
||||
|
||||
/* Update statistics about heap */
|
||||
hdr->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_man_remove() */
|
||||
|
||||
|
@ -436,7 +436,7 @@ H5HF_man_iter_next(H5HF_hdr_t *hdr, H5HF_block_iter_t *biter, unsigned nentries)
|
||||
biter->curr->row = biter->curr->entry / hdr->man_dtable.cparam.width;
|
||||
biter->curr->col = biter->curr->entry % hdr->man_dtable.cparam.width;
|
||||
} /* end else */
|
||||
HDassert(biter->curr->row <= biter->curr->context->nrows);
|
||||
/* HDassert(biter->curr->row <= biter->curr->context->nrows); */
|
||||
|
||||
FUNC_LEAVE_NOAPI(SUCCEED)
|
||||
} /* end H5HF_man_iter_next() */
|
||||
|
@ -113,6 +113,16 @@
|
||||
#define H5HF_SIZEOF_OFFSET_BITS(b) (((b) + 7) / 8)
|
||||
#define H5HF_SIZEOF_OFFSET_LEN(l) H5HF_SIZEOF_OFFSET_BITS(H5V_log2_of2((unsigned)(l)))
|
||||
|
||||
/* Encode a heap ID */
|
||||
#define H5HF_ID_ENCODE(i, h, o, l) \
|
||||
UINT64ENCODE_VAR((i), (o), (h)->heap_off_size); \
|
||||
UINT64ENCODE_VAR((i), (l), (h)->heap_len_size)
|
||||
|
||||
/* Decode a heap ID */
|
||||
#define H5HF_ID_DECODE(i, h, o, l) \
|
||||
UINT64DECODE_VAR((i), (o), (h)->heap_off_size); \
|
||||
UINT64DECODE_VAR((i), (l), (h)->heap_len_size)
|
||||
|
||||
/* Free space section types for fractal heap */
|
||||
/* (values stored in free space data structures in file) */
|
||||
#define H5FS_SECT_FHEAP_SINGLE 0 /* Section is actual bytes in a direct block */
|
||||
@ -236,7 +246,7 @@ typedef struct H5HF_hdr_t {
|
||||
H5F_t *f; /* Pointer to file for heap */
|
||||
size_t sizeof_size; /* Size of file sizes */
|
||||
size_t sizeof_addr; /* Size of file addresses */
|
||||
size_t id_len; /* Size of heap IDs */
|
||||
size_t id_len; /* Size of heap IDs (in bytes) */
|
||||
size_t nsect_classes; /* Number of free space section classes */
|
||||
H5FS_section_class_t *sect_cls; /* Array of free space section classes */
|
||||
H5FS_t *fspace; /* Free space list for objects in heap */
|
||||
@ -254,6 +264,7 @@ typedef struct H5HF_hdr_t {
|
||||
|
||||
/* Information derived from user parameters (not stored in header) */
|
||||
unsigned char heap_off_size; /* Size of heap offsets (in bytes) */
|
||||
unsigned char heap_len_size; /* Size of heap ID lengths (in bytes) */
|
||||
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? */
|
||||
@ -325,6 +336,13 @@ typedef struct H5HF_parent_t {
|
||||
unsigned entry; /* Location of block in parent's entry table */
|
||||
} H5HF_parent_t;
|
||||
|
||||
/* User data for free space section 'add' callback */
|
||||
typedef struct {
|
||||
H5HF_hdr_t *hdr; /* Fractal heap header */
|
||||
hid_t dxpl_id; /* DXPL ID for operation */
|
||||
H5HF_direct_t *dblock; /* Direct block */
|
||||
} H5HF_add_ud1_t;
|
||||
|
||||
/*****************************/
|
||||
/* Package Private Variables */
|
||||
/*****************************/
|
||||
@ -390,6 +408,7 @@ H5_DLL herr_t H5HF_hdr_adj_free(H5HF_hdr_t *hdr, ssize_t amt);
|
||||
H5_DLL herr_t H5HF_hdr_extend_heap(H5HF_hdr_t *hdr, hsize_t new_size, hsize_t extra_free);
|
||||
H5_DLL herr_t H5HF_hdr_inc_alloc(H5HF_hdr_t *hdr, hsize_t new_alloc_size,
|
||||
unsigned nentries);
|
||||
H5_DLL herr_t H5HF_hdr_empty(H5HF_hdr_t *hdr);
|
||||
|
||||
/* Indirect block routines */
|
||||
H5_DLL herr_t H5HF_iblock_incr(H5HF_indirect_t *iblock);
|
||||
@ -397,8 +416,6 @@ H5_DLL herr_t H5HF_iblock_decr(H5HF_indirect_t *iblock);
|
||||
H5_DLL herr_t H5HF_iblock_dirty(H5HF_indirect_t *iblock);
|
||||
H5_DLL H5HF_indirect_t * H5HF_man_iblock_place_dblock(H5HF_hdr_t *fh, hid_t dxpl_id,
|
||||
size_t min_dblock_size, size_t *entry_p, size_t *dblock_size);
|
||||
H5_DLL herr_t H5HF_man_iblock_alloc_single(H5HF_hdr_t *hdr, hid_t dxpl_id,
|
||||
H5HF_free_section_t *sec_node);
|
||||
H5_DLL herr_t H5HF_man_iblock_alloc_range(H5HF_hdr_t *hdr, hid_t dxpl_id,
|
||||
H5HF_free_section_t **sec_node);
|
||||
H5_DLL herr_t H5HF_man_iblock_alloc_indirect(H5HF_hdr_t *hdr, hid_t dxpl_id,
|
||||
@ -413,14 +430,14 @@ H5_DLL herr_t H5HF_man_dblock_new(H5HF_hdr_t *fh, hid_t dxpl_id, size_t request)
|
||||
H5_DLL herr_t H5HF_man_dblock_create(hid_t dxpl_id, H5HF_hdr_t *hdr,
|
||||
H5HF_indirect_t *par_iblock, unsigned par_entry, size_t block_size,
|
||||
hsize_t block_off, haddr_t *addr_p, H5HF_free_section_t **ret_sec_node);
|
||||
H5_DLL herr_t H5HF_man_dblock_destroy(H5HF_hdr_t *hdr, hid_t dxpl_id,
|
||||
H5HF_direct_t *dblock, haddr_t dblock_addr);
|
||||
H5_DLL H5HF_direct_t *H5HF_man_dblock_protect(H5HF_hdr_t *hdr, hid_t dxpl_id,
|
||||
haddr_t dblock_addr, size_t dblock_size,
|
||||
H5HF_indirect_t *par_iblock, unsigned par_entry,
|
||||
H5AC_protect_t rw);
|
||||
|
||||
/* Routines for internal operations */
|
||||
H5_DLL herr_t H5HF_free_section_free_cb(void *item, void UNUSED *key,
|
||||
void UNUSED *op_data);
|
||||
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);
|
||||
@ -431,6 +448,8 @@ H5_DLL herr_t H5HF_man_insert(H5HF_hdr_t *fh, hid_t dxpl_id,
|
||||
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);
|
||||
|
||||
/* Metadata cache callbacks */
|
||||
H5_DLL herr_t H5HF_cache_hdr_dest(H5F_t *f, H5HF_hdr_t *hdr);
|
||||
@ -470,14 +489,27 @@ H5_DLL hbool_t H5HF_man_iter_ready(H5HF_block_iter_t *biter);
|
||||
H5_DLL herr_t H5HF_space_start(H5HF_hdr_t *hdr, hid_t dxpl_id);
|
||||
H5_DLL htri_t H5HF_space_find(H5HF_hdr_t *hdr, hid_t dxpl_id, hsize_t request,
|
||||
H5HF_free_section_t **node);
|
||||
H5_DLL herr_t H5HF_space_add(H5HF_hdr_t *hdr, hid_t dxpl_id, H5HF_free_section_t *node);
|
||||
H5_DLL herr_t H5HF_space_add(H5HF_hdr_t *hdr, hid_t dxpl_id,
|
||||
H5HF_free_section_t *node);
|
||||
H5_DLL herr_t H5HF_space_return(H5HF_hdr_t *hdr, hid_t dxpl_id,
|
||||
H5HF_free_section_t *node);
|
||||
H5_DLL herr_t H5HF_space_close(H5HF_hdr_t *hdr, hid_t dxpl_id);
|
||||
|
||||
/* Free space section routines */
|
||||
H5_DLL herr_t H5HF_sect_single_revive(H5HF_hdr_t *hdr, hid_t dxpl_id,
|
||||
H5HF_free_section_t *sect);
|
||||
H5_DLL herr_t H5HF_sect_range_revive(H5HF_hdr_t *hdr, hid_t dxpl_id,
|
||||
H5HF_free_section_t *sect);
|
||||
H5_DLL herr_t H5HF_sect_indirect_revive(H5HF_hdr_t *hdr, hid_t dxpl_id,
|
||||
H5HF_free_section_t *sect);
|
||||
|
||||
/* Testing routines */
|
||||
#ifdef H5HF_TESTING
|
||||
H5_DLL herr_t H5HF_get_cparam_test(H5HF_t *fh, H5HF_create_t *cparam);
|
||||
H5_DLL hsize_t H5HF_get_dblock_free_test(H5HF_t *fh, unsigned row);
|
||||
H5_DLL size_t H5HF_get_dblock_overhead(H5HF_t *fh);
|
||||
H5_DLL herr_t H5HF_get_cparam_test(const H5HF_t *fh, H5HF_create_t *cparam);
|
||||
H5_DLL size_t H5HF_get_dblock_overhead(const H5HF_t *fh);
|
||||
H5_DLL hsize_t H5HF_get_dblock_size_test(const H5HF_t *fh, unsigned row);
|
||||
H5_DLL hsize_t H5HF_get_dblock_free_test(const H5HF_t *fh, unsigned row);
|
||||
H5_DLL herr_t H5HF_get_id_off_test(const H5HF_t *fh, const void *id, hsize_t *obj_off);
|
||||
#endif /* H5HF_TESTING */
|
||||
|
||||
#endif /* _H5HFpkg_H */
|
||||
|
@ -87,6 +87,7 @@ H5_DLL herr_t H5HF_insert(H5HF_t *fh, hid_t dxpl_id, size_t size,
|
||||
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_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);
|
||||
H5_DLL herr_t H5HF_close(H5HF_t *fh, hid_t dxpl_id);
|
||||
|
||||
/* Debugging routines */
|
||||
|
@ -50,21 +50,43 @@
|
||||
/********************/
|
||||
/* Local Prototypes */
|
||||
/********************/
|
||||
|
||||
/* Shared routines */
|
||||
static herr_t H5HF_sect_node_alloc(H5FS_section_class_t *sect_cls,
|
||||
unsigned sect_type, haddr_t sect_addr, hsize_t sect_size,
|
||||
H5FS_section_info_t **sect);
|
||||
static herr_t H5HF_sect_node_free(H5HF_free_section_t *sect,
|
||||
H5HF_indirect_t *parent);
|
||||
|
||||
/* 'single' section callbacks */
|
||||
static herr_t H5HF_sect_single_deserialize(H5FS_section_class_t *sect_cls,
|
||||
const uint8_t *buf, haddr_t sect_addr, hsize_t sect_size,
|
||||
H5FS_section_info_t **sect);
|
||||
static herr_t H5HF_sect_range_init(H5FS_section_class_t *cls, const void *udata);
|
||||
static htri_t H5HF_sect_single_can_merge(const H5FS_section_info_t *sect1,
|
||||
const H5FS_section_info_t *sect2, void *udata);
|
||||
static herr_t H5HF_sect_single_merge(H5FS_section_info_t *sect1,
|
||||
H5FS_section_info_t *sect2, void *udata);
|
||||
static htri_t H5HF_sect_single_can_shrink(H5FS_section_info_t *sect, void *udata);
|
||||
static herr_t H5HF_sect_single_shrink(H5FS_section_info_t **sect, void *udata);
|
||||
static herr_t H5HF_sect_single_free(H5FS_section_info_t *sect);
|
||||
|
||||
/* 'range' section callbacks */
|
||||
static herr_t H5HF_sect_range_init_cls(H5FS_section_class_t *cls, const void *udata);
|
||||
static herr_t H5HF_sect_range_serialize(const H5FS_section_info_t *sect, uint8_t *buf);
|
||||
static herr_t H5HF_sect_range_deserialize(H5FS_section_class_t *sect_cls,
|
||||
const uint8_t *buf, haddr_t sect_addr, hsize_t sect_size,
|
||||
H5FS_section_info_t **sect);
|
||||
static herr_t H5HF_sect_range_free(H5FS_section_info_t *sect);
|
||||
static herr_t H5HF_sect_range_debug(const H5FS_section_info_t *sect,
|
||||
FILE *stream, int indent, int fwidth);
|
||||
static herr_t H5HF_sect_indirect_init(H5FS_section_class_t *cls, const void *udata);
|
||||
|
||||
/* 'indirect' section callbacks */
|
||||
static herr_t H5HF_sect_indirect_init_cls(H5FS_section_class_t *cls, const void *udata);
|
||||
static herr_t H5HF_sect_indirect_serialize(const H5FS_section_info_t *sect, uint8_t *buf);
|
||||
static herr_t H5HF_sect_indirect_deserialize(H5FS_section_class_t *sect_cls,
|
||||
const uint8_t *buf, haddr_t sect_addr, hsize_t sect_size,
|
||||
H5FS_section_info_t **sect);
|
||||
static herr_t H5HF_sect_indirect_free(H5FS_section_info_t *sect);
|
||||
static herr_t H5HF_sect_indirect_debug(const H5FS_section_info_t *sect,
|
||||
FILE *stream, int indent, int fwidth);
|
||||
|
||||
@ -76,32 +98,47 @@ static herr_t H5HF_sect_indirect_debug(const H5FS_section_info_t *sect,
|
||||
/* Class info for "single" free space sections */
|
||||
/* (No callbacks necessary) */
|
||||
H5FS_section_class_t H5FS_SECT_CLS_FHEAP_SINGLE[1] = {{
|
||||
H5FS_SECT_FHEAP_SINGLE,
|
||||
0,
|
||||
NULL,
|
||||
NULL,
|
||||
H5HF_sect_single_deserialize,
|
||||
NULL,
|
||||
H5FS_SECT_FHEAP_SINGLE, /* Section type */
|
||||
0, /* Extra serialized size */
|
||||
NULL, /* Initialize section class */
|
||||
NULL, /* Serialize section */
|
||||
H5HF_sect_single_deserialize, /* Deserialize section */
|
||||
H5HF_sect_single_can_merge, /* Can sections merge? */
|
||||
H5HF_sect_single_merge, /* Merge sections */
|
||||
H5HF_sect_single_can_shrink, /* Can section shrink container?*/
|
||||
H5HF_sect_single_shrink, /* Shrink container w/section */
|
||||
H5HF_sect_single_free, /* Free section */
|
||||
NULL, /* Dump debugging for section */
|
||||
}};
|
||||
|
||||
/* Class info for "range" free space sections */
|
||||
H5FS_section_class_t H5FS_SECT_CLS_FHEAP_RANGE[1] = {{
|
||||
H5FS_SECT_FHEAP_RANGE,
|
||||
0,
|
||||
H5HF_sect_range_init,
|
||||
H5HF_sect_range_serialize,
|
||||
H5HF_sect_range_deserialize,
|
||||
H5HF_sect_range_debug,
|
||||
H5FS_SECT_FHEAP_RANGE, /* Section type */
|
||||
0, /* Extra serialized size */
|
||||
H5HF_sect_range_init_cls, /* Initialize section class */
|
||||
H5HF_sect_range_serialize, /* Serialize section */
|
||||
H5HF_sect_range_deserialize, /* Deserialize section */
|
||||
NULL, /* Can sections merge? */
|
||||
NULL, /* Merge sections */
|
||||
NULL, /* Can section shrink container?*/
|
||||
NULL, /* Shrink container w/section */
|
||||
H5HF_sect_range_free, /* Free section */
|
||||
H5HF_sect_range_debug, /* Dump debugging for section */
|
||||
}};
|
||||
|
||||
/* Class info for "indirect" free space sections */
|
||||
H5FS_section_class_t H5FS_SECT_CLS_FHEAP_INDIRECT[1] = {{
|
||||
H5FS_SECT_FHEAP_INDIRECT,
|
||||
0,
|
||||
H5HF_sect_indirect_init,
|
||||
H5HF_sect_indirect_serialize,
|
||||
H5HF_sect_indirect_deserialize,
|
||||
H5HF_sect_indirect_debug,
|
||||
H5FS_SECT_FHEAP_INDIRECT, /* Section type */
|
||||
0, /* Extra serialized size */
|
||||
H5HF_sect_indirect_init_cls, /* Initialize section class */
|
||||
H5HF_sect_indirect_serialize, /* Serialize section */
|
||||
H5HF_sect_indirect_deserialize, /* Deserialize section */
|
||||
NULL, /* Can sections merge? */
|
||||
NULL, /* Merge sections */
|
||||
NULL, /* Can section shrink container?*/
|
||||
NULL, /* Shrink container w/section */
|
||||
H5HF_sect_indirect_free, /* Free section */
|
||||
H5HF_sect_indirect_debug, /* Dump debugging for section */
|
||||
}};
|
||||
|
||||
/* Declare a free list to manage the H5HF_free_section_t struct */
|
||||
@ -118,63 +155,6 @@ H5FL_DEFINE(H5HF_free_section_t);
|
||||
/*******************/
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5HF_free_section_free_cb
|
||||
*
|
||||
* Purpose: Free a free section node
|
||||
*
|
||||
* Return: Success: non-negative
|
||||
*
|
||||
* Failure: negative
|
||||
*
|
||||
* Programmer: Quincey Koziol
|
||||
* Monday, March 13, 2006
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
herr_t
|
||||
H5HF_free_section_free_cb(void *_sect, void UNUSED *key, void UNUSED *op_data)
|
||||
{
|
||||
H5HF_free_section_t *sect = (H5HF_free_section_t *)_sect;
|
||||
herr_t ret_value = 0; /* Return value */
|
||||
|
||||
FUNC_ENTER_NOAPI_NOINIT(H5HF_free_section_free_cb)
|
||||
|
||||
HDassert(sect);
|
||||
|
||||
/* Check for live reference to an indirect block */
|
||||
if(sect->sect_info.state == H5FS_SECT_LIVE) {
|
||||
H5HF_indirect_t *iblock; /* Indirect block referenced */
|
||||
|
||||
/* Find indirect block that free section references */
|
||||
switch(sect->sect_info.cls->type) {
|
||||
case H5FS_SECT_FHEAP_SINGLE:
|
||||
iblock = sect->u.single.parent;
|
||||
break;
|
||||
|
||||
case H5FS_SECT_FHEAP_RANGE:
|
||||
iblock = sect->u.range.iblock;
|
||||
break;
|
||||
|
||||
case H5FS_SECT_FHEAP_INDIRECT:
|
||||
iblock = sect->u.indirect.iblock;
|
||||
break;
|
||||
} /* end switch */
|
||||
|
||||
/* Release indirect block, if there was one */
|
||||
if(iblock)
|
||||
if(H5HF_iblock_decr(iblock) < 0)
|
||||
HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't decrement reference count on shared indirect block")
|
||||
} /* end if */
|
||||
|
||||
/* Release the sections */
|
||||
H5FL_FREE(H5HF_free_section_t, sect);
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* H5HF_free_section_free_cb() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5HF_sect_node_alloc
|
||||
@ -223,6 +203,114 @@ done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* H5HF_sect_node_alloc() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5HF_sect_node_free
|
||||
*
|
||||
* Purpose: Free a section node
|
||||
*
|
||||
* Return: Success: non-negative
|
||||
*
|
||||
* Failure: negative
|
||||
*
|
||||
* Programmer: Quincey Koziol
|
||||
* Wednesday, May 17, 2006
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
herr_t
|
||||
H5HF_sect_node_free(H5HF_free_section_t *sect, H5HF_indirect_t *parent)
|
||||
{
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
|
||||
FUNC_ENTER_NOAPI_NOINIT(H5HF_sect_node_free)
|
||||
|
||||
HDassert(sect);
|
||||
|
||||
/* Release indirect block, if there was one */
|
||||
if(parent)
|
||||
if(H5HF_iblock_decr(parent) < 0)
|
||||
HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't decrement reference count on parent indirect block")
|
||||
|
||||
/* Release the section */
|
||||
H5FL_FREE(H5HF_free_section_t, sect);
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* H5HF_sect_node_free() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5HF_sect_single_revive
|
||||
*
|
||||
* Purpose: Update the memory information for a 'single' free section
|
||||
*
|
||||
* Return: Non-negative on success/Negative on failure
|
||||
*
|
||||
* Programmer: Quincey Koziol
|
||||
* koziol@ncsa.uiuc.edu
|
||||
* May 8 2006
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
herr_t
|
||||
H5HF_sect_single_revive(H5HF_hdr_t *hdr, hid_t dxpl_id,
|
||||
H5HF_free_section_t *sect)
|
||||
{
|
||||
H5HF_indirect_t *sec_iblock; /* Pointer to section indirect block */
|
||||
unsigned sec_entry; /* Entry within section indirect block */
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
|
||||
FUNC_ENTER_NOAPI_NOINIT(H5HF_sect_single_revive)
|
||||
|
||||
/*
|
||||
* Check arguments.
|
||||
*/
|
||||
HDassert(hdr);
|
||||
HDassert(sect);
|
||||
HDassert(sect->sect_info.state == H5FS_SECT_SERIALIZED);
|
||||
|
||||
/* Check for root direct block */
|
||||
if(hdr->man_dtable.curr_root_rows == 0) {
|
||||
/* Set the information for the section */
|
||||
sect->u.single.parent = NULL;
|
||||
sect->u.single.par_entry = 0;
|
||||
|
||||
/* Set direct block info */
|
||||
HDassert(H5F_addr_defined(hdr->man_dtable.table_addr));
|
||||
sect->u.single.dblock_addr = hdr->man_dtable.table_addr;
|
||||
sect->u.single.dblock_size = hdr->man_dtable.cparam.start_block_size;
|
||||
} /* end if */
|
||||
else {
|
||||
/* Look up indirect block containing direct blocks for range */
|
||||
if(H5HF_man_locate_block(hdr, dxpl_id, sect->sect_info.addr, FALSE, &sec_iblock, &sec_entry, H5AC_READ) < 0)
|
||||
HGOTO_ERROR(H5E_HEAP, H5E_CANTCOMPUTE, FAIL, "can't compute row & column of section")
|
||||
|
||||
/* Increment reference count on indirect block that free section is in */
|
||||
if(H5HF_iblock_incr(sec_iblock) < 0)
|
||||
HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't decrement reference count on shared indirect block")
|
||||
|
||||
/* Set the information for the section */
|
||||
sect->u.single.parent = sec_iblock;
|
||||
sect->u.single.par_entry = sec_entry;
|
||||
|
||||
/* Set direct block info */
|
||||
sect->u.single.dblock_addr = sec_iblock->ents[sec_entry].addr;
|
||||
sect->u.single.dblock_size = hdr->man_dtable.row_block_size[sec_entry / hdr->man_dtable.cparam.width];
|
||||
|
||||
/* Unlock indirect block */
|
||||
if(H5AC_unprotect(hdr->f, dxpl_id, H5AC_FHEAP_IBLOCK, sec_iblock->addr, sec_iblock, H5AC__NO_FLAGS_SET) < 0)
|
||||
HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release fractal heap indirect block")
|
||||
sec_iblock = NULL;
|
||||
} /* end else */
|
||||
|
||||
/* Section is "live" now */
|
||||
sect->sect_info.state = H5FS_SECT_LIVE;
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5HF_sect_single_revive() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5HF_sect_single_deserialize
|
||||
@ -263,7 +351,276 @@ done:
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5HF_sect_range_init
|
||||
* Function: H5HF_sect_single_can_merge
|
||||
*
|
||||
* Purpose: Can two sections of this type merge?
|
||||
*
|
||||
* Note: Second section must be "after" first section
|
||||
*
|
||||
* Return: Success: non-negative (TRUE/FALSE)
|
||||
*
|
||||
* Failure: negative
|
||||
*
|
||||
* Programmer: Quincey Koziol
|
||||
* Wednesday, May 17, 2006
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static htri_t
|
||||
H5HF_sect_single_can_merge(const H5FS_section_info_t *sect1,
|
||||
const H5FS_section_info_t *sect2, void UNUSED *udata)
|
||||
{
|
||||
htri_t ret_value = FALSE; /* Return value */
|
||||
|
||||
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_sect_single_can_merge)
|
||||
|
||||
/* Check arguments. */
|
||||
HDassert(sect1);
|
||||
HDassert(sect2);
|
||||
HDassert(H5F_addr_lt(sect1->addr, sect2->addr));
|
||||
|
||||
#ifdef QAK
|
||||
HDfprintf(stderr, "%s: sect1->size = %Hu, sect1->addr = %a\n", "H5HF_sect_single_can_merge", sect1->size, sect1->addr);
|
||||
HDfprintf(stderr, "%s: sect2->size = %Hu, sect2->addr = %a\n", "H5HF_sect_single_can_merge", sect2->size, sect2->addr);
|
||||
#endif /* QAK */
|
||||
|
||||
/* Single section can only merge with other single sections */
|
||||
if(sect1->cls->type != sect2->cls->type)
|
||||
HGOTO_DONE(FALSE)
|
||||
|
||||
/* Check if second section adjoins first section */
|
||||
/* (This can only occurs within a direct block, due to the direct block
|
||||
* overhead at the beginning of a block)
|
||||
*/
|
||||
if(H5F_addr_eq(sect1->addr + sect1->size, sect2->addr))
|
||||
HGOTO_DONE(TRUE)
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* H5HF_sect_single_can_merge() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5HF_sect_single_merge
|
||||
*
|
||||
* Purpose: Merge two sections of this type
|
||||
*
|
||||
* Note: Second section always merges into first node
|
||||
*
|
||||
* Return: Success: non-negative
|
||||
*
|
||||
* Failure: negative
|
||||
*
|
||||
* Programmer: Quincey Koziol
|
||||
* Wednesday, May 17, 2006
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static herr_t
|
||||
H5HF_sect_single_merge(H5FS_section_info_t *sect1, H5FS_section_info_t *sect2,
|
||||
void UNUSED *udata)
|
||||
{
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
|
||||
FUNC_ENTER_NOAPI_NOINIT(H5HF_sect_single_merge)
|
||||
|
||||
/* Check arguments. */
|
||||
HDassert(sect1);
|
||||
HDassert(sect2);
|
||||
HDassert(H5F_addr_eq(sect1->addr + sect1->size, sect2->addr));
|
||||
|
||||
#ifdef QAK
|
||||
HDfprintf(stderr, "%s: sect1->size = %Hu, sect1->addr = %a\n", "H5HF_sect_single_merge", sect1->size, sect1->addr);
|
||||
HDfprintf(stderr, "%s: sect2->size = %Hu, sect2->addr = %a\n", "H5HF_sect_single_merge", sect2->size, sect2->addr);
|
||||
#endif /* QAK */
|
||||
|
||||
/* Add second section's size to first section */
|
||||
sect1->size += sect2->size;
|
||||
|
||||
/* Get rid of second section */
|
||||
if(H5HF_sect_single_free(sect2) < 0)
|
||||
HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't free section node")
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* H5HF_sect_single_merge() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5HF_sect_single_can_shrink
|
||||
*
|
||||
* Purpose: Can this section shrink the heap?
|
||||
*
|
||||
* Return: Success: non-negative (TRUE/FALSE)
|
||||
*
|
||||
* Failure: negative
|
||||
*
|
||||
* Programmer: Quincey Koziol
|
||||
* Wednesday, May 17, 2006
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static htri_t
|
||||
H5HF_sect_single_can_shrink(H5FS_section_info_t *_sect, void *_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_hdr_t *hdr; /* Fractal heap header */
|
||||
H5HF_direct_t *dblock = NULL; /* Pointer to direct block for section */
|
||||
haddr_t dblock_addr; /* Section's direct block's address */
|
||||
size_t dblock_size; /* Section's direct block's size */
|
||||
size_t dblock_overhead; /* Direct block's overhead */
|
||||
hid_t dxpl_id; /* DXPL ID for operation */
|
||||
htri_t ret_value = FALSE; /* Return value */
|
||||
|
||||
FUNC_ENTER_NOAPI_NOINIT(H5HF_sect_single_can_shrink)
|
||||
|
||||
/* Check arguments. */
|
||||
HDassert(sect);
|
||||
HDassert(udata);
|
||||
HDassert(udata->hdr);
|
||||
|
||||
#ifdef QAK
|
||||
HDfprintf(stderr, "%s: sect->sect_info.size = %Hu, sect->sect_info.addr = %a\n", FUNC, sect->sect_info.size, sect->sect_info.addr);
|
||||
#endif /* QAK */
|
||||
|
||||
/* Initialize some local convenience variables */
|
||||
hdr = udata->hdr;
|
||||
dxpl_id = udata->dxpl_id;
|
||||
|
||||
/* Revive the section, if it's still serialized */
|
||||
if(sect->sect_info.state != H5FS_SECT_LIVE) {
|
||||
if(H5HF_sect_single_revive(hdr, dxpl_id, sect) < 0)
|
||||
HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't revive single free section")
|
||||
} /* end if */
|
||||
|
||||
/* Protect the direct block for the section */
|
||||
dblock_addr = sect->u.single.dblock_addr;
|
||||
dblock_size = sect->u.single.dblock_size;
|
||||
#ifdef QAK
|
||||
HDfprintf(stderr, "%s: dblock_size = %u, dblock_addr = %a\n", FUNC, dblock_size, dblock_addr);
|
||||
#endif /* QAK */
|
||||
if(NULL == (dblock = H5HF_man_dblock_protect(hdr, dxpl_id, dblock_addr, dblock_size, sect->u.single.parent, sect->u.single.par_entry, H5AC_READ)))
|
||||
HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to load fractal heap direct block")
|
||||
|
||||
/* Check for section occupying entire direct block */
|
||||
dblock_overhead = H5HF_MAN_ABS_DIRECT_OVERHEAD(hdr);
|
||||
if(H5F_addr_eq(dblock->block_off + dblock_overhead, sect->sect_info.addr) &&
|
||||
(dblock_size - dblock_overhead) == sect->sect_info.size) {
|
||||
/* Stash the direct block pointer away for the 'shrink' callback */
|
||||
udata->dblock = dblock;
|
||||
|
||||
/* Indicate that the heap can be shrunk */
|
||||
HGOTO_DONE(TRUE)
|
||||
} /* end if */
|
||||
|
||||
done:
|
||||
/* Unprotect the direct block, if we aren't going to use it in the 'shrink' callback */
|
||||
if(ret_value != TRUE)
|
||||
if(dblock && H5AC_unprotect(hdr->f, dxpl_id, H5AC_FHEAP_DBLOCK, dblock_addr, dblock, H5AC__NO_FLAGS_SET) < 0)
|
||||
HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release fractal heap direct block")
|
||||
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* H5HF_sect_single_can_shrink() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5HF_sect_single_shrink
|
||||
*
|
||||
* Purpose: Shrink heap w/section
|
||||
*
|
||||
* Return: Success: non-negative
|
||||
*
|
||||
* Failure: negative
|
||||
*
|
||||
* Programmer: Quincey Koziol
|
||||
* Wednesday, May 17, 2006
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static herr_t
|
||||
H5HF_sect_single_shrink(H5FS_section_info_t **_sect, void *_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 */
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
|
||||
FUNC_ENTER_NOAPI_NOINIT(H5HF_sect_single_shrink)
|
||||
|
||||
/* Check arguments. */
|
||||
HDassert(sect);
|
||||
HDassert(*sect);
|
||||
HDassert((*sect)->sect_info.state == H5FS_SECT_LIVE);
|
||||
HDassert(udata);
|
||||
HDassert(udata->hdr);
|
||||
HDassert(udata->dblock);
|
||||
|
||||
#ifdef QAK
|
||||
HDfprintf(stderr, "%s: (*sect)->sect_info.size = %Hu, (*sect)->sect_info.addr = %a\n", "H5HF_sect_single_shrink", (*sect)->sect_info.size, (*sect)->sect_info.addr);
|
||||
#endif /* QAK */
|
||||
|
||||
/* Destroy direct block */
|
||||
if(H5HF_man_dblock_destroy(udata->hdr, udata->dxpl_id, udata->dblock, (*sect)->u.single.dblock_addr) < 0)
|
||||
HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't release direct block")
|
||||
|
||||
/* Mark section as "dead", since it's direct block is destroyed */
|
||||
(*sect)->sect_info.state = H5FS_SECT_SERIALIZED;
|
||||
|
||||
/* Release section */
|
||||
if(H5HF_sect_single_free((H5FS_section_info_t *)*sect) < 0)
|
||||
HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't free section node")
|
||||
|
||||
/* Set section pointer to NULL, to indicate that the section was released */
|
||||
*sect = NULL;
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* H5HF_sect_single_shrink() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5HF_sect_single_free
|
||||
*
|
||||
* Purpose: Free a 'single' section node
|
||||
*
|
||||
* Return: Success: non-negative
|
||||
*
|
||||
* Failure: negative
|
||||
*
|
||||
* Programmer: Quincey Koziol
|
||||
* Wednesday, May 17, 2006
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
herr_t
|
||||
H5HF_sect_single_free(H5FS_section_info_t *_sect)
|
||||
{
|
||||
H5HF_free_section_t *sect = (H5HF_free_section_t *)_sect; /* Pointer to section to free */
|
||||
H5HF_indirect_t *parent = NULL; /* Parent indirect block for section */
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
|
||||
FUNC_ENTER_NOAPI_NOINIT(H5HF_sect_single_free)
|
||||
|
||||
HDassert(sect);
|
||||
|
||||
/* Check for live reference to an indirect block */
|
||||
if(sect->sect_info.state == H5FS_SECT_LIVE) {
|
||||
/* Get parent indirect block, if there was one */
|
||||
if(sect->u.single.parent)
|
||||
parent = sect->u.single.parent;
|
||||
} /* end if */
|
||||
|
||||
/* Release the section */
|
||||
if(H5HF_sect_node_free(sect, parent) < 0)
|
||||
HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't free section node")
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* H5HF_sect_single_free() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5HF_sect_range_init_cls
|
||||
*
|
||||
* Purpose: Initialize the "range" class structure
|
||||
*
|
||||
@ -277,9 +634,9 @@ done:
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static herr_t
|
||||
H5HF_sect_range_init(H5FS_section_class_t *cls, const void UNUSED *udata)
|
||||
H5HF_sect_range_init_cls(H5FS_section_class_t *cls, const void UNUSED *udata)
|
||||
{
|
||||
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_sect_range_init)
|
||||
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_sect_range_init_cls)
|
||||
|
||||
/* Check arguments. */
|
||||
HDassert(cls);
|
||||
@ -290,7 +647,61 @@ H5HF_sect_range_init(H5FS_section_class_t *cls, const void UNUSED *udata)
|
||||
+ 2; /* # of entries */
|
||||
|
||||
FUNC_LEAVE_NOAPI(SUCCEED)
|
||||
} /* H5HF_sect_range_init() */
|
||||
} /* H5HF_sect_range_init_cls() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5HF_sect_range_revive
|
||||
*
|
||||
* Purpose: Update the memory information for a 'range' free section
|
||||
*
|
||||
* Return: Non-negative on success/Negative on failure
|
||||
*
|
||||
* Programmer: Quincey Koziol
|
||||
* koziol@ncsa.uiuc.edu
|
||||
* May 8 2006
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
herr_t
|
||||
H5HF_sect_range_revive(H5HF_hdr_t *hdr, hid_t dxpl_id,
|
||||
H5HF_free_section_t *sect)
|
||||
{
|
||||
H5HF_indirect_t *sec_iblock; /* Pointer to section indirect block */
|
||||
unsigned sec_entry; /* Entry within section indirect block */
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
|
||||
FUNC_ENTER_NOAPI_NOINIT(H5HF_sect_range_revive)
|
||||
|
||||
/*
|
||||
* Check arguments.
|
||||
*/
|
||||
HDassert(hdr);
|
||||
HDassert(sect);
|
||||
HDassert(sect->sect_info.state == H5FS_SECT_SERIALIZED);
|
||||
|
||||
/* Look up indirect block containing direct blocks for range */
|
||||
if(H5HF_man_locate_block(hdr, dxpl_id, sect->sect_info.addr, FALSE, &sec_iblock, &sec_entry, H5AC_READ) < 0)
|
||||
HGOTO_ERROR(H5E_HEAP, H5E_CANTCOMPUTE, FAIL, "can't compute row & column of section")
|
||||
|
||||
/* Increment reference count on indirect block that free section is in */
|
||||
if(H5HF_iblock_incr(sec_iblock) < 0)
|
||||
HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't decrement reference count on shared indirect block")
|
||||
|
||||
/* Set the pointer to the section's indirect block */
|
||||
sect->u.range.iblock = sec_iblock;
|
||||
|
||||
/* Unlock indirect block */
|
||||
if(H5AC_unprotect(hdr->f, dxpl_id, H5AC_FHEAP_IBLOCK, sec_iblock->addr, sec_iblock, H5AC__NO_FLAGS_SET) < 0)
|
||||
HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release fractal heap indirect block")
|
||||
sec_iblock = NULL;
|
||||
|
||||
/* Section is "live" now */
|
||||
sect->sect_info.state = H5FS_SECT_LIVE;
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5HF_sect_range_revive() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
@ -377,6 +788,47 @@ done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* H5HF_sect_range_deserialize() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5HF_sect_range_free
|
||||
*
|
||||
* Purpose: Free a 'range' section node
|
||||
*
|
||||
* Return: Success: non-negative
|
||||
*
|
||||
* Failure: negative
|
||||
*
|
||||
* Programmer: Quincey Koziol
|
||||
* Wednesday, May 17, 2006
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
herr_t
|
||||
H5HF_sect_range_free(H5FS_section_info_t *_sect)
|
||||
{
|
||||
H5HF_free_section_t *sect = (H5HF_free_section_t *)_sect; /* Pointer to section to free */
|
||||
H5HF_indirect_t *parent = NULL; /* Parent indirect block for section */
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
|
||||
FUNC_ENTER_NOAPI_NOINIT(H5HF_sect_range_free)
|
||||
|
||||
HDassert(sect);
|
||||
|
||||
/* Check for live reference to an indirect block */
|
||||
if(sect->sect_info.state == H5FS_SECT_LIVE) {
|
||||
/* Get parent indirect block, if there was one */
|
||||
if(sect->u.range.iblock)
|
||||
parent = sect->u.range.iblock;
|
||||
} /* end if */
|
||||
|
||||
/* Release the section */
|
||||
if(H5HF_sect_node_free(sect, parent) < 0)
|
||||
HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't free section node")
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* H5HF_sect_range_free() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5HF_sect_range_debug
|
||||
@ -419,7 +871,7 @@ H5HF_sect_range_debug(const H5FS_section_info_t *_sect,
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5HF_sect_indirect_init
|
||||
* Function: H5HF_sect_indirect_init_cls
|
||||
*
|
||||
* Purpose: Initialize the "indirect" class structure
|
||||
*
|
||||
@ -433,9 +885,9 @@ H5HF_sect_range_debug(const H5FS_section_info_t *_sect,
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static herr_t
|
||||
H5HF_sect_indirect_init(H5FS_section_class_t *cls, const void UNUSED *udata)
|
||||
H5HF_sect_indirect_init_cls(H5FS_section_class_t *cls, const void UNUSED *udata)
|
||||
{
|
||||
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_sect_indirect_init)
|
||||
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_sect_indirect_init_cls)
|
||||
|
||||
/* Check arguments. */
|
||||
HDassert(cls);
|
||||
@ -448,7 +900,61 @@ H5HF_sect_indirect_init(H5FS_section_class_t *cls, const void UNUSED *udata)
|
||||
+ 2; /* Indirect # of rows */
|
||||
|
||||
FUNC_LEAVE_NOAPI(SUCCEED)
|
||||
} /* H5HF_sect_indirect_init() */
|
||||
} /* H5HF_sect_indirect_init_cls() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5HF_sect_indirect_revive
|
||||
*
|
||||
* Purpose: Update the memory information for a 'indirect' free section
|
||||
*
|
||||
* Return: Non-negative on success/Negative on failure
|
||||
*
|
||||
* Programmer: Quincey Koziol
|
||||
* koziol@ncsa.uiuc.edu
|
||||
* May 8 2006
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
herr_t
|
||||
H5HF_sect_indirect_revive(H5HF_hdr_t *hdr, hid_t dxpl_id,
|
||||
H5HF_free_section_t *sect)
|
||||
{
|
||||
H5HF_indirect_t *sec_iblock; /* Pointer to section indirect block */
|
||||
unsigned sec_entry; /* Entry within section indirect block */
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
|
||||
FUNC_ENTER_NOAPI_NOINIT(H5HF_sect_indirect_revive)
|
||||
|
||||
/*
|
||||
* Check arguments.
|
||||
*/
|
||||
HDassert(hdr);
|
||||
HDassert(sect);
|
||||
HDassert(sect->sect_info.state == H5FS_SECT_SERIALIZED);
|
||||
|
||||
/* Look up indirect block containing indirect blocks for section */
|
||||
if(H5HF_man_locate_block(hdr, dxpl_id, sect->sect_info.addr, TRUE, &sec_iblock, &sec_entry, H5AC_READ) < 0)
|
||||
HGOTO_ERROR(H5E_HEAP, H5E_CANTCOMPUTE, FAIL, "can't compute row & column of section")
|
||||
|
||||
/* Increment reference count on indirect block that free section is in */
|
||||
if(H5HF_iblock_incr(sec_iblock) < 0)
|
||||
HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't decrement reference count on shared indirect block")
|
||||
|
||||
/* Set the pointer to the section's indirect block */
|
||||
sect->u.indirect.iblock = sec_iblock;
|
||||
|
||||
/* Unlock indirect block */
|
||||
if(H5AC_unprotect(hdr->f, dxpl_id, H5AC_FHEAP_IBLOCK, sec_iblock->addr, sec_iblock, H5AC__NO_FLAGS_SET) < 0)
|
||||
HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release fractal heap indirect block")
|
||||
sec_iblock = NULL;
|
||||
|
||||
/* Section is "live" now */
|
||||
sect->sect_info.state = H5FS_SECT_LIVE;
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5HF_sect_indirect_revive() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
@ -547,6 +1053,47 @@ done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* H5HF_sect_indirect_deserialize() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5HF_sect_indirect_free
|
||||
*
|
||||
* Purpose: Free a 'indirect' section node
|
||||
*
|
||||
* Return: Success: non-negative
|
||||
*
|
||||
* Failure: negative
|
||||
*
|
||||
* Programmer: Quincey Koziol
|
||||
* Wednesday, May 17, 2006
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
herr_t
|
||||
H5HF_sect_indirect_free(H5FS_section_info_t *_sect)
|
||||
{
|
||||
H5HF_free_section_t *sect = (H5HF_free_section_t *)_sect; /* Pointer to section to free */
|
||||
H5HF_indirect_t *parent = NULL; /* Parent indirect block for section */
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
|
||||
FUNC_ENTER_NOAPI_NOINIT(H5HF_sect_indirect_free)
|
||||
|
||||
HDassert(sect);
|
||||
|
||||
/* Check for live reference to an indirect block */
|
||||
if(sect->sect_info.state == H5FS_SECT_LIVE) {
|
||||
/* Get parent indirect block, if there was one */
|
||||
if(sect->u.indirect.iblock)
|
||||
parent = sect->u.indirect.iblock;
|
||||
} /* end if */
|
||||
|
||||
/* Release the sections */
|
||||
if(H5HF_sect_node_free(sect, parent) < 0)
|
||||
HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't free section node")
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* H5HF_sect_indirect_free() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5HF_sect_indirect_debug
|
||||
|
@ -127,7 +127,7 @@ H5HF_space_start(H5HF_hdr_t *hdr, hid_t dxpl_id)
|
||||
if(H5F_addr_defined(hdr->fs_addr)) {
|
||||
/* Open an existing free space structure for the heap */
|
||||
if(NULL == (hdr->fspace = H5FS_open(hdr->f, dxpl_id, hdr->fs_addr,
|
||||
H5HF_free_section_free_cb, hdr->nsect_classes, hdr->sect_cls, hdr)))
|
||||
hdr->nsect_classes, hdr->sect_cls, hdr)))
|
||||
HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't initialize free space info")
|
||||
} /* end if */
|
||||
else {
|
||||
@ -142,8 +142,7 @@ H5HF_space_start(H5HF_hdr_t *hdr, hid_t dxpl_id)
|
||||
|
||||
/* Create the free space structure for the heap */
|
||||
if(NULL == (hdr->fspace = H5FS_create(hdr->f, dxpl_id, &hdr->fs_addr,
|
||||
&fs_create, H5HF_free_section_free_cb,
|
||||
hdr->nsect_classes, hdr->sect_cls, hdr)))
|
||||
&fs_create, hdr->nsect_classes, hdr->sect_cls, hdr)))
|
||||
HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't initialize free space info")
|
||||
} /* end else */
|
||||
|
||||
@ -233,13 +232,61 @@ H5HF_space_add(H5HF_hdr_t *hdr, hid_t dxpl_id, H5HF_free_section_t *node)
|
||||
HDassert(hdr->fspace);
|
||||
|
||||
/* Add to the free space for the heap */
|
||||
if(H5FS_add(hdr->f, dxpl_id, hdr->fspace, (H5FS_section_info_t *)node) < 0)
|
||||
if(H5FS_add(hdr->f, dxpl_id, hdr->fspace, (H5FS_section_info_t *)node, 0, NULL) < 0)
|
||||
HGOTO_ERROR(H5E_HEAP, H5E_CANTINSERT, FAIL, "can't add section to heap free space")
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5HF_space_add() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5HF_space_return
|
||||
*
|
||||
* Purpose: Return a freedsection to the free space for the heap
|
||||
*
|
||||
* Return: Success: non-negative
|
||||
*
|
||||
* Failure: negative
|
||||
*
|
||||
* Programmer: Quincey Koziol
|
||||
* koziol@ncsa.uiuc.edu
|
||||
* May 15 2006
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
herr_t
|
||||
H5HF_space_return(H5HF_hdr_t *hdr, hid_t dxpl_id, H5HF_free_section_t *node)
|
||||
{
|
||||
H5HF_add_ud1_t udata; /* User data for free space manager 'add' */
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
|
||||
FUNC_ENTER_NOAPI_NOINIT(H5HF_space_return)
|
||||
|
||||
/*
|
||||
* Check arguments.
|
||||
*/
|
||||
HDassert(hdr);
|
||||
HDassert(node);
|
||||
|
||||
/* Check if the free space for the heap has been initialized */
|
||||
if(!hdr->fspace_open)
|
||||
if(H5HF_space_start(hdr, dxpl_id) < 0)
|
||||
HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't initialize heap free space")
|
||||
|
||||
/* Construct user data */
|
||||
udata.hdr = hdr;
|
||||
udata.dxpl_id = dxpl_id;
|
||||
udata.dblock = NULL;
|
||||
|
||||
/* Add to the free space for the heap */
|
||||
if(H5FS_add(hdr->f, dxpl_id, hdr->fspace, (H5FS_section_info_t *)node, H5FS_ADD_RETURNED_SPACE, &udata) < 0)
|
||||
HGOTO_ERROR(H5E_HEAP, H5E_CANTINSERT, FAIL, "can't add section to heap free space")
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5HF_space_return() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5HF_space_close
|
||||
|
@ -84,7 +84,7 @@
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
herr_t
|
||||
H5HF_get_cparam_test(H5HF_t *fh, H5HF_create_t *cparam)
|
||||
H5HF_get_cparam_test(const H5HF_t *fh, H5HF_create_t *cparam)
|
||||
{
|
||||
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_get_cparam_test)
|
||||
|
||||
@ -100,6 +100,68 @@ H5HF_get_cparam_test(H5HF_t *fh, H5HF_create_t *cparam)
|
||||
FUNC_LEAVE_NOAPI(SUCCEED)
|
||||
} /* H5HF_get_cparam_test() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5HF_get_dblock_overhead
|
||||
*
|
||||
* Purpose: Retrieve the size of direct block overhead
|
||||
*
|
||||
* Return: Success: Size of direct block overhead
|
||||
*
|
||||
* Failure: 0
|
||||
*
|
||||
* Programmer: Quincey Koziol
|
||||
* Tuesday, May 9, 2006
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
size_t
|
||||
H5HF_get_dblock_overhead(const H5HF_t *fh)
|
||||
{
|
||||
size_t ret_value; /* Return value */
|
||||
|
||||
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_get_dblock_overhead)
|
||||
|
||||
/* Check arguments. */
|
||||
HDassert(fh);
|
||||
|
||||
/* Return direct block overhead */
|
||||
ret_value = H5HF_MAN_ABS_DIRECT_OVERHEAD(fh->hdr);
|
||||
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* H5HF_get_dblock_overhead() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5HF_get_dblock_size_test
|
||||
*
|
||||
* Purpose: Retrieve the size of a direct block for a given row
|
||||
*
|
||||
* Return: Success: Size of direct block
|
||||
*
|
||||
* Failure: 0
|
||||
*
|
||||
* Programmer: Quincey Koziol
|
||||
* Monday, May 15, 2006
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
hsize_t
|
||||
H5HF_get_dblock_size_test(const H5HF_t *fh, unsigned row)
|
||||
{
|
||||
hsize_t ret_value; /* Return value */
|
||||
|
||||
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_get_dblock_size_test)
|
||||
|
||||
/* Check arguments. */
|
||||
HDassert(fh);
|
||||
|
||||
/* Return direct block free space */
|
||||
ret_value = fh->hdr->man_dtable.row_block_size[row];
|
||||
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* H5HF_get_dblock_size_test() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5HF_get_dblock_free_test
|
||||
@ -117,7 +179,7 @@ H5HF_get_cparam_test(H5HF_t *fh, H5HF_create_t *cparam)
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
hsize_t
|
||||
H5HF_get_dblock_free_test(H5HF_t *fh, unsigned row)
|
||||
H5HF_get_dblock_free_test(const H5HF_t *fh, unsigned row)
|
||||
{
|
||||
hsize_t ret_value; /* Return value */
|
||||
|
||||
@ -134,32 +196,35 @@ H5HF_get_dblock_free_test(H5HF_t *fh, unsigned row)
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5HF_get_dblock_overhead
|
||||
* Function: H5HF_get_id_off_test
|
||||
*
|
||||
* Purpose: Retrieve the size of direct block overhead
|
||||
* Purpose: Retrieve the offset for a heap ID
|
||||
*
|
||||
* Return: Success: Size of direct block overhead
|
||||
* Return: Success: non-negative
|
||||
*
|
||||
* Failure: 0
|
||||
* Failure: negative
|
||||
*
|
||||
* Programmer: Quincey Koziol
|
||||
* Tuesday, May 9, 2006
|
||||
* Monday, May 15, 2006
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
size_t
|
||||
H5HF_get_dblock_overhead(H5HF_t *fh)
|
||||
herr_t
|
||||
H5HF_get_id_off_test(const H5HF_t *fh, const void *_id, hsize_t *obj_off)
|
||||
{
|
||||
size_t ret_value; /* Return value */
|
||||
const uint8_t *id = (const uint8_t *)_id; /* Object ID */
|
||||
|
||||
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_get_dblock_overhead)
|
||||
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_get_id_off_test)
|
||||
|
||||
/* Check arguments. */
|
||||
HDassert(fh);
|
||||
HDassert(fh->hdr);
|
||||
HDassert(id);
|
||||
HDassert(obj_off);
|
||||
|
||||
/* Return direct block overhead */
|
||||
ret_value = H5HF_MAN_ABS_DIRECT_OVERHEAD(fh->hdr);
|
||||
/* Get the offset for a heap ID */
|
||||
UINT64DECODE_VAR(id, *obj_off, fh->hdr->heap_off_size); \
|
||||
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* H5HF_get_dblock_overhead() */
|
||||
FUNC_LEAVE_NOAPI(SUCCEED)
|
||||
} /* H5HF_get_id_off_test() */
|
||||
|
||||
|
@ -70,7 +70,7 @@ MAJOR, H5E_TST, Ternary Search Trees
|
||||
MAJOR, H5E_RS, Reference Counted Strings
|
||||
MAJOR, H5E_ERROR, Error API
|
||||
MAJOR, H5E_SLIST, Skip Lists
|
||||
MAJOR, H5E_FSPACE, File Free Space
|
||||
MAJOR, H5E_FSPACE, Free Space Manager
|
||||
MAJOR, H5E_NONE_MAJOR, No error
|
||||
|
||||
# Sections (for grouping minor errors)
|
||||
@ -89,6 +89,7 @@ SECTION, DSPACE, Dataspace errors
|
||||
SECTION, PLIST, Property list errors
|
||||
SECTION, MPI, Parallel MPI errors
|
||||
SECTION, HEAP, Heap errors
|
||||
SECTION, FSPACE, Free space errors
|
||||
SECTION, PIPELINE, I/O pipeline errors
|
||||
SECTION, SYSTEM, System level errors
|
||||
SECTION, NONE, No error
|
||||
@ -172,6 +173,7 @@ MINOR, BTREE, H5E_CANTSWAP, Unable to swap records
|
||||
MINOR, BTREE, H5E_CANTINSERT, Unable to insert object
|
||||
MINOR, BTREE, H5E_CANTLIST, Unable to list node
|
||||
MINOR, BTREE, H5E_CANTMODIFY, Unable to modify record
|
||||
MINOR, BTREE, H5E_CANTREMOVE, Unable to remove object
|
||||
|
||||
# Object header related errors
|
||||
MINOR, OHDR, H5E_LINKCOUNT, Bad object header link count
|
||||
@ -217,6 +219,11 @@ MINOR, HEAP, H5E_CANTRESTORE, Can't restore condition
|
||||
MINOR, HEAP, H5E_CANTCOMPUTE, Can't compute value
|
||||
MINOR, HEAP, H5E_CANTEXTEND, Can't extend heap's space
|
||||
|
||||
# Free space manager errors
|
||||
MINOR, FSPACE, H5E_CANTMERGE, Can't merge objects
|
||||
MINOR, FSPACE, H5E_CANTREVIVE, Can't revive object
|
||||
MINOR, FSPACE, H5E_CANTSHRINK, Can't shrink container
|
||||
|
||||
# I/O pipeline errors
|
||||
MINOR, PIPELINE, H5E_NOFILTER, Requested filter is not available
|
||||
MINOR, PIPELINE, H5E_CALLBACK, Callback failed
|
||||
|
1059
test/fheap.c
1059
test/fheap.c
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user