[svn-r12707] Description:

Further minor modifications to the file format for tracking links in groups.
This is tentatively the "final" file format for groups.

Tested on:
    Linux/32 2.6 (chicago)
    Linux/64 2.6 (chicago2)
This commit is contained in:
Quincey Koziol 2006-10-02 16:46:39 -05:00
parent 79aecf8953
commit 84a4166e72
17 changed files with 123 additions and 71 deletions

View File

@ -563,29 +563,29 @@ H5G_link_remove_cb(const void *_mesg, unsigned UNUSED idx, void *_udata)
if(HDstrcmp(lnk->name, udata->name) == 0) {
switch(lnk->type)
{
case H5L_TYPE_HARD:
{
H5O_loc_t tmp_oloc; /* Temporary object location */
case H5L_TYPE_HARD:
{
H5O_loc_t tmp_oloc; /* Temporary object location */
/* Build temporary object location */
tmp_oloc.file = udata->file;
tmp_oloc.addr = lnk->u.hard.addr;
/* Build temporary object location */
tmp_oloc.file = udata->file;
tmp_oloc.addr = lnk->u.hard.addr;
/* Get the type of the object */
/* Note: no way to check for error :-( */
*(udata->obj_type) = H5O_obj_type(&tmp_oloc, udata->dxpl_id);
}
break;
/* Get the type of the object */
/* Note: no way to check for error :-( */
*(udata->obj_type) = H5O_obj_type(&tmp_oloc, udata->dxpl_id);
}
break;
case H5L_TYPE_SOFT:
*(udata->obj_type) = H5G_LINK;
break;
case H5L_TYPE_SOFT:
*(udata->obj_type) = H5G_LINK;
break;
default: /* User-defined link */
if(lnk->type < H5L_TYPE_UD_MIN)
HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "unknown link type")
default: /* User-defined link */
if(lnk->type < H5L_TYPE_UD_MIN)
HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "unknown link type")
*(udata->obj_type) = H5G_UDLINK;
*(udata->obj_type) = H5G_UDLINK;
}
/* Stop the iteration, we found the correct link */
HGOTO_DONE(H5O_ITER_STOP)

View File

@ -59,13 +59,15 @@
/* ========= Group Creation properties ============ */
/* Defaults for link info values */
#define H5G_CRT_LINFO_INDEX_CORDER FALSE
#define H5G_CRT_LINFO_NLINKS 0
#define H5G_CRT_LINFO_MIN_CORDER 0
#define H5G_CRT_LINFO_MAX_CORDER 0
#define H5G_CRT_LINFO_LINK_FHEAP_ADDR HADDR_UNDEF
#define H5G_CRT_LINFO_NAME_BT2_ADDR HADDR_UNDEF
#define H5G_CRT_LINFO_CORDER_BT2_ADDR HADDR_UNDEF
#define H5G_CRT_LINK_INFO_DEF {H5G_CRT_LINFO_NLINKS, \
#define H5G_CRT_LINK_INFO_DEF {H5G_CRT_LINFO_INDEX_CORDER, \
H5G_CRT_LINFO_NLINKS, \
H5G_CRT_LINFO_MIN_CORDER, \
H5G_CRT_LINFO_MAX_CORDER, \
H5G_CRT_LINFO_LINK_FHEAP_ADDR, \
@ -75,7 +77,6 @@
/* Defaults for group info values */
#define H5G_CRT_GINFO_LHEAP_SIZE_HINT 0
#define H5G_CRT_GINFO_TRACK_CORDER FALSE
#define H5G_CRT_GINFO_INDEX_CORDER FALSE
#define H5G_CRT_GINFO_MAX_COMPACT 8
#define H5G_CRT_GINFO_MIN_DENSE 6
#define H5G_CRT_GINFO_EST_NUM_ENTRIES 4
@ -86,7 +87,6 @@
#define H5G_CRT_GROUP_INFO_SIZE sizeof(H5O_ginfo_t)
#define H5G_CRT_GROUP_INFO_DEF {H5G_CRT_GINFO_LHEAP_SIZE_HINT, \
H5G_CRT_GINFO_TRACK_CORDER, \
H5G_CRT_GINFO_INDEX_CORDER, \
H5G_CRT_GINFO_MAX_COMPACT, \
H5G_CRT_GINFO_MIN_DENSE, \
H5G_CRT_GINFO_EST_NUM_ENTRIES, \

