[svn-r17553] Description:

Bring general fixes/improvements from file_free_space branch back to
trunk.

Tested on:
        FreeBSD/32 6.3 (duty) in debug mode
        FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
        Linux/32 2.6 (jam) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
                                in debug mode
        Linux/64-amd64 2.6 (smirom) w/Intel compilers w/default API=1.6.x,
                                w/C++ & FORTRAN, in production mode
        Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
                                w/szip filter, in production mode
        Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
                                in production mode
        Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
        Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
        Mac OS X/32 10.5.8 (amazon) in debug mode
        Mac OS X/32 10.5.8 (amazon) w/C++ & FORTRAN, w/threadsafe,
                                in production mode
This commit is contained in:
Quincey Koziol 2009-09-29 15:08:01 -05:00
parent 531f086cbc
commit ee383d182f
21 changed files with 329 additions and 202 deletions

View File

@ -50,7 +50,6 @@
/* Layout operation callbacks */
static herr_t H5D_efl_construct(H5F_t *f, H5D_t *dset);
static hbool_t H5D_efl_is_space_alloc(const H5O_storage_t *storage);
static herr_t H5D_efl_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space,
H5D_chunk_map_t *cm);
@ -181,7 +180,7 @@ done:
*
*-------------------------------------------------------------------------
*/
static hbool_t
hbool_t
H5D_efl_is_space_alloc(const H5O_storage_t UNUSED *storage)
{
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_efl_is_space_alloc)
@ -556,3 +555,37 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D_efl_writevv() */
/*-------------------------------------------------------------------------
* Function: H5D_efl_bh_size
*
* Purpose: Retrieve the amount of heap storage used for External File
* List message
*
* Return: Success: Non-negative
* Failure: negative
*
* Programmer: Vailin Choi; August 2009
*
*-------------------------------------------------------------------------
*/
herr_t
H5D_efl_bh_info(H5F_t *f, hid_t dxpl_id, H5O_efl_t *efl, hsize_t *heap_size)
{
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5D_efl_bh_info, FAIL)
/* Check args */
HDassert(f);
HDassert(efl);
HDassert(H5F_addr_defined(efl->heap_addr));
HDassert(heap_size);
/* Get the size of the local heap for EFL's file list */
if(H5HL_heapsize(f, dxpl_id, efl->heap_addr, heap_size) < 0)
HGOTO_ERROR(H5E_EFL, H5E_CANTINIT, FAIL, "unable to retrieve local heap info")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D_chunk_bh_info() */

View File

