2003-04-01 02:30:57 +08:00
|
|
|
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
|
|
|
* Copyright by the Board of Trustees of the University of Illinois. *
|
|
|
|
|
* All rights reserved. *
|
|
|
|
|
* *
|
|
|
|
|
* This file is part of HDF5. The full HDF5 copyright notice, including *
|
|
|
|
|
* terms governing use, modification, and redistribution, is contained in *
|
|
|
|
|
* the files COPYING and Copyright.html. COPYING can be found at the root *
|
|
|
|
|
* of the source code distribution tree; Copyright.html can be found at the *
|
|
|
|
|
* root level of an installed copy of the electronic HDF5 document set and *
|
|
|
|
|
* is linked from the top-level documents page. It can also be found at *
|
|
|
|
|
* http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have *
|
|
|
|
|
* access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. *
|
|
|
|
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
|
|
|
|
|
1997-09-22 10:08:54 +08:00
|
|
|
|
/*
|
|
|
|
|
* Programmer: Robb Matzke <matzke@llnl.gov>
|
|
|
|
|
* Friday, September 19, 1997
|
|
|
|
|
*/
|
|
|
|
|
#define H5G_PACKAGE
|
2000-10-10 15:43:38 +08:00
|
|
|
|
#define H5F_PACKAGE /*suppress error about including H5Fpkg */
|
1997-09-22 10:08:54 +08:00
|
|
|
|
|
2001-04-06 01:29:14 +08:00
|
|
|
|
#include "H5private.h"
|
|
|
|
|
#include "H5Eprivate.h"
|
|
|
|
|
#include "H5Fpkg.h"
|
|
|
|
|
#include "H5Gpkg.h"
|
|
|
|
|
#include "H5HLprivate.h"
|
|
|
|
|
#include "H5MMprivate.h"
|
1997-09-22 10:08:54 +08:00
|
|
|
|
|
1998-01-17 06:23:43 +08:00
|
|
|
|
#define PABLO_MASK H5G_ent_mask
|
2001-08-15 06:09:56 +08:00
|
|
|
|
static int interface_initialize_g = 0;
|
1998-01-17 06:23:43 +08:00
|
|
|
|
#define INTERFACE_INIT NULL
|
|
|
|
|
|
1997-09-22 10:08:54 +08:00
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Function: H5G_ent_cache
|
1997-09-22 10:08:54 +08:00
|
|
|
|
*
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Purpose: Returns a pointer to the cache associated with the symbol
|
|
|
|
|
* table entry. You should modify the cache directly, then call
|
|
|
|
|
* H5G_modified() with the new cache type (even if the type is
|
|
|
|
|
* still the same).
|
1997-09-22 10:08:54 +08:00
|
|
|
|
*
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Return: Success: Ptr to the cache in the symbol table entry.
|
1997-09-22 10:08:54 +08:00
|
|
|
|
*
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Failure: NULL
|
1997-09-22 10:08:54 +08:00
|
|
|
|
*
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Programmer: Robb Matzke
|
1997-09-22 10:08:54 +08:00
|
|
|
|
* Friday, September 19, 1997
|
|
|
|
|
*
|
|
|
|
|
* Modifications:
|
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
1998-01-17 06:23:43 +08:00
|
|
|
|
H5G_cache_t *
|
|
|
|
|
H5G_ent_cache(H5G_entry_t *ent, H5G_type_t *cache_type)
|
1997-09-22 10:08:54 +08:00
|
|
|
|
{
|
2002-08-09 00:52:55 +08:00
|
|
|
|
H5G_cache_t *ret_value; /* Return value */
|
|
|
|
|
|
2002-05-29 23:07:55 +08:00
|
|
|
|
FUNC_ENTER_NOAPI(H5G_ent_cache, NULL);
|
|
|
|
|
|
2002-08-09 00:52:55 +08:00
|
|
|
|
if (!ent)
|
|
|
|
|
HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, NULL, "no entry");
|
1998-01-17 06:23:43 +08:00
|
|
|
|
if (cache_type)
|
|
|
|
|
*cache_type = ent->type;
|
|
|
|
|
|
2002-08-09 00:52:55 +08:00
|
|
|
|
/* Set return value */
|
|
|
|
|
ret_value=&(ent->cache);
|
|
|
|
|
|
|
|
|
|
done:
|
2003-01-11 04:26:02 +08:00
|
|
|
|
FUNC_LEAVE_NOAPI(ret_value);
|
1997-09-22 10:08:54 +08:00
|
|
|
|
}
|
2002-08-09 00:52:55 +08:00
|
|
|
|
|
1997-09-22 10:08:54 +08:00
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Function: H5G_ent_modified
|
1997-09-22 10:08:54 +08:00
|
|
|
|
*
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Purpose: This function should be called after you make any
|
|
|
|
|
* modifications to a symbol table entry cache. Supply the new
|
|
|
|
|
* type for the cache. If CACHE_TYPE is the constant
|
|
|
|
|
* H5G_NO_CHANGE then the cache type isn't changed--just the
|
|
|
|
|
* dirty bit is set.
|
1997-09-22 10:08:54 +08:00
|
|
|
|
*
|
1998-10-27 05:18:54 +08:00
|
|
|
|
* Return: Non-negative on success/Negative on failure
|
1997-09-22 10:08:54 +08:00
|
|
|
|
*
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Programmer: Robb Matzke
|
1997-09-22 10:08:54 +08:00
|
|
|
|
* Friday, September 19, 1997
|
|
|
|
|
*
|
|
|
|
|
* Modifications:
|
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
herr_t
|
1998-01-17 06:23:43 +08:00
|
|
|
|
H5G_ent_modified(H5G_entry_t *ent, H5G_type_t cache_type)
|
1997-09-22 10:08:54 +08:00
|
|
|
|
{
|
2002-08-10 04:48:23 +08:00
|
|
|
|
herr_t ret_value=SUCCEED; /* Return value */
|
|
|
|
|
|
2002-05-29 23:07:55 +08:00
|
|
|
|
FUNC_ENTER_NOAPI(H5G_ent_modified, FAIL);
|
|
|
|
|
|
1998-01-17 06:23:43 +08:00
|
|
|
|
assert(ent);
|
2002-05-29 23:07:55 +08:00
|
|
|
|
|
2002-08-09 00:52:55 +08:00
|
|
|
|
if (H5G_NO_CHANGE != ent->type)
|
|
|
|
|
ent->type = cache_type;
|
1998-01-17 06:23:43 +08:00
|
|
|
|
ent->dirty = TRUE;
|
2002-05-29 23:07:55 +08:00
|
|
|
|
|
2002-08-10 04:48:23 +08:00
|
|
|
|
done:
|
2003-01-11 04:26:02 +08:00
|
|
|
|
FUNC_LEAVE_NOAPI(ret_value);
|
1997-09-22 10:08:54 +08:00
|
|
|
|
}
|
2002-08-09 00:52:55 +08:00
|
|
|
|
|
1997-09-22 10:08:54 +08:00
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Function: H5G_ent_decode_vec
|
1997-09-22 10:08:54 +08:00
|
|
|
|
*
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Purpose: Same as H5G_ent_decode() except it does it for an array of
|
|
|
|
|
* symbol table entries.
|
1997-09-22 10:08:54 +08:00
|
|
|
|
*
|
|
|
|
|
* Errors:
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* SYM CANTDECODE Can't decode.
|
1997-09-22 10:08:54 +08:00
|
|
|
|
*
|
1998-10-27 05:18:54 +08:00
|
|
|
|
* Return: Success: Non-negative, with *pp pointing to the first byte
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* after the last symbol.
|
1997-09-22 10:08:54 +08:00
|
|
|
|
*
|
1998-10-27 05:18:54 +08:00
|
|
|
|
* Failure: Negative
|
1997-09-22 10:08:54 +08:00
|
|
|
|
*
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Programmer: Robb Matzke
|
|
|
|
|
* matzke@llnl.gov
|
|
|
|
|
* Jul 18 1997
|
1997-09-22 10:08:54 +08:00
|
|
|
|
*
|
|
|
|
|
* Modifications:
|
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
herr_t
|
2001-08-15 06:09:56 +08:00
|
|
|
|
H5G_ent_decode_vec(H5F_t *f, const uint8_t **pp, H5G_entry_t *ent, int n)
|
1997-09-22 10:08:54 +08:00
|
|
|
|
{
|
2001-08-15 06:09:56 +08:00
|
|
|
|
int i;
|
2002-08-09 00:52:55 +08:00
|
|
|
|
herr_t ret_value=SUCCEED; /* Return value */
|
1997-09-22 10:08:54 +08:00
|
|
|
|
|
2002-05-29 23:07:55 +08:00
|
|
|
|
FUNC_ENTER_NOAPI(H5G_ent_decode_vec, FAIL);
|
1997-09-22 10:08:54 +08:00
|
|
|
|
|
1998-01-17 06:23:43 +08:00
|
|
|
|
/* check arguments */
|
|
|
|
|
assert(f);
|
|
|
|
|
assert(pp);
|
|
|
|
|
assert(ent);
|
|
|
|
|
assert(n >= 0);
|
1997-09-22 10:08:54 +08:00
|
|
|
|
|
1998-01-17 06:23:43 +08:00
|
|
|
|
/* decode entries */
|
|
|
|
|
for (i = 0; i < n; i++) {
|
2002-08-09 00:52:55 +08:00
|
|
|
|
if (H5G_ent_decode(f, pp, ent + i) < 0)
|
|
|
|
|
HGOTO_ERROR(H5E_SYM, H5E_CANTDECODE, FAIL, "can't decode");
|
1998-01-17 06:23:43 +08:00
|
|
|
|
}
|
1997-09-22 10:08:54 +08:00
|
|
|
|
|
2002-08-09 00:52:55 +08:00
|
|
|
|
done:
|
2003-01-11 04:26:02 +08:00
|
|
|
|
FUNC_LEAVE_NOAPI(ret_value);
|
1997-09-22 10:08:54 +08:00
|
|
|
|
}
|
2002-08-09 00:52:55 +08:00
|
|
|
|
|
1997-09-22 10:08:54 +08:00
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Function: H5G_ent_decode
|
1997-09-22 10:08:54 +08:00
|
|
|
|
*
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Purpose: Decodes a symbol table entry pointed to by `*pp'.
|
1997-09-22 10:08:54 +08:00
|
|
|
|
*
|
|
|
|
|
* Errors:
|
|
|
|
|
*
|
1998-10-27 05:18:54 +08:00
|
|
|
|
* Return: Success: Non-negative with *pp pointing to the first byte
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* following the symbol table entry.
|
1997-09-22 10:08:54 +08:00
|
|
|
|
*
|
1998-10-27 05:18:54 +08:00
|
|
|
|
* Failure: Negative
|
1997-09-22 10:08:54 +08:00
|
|
|
|
*
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Programmer: Robb Matzke
|
|
|
|
|
* matzke@llnl.gov
|
|
|
|
|
* Jul 18 1997
|
1997-09-22 10:08:54 +08:00
|
|
|
|
*
|
|
|
|
|
* Modifications:
|
1998-07-20 21:45:25 +08:00
|
|
|
|
* Robb Matzke, 17 Jul 1998
|
|
|
|
|
* Added a 4-byte padding field for alignment and future expansion.
|
1997-09-22 10:08:54 +08:00
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
herr_t
|
1998-11-19 02:40:09 +08:00
|
|
|
|
H5G_ent_decode(H5F_t *f, const uint8_t **pp, H5G_entry_t *ent)
|
1997-09-22 10:08:54 +08:00
|
|
|
|
{
|
1998-11-19 02:40:09 +08:00
|
|
|
|
const uint8_t *p_ret = *pp;
|
|
|
|
|
uint32_t tmp;
|
2002-08-10 04:48:23 +08:00
|
|
|
|
herr_t ret_value=SUCCEED; /* Return value */
|
1997-09-22 10:08:54 +08:00
|
|
|
|
|
2002-05-29 23:07:55 +08:00
|
|
|
|
FUNC_ENTER_NOAPI(H5G_ent_decode, FAIL);
|
1997-09-22 10:08:54 +08:00
|
|
|
|
|
1998-01-17 06:23:43 +08:00
|
|
|
|
/* check arguments */
|
|
|
|
|
assert(f);
|
|
|
|
|
assert(pp);
|
|
|
|
|
assert(ent);
|
1997-09-22 10:08:54 +08:00
|
|
|
|
|
1998-01-17 06:23:43 +08:00
|
|
|
|
ent->file = f;
|
1998-01-08 01:14:26 +08:00
|
|
|
|
|
1998-01-17 06:23:43 +08:00
|
|
|
|
/* decode header */
|
2000-10-10 15:43:38 +08:00
|
|
|
|
H5F_DECODE_LENGTH(f, *pp, ent->name_off);
|
1998-01-17 06:23:43 +08:00
|
|
|
|
H5F_addr_decode(f, pp, &(ent->header));
|
1998-01-29 04:24:49 +08:00
|
|
|
|
UINT32DECODE(*pp, tmp);
|
1998-07-20 21:45:25 +08:00
|
|
|
|
*pp += 4; /*reserved*/
|
1998-01-29 04:24:49 +08:00
|
|
|
|
ent->type=(H5G_type_t)tmp;
|
1997-09-22 10:08:54 +08:00
|
|
|
|
|
1998-01-17 06:23:43 +08:00
|
|
|
|
/* decode scratch-pad */
|
|
|
|
|
switch (ent->type) {
|
|
|
|
|
case H5G_NOTHING_CACHED:
|
|
|
|
|
break;
|
1997-09-22 10:08:54 +08:00
|
|
|
|
|
1998-01-17 06:23:43 +08:00
|
|
|
|
case H5G_CACHED_STAB:
|
|
|
|
|
assert(2 * H5F_SIZEOF_ADDR(f) <= H5G_SIZEOF_SCRATCH);
|
|
|
|
|
H5F_addr_decode(f, pp, &(ent->cache.stab.btree_addr));
|
|
|
|
|
H5F_addr_decode(f, pp, &(ent->cache.stab.heap_addr));
|
|
|
|
|
break;
|
1997-09-22 10:08:54 +08:00
|
|
|
|
|
1998-04-15 00:44:46 +08:00
|
|
|
|
case H5G_CACHED_SLINK:
|
|
|
|
|
UINT32DECODE (*pp, ent->cache.slink.lval_offset);
|
|
|
|
|
break;
|
|
|
|
|
|
1998-01-17 06:23:43 +08:00
|
|
|
|
default:
|
|
|
|
|
HDabort();
|
|
|
|
|
}
|
1997-09-22 10:08:54 +08:00
|
|
|
|
|
1998-01-17 06:23:43 +08:00
|
|
|
|
*pp = p_ret + H5G_SIZEOF_ENTRY(f);
|
2002-08-10 04:48:23 +08:00
|
|
|
|
|
|
|
|
|
done:
|
2003-01-11 04:26:02 +08:00
|
|
|
|
FUNC_LEAVE_NOAPI(ret_value);
|
1997-09-22 10:08:54 +08:00
|
|
|
|
}
|
2002-08-10 04:48:23 +08:00
|
|
|
|
|
1997-09-22 10:08:54 +08:00
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Function: H5G_ent_encode_vec
|
1997-09-22 10:08:54 +08:00
|
|
|
|
*
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Purpose: Same as H5G_ent_encode() except it does it for an array of
|
|
|
|
|
* symbol table entries.
|
1997-09-22 10:08:54 +08:00
|
|
|
|
*
|
|
|
|
|
* Errors:
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* SYM CANTENCODE Can't encode.
|
1997-09-22 10:08:54 +08:00
|
|
|
|
*
|
1998-10-27 05:18:54 +08:00
|
|
|
|
* Return: Success: Non-negative, with *pp pointing to the first byte
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* after the last symbol.
|
1997-09-22 10:08:54 +08:00
|
|
|
|
*
|
1998-10-27 05:18:54 +08:00
|
|
|
|
* Failure: Negative
|
1997-09-22 10:08:54 +08:00
|
|
|
|
*
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Programmer: Robb Matzke
|
|
|
|
|
* matzke@llnl.gov
|
|
|
|
|
* Jul 18 1997
|
1997-09-22 10:08:54 +08:00
|
|
|
|
*
|
|
|
|
|
* Modifications:
|
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
herr_t
|
2001-08-15 06:09:56 +08:00
|
|
|
|
H5G_ent_encode_vec(H5F_t *f, uint8_t **pp, const H5G_entry_t *ent, int n)
|
1997-09-22 10:08:54 +08:00
|
|
|
|
{
|
2001-08-15 06:09:56 +08:00
|
|
|
|
int i;
|
2002-08-09 00:52:55 +08:00
|
|
|
|
herr_t ret_value=SUCCEED; /* Return value */
|
1997-09-22 10:08:54 +08:00
|
|
|
|
|
2002-05-29 23:07:55 +08:00
|
|
|
|
FUNC_ENTER_NOAPI(H5G_ent_encode_vec, FAIL);
|
1997-09-22 10:08:54 +08:00
|
|
|
|
|
1998-01-17 06:23:43 +08:00
|
|
|
|
/* check arguments */
|
|
|
|
|
assert(f);
|
|
|
|
|
assert(pp);
|
|
|
|
|
assert(ent);
|
|
|
|
|
assert(n >= 0);
|
1997-09-22 10:08:54 +08:00
|
|
|
|
|
1998-01-17 06:23:43 +08:00
|
|
|
|
/* encode entries */
|
|
|
|
|
for (i = 0; i < n; i++) {
|
2002-08-09 00:52:55 +08:00
|
|
|
|
if (H5G_ent_encode(f, pp, ent + i) < 0)
|
|
|
|
|
HGOTO_ERROR(H5E_SYM, H5E_CANTENCODE, FAIL, "can't encode");
|
1998-01-17 06:23:43 +08:00
|
|
|
|
}
|
1997-09-22 10:08:54 +08:00
|
|
|
|
|
2002-08-09 00:52:55 +08:00
|
|
|
|
done:
|
2003-01-11 04:26:02 +08:00
|
|
|
|
FUNC_LEAVE_NOAPI(ret_value);
|
1997-09-22 10:08:54 +08:00
|
|
|
|
}
|
2002-08-09 00:52:55 +08:00
|
|
|
|
|
1997-09-22 10:08:54 +08:00
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Function: H5G_ent_encode
|
1997-09-22 10:08:54 +08:00
|
|
|
|
*
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Purpose: Encodes the specified symbol table entry into the buffer
|
|
|
|
|
* pointed to by *pp.
|
1997-09-22 10:08:54 +08:00
|
|
|
|
*
|
|
|
|
|
* Errors:
|
|
|
|
|
*
|
1998-10-27 05:18:54 +08:00
|
|
|
|
* Return: Success: Non-negative, with *pp pointing to the first byte
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* after the symbol table entry.
|
1997-09-22 10:08:54 +08:00
|
|
|
|
*
|
1998-10-27 05:18:54 +08:00
|
|
|
|
* Failure: Negative
|
1997-09-22 10:08:54 +08:00
|
|
|
|
*
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Programmer: Robb Matzke
|
|
|
|
|
* matzke@llnl.gov
|
|
|
|
|
* Jul 18 1997
|
1997-09-22 10:08:54 +08:00
|
|
|
|
*
|
|
|
|
|
* Modifications:
|
|
|
|
|
*
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Robb Matzke, 8 Aug 1997
|
|
|
|
|
* Writes zeros for the bytes that aren't used so the file doesn't
|
|
|
|
|
* contain junk.
|
1997-09-22 10:08:54 +08:00
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
herr_t
|
1998-11-19 02:40:09 +08:00
|
|
|
|
H5G_ent_encode(H5F_t *f, uint8_t **pp, const H5G_entry_t *ent)
|
1997-09-22 10:08:54 +08:00
|
|
|
|
{
|
1998-11-19 02:40:09 +08:00
|
|
|
|
uint8_t *p_ret = *pp + H5G_SIZEOF_ENTRY(f);
|
2002-08-10 04:48:23 +08:00
|
|
|
|
herr_t ret_value=SUCCEED; /* Return value */
|
1998-01-17 06:23:43 +08:00
|
|
|
|
|
2002-05-29 23:07:55 +08:00
|
|
|
|
FUNC_ENTER_NOAPI(H5G_ent_encode, FAIL);
|
1998-01-17 06:23:43 +08:00
|
|
|
|
|
|
|
|
|
/* check arguments */
|
|
|
|
|
assert(f);
|
|
|
|
|
assert(pp);
|
|
|
|
|
|
|
|
|
|
if (ent) {
|
|
|
|
|
/* encode header */
|
2000-10-10 15:43:38 +08:00
|
|
|
|
H5F_ENCODE_LENGTH(f, *pp, ent->name_off);
|
1999-07-29 02:25:43 +08:00
|
|
|
|
H5F_addr_encode(f, pp, ent->header);
|
1998-01-17 06:23:43 +08:00
|
|
|
|
UINT32ENCODE(*pp, ent->type);
|
1998-07-20 21:45:25 +08:00
|
|
|
|
UINT32ENCODE(*pp, 0); /*reserved*/
|
1998-01-17 06:23:43 +08:00
|
|
|
|
|
|
|
|
|
/* encode scratch-pad */
|
|
|
|
|
switch (ent->type) {
|
2002-08-09 00:52:55 +08:00
|
|
|
|
case H5G_NOTHING_CACHED:
|
|
|
|
|
break;
|
1998-01-17 06:23:43 +08:00
|
|
|
|
|
2002-08-09 00:52:55 +08:00
|
|
|
|
case H5G_CACHED_STAB:
|
|
|
|
|
assert(2 * H5F_SIZEOF_ADDR(f) <= H5G_SIZEOF_SCRATCH);
|
|
|
|
|
H5F_addr_encode(f, pp, ent->cache.stab.btree_addr);
|
|
|
|
|
H5F_addr_encode(f, pp, ent->cache.stab.heap_addr);
|
|
|
|
|
break;
|
1998-01-17 06:23:43 +08:00
|
|
|
|
|
2002-08-09 00:52:55 +08:00
|
|
|
|
case H5G_CACHED_SLINK:
|
|
|
|
|
UINT32ENCODE (*pp, ent->cache.slink.lval_offset);
|
|
|
|
|
break;
|
1998-04-15 00:44:46 +08:00
|
|
|
|
|
2002-08-09 00:52:55 +08:00
|
|
|
|
default:
|
|
|
|
|
HDabort();
|
1998-01-17 06:23:43 +08:00
|
|
|
|
}
|
|
|
|
|
} else {
|
2000-10-10 15:43:38 +08:00
|
|
|
|
H5F_ENCODE_LENGTH(f, *pp, 0);
|
1999-08-11 04:21:32 +08:00
|
|
|
|
H5F_addr_encode(f, pp, HADDR_UNDEF);
|
1998-01-17 06:23:43 +08:00
|
|
|
|
UINT32ENCODE(*pp, H5G_NOTHING_CACHED);
|
1998-07-20 21:45:25 +08:00
|
|
|
|
UINT32ENCODE(*pp, 0); /*reserved*/
|
1998-01-17 06:23:43 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* fill with zero */
|
1999-07-29 02:25:43 +08:00
|
|
|
|
while (*pp < p_ret) *(*pp)++ = 0;
|
1998-01-17 06:23:43 +08:00
|
|
|
|
*pp = p_ret;
|
1999-07-29 02:25:43 +08:00
|
|
|
|
|
2002-08-10 04:48:23 +08:00
|
|
|
|
done:
|
2003-01-11 04:26:02 +08:00
|
|
|
|
FUNC_LEAVE_NOAPI(ret_value);
|
1997-09-22 10:08:54 +08:00
|
|
|
|
}
|
2002-08-10 04:48:23 +08:00
|
|
|
|
|
2002-09-25 22:50:49 +08:00
|
|
|
|
|
2002-08-29 02:34:12 +08:00
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
|
* Function: H5G_ent_copy
|
|
|
|
|
*
|
|
|
|
|
* Purpose: Do a deep copy of symbol table entries
|
|
|
|
|
*
|
|
|
|
|
* Return: Success: 0, Failure: -1
|
|
|
|
|
*
|
|
|
|
|
* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
|
|
|
|
|
*
|
|
|
|
|
* Date: August 2002
|
|
|
|
|
*
|
|
|
|
|
* Comments:
|
|
|
|
|
*
|
|
|
|
|
* Modifications:
|
2002-10-15 04:08:23 +08:00
|
|
|
|
* Quincey Koziol, Sept. 25, 2002:
|
|
|
|
|
* - Changed source & destination parameters to match the rest
|
|
|
|
|
* of the functions in the library.
|
|
|
|
|
* - Added 'depth' parameter to determine how much of the group
|
|
|
|
|
* entry structure we want to copy. The new depths are:
|
[svn-r6252] Purpose:
Lots of performance improvements & a couple new internal API interfaces.
Description:
Performance Improvements:
- Cached file offset & length sizes in shared file struct, to avoid
constantly looking them up in the FCPL.
- Generic property improvements:
- Added "revision" number to generic property classes to speed
up comparisons.
- Changed method of storing properties from using a hash-table
to the TBBT routines in the library.
- Share the propery names between classes and the lists derived
from them.
- Removed redundant 'def_value' buffer from each property.
- Switching code to use a "copy on write" strategy for
properties in each list, where the properties in each list
are shared with the properties in the class, until a
property's value is changed in a list.
- Fixed error in layout code which was allocating too many buffers.
- Redefined public macros of the form (H5open()/H5check, <variable>)
internally to only be (<variable>), avoiding innumerable useless
calls to H5open() and H5check_version().
- Reuse already zeroed buffers in H5F_contig_fill instead of
constantly re-zeroing them.
- Don't write fill values if writing entire dataset.
- Use gettimeofday() system call instead of time() system when
checking the modification time of a dataset.
- Added reference counted string API and use it for tracking the
names of objects opening in a file (for the ID->name code).
- Removed redundant H5P_get() calls in B-tree routines.
- Redefine H5T datatype macros internally to the library, to avoid
calling H5check redundantly.
- Keep dataspace information for dataset locally instead of reading
from disk each time. Added new module to track open objects
in a file, to allow this (which will be useful eventually for
some FPH5 metadata caching issues).
- Remove H5AC_find macro which was inlining metadata cache lookups,
and call function instead.
- Remove redundant memset() calls from H5G_namei() routine.
- Remove redundant checking of object type when locating objects
in metadata cache and rely on the address only.
- Create default dataset object to use when default dataset creation
property list is used to create datasets, bypassing querying
for all the property list values.
- Use default I/O vector size when performing raw data with the
default dataset transfer property list, instead of querying for
I/O vector size.
- Remove H5P_DEFAULT internally to the library, replacing it with
more specific default property list based on the type of
property list needed.
- Remove redundant memset() calls in object header message (H5O*)
routines.
- Remove redunant memset() calls in data I/O routines.
- Split free-list allocation routines into malloc() and calloc()-
like routines, instead of one combined routine.
- Remove lots of indirection in H5O*() routines.
- Simplify metadata cache entry comparison routine (used when
flushing entire cache out).
- Only enable metadata cache statistics when H5AC_DEBUG is turned
on, instead of always tracking them.
- Simplify address comparison macro (H5F_addr_eq).
- Remove redundant metadata cache entry protections during dataset
creation by protecting the object header once and making all
the modifications necessary for the dataset creation before
unprotecting it.
- Reduce # of "number of element in extent" computations performed
by computing and storing the value during dataspace creation.
- Simplify checking for group location's file information, when file
has not been involving in file-mounting operations.
- Use binary encoding for modification time, instead of ASCII.
- Hoist H5HL_peek calls (to get information in a local heap)
out of loops in many group routine.
- Use static variable for iterators of selections, instead of
dynamically allocation them each time.
- Lookup & insert new entries in one step, avoiding traversing
group's B-tree twice.
- Fixed memory leak in H5Gget_objname_idx() routine (tangential to
performance improvements, but fixed along the way).
- Use free-list for reference counted strings.
- Don't bother copying object names into cached group entries,
since they are re-created when an object is opened.
The benchmark I used to measure these results created several thousand
small (2K) datasets in a file and wrote out the data for them. This is
Elena's "regular.c" benchmark.
These changes resulted in approximately ~4.3x speedup of the
development branch when compared to the previous code in the
development branch and ~1.4x speedup compared to the release
branch.
Additionally, these changes reduce the total memory used (code and
data) by the development branch by ~800KB, bringing the development
branch back into the same ballpark as the release branch.
I'll send out a more detailed description of the benchmark results
as a followup note.
New internal API routines:
Added "reference counted strings" API for tracking strings that get
used by multiple owners without duplicating the strings.
Added "ternary search tree" API for text->object mappings.
Platforms tested:
Tested h5committest {arabica (fortran), eirene (fortran, C++)
modi4 (parallel, fortran)}
Other platforms/configurations tested?
FreeBSD 4.7 (sleipnir) serial & parallel
Solaris 2.6 (baldric) serial
2003-01-10 01:20:03 +08:00
|
|
|
|
* H5G_COPY_NULL - Copy all the fields from the
|
|
|
|
|
* source to the destination, but set the destination's
|
|
|
|
|
* user path and canonical path to NULL.
|
2002-10-15 04:08:23 +08:00
|
|
|
|
* H5G_COPY_LIMITED - Copy all the fields from the
|
|
|
|
|
* source to the destination, except for the user path
|
|
|
|
|
* field, keeping it the same as its
|
|
|
|
|
* previous value in the destination.
|
|
|
|
|
* H5G_COPY_SHALLOW - Copy all the fields from the source
|
|
|
|
|
* to the destination, including the user path and
|
|
|
|
|
* canonical path.
|
|
|
|
|
* H5G_COPY_DEEP - Copy all the fields from the source to
|
|
|
|
|
* the destination, deep copying the user and canonical
|
|
|
|
|
* paths.
|
2002-08-29 02:34:12 +08:00
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
herr_t
|
2002-10-15 04:08:23 +08:00
|
|
|
|
H5G_ent_copy(H5G_entry_t *dst, const H5G_entry_t *src, H5G_ent_copy_depth_t depth)
|
2002-08-29 02:34:12 +08:00
|
|
|
|
{
|
[svn-r6252] Purpose:
Lots of performance improvements & a couple new internal API interfaces.
Description:
Performance Improvements:
- Cached file offset & length sizes in shared file struct, to avoid
constantly looking them up in the FCPL.
- Generic property improvements:
- Added "revision" number to generic property classes to speed
up comparisons.
- Changed method of storing properties from using a hash-table
to the TBBT routines in the library.
- Share the propery names between classes and the lists derived
from them.
- Removed redundant 'def_value' buffer from each property.
- Switching code to use a "copy on write" strategy for
properties in each list, where the properties in each list
are shared with the properties in the class, until a
property's value is changed in a list.
- Fixed error in layout code which was allocating too many buffers.
- Redefined public macros of the form (H5open()/H5check, <variable>)
internally to only be (<variable>), avoiding innumerable useless
calls to H5open() and H5check_version().
- Reuse already zeroed buffers in H5F_contig_fill instead of
constantly re-zeroing them.
- Don't write fill values if writing entire dataset.
- Use gettimeofday() system call instead of time() system when
checking the modification time of a dataset.
- Added reference counted string API and use it for tracking the
names of objects opening in a file (for the ID->name code).
- Removed redundant H5P_get() calls in B-tree routines.
- Redefine H5T datatype macros internally to the library, to avoid
calling H5check redundantly.
- Keep dataspace information for dataset locally instead of reading
from disk each time. Added new module to track open objects
in a file, to allow this (which will be useful eventually for
some FPH5 metadata caching issues).
- Remove H5AC_find macro which was inlining metadata cache lookups,
and call function instead.
- Remove redundant memset() calls from H5G_namei() routine.
- Remove redundant checking of object type when locating objects
in metadata cache and rely on the address only.
- Create default dataset object to use when default dataset creation
property list is used to create datasets, bypassing querying
for all the property list values.
- Use default I/O vector size when performing raw data with the
default dataset transfer property list, instead of querying for
I/O vector size.
- Remove H5P_DEFAULT internally to the library, replacing it with
more specific default property list based on the type of
property list needed.
- Remove redundant memset() calls in object header message (H5O*)
routines.
- Remove redunant memset() calls in data I/O routines.
- Split free-list allocation routines into malloc() and calloc()-
like routines, instead of one combined routine.
- Remove lots of indirection in H5O*() routines.
- Simplify metadata cache entry comparison routine (used when
flushing entire cache out).
- Only enable metadata cache statistics when H5AC_DEBUG is turned
on, instead of always tracking them.
- Simplify address comparison macro (H5F_addr_eq).
- Remove redundant metadata cache entry protections during dataset
creation by protecting the object header once and making all
the modifications necessary for the dataset creation before
unprotecting it.
- Reduce # of "number of element in extent" computations performed
by computing and storing the value during dataspace creation.
- Simplify checking for group location's file information, when file
has not been involving in file-mounting operations.
- Use binary encoding for modification time, instead of ASCII.
- Hoist H5HL_peek calls (to get information in a local heap)
out of loops in many group routine.
- Use static variable for iterators of selections, instead of
dynamically allocation them each time.
- Lookup & insert new entries in one step, avoiding traversing
group's B-tree twice.
- Fixed memory leak in H5Gget_objname_idx() routine (tangential to
performance improvements, but fixed along the way).
- Use free-list for reference counted strings.
- Don't bother copying object names into cached group entries,
since they are re-created when an object is opened.
The benchmark I used to measure these results created several thousand
small (2K) datasets in a file and wrote out the data for them. This is
Elena's "regular.c" benchmark.
These changes resulted in approximately ~4.3x speedup of the
development branch when compared to the previous code in the
development branch and ~1.4x speedup compared to the release
branch.
Additionally, these changes reduce the total memory used (code and
data) by the development branch by ~800KB, bringing the development
branch back into the same ballpark as the release branch.
I'll send out a more detailed description of the benchmark results
as a followup note.
New internal API routines:
Added "reference counted strings" API for tracking strings that get
used by multiple owners without duplicating the strings.
Added "ternary search tree" API for text->object mappings.
Platforms tested:
Tested h5committest {arabica (fortran), eirene (fortran, C++)
modi4 (parallel, fortran)}
Other platforms/configurations tested?
FreeBSD 4.7 (sleipnir) serial & parallel
Solaris 2.6 (baldric) serial
2003-01-10 01:20:03 +08:00
|
|
|
|
H5RS_str_t *tmp_user_path_r=NULL; /* Temporary string pointer for entry's user path */
|
2002-09-25 22:50:49 +08:00
|
|
|
|
herr_t ret_value=SUCCEED; /* Return value */
|
2002-08-29 02:34:12 +08:00
|
|
|
|
|
2002-09-25 22:50:49 +08:00
|
|
|
|
FUNC_ENTER_NOAPI(H5G_ent_copy, FAIL);
|
2002-08-29 02:34:12 +08:00
|
|
|
|
|
[svn-r6252] Purpose:
Lots of performance improvements & a couple new internal API interfaces.
Description:
Performance Improvements:
- Cached file offset & length sizes in shared file struct, to avoid
constantly looking them up in the FCPL.
- Generic property improvements:
- Added "revision" number to generic property classes to speed
up comparisons.
- Changed method of storing properties from using a hash-table
to the TBBT routines in the library.
- Share the propery names between classes and the lists derived
from them.
- Removed redundant 'def_value' buffer from each property.
- Switching code to use a "copy on write" strategy for
properties in each list, where the properties in each list
are shared with the properties in the class, until a
property's value is changed in a list.
- Fixed error in layout code which was allocating too many buffers.
- Redefined public macros of the form (H5open()/H5check, <variable>)
internally to only be (<variable>), avoiding innumerable useless
calls to H5open() and H5check_version().
- Reuse already zeroed buffers in H5F_contig_fill instead of
constantly re-zeroing them.
- Don't write fill values if writing entire dataset.
- Use gettimeofday() system call instead of time() system when
checking the modification time of a dataset.
- Added reference counted string API and use it for tracking the
names of objects opening in a file (for the ID->name code).
- Removed redundant H5P_get() calls in B-tree routines.
- Redefine H5T datatype macros internally to the library, to avoid
calling H5check redundantly.
- Keep dataspace information for dataset locally instead of reading
from disk each time. Added new module to track open objects
in a file, to allow this (which will be useful eventually for
some FPH5 metadata caching issues).
- Remove H5AC_find macro which was inlining metadata cache lookups,
and call function instead.
- Remove redundant memset() calls from H5G_namei() routine.
- Remove redundant checking of object type when locating objects
in metadata cache and rely on the address only.
- Create default dataset object to use when default dataset creation
property list is used to create datasets, bypassing querying
for all the property list values.
- Use default I/O vector size when performing raw data with the
default dataset transfer property list, instead of querying for
I/O vector size.
- Remove H5P_DEFAULT internally to the library, replacing it with
more specific default property list based on the type of
property list needed.
- Remove redundant memset() calls in object header message (H5O*)
routines.
- Remove redunant memset() calls in data I/O routines.
- Split free-list allocation routines into malloc() and calloc()-
like routines, instead of one combined routine.
- Remove lots of indirection in H5O*() routines.
- Simplify metadata cache entry comparison routine (used when
flushing entire cache out).
- Only enable metadata cache statistics when H5AC_DEBUG is turned
on, instead of always tracking them.
- Simplify address comparison macro (H5F_addr_eq).
- Remove redundant metadata cache entry protections during dataset
creation by protecting the object header once and making all
the modifications necessary for the dataset creation before
unprotecting it.
- Reduce # of "number of element in extent" computations performed
by computing and storing the value during dataspace creation.
- Simplify checking for group location's file information, when file
has not been involving in file-mounting operations.
- Use binary encoding for modification time, instead of ASCII.
- Hoist H5HL_peek calls (to get information in a local heap)
out of loops in many group routine.
- Use static variable for iterators of selections, instead of
dynamically allocation them each time.
- Lookup & insert new entries in one step, avoiding traversing
group's B-tree twice.
- Fixed memory leak in H5Gget_objname_idx() routine (tangential to
performance improvements, but fixed along the way).
- Use free-list for reference counted strings.
- Don't bother copying object names into cached group entries,
since they are re-created when an object is opened.
The benchmark I used to measure these results created several thousand
small (2K) datasets in a file and wrote out the data for them. This is
Elena's "regular.c" benchmark.
These changes resulted in approximately ~4.3x speedup of the
development branch when compared to the previous code in the
development branch and ~1.4x speedup compared to the release
branch.
Additionally, these changes reduce the total memory used (code and
data) by the development branch by ~800KB, bringing the development
branch back into the same ballpark as the release branch.
I'll send out a more detailed description of the benchmark results
as a followup note.
New internal API routines:
Added "reference counted strings" API for tracking strings that get
used by multiple owners without duplicating the strings.
Added "ternary search tree" API for text->object mappings.
Platforms tested:
Tested h5committest {arabica (fortran), eirene (fortran, C++)
modi4 (parallel, fortran)}
Other platforms/configurations tested?
FreeBSD 4.7 (sleipnir) serial & parallel
Solaris 2.6 (baldric) serial
2003-01-10 01:20:03 +08:00
|
|
|
|
/* Check arguments */
|
|
|
|
|
assert(src);
|
|
|
|
|
assert(dst);
|
2002-08-29 02:34:12 +08:00
|
|
|
|
|
2002-10-15 04:08:23 +08:00
|
|
|
|
/* If the depth is "very shallow", keep the old entry's user path */
|
|
|
|
|
if(depth==H5G_COPY_LIMITED) {
|
[svn-r6252] Purpose:
Lots of performance improvements & a couple new internal API interfaces.
Description:
Performance Improvements:
- Cached file offset & length sizes in shared file struct, to avoid
constantly looking them up in the FCPL.
- Generic property improvements:
- Added "revision" number to generic property classes to speed
up comparisons.
- Changed method of storing properties from using a hash-table
to the TBBT routines in the library.
- Share the propery names between classes and the lists derived
from them.
- Removed redundant 'def_value' buffer from each property.
- Switching code to use a "copy on write" strategy for
properties in each list, where the properties in each list
are shared with the properties in the class, until a
property's value is changed in a list.
- Fixed error in layout code which was allocating too many buffers.
- Redefined public macros of the form (H5open()/H5check, <variable>)
internally to only be (<variable>), avoiding innumerable useless
calls to H5open() and H5check_version().
- Reuse already zeroed buffers in H5F_contig_fill instead of
constantly re-zeroing them.
- Don't write fill values if writing entire dataset.
- Use gettimeofday() system call instead of time() system when
checking the modification time of a dataset.
- Added reference counted string API and use it for tracking the
names of objects opening in a file (for the ID->name code).
- Removed redundant H5P_get() calls in B-tree routines.
- Redefine H5T datatype macros internally to the library, to avoid
calling H5check redundantly.
- Keep dataspace information for dataset locally instead of reading
from disk each time. Added new module to track open objects
in a file, to allow this (which will be useful eventually for
some FPH5 metadata caching issues).
- Remove H5AC_find macro which was inlining metadata cache lookups,
and call function instead.
- Remove redundant memset() calls from H5G_namei() routine.
- Remove redundant checking of object type when locating objects
in metadata cache and rely on the address only.
- Create default dataset object to use when default dataset creation
property list is used to create datasets, bypassing querying
for all the property list values.
- Use default I/O vector size when performing raw data with the
default dataset transfer property list, instead of querying for
I/O vector size.
- Remove H5P_DEFAULT internally to the library, replacing it with
more specific default property list based on the type of
property list needed.
- Remove redundant memset() calls in object header message (H5O*)
routines.
- Remove redunant memset() calls in data I/O routines.
- Split free-list allocation routines into malloc() and calloc()-
like routines, instead of one combined routine.
- Remove lots of indirection in H5O*() routines.
- Simplify metadata cache entry comparison routine (used when
flushing entire cache out).
- Only enable metadata cache statistics when H5AC_DEBUG is turned
on, instead of always tracking them.
- Simplify address comparison macro (H5F_addr_eq).
- Remove redundant metadata cache entry protections during dataset
creation by protecting the object header once and making all
the modifications necessary for the dataset creation before
unprotecting it.
- Reduce # of "number of element in extent" computations performed
by computing and storing the value during dataspace creation.
- Simplify checking for group location's file information, when file
has not been involving in file-mounting operations.
- Use binary encoding for modification time, instead of ASCII.
- Hoist H5HL_peek calls (to get information in a local heap)
out of loops in many group routine.
- Use static variable for iterators of selections, instead of
dynamically allocation them each time.
- Lookup & insert new entries in one step, avoiding traversing
group's B-tree twice.
- Fixed memory leak in H5Gget_objname_idx() routine (tangential to
performance improvements, but fixed along the way).
- Use free-list for reference counted strings.
- Don't bother copying object names into cached group entries,
since they are re-created when an object is opened.
The benchmark I used to measure these results created several thousand
small (2K) datasets in a file and wrote out the data for them. This is
Elena's "regular.c" benchmark.
These changes resulted in approximately ~4.3x speedup of the
development branch when compared to the previous code in the
development branch and ~1.4x speedup compared to the release
branch.
Additionally, these changes reduce the total memory used (code and
data) by the development branch by ~800KB, bringing the development
branch back into the same ballpark as the release branch.
I'll send out a more detailed description of the benchmark results
as a followup note.
New internal API routines:
Added "reference counted strings" API for tracking strings that get
used by multiple owners without duplicating the strings.
Added "ternary search tree" API for text->object mappings.
Platforms tested:
Tested h5committest {arabica (fortran), eirene (fortran, C++)
modi4 (parallel, fortran)}
Other platforms/configurations tested?
FreeBSD 4.7 (sleipnir) serial & parallel
Solaris 2.6 (baldric) serial
2003-01-10 01:20:03 +08:00
|
|
|
|
tmp_user_path_r=dst->user_path_r;
|
|
|
|
|
H5RS_decr(dst->canon_path_r);
|
2002-10-15 04:08:23 +08:00
|
|
|
|
} /* end if */
|
|
|
|
|
|
2002-09-25 22:50:49 +08:00
|
|
|
|
/* Copy the top level information */
|
|
|
|
|
HDmemcpy(dst,src,sizeof(H5G_entry_t));
|
2002-08-29 02:34:12 +08:00
|
|
|
|
|
2002-09-25 22:50:49 +08:00
|
|
|
|
/* Deep copy the names */
|
2002-10-15 04:08:23 +08:00
|
|
|
|
if(depth==H5G_COPY_DEEP) {
|
[svn-r6252] Purpose:
Lots of performance improvements & a couple new internal API interfaces.
Description:
Performance Improvements:
- Cached file offset & length sizes in shared file struct, to avoid
constantly looking them up in the FCPL.
- Generic property improvements:
- Added "revision" number to generic property classes to speed
up comparisons.
- Changed method of storing properties from using a hash-table
to the TBBT routines in the library.
- Share the propery names between classes and the lists derived
from them.
- Removed redundant 'def_value' buffer from each property.
- Switching code to use a "copy on write" strategy for
properties in each list, where the properties in each list
are shared with the properties in the class, until a
property's value is changed in a list.
- Fixed error in layout code which was allocating too many buffers.
- Redefined public macros of the form (H5open()/H5check, <variable>)
internally to only be (<variable>), avoiding innumerable useless
calls to H5open() and H5check_version().
- Reuse already zeroed buffers in H5F_contig_fill instead of
constantly re-zeroing them.
- Don't write fill values if writing entire dataset.
- Use gettimeofday() system call instead of time() system when
checking the modification time of a dataset.
- Added reference counted string API and use it for tracking the
names of objects opening in a file (for the ID->name code).
- Removed redundant H5P_get() calls in B-tree routines.
- Redefine H5T datatype macros internally to the library, to avoid
calling H5check redundantly.
- Keep dataspace information for dataset locally instead of reading
from disk each time. Added new module to track open objects
in a file, to allow this (which will be useful eventually for
some FPH5 metadata caching issues).
- Remove H5AC_find macro which was inlining metadata cache lookups,
and call function instead.
- Remove redundant memset() calls from H5G_namei() routine.
- Remove redundant checking of object type when locating objects
in metadata cache and rely on the address only.
- Create default dataset object to use when default dataset creation
property list is used to create datasets, bypassing querying
for all the property list values.
- Use default I/O vector size when performing raw data with the
default dataset transfer property list, instead of querying for
I/O vector size.
- Remove H5P_DEFAULT internally to the library, replacing it with
more specific default property list based on the type of
property list needed.
- Remove redundant memset() calls in object header message (H5O*)
routines.
- Remove redunant memset() calls in data I/O routines.
- Split free-list allocation routines into malloc() and calloc()-
like routines, instead of one combined routine.
- Remove lots of indirection in H5O*() routines.
- Simplify metadata cache entry comparison routine (used when
flushing entire cache out).
- Only enable metadata cache statistics when H5AC_DEBUG is turned
on, instead of always tracking them.
- Simplify address comparison macro (H5F_addr_eq).
- Remove redundant metadata cache entry protections during dataset
creation by protecting the object header once and making all
the modifications necessary for the dataset creation before
unprotecting it.
- Reduce # of "number of element in extent" computations performed
by computing and storing the value during dataspace creation.
- Simplify checking for group location's file information, when file
has not been involving in file-mounting operations.
- Use binary encoding for modification time, instead of ASCII.
- Hoist H5HL_peek calls (to get information in a local heap)
out of loops in many group routine.
- Use static variable for iterators of selections, instead of
dynamically allocation them each time.
- Lookup & insert new entries in one step, avoiding traversing
group's B-tree twice.
- Fixed memory leak in H5Gget_objname_idx() routine (tangential to
performance improvements, but fixed along the way).
- Use free-list for reference counted strings.
- Don't bother copying object names into cached group entries,
since they are re-created when an object is opened.
The benchmark I used to measure these results created several thousand
small (2K) datasets in a file and wrote out the data for them. This is
Elena's "regular.c" benchmark.
These changes resulted in approximately ~4.3x speedup of the
development branch when compared to the previous code in the
development branch and ~1.4x speedup compared to the release
branch.
Additionally, these changes reduce the total memory used (code and
data) by the development branch by ~800KB, bringing the development
branch back into the same ballpark as the release branch.
I'll send out a more detailed description of the benchmark results
as a followup note.
New internal API routines:
Added "reference counted strings" API for tracking strings that get
used by multiple owners without duplicating the strings.
Added "ternary search tree" API for text->object mappings.
Platforms tested:
Tested h5committest {arabica (fortran), eirene (fortran, C++)
modi4 (parallel, fortran)}
Other platforms/configurations tested?
FreeBSD 4.7 (sleipnir) serial & parallel
Solaris 2.6 (baldric) serial
2003-01-10 01:20:03 +08:00
|
|
|
|
dst->user_path_r=H5RS_dup(src->user_path_r);
|
|
|
|
|
dst->canon_path_r=H5RS_dup(src->canon_path_r);
|
2002-10-15 04:08:23 +08:00
|
|
|
|
} else if(depth==H5G_COPY_LIMITED) {
|
[svn-r6252] Purpose:
Lots of performance improvements & a couple new internal API interfaces.
Description:
Performance Improvements:
- Cached file offset & length sizes in shared file struct, to avoid
constantly looking them up in the FCPL.
- Generic property improvements:
- Added "revision" number to generic property classes to speed
up comparisons.
- Changed method of storing properties from using a hash-table
to the TBBT routines in the library.
- Share the propery names between classes and the lists derived
from them.
- Removed redundant 'def_value' buffer from each property.
- Switching code to use a "copy on write" strategy for
properties in each list, where the properties in each list
are shared with the properties in the class, until a
property's value is changed in a list.
- Fixed error in layout code which was allocating too many buffers.
- Redefined public macros of the form (H5open()/H5check, <variable>)
internally to only be (<variable>), avoiding innumerable useless
calls to H5open() and H5check_version().
- Reuse already zeroed buffers in H5F_contig_fill instead of
constantly re-zeroing them.
- Don't write fill values if writing entire dataset.
- Use gettimeofday() system call instead of time() system when
checking the modification time of a dataset.
- Added reference counted string API and use it for tracking the
names of objects opening in a file (for the ID->name code).
- Removed redundant H5P_get() calls in B-tree routines.
- Redefine H5T datatype macros internally to the library, to avoid
calling H5check redundantly.
- Keep dataspace information for dataset locally instead of reading
from disk each time. Added new module to track open objects
in a file, to allow this (which will be useful eventually for
some FPH5 metadata caching issues).
- Remove H5AC_find macro which was inlining metadata cache lookups,
and call function instead.
- Remove redundant memset() calls from H5G_namei() routine.
- Remove redundant checking of object type when locating objects
in metadata cache and rely on the address only.
- Create default dataset object to use when default dataset creation
property list is used to create datasets, bypassing querying
for all the property list values.
- Use default I/O vector size when performing raw data with the
default dataset transfer property list, instead of querying for
I/O vector size.
- Remove H5P_DEFAULT internally to the library, replacing it with
more specific default property list based on the type of
property list needed.
- Remove redundant memset() calls in object header message (H5O*)
routines.
- Remove redunant memset() calls in data I/O routines.
- Split free-list allocation routines into malloc() and calloc()-
like routines, instead of one combined routine.
- Remove lots of indirection in H5O*() routines.
- Simplify metadata cache entry comparison routine (used when
flushing entire cache out).
- Only enable metadata cache statistics when H5AC_DEBUG is turned
on, instead of always tracking them.
- Simplify address comparison macro (H5F_addr_eq).
- Remove redundant metadata cache entry protections during dataset
creation by protecting the object header once and making all
the modifications necessary for the dataset creation before
unprotecting it.
- Reduce # of "number of element in extent" computations performed
by computing and storing the value during dataspace creation.
- Simplify checking for group location's file information, when file
has not been involving in file-mounting operations.
- Use binary encoding for modification time, instead of ASCII.
- Hoist H5HL_peek calls (to get information in a local heap)
out of loops in many group routine.
- Use static variable for iterators of selections, instead of
dynamically allocation them each time.
- Lookup & insert new entries in one step, avoiding traversing
group's B-tree twice.
- Fixed memory leak in H5Gget_objname_idx() routine (tangential to
performance improvements, but fixed along the way).
- Use free-list for reference counted strings.
- Don't bother copying object names into cached group entries,
since they are re-created when an object is opened.
The benchmark I used to measure these results created several thousand
small (2K) datasets in a file and wrote out the data for them. This is
Elena's "regular.c" benchmark.
These changes resulted in approximately ~4.3x speedup of the
development branch when compared to the previous code in the
development branch and ~1.4x speedup compared to the release
branch.
Additionally, these changes reduce the total memory used (code and
data) by the development branch by ~800KB, bringing the development
branch back into the same ballpark as the release branch.
I'll send out a more detailed description of the benchmark results
as a followup note.
New internal API routines:
Added "reference counted strings" API for tracking strings that get
used by multiple owners without duplicating the strings.
Added "ternary search tree" API for text->object mappings.
Platforms tested:
Tested h5committest {arabica (fortran), eirene (fortran, C++)
modi4 (parallel, fortran)}
Other platforms/configurations tested?
FreeBSD 4.7 (sleipnir) serial & parallel
Solaris 2.6 (baldric) serial
2003-01-10 01:20:03 +08:00
|
|
|
|
dst->user_path_r=tmp_user_path_r;
|
|
|
|
|
dst->canon_path_r=H5RS_dup(src->canon_path_r);
|
|
|
|
|
} else if(depth==H5G_COPY_NULL) {
|
|
|
|
|
dst->user_path_r=NULL;
|
|
|
|
|
dst->canon_path_r=NULL;
|
2002-10-15 04:08:23 +08:00
|
|
|
|
} /* end if */
|
2002-08-29 02:34:12 +08:00
|
|
|
|
|
|
|
|
|
done:
|
2003-01-11 04:26:02 +08:00
|
|
|
|
FUNC_LEAVE_NOAPI(ret_value);
|
2002-08-29 02:34:12 +08:00
|
|
|
|
}
|
|
|
|
|
|
1997-09-22 10:08:54 +08:00
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Function: H5G_ent_debug
|
1997-09-22 10:08:54 +08:00
|
|
|
|
*
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Purpose: Prints debugging information about a symbol table entry.
|
1997-09-22 10:08:54 +08:00
|
|
|
|
*
|
|
|
|
|
* Errors:
|
|
|
|
|
*
|
1998-10-27 05:18:54 +08:00
|
|
|
|
* Return: Non-negative on success/Negative on failure
|
1997-09-22 10:08:54 +08:00
|
|
|
|
*
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Programmer: Robb Matzke
|
|
|
|
|
* matzke@llnl.gov
|
|
|
|
|
* Aug 29 1997
|
1997-09-22 10:08:54 +08:00
|
|
|
|
*
|
|
|
|
|
* Modifications:
|
1999-07-29 02:25:43 +08:00
|
|
|
|
* Robb Matzke, 1999-07-28
|
|
|
|
|
* The HEAP argument is passed by value.
|
1997-09-22 10:08:54 +08:00
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
herr_t
|
2003-02-11 01:26:09 +08:00
|
|
|
|
H5G_ent_debug(H5F_t UNUSED *f, hid_t dxpl_id, const H5G_entry_t *ent, FILE * stream,
|
2001-08-15 06:09:56 +08:00
|
|
|
|
int indent, int fwidth, haddr_t heap)
|
1997-09-22 10:08:54 +08:00
|
|
|
|
{
|
1998-04-15 00:44:46 +08:00
|
|
|
|
const char *lval = NULL;
|
2003-03-22 22:53:27 +08:00
|
|
|
|
int nested_indent, nested_fwidth;
|
2002-08-10 04:48:23 +08:00
|
|
|
|
herr_t ret_value=SUCCEED; /* Return value */
|
1998-04-15 00:44:46 +08:00
|
|
|
|
|
2002-05-29 23:07:55 +08:00
|
|
|
|
FUNC_ENTER_NOAPI(H5G_ent_debug, FAIL);
|
1998-01-17 06:23:43 +08:00
|
|
|
|
|
2003-03-22 22:53:27 +08:00
|
|
|
|
/* Calculate the indent & field width values for nested information */
|
|
|
|
|
nested_indent=indent+3;
|
|
|
|
|
nested_fwidth=MAX(0,fwidth-3);
|
|
|
|
|
|
1999-07-29 02:25:43 +08:00
|
|
|
|
HDfprintf(stream, "%*s%-*s %lu\n", indent, "", fwidth,
|
|
|
|
|
"Name offset into private heap:",
|
|
|
|
|
(unsigned long) (ent->name_off));
|
1998-01-17 06:23:43 +08:00
|
|
|
|
|
1999-07-29 02:25:43 +08:00
|
|
|
|
HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth,
|
|
|
|
|
"Object header address:", ent->header);
|
1998-01-17 06:23:43 +08:00
|
|
|
|
|
1999-07-29 02:25:43 +08:00
|
|
|
|
HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
|
|
|
|
|
"Dirty:",
|
|
|
|
|
ent->dirty ? "Yes" : "No");
|
|
|
|
|
HDfprintf(stream, "%*s%-*s ", indent, "", fwidth,
|
2003-03-22 22:53:27 +08:00
|
|
|
|
"Cache info type:");
|
1998-01-17 06:23:43 +08:00
|
|
|
|
switch (ent->type) {
|
2003-03-22 22:53:27 +08:00
|
|
|
|
case H5G_NOTHING_CACHED:
|
|
|
|
|
HDfprintf(stream, "Nothing Cached\n");
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case H5G_CACHED_STAB:
|
|
|
|
|
HDfprintf(stream, "Symbol Table\n");
|
|
|
|
|
|
|
|
|
|
HDfprintf(stream, "%*s%-*s\n", indent, "", fwidth,
|
|
|
|
|
"Cached entry information:");
|
|
|
|
|
HDfprintf(stream, "%*s%-*s %a\n", nested_indent, "", nested_fwidth,
|
|
|
|
|
"B-tree address:", ent->cache.stab.btree_addr);
|
|
|
|
|
|
|
|
|
|
HDfprintf(stream, "%*s%-*s %a\n", nested_indent, "", nested_fwidth,
|
|
|
|
|
"Heap address:", ent->cache.stab.heap_addr);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case H5G_CACHED_SLINK:
|
|
|
|
|
HDfprintf (stream, "Symbolic Link\n");
|
|
|
|
|
HDfprintf(stream, "%*s%-*s ", indent, "", fwidth,
|
|
|
|
|
"Cached information:\n");
|
|
|
|
|
HDfprintf (stream, "%*s%-*s %lu\n", nested_indent, "", nested_fwidth,
|
|
|
|
|
"Link value offset:",
|
|
|
|
|
(unsigned long)(ent->cache.slink.lval_offset));
|
|
|
|
|
if (H5F_addr_defined(heap)) {
|
|
|
|
|
lval = H5HL_peek (ent->file, dxpl_id, heap, ent->cache.slink.lval_offset);
|
|
|
|
|
HDfprintf (stream, "%*s%-*s %s\n", nested_indent, "", nested_fwidth,
|
|
|
|
|
"Link value:",
|
|
|
|
|
lval);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
HDfprintf(stream, "*** Unknown symbol type %d\n", ent->type);
|
|
|
|
|
break;
|
1998-01-17 06:23:43 +08:00
|
|
|
|
}
|
|
|
|
|
|
2002-08-10 04:48:23 +08:00
|
|
|
|
done:
|
2003-01-11 04:26:02 +08:00
|
|
|
|
FUNC_LEAVE_NOAPI(ret_value);
|
1997-09-22 10:08:54 +08:00
|
|
|
|
}
|