View File

@ -66,9 +66,9 @@ const H5O_msg_class_t H5O_MSG_GINFO[1] = {{
/* Current version of group info information */
#define H5O_GINFO_VERSION 1
/* Flags for group flag encoding */
#define H5O_GINFO_FLAG_TRACK_CORDER 0x01
#define H5O_GINFO_FLAG_INDEX_CORDER 0x02
/* Flags for group info flag encoding */
#define H5O_GINFO_FLAG_TRACK_NAME 0x01
#define H5O_GINFO_FLAG_TRACK_CORDER 0x02
/* Declare a free list to manage the H5O_ginfo_t struct */
H5FL_DEFINE_STATIC(H5O_ginfo_t);
@ -104,6 +104,11 @@ H5O_ginfo_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const uint8_t *p)
/* check args */
HDassert(p);
#ifndef NDEBUG
{
const uint8_t *start_p = p;
#endif /* NDEBUG */
/* Version of message */
if(*p++ != H5O_GINFO_VERSION)
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "bad version number for message")
@ -114,8 +119,8 @@ H5O_ginfo_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const uint8_t *p)
/* Get the flags for the group */
flags = *p++;
HDassert(flags & H5O_GINFO_FLAG_TRACK_NAME);
ginfo->track_corder = (flags & H5O_GINFO_FLAG_TRACK_CORDER) ? TRUE : FALSE;
ginfo->index_corder = (flags & H5O_GINFO_FLAG_INDEX_CORDER) ? TRUE : FALSE;
/* Get the max. # of links to store compactly & the min. # of links to store densely */
UINT32DECODE(p, ginfo->max_compact)
@ -125,8 +130,13 @@ H5O_ginfo_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const uint8_t *p)
UINT32DECODE(p, ginfo->est_num_entries)
UINT32DECODE(p, ginfo->est_name_len)
#ifndef NDEBUG
HDassert((size_t)(p - start_p) == H5O_ginfo_size(f, ginfo));
}
#endif /* NDEBUG */
/* Set return value */
ret_value=ginfo;
ret_value = ginfo;
done:
if(ret_value == NULL)
@ -164,12 +174,17 @@ H5O_ginfo_encode(H5F_t UNUSED *f, uint8_t *p, const void *_mesg)
HDassert(p);
HDassert(ginfo);
/* encode */
#ifndef NDEBUG
{
uint8_t *start_p = p;
#endif /* NDEBUG */
/* Message version */
*p++ = H5O_GINFO_VERSION;
/* The flags for the group */
flags = ginfo->track_corder ? H5O_GINFO_FLAG_TRACK_CORDER : 0;
flags |= ginfo->index_corder ? H5O_GINFO_FLAG_INDEX_CORDER : 0;
/* The flags for the group info */
flags = H5O_GINFO_FLAG_TRACK_NAME; /* Names are always tracked */
flags |= ginfo->track_corder ? H5O_GINFO_FLAG_TRACK_CORDER : 0;
*p++ = flags;
/* Store the max. # of links to store compactly & the min. # of links to store densely */
@ -180,6 +195,11 @@ H5O_ginfo_encode(H5F_t UNUSED *f, uint8_t *p, const void *_mesg)
UINT32ENCODE(p, ginfo->est_num_entries)
UINT32ENCODE(p, ginfo->est_name_len)
#ifndef NDEBUG
HDassert((size_t)(p - start_p) == H5O_ginfo_size(f, ginfo));
}
#endif /* NDEBUG */
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5O_ginfo_encode() */
@ -205,8 +225,8 @@ H5O_ginfo_encode(H5F_t UNUSED *f, uint8_t *p, const void *_mesg)
static void *
H5O_ginfo_copy(const void *_mesg, void *_dest, unsigned UNUSED update_flags)
{
const H5O_ginfo_t *ginfo = (const H5O_ginfo_t *) _mesg;
H5O_ginfo_t *dest = (H5O_ginfo_t *) _dest;
const H5O_ginfo_t *ginfo = (const H5O_ginfo_t *)_mesg;
H5O_ginfo_t *dest = (H5O_ginfo_t *)_dest;
void *ret_value; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5O_ginfo_copy)
@ -220,7 +240,7 @@ H5O_ginfo_copy(const void *_mesg, void *_dest, unsigned UNUSED update_flags)
*dest = *ginfo;
/* Set return value */
ret_value=dest;
ret_value = dest;
done:
FUNC_LEAVE_NOAPI(ret_value)
@ -324,8 +344,6 @@ H5O_ginfo_debug(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *_mesg, FILE *
HDfprintf(stream, "%*s%-*s %t\n", indent, "", fwidth,
"Track creation order of links:", ginfo->track_corder);
HDfprintf(stream, "%*s%-*s %t\n", indent, "", fwidth,
"Index creation order of links:", ginfo->index_corder);
HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
"Max. compact links:", ginfo->max_compact);
HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,