@ -53,6 +53,8 @@ static hid_t H5O_dset_open(const H5G_loc_t *obj_loc, hid_t lapl_id,
static void *H5O_dset_create(H5F_t *f, void *_crt_info, H5G_loc_t *obj_loc,
hid_t dxpl_id);
static H5O_loc_t *H5O_dset_get_oloc(hid_t obj_id);
static herr_t H5O_dset_bh_info(H5F_t *f, hid_t dxpl_id, H5O_t *oh,
H5_ih_info_t *bh_info);
/*********************/
@ -78,7 +80,8 @@ const H5O_obj_class_t H5O_OBJ_DATASET[1] = {{
H5O_dset_isa, /* "isa" message */
H5O_dset_open, /* open an object of this class */
H5O_dset_create, /* create an object of this class */
H5O_dset_get_oloc /* get an object header location for an object */
H5O_dset_get_oloc, /* get an object header location for an object */
H5O_dset_bh_info /* get the index & heap info for an object */
}};
/* Declare a free list to manage the H5D_copy_file_ud_t struct */
@ -358,13 +361,14 @@ done:
*
*-------------------------------------------------------------------------
*/
herr_t
static herr_t
H5O_dset_bh_info(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5_ih_info_t *bh_info)
{
H5O_layout_t layout; /* Data storage layout message */
herr_t ret_value = SUCCEED; /* Return value */
htri_t exists; /* Flag if header message of interest exists */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5O_dset_bh_info, FAIL)
FUNC_ENTER_NOAPI_NOINIT(H5O_dset_bh_info)
/* Sanity check */
HDassert(f);
@ -378,7 +382,6 @@ H5O_dset_bh_info(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5_ih_info_t *bh_info)
/* Check for chunked dataset storage */
if(layout.type == H5D_CHUNKED && H5D_chunk_is_space_alloc(&layout.storage)) {
H5O_pline_t pline; /* I/O pipeline message */
htri_t exists; /* Flag if header message of interest exists */
/* Check for I/O pipeline message */
if((exists = H5O_msg_exists_oh(oh, H5O_PLINE_ID)) < 0)
@ -394,6 +397,25 @@ H5O_dset_bh_info(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5_ih_info_t *bh_info)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't determine chunked dataset btree info")
} /* end if */
/* Check for External File List message in the object header */
if((exists = H5O_msg_exists_oh(oh, H5O_EFL_ID)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "unable to check for EFL message")
if(exists && H5D_efl_is_space_alloc(&layout)) {
H5O_efl_t efl; /* External File List message */
/* Start with clean EFL info */
HDmemset(&efl, 0, sizeof(efl));
/* Get External File List message from the object header */
if(NULL == H5O_msg_read_oh(f, dxpl_id, oh, H5O_EFL_ID, &efl))
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't find EFL message")
/* Get size of local heap for EFL message's file list */
if(H5D_efl_bh_info(f, dxpl_id, &efl, &(bh_info->heap_size)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't determine EFL heap info")
} /* end if */
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_dset_bh_info() */

View File

@ -633,6 +633,11 @@ H5_DLL herr_t H5D_compact_copy(H5F_t *f_src, H5O_storage_compact_t *storage_src,
H5F_t *f_dst, H5O_storage_compact_t *storage_dst, H5T_t *src_dtype,
H5O_copy_t *cpy_info, hid_t dxpl_id);
/* Functions that operate on EFL (External File List)*/
H5_DLL hbool_t H5D_efl_is_space_alloc(const H5O_storage_t *storage);
H5_DLL herr_t H5D_efl_bh_info(H5F_t *f, hid_t dxpl_id, H5O_efl_t *efl,
hsize_t *heap_size);
/* Functions that perform fill value operations on datasets */
H5_DLL herr_t H5D_fill(const void *fill, const H5T_t *fill_type, void *buf,
const H5T_t *buf_type, const H5S_t *space, hid_t dxpl_id);

View File

@ -1084,7 +1084,7 @@ H5F_dest(H5F_t *f, hid_t dxpl_id)
HDONE_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "can't close property list")
/* Only truncate the file on an orderly close, with write-access */
if(f->closing && (H5F_ACC_RDWR & f->shared->flags)) {
if(f->closing && (H5F_ACC_RDWR & H5F_INTENT(f))) {
/* Truncate the file to the current allocated size */
if(H5FD_truncate(f->shared->lf, dxpl_id, (unsigned)TRUE) < 0)
/* Push error, but keep going*/
@ -1616,7 +1616,7 @@ H5Fflush(hid_t object_id, H5F_scope_t scope)
* calling H5Fflush() with the read-only handle, still causes data
* to be flushed.
*/
if(H5F_ACC_RDWR & f->shared->flags) {
if(H5F_ACC_RDWR & H5F_INTENT(f)) {
/* Flush other files, depending on scope */
if(H5F_SCOPE_GLOBAL == scope) {
/* Call the flush routine for mounted file hierarchies */
@ -1894,7 +1894,7 @@ H5F_try_close(H5F_t *f)
* copy of the cache needs to be clean.
* Only try to flush the file if it was opened with write access.
*/
if(f->intent&H5F_ACC_RDWR) {
if(f->intent & H5F_ACC_RDWR) {
/* Flush all caches */
if(H5F_flush(f, H5AC_dxpl_id) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush cache")

View File

@ -670,8 +670,8 @@ H5F_super_size(H5F_t *f, hid_t dxpl_id, hsize_t *super_size, hsize_t *super_ext_
/* Set the superblock extension size */
if(super_ext_size) {
if(H5F_addr_defined(f->shared->sblock->ext_addr)) {
H5O_loc_t ext_loc; /* "Object location" for superblock extension */
H5O_info_t oinfo; /* Object info for superblock extension */
H5O_loc_t ext_loc; /* "Object location" for superblock extension */
H5O_hdr_info_t hdr_info; /* Object info for superblock extension */
/* Set up "fake" object location for superblock extension */
H5O_loc_reset(&ext_loc);
@ -679,11 +679,11 @@ H5F_super_size(H5F_t *f, hid_t dxpl_id, hsize_t *super_size, hsize_t *super_ext_
ext_loc.addr = f->shared->sblock->ext_addr;
/* Get object header info for superblock extension */
if(H5O_get_info(&ext_loc, dxpl_id, FALSE, &oinfo) < 0)
if(H5O_get_hdr_info(&ext_loc, dxpl_id, &hdr_info) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to retrieve superblock extension info")
/* Set the superblock extension size */
*super_ext_size = oinfo.hdr.space.total;
*super_ext_size = hdr_info.space.total;
} /* end if */
else
/* Set the superblock extension size to zero */

View File

@ -573,7 +573,6 @@ H5F_sblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *udata1
ret_value = sblock;
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5F_sblock_load() */

View File

@ -51,6 +51,8 @@ static hid_t H5O_group_open(const H5G_loc_t *obj_loc, hid_t lapl_id,
static void *H5O_group_create(H5F_t *f, void *_crt_info, H5G_loc_t *obj_loc,
hid_t dxpl_id);
static H5O_loc_t *H5O_group_get_oloc(hid_t obj_id);
static herr_t H5O_group_bh_info(H5F_t *f, hid_t dxpl_id, H5O_t *oh,
H5_ih_info_t *bh_info);
/*********************/
@ -76,7 +78,8 @@ const H5O_obj_class_t H5O_OBJ_GROUP[1] = {{
H5O_group_isa, /* "isa" message */
H5O_group_open, /* open an object of this class */
H5O_group_create, /* create an object of this class */
H5O_group_get_oloc /* get an object header location for an object */
H5O_group_get_oloc, /* get an object header location for an object */
H5O_group_bh_info /* get the index & heap info for an object */
}};
@ -257,14 +260,14 @@ done:
*
*-------------------------------------------------------------------------
*/
herr_t
static herr_t
H5O_group_bh_info(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5_ih_info_t *bh_info)
{
htri_t exists; /* Flag if header message of interest exists */
H5HF_t *fheap = NULL; /* Fractal heap handle */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5O_group_bh_info, FAIL)
FUNC_ENTER_NOAPI_NOINIT(H5O_group_bh_info)
/* Sanity check */
HDassert(f);

244
src/H5O.c
View File

@ -84,6 +84,7 @@ static herr_t H5O_obj_type_real(H5O_t *oh, H5O_type_t *obj_type);
static herr_t H5O_visit(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
H5_iter_order_t order, H5O_iterate_t op, void *op_data, hid_t lapl_id,
hid_t dxpl_id);
static herr_t H5O_get_hdr_info_real(const H5O_t *oh, H5O_hdr_info_t *hdr);
/*********************/
@ -127,18 +128,6 @@ const H5O_msg_class_t *const H5O_msg_class_g[] = {
H5O_MSG_UNKNOWN, /*0x0017 Placeholder for unknown message */
};
/* Header object ID to class mapping */
/*
* Initialize the object class info table. Begin with the most general types
* and end with the most specific. For instance, any object that has a
* datatype message is a datatype but only some of them are datasets.
*/
const H5O_obj_class_t *const H5O_obj_class_g[] = {
H5O_OBJ_DATATYPE, /* Datatype object (H5O_TYPE_NAMED_DATATYPE - 2) */
H5O_OBJ_DATASET, /* Dataset object (H5O_TYPE_DATASET - 1) */
H5O_OBJ_GROUP, /* Group object (H5O_TYPE_GROUP - 0) */
};
/* Declare a free list to manage the H5O_t struct */
H5FL_DEFINE(H5O_t);
@ -167,6 +156,18 @@ H5FL_EXTERN(H5_obj_t);
/* Local Variables */
/*******************/
/* Header object ID to class mapping */
/*
* Initialize the object class info table. Begin with the most general types
* and end with the most specific. For instance, any object that has a
* datatype message is a datatype but only some of them are datasets.
*/
static const H5O_obj_class_t *const H5O_obj_class_g[] = {
H5O_OBJ_DATATYPE, /* Datatype object (H5O_TYPE_NAMED_DATATYPE - 2) */
H5O_OBJ_DATASET, /* Dataset object (H5O_TYPE_DATASET - 1) */
H5O_OBJ_GROUP, /* Group object (H5O_TYPE_GROUP - 0) */
};
/*-------------------------------------------------------------------------
@ -2294,6 +2295,131 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_loc_free() */
/*-------------------------------------------------------------------------
* Function: H5O_get_hdr_info
*
* Purpose: Retrieve the object header information for an object
*
* Return: Success: Non-negative
* Failure: Negative
*
* Programmer: Quincey Koziol
* September 22 2009
*
*-------------------------------------------------------------------------
*/
herr_t
H5O_get_hdr_info(const H5O_loc_t *oloc, hid_t dxpl_id, H5O_hdr_info_t *hdr)
{
H5O_t *oh = NULL; /* Object header */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5O_get_hdr_info, FAIL)
/* Check args */
HDassert(oloc);
HDassert(hdr);
/* Reset the object header info structure */
HDmemset(hdr, 0, sizeof(*hdr));
/* Get the object header */
if(NULL == (oh = (H5O_t *)H5AC_protect(oloc->file, dxpl_id, H5AC_OHDR, oloc->addr, NULL, NULL, H5AC_READ)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header")
/* Get the information for the object header */
if(H5O_get_hdr_info_real(oh, hdr) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve object header info")
done:
if(oh && H5AC_unprotect(oloc->file, dxpl_id, H5AC_OHDR, oloc->addr, oh, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_get_hdr_info() */
/*-------------------------------------------------------------------------
* Function: H5O_get_hdr_info_real
*
* Purpose: Internal routine to retrieve the object header information for an object
*
* Return: Success: Non-negative
* Failure: Negative
*
* Programmer: Quincey Koziol
* September 22 2009
*
*-------------------------------------------------------------------------
*/
static herr_t
H5O_get_hdr_info_real(const H5O_t *oh, H5O_hdr_info_t *hdr)
{
const H5O_mesg_t *curr_msg; /* Pointer to current message being operated on */
const H5O_chunk_t *curr_chunk; /* Pointer to current message being operated on */
unsigned u; /* Local index variable */
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_get_hdr_info_real)
/* Check args */
HDassert(oh);
HDassert(hdr);
/* Set the version for the object header */
hdr->version = oh->version;
/* Set the number of messages & chunks */
hdr->nmesgs = oh->nmesgs;
hdr->nchunks = oh->nchunks;
/* Set the status flags */
hdr->flags = oh->flags;
/* Iterate over all the messages, accumulating message size & type information */
hdr->space.meta = H5O_SIZEOF_HDR(oh) + (H5O_SIZEOF_CHKHDR_OH(oh) * (oh->nchunks - 1));
hdr->space.mesg = 0;
hdr->space.free = 0;
hdr->mesg.present = 0;
hdr->mesg.shared = 0;
for(u = 0, curr_msg = &oh->mesg[0]; u < oh->nmesgs; u++, curr_msg++) {
uint64_t type_flag; /* Flag for message type */
/* Accumulate space usage information, based on the type of message */
if(H5O_NULL_ID == curr_msg->type->id)
hdr->space.free += H5O_SIZEOF_MSGHDR_OH(oh) + curr_msg->raw_size;
else if(H5O_CONT_ID == curr_msg->type->id)
hdr->space.meta += H5O_SIZEOF_MSGHDR_OH(oh) + curr_msg->raw_size;
else {
hdr->space.meta += H5O_SIZEOF_MSGHDR_OH(oh);
hdr->space.mesg += curr_msg->raw_size;
} /* end else */
/* Set flag to indicate presence of message type */
type_flag = ((uint64_t)1) << curr_msg->type->id;
hdr->mesg.present |= type_flag;
/* Set flag if the message is shared in some way */
if(curr_msg->flags & H5O_MSG_FLAG_SHARED) \
hdr->mesg.shared |= type_flag;
} /* end for */
/* Iterate over all the chunks, adding any gaps to the free space */
hdr->space.total = 0;
for(u = 0, curr_chunk = &oh->chunk[0]; u < oh->nchunks; u++, curr_chunk++) {
/* Accumulate the size of the header on disk */
hdr->space.total += curr_chunk->size;
/* If the chunk has a gap, add it to the free space */
hdr->space.free += curr_chunk->gap;
} /* end for */
/* Sanity check that all the bytes are accounted for */
HDassert(hdr->space.total == (hdr->space.free + hdr->space.meta + hdr->space.mesg));
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5O_get_hdr_info_real() */
/*-------------------------------------------------------------------------
* Function: H5O_get_info
@ -2309,12 +2435,11 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
H5O_get_info(H5O_loc_t *oloc, hid_t dxpl_id, hbool_t want_ih_info, H5O_info_t *oinfo)
H5O_get_info(const H5O_loc_t *oloc, hid_t dxpl_id, hbool_t want_ih_info,
H5O_info_t *oinfo)
{
const H5O_obj_class_t *obj_class; /* Class of object for header */
H5O_t *oh = NULL; /* Object header */
H5O_chunk_t *curr_chunk; /* Pointer to current message being operated on */
H5O_mesg_t *curr_msg; /* Pointer to current message being operated on */
unsigned u; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5O_get_info, FAIL)
@ -2336,20 +2461,12 @@ H5O_get_info(H5O_loc_t *oloc, hid_t dxpl_id, hbool_t want_ih_info, H5O_info_t *o
/* Set the object's address */
oinfo->addr = oloc->addr;
/* Retrieve the type of the object */
if(H5O_obj_type_real(oh, &oinfo->type) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to determine object type")
/* Get class for object */
if(NULL == (obj_class = H5O_obj_class_real(oh)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to determine object class")
/* Retrieve btree and heap storage info, if requested */
if(want_ih_info) {
if(oinfo->type == H5O_TYPE_GROUP) {
if(H5O_group_bh_info(oloc->file, dxpl_id, oh, &(oinfo->meta_size.obj)/*out*/) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve group btree & heap info")
} else if(oinfo->type == H5O_TYPE_DATASET) {
if(H5O_dset_bh_info(oloc->file, dxpl_id, oh, &(oinfo->meta_size.obj)/*out*/) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve chunked dataset btree info")
}
} /* end if */
/* Retrieve the type of the object */
oinfo->type = obj_class->type;
/* Set the object's reference count */
oinfo->rc = oh->nlink;
@ -2395,67 +2512,30 @@ H5O_get_info(H5O_loc_t *oloc, hid_t dxpl_id, hbool_t want_ih_info, H5O_info_t *o
} /* end else */
} /* end else */
/* Set the version for the object header */
oinfo->hdr.version = oh->version;
/* Set the number of messages & chunks */
oinfo->hdr.nmesgs = oh->nmesgs;
oinfo->hdr.nchunks = oh->nchunks;
/* Set the status flags */
oinfo->hdr.flags = oh->flags;
/* Iterate over all the messages, accumulating message size & type information */
oinfo->hdr.space.meta = H5O_SIZEOF_HDR(oh) + (H5O_SIZEOF_CHKHDR_OH(oh) * (oh->nchunks - 1));
oinfo->hdr.space.mesg = 0;
oinfo->hdr.space.free = 0;
oinfo->hdr.mesg.present = 0;
oinfo->hdr.mesg.shared = 0;
for(u = 0, curr_msg = &oh->mesg[0]; u < oh->nmesgs; u++, curr_msg++) {
uint64_t type_flag; /* Flag for message type */
/* Accumulate space usage information, based on the type of message */
if(H5O_NULL_ID == curr_msg->type->id)
oinfo->hdr.space.free += H5O_SIZEOF_MSGHDR_OH(oh) + curr_msg->raw_size;
else if(H5O_CONT_ID == curr_msg->type->id)
oinfo->hdr.space.meta += H5O_SIZEOF_MSGHDR_OH(oh) + curr_msg->raw_size;
else {
oinfo->hdr.space.meta += H5O_SIZEOF_MSGHDR_OH(oh);
oinfo->hdr.space.mesg += curr_msg->raw_size;
} /* end else */
/* Set flag to indicate presence of message type */
type_flag = ((uint64_t)1) << curr_msg->type->id;
oinfo->hdr.mesg.present |= type_flag;
/* Set flag if the message is shared in some way */
if(curr_msg->flags & H5O_MSG_FLAG_SHARED) \
oinfo->hdr.mesg.shared |= type_flag;
} /* end for */
/* Get the information for the object header */
if(H5O_get_hdr_info_real(oh, &oinfo->hdr) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve object header info")
/* Retrieve # of attributes */
if(H5O_attr_count_real(oloc->file, dxpl_id, oh, &oinfo->num_attrs) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't retrieve attribute count")
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve attribute count")
/* Get B-tree & heap metadata storage size, if requested */
if(want_ih_info) {
if((oinfo->num_attrs > 0) && (H5O_attr_bh_info(oloc->file, dxpl_id, oh, &oinfo->meta_size.attr/*out*/) < 0))
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't retrieve attribute btree & heap info")
/* Check for 'bh_info' callback for this type of object */
if(obj_class->bh_info) {
/* Call the object's class 'bh_info' routine */
if((obj_class->bh_info)(oloc->file, dxpl_id, oh, &(oinfo->meta_size.obj) /* out */) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve object's btree & heap info")
} /* end if */
/* Get B-tree & heap info for any attributes */
if(oinfo->num_attrs > 0) {
if(H5O_attr_bh_info(oloc->file, dxpl_id, oh, &oinfo->meta_size.attr/*out*/) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve attribute btree & heap info")
} /* end if */
} /* end if */
/* Iterate over all the chunks, adding any gaps to the free space */
oinfo->hdr.space.total = 0;
for(u = 0, curr_chunk = &oh->chunk[0]; u < oh->nchunks; u++, curr_chunk++) {
/* Accumulate the size of the header on disk */
oinfo->hdr.space.total += curr_chunk->size;
/* If the chunk has a gap, add it to the free space */
oinfo->hdr.space.free += curr_chunk->gap;
} /* end for */
/* Sanity check that all the bytes are accounted for */
HDassert(oinfo->hdr.space.total == (oinfo->hdr.space.free + oinfo->hdr.space.meta + oinfo->hdr.space.mesg));
done:
if(oh && H5AC_unprotect(oloc->file, dxpl_id, H5AC_OHDR, oloc->addr, oh, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header")

View File

@ -320,6 +320,7 @@ typedef struct H5O_obj_class_t {
hid_t (*open)(const H5G_loc_t *, hid_t, hid_t, hbool_t ); /*open an object of this class */
void *(*create)(H5F_t *, void *, H5G_loc_t *, hid_t ); /*create an object of this class */
H5O_loc_t *(*get_oloc)(hid_t ); /*get the object header location for an object */
herr_t (*bh_info)(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5_ih_info_t *bh_info); /*get the index & heap info for an object */
} H5O_obj_class_t;
/* Node in skip list to map addresses from one file to another during object header copy */
@ -337,9 +338,6 @@ H5_DLLVAR const H5AC_class_t H5AC_OHDR[1];
/* Header message ID to class mapping */
H5_DLLVAR const H5O_msg_class_t *const H5O_msg_class_g[H5O_MSG_TYPES];
/* Header object ID to class mapping */
H5_DLLVAR const H5O_obj_class_t *const H5O_obj_class_g[3];
/* Declare external the free list for H5O_t's */
H5FL_EXTERN(H5O_t);
@ -497,10 +495,6 @@ H5_DLL herr_t H5O_msg_iterate_real(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *t
const H5O_mesg_operator_t *op, void *op_data, hid_t dxpl_id);
/* Collect storage info for btree and heap */
H5_DLL herr_t H5O_group_bh_info(H5F_t *f, hid_t dxpl_id, H5O_t *oh,
H5_ih_info_t *bh_info);
H5_DLL herr_t H5O_dset_bh_info(H5F_t *f, hid_t dxpl_id, H5O_t *oh,
H5_ih_info_t *bh_info);
H5_DLL herr_t H5O_attr_bh_info(H5F_t *f, hid_t dxpl_id, H5O_t *oh,
H5_ih_info_t *bh_info);

View File

@ -602,7 +602,8 @@ H5_DLL herr_t H5O_touch_oh(H5F_t *f, hid_t dxpl_id, H5O_t *oh,
H5_DLL herr_t H5O_bogus_oh(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned mesg_flags);
#endif /* H5O_ENABLE_BOGUS */
H5_DLL herr_t H5O_delete(H5F_t *f, hid_t dxpl_id, haddr_t addr);
H5_DLL herr_t H5O_get_info(H5O_loc_t *oloc, hid_t dxpl_id, hbool_t want_ih_info,
H5_DLL herr_t H5O_get_hdr_info(const H5O_loc_t *oloc, hid_t dxpl_id, H5O_hdr_info_t *hdr);
H5_DLL herr_t H5O_get_info(const H5O_loc_t *oloc, hid_t dxpl_id, hbool_t want_ih_info,
H5O_info_t *oinfo);
H5_DLL herr_t H5O_obj_type(const H5O_loc_t *loc, H5O_type_t *obj_type, hid_t dxpl_id);
H5_DLL herr_t H5O_get_create_plist(const H5O_loc_t *loc, hid_t dxpl_id, struct H5P_genplist_t *oc_plist);

View File

@ -87,6 +87,24 @@ typedef enum H5O_type_t {
H5O_TYPE_NTYPES /* Number of different object types (must be last!) */
} H5O_type_t;
/* Information struct for object header metadata (for H5Oget_info/H5Oget_info_by_name/H5Oget_info_by_idx) */
typedef struct H5O_hdr_info_t {
unsigned version; /* Version number of header format in file */
unsigned nmesgs; /* Number of object header messages */
unsigned nchunks; /* Number of object header chunks */
unsigned flags; /* Object header status flags */
struct {
hsize_t total; /* Total space for storing object header in file */
hsize_t meta; /* Space within header for object header metadata information */
hsize_t mesg; /* Space within header for actual message information */
hsize_t free; /* Free space within object header */
} space;
struct {
uint64_t present; /* Flags to indicate presence of message type in header */
uint64_t shared; /* Flags to indicate message type is shared in header */
} mesg;
} H5O_hdr_info_t;
/* Information struct for object (for H5Oget_info/H5Oget_info_by_name/H5Oget_info_by_idx) */
typedef struct H5O_info_t {
unsigned long fileno; /* File number that object is located in */
@ -98,22 +116,7 @@ typedef struct H5O_info_t {
time_t ctime; /* Change time */
time_t btime; /* Birth time */
hsize_t num_attrs; /* # of attributes attached to object */
struct {
unsigned version; /* Version number of header format in file */
unsigned nmesgs; /* Number of object header messages */
unsigned nchunks; /* Number of object header chunks */
unsigned flags; /* Object header status flags */
struct {
hsize_t total; /* Total space for storing object header in file */
hsize_t meta; /* Space within header for object header metadata information */
hsize_t mesg; /* Space within header for actual message information */
hsize_t free; /* Free space within object header */
} space;
struct {
uint64_t present; /* Flags to indicate presence of message type in header */
uint64_t shared; /* Flags to indicate message type is shared in header */
} mesg;
} hdr;
H5O_hdr_info_t hdr; /* Object header information */
/* Extra metadata storage for obj & attributes */
struct {
H5_ih_info_t obj; /* v1/v2 B-tree & local/fractal heap for groups, B-tree for chunked datasets */

View File

@ -76,7 +76,8 @@ const H5O_obj_class_t H5O_OBJ_DATATYPE[1] = {{
H5O_dtype_isa, /* "isa" */
H5O_dtype_open, /* open an object of this class */
H5O_dtype_create, /* create an object of this class */
H5O_dtype_get_oloc /* get an object header location for an object */
H5O_dtype_get_oloc, /* get an object header location for an object */
NULL /* get the index & heap info for an object */
}};

View File

@ -57,7 +57,7 @@ test_cont(char *filename, hid_t fapl)
{
hid_t file=-1;
H5F_t *f = NULL;
H5O_info_t oinfo;
H5O_hdr_info_t hdr_info;
H5O_loc_t oh_locA, oh_locB;
time_t time_new;
const char *short_name = "T";
@ -105,18 +105,18 @@ test_cont(char *filename, hid_t fapl)
if(H5AC_expunge_entry(f, H5P_DATASET_XFER_DEFAULT, H5AC_OHDR, oh_locA.addr, H5AC__NO_FLAGS_SET) < 0)
FAIL_STACK_ERROR
if(H5O_get_info(&oh_locA, H5P_DATASET_XFER_DEFAULT, FALSE, &oinfo) < 0)
if(H5O_get_hdr_info(&oh_locA, H5P_DATASET_XFER_DEFAULT, &hdr_info) < 0)
FAIL_STACK_ERROR
nchunks = oinfo.hdr.nchunks;
nchunks = hdr_info.nchunks;
/* remove the 1st H5O_NAME_ID message */
if(H5O_msg_remove(&oh_locA, H5O_NAME_ID, 0, FALSE, H5P_DATASET_XFER_DEFAULT) < 0)
FAIL_STACK_ERROR
if(H5O_get_info(&oh_locA, H5P_DATASET_XFER_DEFAULT, FALSE, &oinfo) < 0)
if(H5O_get_hdr_info(&oh_locA, H5P_DATASET_XFER_DEFAULT, &hdr_info) < 0)
FAIL_STACK_ERROR
if (oinfo.hdr.nchunks >= nchunks)
if(hdr_info.nchunks >= nchunks)
TEST_ERROR
if(H5O_close(&oh_locA) < 0)
@ -164,7 +164,7 @@ main(void)
hid_t dset=-1;
H5F_t *f=NULL;
char filename[1024];
H5O_info_t oinfo; /* Object info */
H5O_hdr_info_t hdr_info; /* Object info */
H5O_loc_t oh_loc;
time_t time_new, ro;
int i;
@ -240,9 +240,9 @@ main(void)
TEST_ERROR
/* Make certain that chunk #0 in the object header can be encoded with a 1-byte size */
if(H5O_get_info(&oh_loc, H5P_DATASET_XFER_DEFAULT, FALSE, &oinfo) < 0)
if(H5O_get_hdr_info(&oh_loc, H5P_DATASET_XFER_DEFAULT, &hdr_info) < 0)
FAIL_STACK_ERROR
if(oinfo.hdr.space.total >=256)
if(hdr_info.space.total >=256)
TEST_ERROR
PASSED();
@ -267,9 +267,9 @@ main(void)
FAIL_STACK_ERROR
/* Make certain that chunk #0 in the object header will be encoded with a 2-byte size */
if(H5O_get_info(&oh_loc, H5P_DATASET_XFER_DEFAULT, FALSE, &oinfo) < 0)
if(H5O_get_hdr_info(&oh_loc, H5P_DATASET_XFER_DEFAULT, &hdr_info) < 0)
FAIL_STACK_ERROR
if(oinfo.hdr.space.total < 256)
if(hdr_info.space.total < 256)
TEST_ERROR
PASSED();

View File

@ -183,60 +183,60 @@ static void usage(const char *prog)
printf("\n");
printf(" M - is an integer greater than 1, size of dataset in bytes (default is 1024) \n");
printf(" E - is a filename.\n");
printf(" S - is an integer\n");
printf(" U - is a filename.\n");
printf(" T - is an integer\n");
printf(" A - is an integer greater than zero\n");
printf(" B - is the user block size, any value that is 512 or greater and is\n");
printf(" M - is an integer greater than 1, size of dataset in bytes (default is 1024) \n");
printf(" E - is a filename.\n");
printf(" S - is an integer\n");
printf(" U - is a filename.\n");
printf(" T - is an integer\n");
printf(" A - is an integer greater than zero\n");
printf(" B - is the user block size, any value that is 512 or greater and is\n");
printf(" a power of 2 (1024 default)\n");
printf(" F - is the shared object header message type, any of <dspace|dtype|fill|\n");
printf(" F - is the shared object header message type, any of <dspace|dtype|fill|\n");
printf(" pline|attr>. If F is not specified, S applies to all messages\n");
printf("\n");
printf(" FILT - is a string with the format:\n");
printf(" FILT - is a string with the format:\n");
printf("\n");
printf(" <list of objects>:<name of filter>=<filter parameters>\n");
printf(" <list of objects>:<name of filter>=<filter parameters>\n");
printf("\n");
printf(" <list of objects> is a comma separated list of object names, meaning apply\n");
printf(" compression only to those objects. If no names are specified, the filter\n");
printf(" is applied to all objects\n");
printf(" <name of filter> can be:\n");
printf(" GZIP, to apply the HDF5 GZIP filter (GZIP compression)\n");
printf(" SZIP, to apply the HDF5 SZIP filter (SZIP compression)\n");
printf(" SHUF, to apply the HDF5 shuffle filter\n");
printf(" FLET, to apply the HDF5 checksum filter\n");
printf(" NBIT, to apply the HDF5 NBIT filter (NBIT compression)\n");
printf(" SOFF, to apply the HDF5 Scale/Offset filter\n");
printf(" NONE, to remove all filters\n");
printf(" <filter parameters> is optional filter parameter information\n");
printf(" GZIP=<deflation level> from 1-9\n");
printf(" SZIP=<pixels per block,coding> pixels per block is a even number in\n");
printf(" <list of objects> is a comma separated list of object names, meaning apply\n");
printf(" compression only to those objects. If no names are specified, the filter\n");
printf(" is applied to all objects\n");
printf(" <name of filter> can be:\n");
printf(" GZIP, to apply the HDF5 GZIP filter (GZIP compression)\n");
printf(" SZIP, to apply the HDF5 SZIP filter (SZIP compression)\n");
printf(" SHUF, to apply the HDF5 shuffle filter\n");
printf(" FLET, to apply the HDF5 checksum filter\n");
printf(" NBIT, to apply the HDF5 NBIT filter (NBIT compression)\n");
printf(" SOFF, to apply the HDF5 Scale/Offset filter\n");
printf(" NONE, to remove all filters\n");
printf(" <filter parameters> is optional filter parameter information\n");
printf(" GZIP=<deflation level> from 1-9\n");
printf(" SZIP=<pixels per block,coding> pixels per block is a even number in\n");
printf(" 2-32 and coding method is either EC or NN\n");
printf(" SHUF (no parameter)\n");
printf(" FLET (no parameter)\n");
printf(" NBIT (no parameter)\n");
printf(" SOFF=<scale_factor,scale_type> scale_factor is an integer and scale_type\n");
printf(" SHUF (no parameter)\n");
printf(" FLET (no parameter)\n");
printf(" NBIT (no parameter)\n");
printf(" SOFF=<scale_factor,scale_type> scale_factor is an integer and scale_type\n");
printf(" is either IN or DS\n");
printf(" NONE (no parameter)\n");
printf(" NONE (no parameter)\n");
printf("\n");
printf(" LAYT - is a string with the format:\n");
printf(" LAYT - is a string with the format:\n");
printf("\n");
printf(" <list of objects>:<layout type>=<layout parameters>\n");
printf(" <list of objects>:<layout type>=<layout parameters>\n");
printf("\n");
printf(" <list of objects> is a comma separated list of object names, meaning that\n");
printf(" layout information is supplied for those objects. If no names are\n");
printf(" specified, the layout type is applied to all objects\n");
printf(" <layout type> can be:\n");
printf(" CHUNK, to apply chunking layout\n");
printf(" COMPA, to apply compact layout\n");
printf(" CONTI, to apply continuous layout\n");
printf(" <layout parameters> is optional layout information\n");
printf(" CHUNK=DIM[xDIM...xDIM], the chunk size of each dimension\n");
printf(" COMPA (no parameter)\n");
printf(" CONTI (no parameter)\n");
printf(" <list of objects> is a comma separated list of object names, meaning that\n");
printf(" layout information is supplied for those objects. If no names are\n");
printf(" specified, the layout type is applied to all objects\n");
printf(" <layout type> can be:\n");
printf(" CHUNK, to apply chunking layout\n");
printf(" COMPA, to apply compact layout\n");
printf(" CONTI, to apply continuous layout\n");
printf(" <layout parameters> is optional layout information\n");
printf(" CHUNK=DIM[xDIM...xDIM], the chunk size of each dimension\n");
printf(" COMPA (no parameter)\n");
printf(" CONTI (no parameter)\n");
printf("\n");
printf("Examples of use:\n");
printf("\n");

View File

@ -210,7 +210,7 @@ error:
trav_table_free(travt);
} H5E_END_TRY;
return -1;
}
} /* h5repack_verify() */

View File

@ -79,7 +79,6 @@
#define FNAME_UB "ublock.bin"
const char *H5REPACK_FILENAMES[] = {
"h5repack_big_out",
NULL
@ -178,6 +177,7 @@ int main (void)
*-------------------------------------------------------------------------
*/
/*-------------------------------------------------------------------------
* file with fill values
*-------------------------------------------------------------------------
@ -1472,7 +1472,6 @@ int main (void)
if(h5repack_verify(FNAME8OUT, &pack_options) <= 0)
GOERROR;
/* verify aligment */
{
hsize_t threshold;

View File

@ -88,7 +88,7 @@ typedef struct iter_t {
hsize_t SM_index_storage_size; /* index (btree & list) size for SOHM table (1.8) */
hsize_t SM_heap_storage_size; /* fractal heap size for SOHM table (1.8) */
hsize_t super_ext_size; /* superblock extension size */
hsize_t datasets_btree_storage_size; /* btree size for chunked dataset */
hsize_t datasets_index_storage_size;/* meta size for chunked dataset's indexing type */
unsigned long nexternal; /* Number of external files for a dataset */
int local; /* Flag to indicate iteration over the object*/
} iter_t;
@ -381,18 +381,6 @@ group_stats(iter_t *iter, const char *name, const H5O_info_t *oi)
* Programmer: Quincey Koziol
* Tuesday, August 16, 2005
*
* Modifications: Refactored code from the walk_function
* EIP, Wednesday, August 16, 2006
*
* Vailin Choi 12 July 2007
* 1. Gathered storage info for btree and heap
* (chunked datasets and attributes)
* 2. Gathered info for attributes
*
* Vailin Choi 14 July 2007
* Cast "dims" and "num_attrs" to size_t
* Due to the -Mbounds problem for the pgi-32bit compiler on indexing
*
*-------------------------------------------------------------------------
*/
static herr_t
@ -426,7 +414,7 @@ dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi)
assert(did > 0);
/* Update dataset metadata info */
iter->datasets_btree_storage_size += oi->meta_size.obj.index_size;
iter->datasets_index_storage_size += oi->meta_size.obj.index_size;
/* Update attribute metadata info */
ret = attribute_stats(iter, oi);
@ -587,8 +575,7 @@ datatype_stats(iter_t *iter, const H5O_info_t *oi)
* Purpose: Gather statistics about an object
*
* Return: Success: 0
*
* Failure: -1
* Failure: -1
*
* Programmer: Quincey Koziol
* Tuesday, November 6, 2007
@ -815,7 +802,7 @@ print_file_info(const iter_t *iter)
printf("File information\n");
printf("\t# of unique groups: %lu\n", iter->uniq_groups);
printf("\t# of unique datasets: %lu\n", iter->uniq_dsets);
printf("\t# of unique named dataypes: %lu\n", iter->uniq_dtypes);
printf("\t# of unique named datatypes: %lu\n", iter->uniq_dtypes);
printf("\t# of unique links: %lu\n", iter->uniq_links);
printf("\t# of unique other: %lu\n", iter->uniq_others);
printf("\tMax. # of links to object: %lu\n", iter->max_links);
@ -860,7 +847,7 @@ print_file_metadata(const iter_t *iter)
HDfprintf(stdout, "\t\tHeap: %Hu\n", iter->attrs_heap_storage_size);
HDfprintf(stdout, "\tChunked datasets:\n");
HDfprintf(stdout, "\t\tB-tree: %Hu\n", iter->datasets_btree_storage_size);
HDfprintf(stdout, "\t\tB-tree: %Hu\n", iter->datasets_index_storage_size);
HDfprintf(stdout, "\tShared Messages:\n");
HDfprintf(stdout, "\t\tHeader: %Hu\n", iter->SM_hdr_storage_size);

View File

@ -5,7 +5,7 @@ Filename: h5stat_filters.h5
File information
# of unique groups: 1
# of unique datasets: 15
# of unique named dataypes: 1
# of unique named datatypes: 1
# of unique links: 0
# of unique other: 0
Max. # of links to object: 1

View File

@ -5,7 +5,7 @@ Filename: h5stat_filters.h5
File information
# of unique groups: 1
# of unique datasets: 15
# of unique named dataypes: 1
# of unique named datatypes: 1
# of unique links: 0
# of unique other: 0
Max. # of links to object: 1

View File

@ -5,7 +5,7 @@ Filename: h5stat_newgrat.h5
File information
# of unique groups: 35001
# of unique datasets: 1
# of unique named dataypes: 0
# of unique named datatypes: 0
# of unique links: 0
# of unique other: 0
Max. # of links to object: 1

View File

@ -5,7 +5,7 @@ Filename: h5stat_tsohm.h5
File information
# of unique groups: 1
# of unique datasets: 3
# of unique named dataypes: 0
# of unique named datatypes: 0
# of unique links: 0
# of unique other: 0
Max. # of links to object: 1