View File

@ -73,6 +73,10 @@ const H5O_msg_class_t H5O_MSG_LINFO[1] = {{
/* Current version of link info information */
#define H5O_LINFO_VERSION 1
/* Flags for link info index flag encoding */
#define H5O_LINFO_INDEX_NAME 0x01
#define H5O_LINFO_INDEX_CORDER 0x02
/* Data exchange structure to use when copying links from src to dst */
typedef struct {
const H5O_loc_t *src_oloc; /* Source object location */
@ -100,13 +104,12 @@ H5FL_DEFINE_STATIC(H5O_linfo_t);
* koziol@ncsa.uiuc.edu
* Aug 23 2005
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
static void *
H5O_linfo_decode(H5F_t *f, hid_t UNUSED dxpl_id, const uint8_t *p)
{
unsigned char index_flags; /* Flags for encoding link index info */
H5O_linfo_t *linfo = NULL; /* Link info */
void *ret_value; /* Return value */
@ -116,14 +119,24 @@ H5O_linfo_decode(H5F_t *f, hid_t UNUSED dxpl_id, const uint8_t *p)
HDassert(f);
HDassert(p);
/* decode */
#ifndef NDEBUG
{
const uint8_t *start_p = p;
#endif /* NDEBUG */
/* Version of message */
if(*p++ != H5O_LINFO_VERSION)
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "bad version number for message")
/* Allocate space for message */
if (NULL == (linfo = H5FL_MALLOC(H5O_linfo_t)))
if(NULL == (linfo = H5FL_MALLOC(H5O_linfo_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Get the index flags for the group */
index_flags = *p++;
HDassert(index_flags & H5O_LINFO_INDEX_NAME);
linfo->index_corder = (index_flags & H5O_LINFO_INDEX_CORDER) ? TRUE : FALSE;
/* Number of links in the group */
H5F_DECODE_LENGTH(f, p, linfo->nlinks)
@ -134,11 +147,19 @@ H5O_linfo_decode(H5F_t *f, hid_t UNUSED dxpl_id, const uint8_t *p)
/* Address of fractal heap to store "dense" links */
H5F_addr_decode(f, &p, &(linfo->link_fheap_addr));
/* Address of v2 B-tree to index names of links */
/* Address of v2 B-tree to index names of links (names are always indexed) */
H5F_addr_decode(f, &p, &(linfo->name_bt2_addr));
/* Address of v2 B-tree to index creation order of links */
H5F_addr_decode(f, &p, &(linfo->corder_bt2_addr));
/* Address of v2 B-tree to index creation order of links, if there is one */
if(linfo->index_corder)
H5F_addr_decode(f, &p, &(linfo->corder_bt2_addr));
else
linfo->corder_bt2_addr = HADDR_UNDEF;
#ifndef NDEBUG
HDassert((size_t)(p - start_p) == H5O_linfo_size(f, linfo));
}
#endif /* NDEBUG */
/* Set return value */
ret_value = linfo;
@ -163,14 +184,13 @@ done:
* koziol@ncsa.uiuc.edu
* Aug 23 2005
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
static herr_t
H5O_linfo_encode(H5F_t *f, uint8_t *p, const void *_mesg)
{
const H5O_linfo_t *linfo = (const H5O_linfo_t *) _mesg;
const H5O_linfo_t *linfo = (const H5O_linfo_t *)_mesg;
unsigned char index_flags; /* Flags for encoding link index info */
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_linfo_encode)
@ -179,9 +199,19 @@ H5O_linfo_encode(H5F_t *f, uint8_t *p, const void *_mesg)
HDassert(p);
HDassert(linfo);
/* encode */
#ifndef NDEBUG
{
uint8_t *start_p = p;
#endif /* NDEBUG */
/* Message version */
*p++ = H5O_LINFO_VERSION;
/* The flags for the link indices */
index_flags = H5O_LINFO_INDEX_NAME; /* Names are always indexed */
index_flags |= linfo->index_corder ? H5O_LINFO_INDEX_CORDER : 0;
*p++ = index_flags;
/* Number of links in the group */
H5F_ENCODE_LENGTH(f, p, linfo->nlinks)
@ -195,8 +225,16 @@ H5O_linfo_encode(H5F_t *f, uint8_t *p, const void *_mesg)
/* Address of v2 B-tree to index names of links */
H5F_addr_encode(f, &p, linfo->name_bt2_addr);
/* Address of v2 B-tree to index creation order of links */
H5F_addr_encode(f, &p, linfo->corder_bt2_addr);
/* Address of v2 B-tree to index creation order of links, if they are indexed */
if(linfo->index_corder)
H5F_addr_encode(f, &p, linfo->corder_bt2_addr);
else
HDassert(!H5F_addr_defined(linfo->corder_bt2_addr));
#ifndef NDEBUG
HDassert((size_t)(p - start_p) == H5O_linfo_size(f, linfo));
}
#endif /* NDEBUG */
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5O_linfo_encode() */
@ -216,14 +254,12 @@ H5O_linfo_encode(H5F_t *f, uint8_t *p, const void *_mesg)
* koziol@ncsa.uiuc.edu
* Aug 23 2005
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
static void *
H5O_linfo_copy(const void *_mesg, void *_dest, unsigned UNUSED update_flags)
{
const H5O_linfo_t *linfo = (const H5O_linfo_t *) _mesg;
const H5O_linfo_t *linfo = (const H5O_linfo_t *)_mesg;
H5O_linfo_t *dest = (H5O_linfo_t *) _dest;
void *ret_value; /* Return value */
@ -260,25 +296,25 @@ done:
* koziol@ncsa.uiuc.edu
* Aug 23 2005
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
static size_t
H5O_linfo_size(const H5F_t *f, const void UNUSED *_mesg)
H5O_linfo_size(const H5F_t *f, const void *_mesg)
{
const H5O_linfo_t *linfo = (const H5O_linfo_t *)_mesg;
size_t ret_value; /* Return value */
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_linfo_size)
/* Set return value */
ret_value = 1 /* Version */
+ 1 /* Index flags */
+ H5F_SIZEOF_SIZE(f) /* Number of links */
+ 8 /* Min. creation order value */
+ 8 /* Max. creation order value */
+ 8 /* Curr. min. creation order value */
+ 8 /* Curr. max. creation order value */
+ H5F_SIZEOF_ADDR(f) /* Address of fractal heap to store "dense" links */
+ H5F_SIZEOF_ADDR(f) /* Address of v2 B-tree for indexing names of links */
+ H5F_SIZEOF_ADDR(f); /* Address of v2 B-tree for indexing creation order values of links */
+ (linfo->index_corder ? H5F_SIZEOF_ADDR(f) : 0); /* Address of v2 B-tree for indexing creation order values of links */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_linfo_size() */
@ -294,8 +330,6 @@ H5O_linfo_size(const H5F_t *f, const void UNUSED *_mesg)
* Programmer: Quincey Koziol
* Tuesday, August 23, 2005
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
static herr_t
@ -530,8 +564,6 @@ done:
* koziol@ncsa.uiuc.edu
* Aug 23 2005
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
static herr_t
@ -549,6 +581,8 @@ H5O_linfo_debug(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *_mesg, FILE *
HDassert(indent >= 0);
HDassert(fwidth >= 0);
HDfprintf(stream, "%*s%-*s %t\n", indent, "", fwidth,
"Index creation order of links:", linfo->index_corder);
HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth,
"Number of links:", linfo->nlinks);
HDfprintf(stream, "%*s%-*s %Hd\n", indent, "", fwidth,

View File

@ -108,9 +108,10 @@ typedef struct H5O_copy_t {
* (Data structure in memory)
*/
typedef struct H5O_linfo_t {
hbool_t index_corder; /* Are creation order values indexed on links? */
hsize_t nlinks; /* Number of links in the group */
int64_t min_corder; /* Min. creation order value for group */
int64_t max_corder; /* Max. creation order value for group */
int64_t min_corder; /* Current min. creation order value for group */
int64_t max_corder; /* Current max. creation order value for group */
haddr_t link_fheap_addr; /* Address of fractal heap for storing "dense" links */
haddr_t name_bt2_addr; /* Address of v2 B-tree for indexing names of links */
haddr_t corder_bt2_addr; /* Address of v2 B-tree for indexing creation order values of links */
@ -252,7 +253,6 @@ typedef struct H5O_ginfo_t {
/* "New" format group info (stored) */
hbool_t track_corder; /* Are creation order values tracked on links? */
hbool_t index_corder; /* Are creation order values indexed on links? */
uint32_t max_compact; /* Maximum # of compact links */
uint32_t min_dense; /* Minimum # of "dense" links */
uint32_t est_num_entries; /* Estimated # of entries in group */

View File

@ -426,9 +426,9 @@ lifecycle(hid_t fapl)
/* Check that the object header is only one chunk and the space has been allocated correctly */
if(H5Gget_objinfo(gid, ".", FALSE, &obj_stat) < 0) TEST_ERROR
#ifdef H5_HAVE_LARGE_HSIZET
if(obj_stat.ohdr.size != 240) TEST_ERROR
#else /* H5_HAVE_LARGE_HSIZET */
if(obj_stat.ohdr.size != 232) TEST_ERROR
#else /* H5_HAVE_LARGE_HSIZET */
if(obj_stat.ohdr.size != 224) TEST_ERROR
#endif /* H5_HAVE_LARGE_HSIZET */
if(obj_stat.ohdr.free != 0) TEST_ERROR
if(obj_stat.ohdr.nmesgs != 6) TEST_ERROR
@ -452,9 +452,9 @@ lifecycle(hid_t fapl)
/* Check that the object header is still one chunk and the space has been allocated correctly */
if(H5Gget_objinfo(gid, ".", FALSE, &obj_stat) < 0) TEST_ERROR
#ifdef H5_HAVE_LARGE_HSIZET
if(obj_stat.ohdr.size != 240) TEST_ERROR
#else /* H5_HAVE_LARGE_HSIZET */
if(obj_stat.ohdr.size != 232) TEST_ERROR
#else /* H5_HAVE_LARGE_HSIZET */
if(obj_stat.ohdr.size != 224) TEST_ERROR
#endif /* H5_HAVE_LARGE_HSIZET */
if(obj_stat.ohdr.free != 128) TEST_ERROR
if(obj_stat.ohdr.nmesgs != 3) TEST_ERROR

Binary file not shown.

View File

@ -157,7 +157,7 @@ Expected output for 'h5dump --xml -A tall.h5'
<hdf5:NoData/>
</hdf5:Data>
</hdf5:Dataset>
<hdf5:Dataset Name="dset2.2" OBJ-XID="xid_8696" H5Path= "/g2/dset2.2" Parents="xid_1848" H5ParentPaths="/g2">
<hdf5:Dataset Name="dset2.2" OBJ-XID="xid_8688" H5Path= "/g2/dset2.2" Parents="xid_1848" H5ParentPaths="/g2">
<hdf5:StorageLayout>
<hdf5:ContiguousLayout/>
</hdf5:StorageLayout>

Binary file not shown.

View File

@ -172,7 +172,7 @@ Expected output for 'h5dump --xml tall.h5'
</hdf5:DataFromFile>
</hdf5:Data>
</hdf5:Dataset>
<hdf5:Dataset Name="dset2.2" OBJ-XID="xid_8696" H5Path= "/g2/dset2.2" Parents="xid_1848" H5ParentPaths="/g2">
<hdf5:Dataset Name="dset2.2" OBJ-XID="xid_8688" H5Path= "/g2/dset2.2" Parents="xid_1848" H5ParentPaths="/g2">
<hdf5:StorageLayout>
<hdf5:ContiguousLayout/>
</hdf5:StorageLayout>

View File

@ -18,7 +18,7 @@ USER_BLOCK {
USERBLOCK_SIZE 0
}
DATASET "dset" {
DATATYPE H5T_STD_I32BE
DATATYPE H5T_STD_I32LE
DATASPACE SIMPLE { ( 4 ) / ( 4 ) }
}
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.