2006-05-15 12:35:53 +08:00
|
|
|
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
2007-02-07 22:56:24 +08:00
|
|
|
|
* Copyright by The HDF Group. *
|
2006-05-15 12:35:53 +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 *
|
2017-04-18 03:32:16 +08:00
|
|
|
|
* the COPYING file, which can be found at the root of the source code *
|
|
|
|
|
* distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
|
|
|
|
|
* If you do not have access to either file, you may request a copy from *
|
|
|
|
|
* help@hdfgroup.org. *
|
2006-05-15 12:35:53 +08:00
|
|
|
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
|
*
|
|
|
|
|
* Created: H5HFspace.c
|
|
|
|
|
* May 2 2006
|
|
|
|
|
* Quincey Koziol <koziol@ncsa.uiuc.edu>
|
|
|
|
|
*
|
|
|
|
|
* Purpose: Space allocation routines for fractal heaps.
|
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/****************/
|
|
|
|
|
/* Module Setup */
|
|
|
|
|
/****************/
|
|
|
|
|
|
2015-09-14 11:58:59 +08:00
|
|
|
|
#include "H5HFmodule.h" /* This source code file is part of the H5HF module */
|
|
|
|
|
|
2006-05-15 12:35:53 +08:00
|
|
|
|
|
|
|
|
|
/***********/
|
|
|
|
|
/* Headers */
|
|
|
|
|
/***********/
|
|
|
|
|
#include "H5private.h" /* Generic Functions */
|
|
|
|
|
#include "H5Eprivate.h" /* Error handling */
|
|
|
|
|
#include "H5HFpkg.h" /* Fractal heaps */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/****************/
|
|
|
|
|
/* Local Macros */
|
|
|
|
|
/****************/
|
|
|
|
|
|
|
|
|
|
#define H5HF_FSPACE_SHRINK 80 /* Percent of "normal" size to shrink serialized free space size */
|
|
|
|
|
#define H5HF_FSPACE_EXPAND 120 /* Percent of "normal" size to expand serialized free space size */
|
[svn-r15800] Description:
Bring file free space branch changes through r15795 into trunk, which
includes a fair bit of code cleanup & rearrangement along with a couple of
bug fixes also.
Tested on:
Mac OS X/32 10.5.5 (amazon) in debug mode
Mac OS X/32 10.5.5 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) 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
2008-10-07 12:17:35 +08:00
|
|
|
|
#define H5HF_FSPACE_THRHD_DEF 1 /* Default: no alignment threshold */
|
|
|
|
|
#define H5HF_FSPACE_ALIGN_DEF 1 /* Default: no alignment */
|
2006-05-15 12:35:53 +08:00
|
|
|
|
|
|
|
|
|
/******************/
|
|
|
|
|
/* Local Typedefs */
|
|
|
|
|
/******************/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/********************/
|
|
|
|
|
/* Package Typedefs */
|
|
|
|
|
/********************/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/********************/
|
|
|
|
|
/* Local Prototypes */
|
|
|
|
|
/********************/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*********************/
|
|
|
|
|
/* Package Variables */
|
|
|
|
|
/*********************/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*****************************/
|
|
|
|
|
/* Library Private Variables */
|
|
|
|
|
/*****************************/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*******************/
|
|
|
|
|
/* Local Variables */
|
|
|
|
|
/*******************/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
2018-03-16 05:54:30 +08:00
|
|
|
|
* Function: H5HF__space_start
|
2006-05-15 12:35:53 +08:00
|
|
|
|
*
|
|
|
|
|
* Purpose: "Start up" free space for heap - open existing free space
|
|
|
|
|
* structure if one exists, otherwise create a new free space
|
|
|
|
|
* structure
|
|
|
|
|
*
|
|
|
|
|
* Return: Success: non-negative
|
|
|
|
|
*
|
|
|
|
|
* Failure: negative
|
|
|
|
|
*
|
|
|
|
|
* Programmer: Quincey Koziol
|
|
|
|
|
* koziol@ncsa.uiuc.edu
|
|
|
|
|
* May 2 2006
|
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
herr_t
|
2018-03-16 05:54:30 +08:00
|
|
|
|
H5HF__space_start(H5HF_hdr_t *hdr, hbool_t may_create)
|
2006-05-15 12:35:53 +08:00
|
|
|
|
{
|
|
|
|
|
const H5FS_section_class_t *classes[] = { /* Free space section classes implemented for fractal heap */
|
2006-06-19 18:06:10 +08:00
|
|
|
|
H5HF_FSPACE_SECT_CLS_SINGLE,
|
2006-07-22 09:55:14 +08:00
|
|
|
|
H5HF_FSPACE_SECT_CLS_FIRST_ROW,
|
|
|
|
|
H5HF_FSPACE_SECT_CLS_NORMAL_ROW,
|
2006-06-19 18:06:10 +08:00
|
|
|
|
H5HF_FSPACE_SECT_CLS_INDIRECT};
|
2006-05-15 12:35:53 +08:00
|
|
|
|
herr_t ret_value = SUCCEED; /* Return value */
|
|
|
|
|
|
2018-03-16 05:54:30 +08:00
|
|
|
|
FUNC_ENTER_PACKAGE
|
2006-05-15 12:35:53 +08:00
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Check arguments.
|
|
|
|
|
*/
|
|
|
|
|
HDassert(hdr);
|
|
|
|
|
|
|
|
|
|
/* Check for creating free space info for the heap */
|
|
|
|
|
if(H5F_addr_defined(hdr->fs_addr)) {
|
|
|
|
|
/* Open an existing free space structure for the heap */
|
2018-03-16 05:54:30 +08:00
|
|
|
|
if(NULL == (hdr->fspace = H5FS_open(hdr->f, hdr->fs_addr,
|
[svn-r16060] Description:
Remove unused field from direct block struct.
Tested on:
Mac OS X/32 10.5.5 (amazon) in debug mode
Mac OS X/32 10.5.5 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
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
2008-11-12 07:29:04 +08:00
|
|
|
|
NELMTS(classes), classes, hdr, (hsize_t)H5HF_FSPACE_THRHD_DEF, (hsize_t)H5HF_FSPACE_ALIGN_DEF)))
|
2006-05-15 12:35:53 +08:00
|
|
|
|
HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't initialize free space info")
|
|
|
|
|
} /* end if */
|
|
|
|
|
else {
|
[svn-r14364] Description:
Avoid creating free space manager for fractal heap when just performing
queries.
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
2008-01-04 03:01:17 +08:00
|
|
|
|
/* Check if we are allowed to create the free space manager */
|
|
|
|
|
if(may_create) {
|
|
|
|
|
H5FS_create_t fs_create; /* Free space creation parameters */
|
|
|
|
|
|
|
|
|
|
/* Set the free space creation parameters */
|
|
|
|
|
fs_create.client = H5FS_CLIENT_FHEAP_ID;
|
|
|
|
|
fs_create.shrink_percent = H5HF_FSPACE_SHRINK;
|
|
|
|
|
fs_create.expand_percent = H5HF_FSPACE_EXPAND;
|
|
|
|
|
fs_create.max_sect_size = hdr->man_dtable.cparam.max_direct_size;
|
|
|
|
|
fs_create.max_sect_addr = hdr->man_dtable.cparam.max_index;
|
|
|
|
|
|
|
|
|
|
/* Create the free space structure for the heap */
|
2018-03-16 05:54:30 +08:00
|
|
|
|
if(NULL == (hdr->fspace = H5FS_create(hdr->f, &hdr->fs_addr,
|
[svn-r16060] Description:
Remove unused field from direct block struct.
Tested on:
Mac OS X/32 10.5.5 (amazon) in debug mode
Mac OS X/32 10.5.5 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
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
2008-11-12 07:29:04 +08:00
|
|
|
|
&fs_create, NELMTS(classes), classes, hdr, (hsize_t)H5HF_FSPACE_THRHD_DEF, (hsize_t)H5HF_FSPACE_ALIGN_DEF)))
|
[svn-r14364] Description:
Avoid creating free space manager for fractal heap when just performing
queries.
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
2008-01-04 03:01:17 +08:00
|
|
|
|
HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't initialize free space info")
|
[svn-r15800] Description:
Bring file free space branch changes through r15795 into trunk, which
includes a fair bit of code cleanup & rearrangement along with a couple of
bug fixes also.
Tested on:
Mac OS X/32 10.5.5 (amazon) in debug mode
Mac OS X/32 10.5.5 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) 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
2008-10-07 12:17:35 +08:00
|
|
|
|
HDassert(H5F_addr_defined(hdr->fs_addr));
|
[svn-r14364] Description:
Avoid creating free space manager for fractal heap when just performing
queries.
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
2008-01-04 03:01:17 +08:00
|
|
|
|
} /* end if */
|
2006-05-15 12:35:53 +08:00
|
|
|
|
} /* end else */
|
|
|
|
|
|
|
|
|
|
done:
|
|
|
|
|
FUNC_LEAVE_NOAPI(ret_value)
|
2018-03-16 05:54:30 +08:00
|
|
|
|
} /* end H5HF__space_start() */
|
2006-05-15 12:35:53 +08:00
|
|
|
|
|
2006-07-25 09:40:00 +08:00
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
2018-03-16 05:54:30 +08:00
|
|
|
|
* Function: H5HF__space_add
|
2006-07-25 09:40:00 +08:00
|
|
|
|
*
|
|
|
|
|
* Purpose: Add a section to the free space for the heap
|
|
|
|
|
*
|
|
|
|
|
* Return: Success: non-negative
|
|
|
|
|
*
|
|
|
|
|
* Failure: negative
|
|
|
|
|
*
|
|
|
|
|
* Programmer: Quincey Koziol
|
|
|
|
|
* koziol@ncsa.uiuc.edu
|
|
|
|
|
* May 15 2006
|
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
herr_t
|
2018-03-16 05:54:30 +08:00
|
|
|
|
H5HF__space_add(H5HF_hdr_t *hdr, H5HF_free_section_t *node, unsigned flags)
|
2006-07-25 09:40:00 +08:00
|
|
|
|
{
|
[svn-r22233] Description:
Correct several errors in fractal heap code: root indirect block was
getting pinned/protected more than once, "single" free space sections weren't
getting "re-parented" correctly when the heap transitioned between having a
root indirect block and a root direct block, and several related issues. Also
cleaned up some warnings in library/tests.
Tested on:
FreeBSD/32 8.2 (loyalty) w/gcc4.6, w/C++ & FORTRAN, in debug mode
FreeBSD/64 8.2 (freedom) w/gcc4.6, w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x,
w/C++ & FORTRAN, w/threadsafe, in debug mode
Linux/64-amd64 2.6 (koala) w/Intel compilers, w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Mac OSX/64 10.7.3 (amazon) w/debug
2012-04-02 07:53:17 +08:00
|
|
|
|
H5HF_sect_add_ud_t udata; /* User data for free space manager 'add' */
|
2006-07-25 09:40:00 +08:00
|
|
|
|
herr_t ret_value = SUCCEED; /* Return value */
|
|
|
|
|
|
2018-03-16 05:54:30 +08:00
|
|
|
|
FUNC_ENTER_PACKAGE
|
2006-07-25 09:40:00 +08:00
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Check arguments.
|
|
|
|
|
*/
|
|
|
|
|
HDassert(hdr);
|
|
|
|
|
HDassert(node);
|
|
|
|
|
|
|
|
|
|
/* Check if the free space for the heap has been initialized */
|
|
|
|
|
if(!hdr->fspace)
|
2018-03-16 05:54:30 +08:00
|
|
|
|
if(H5HF__space_start(hdr, TRUE) < 0)
|
2006-07-25 09:40:00 +08:00
|
|
|
|
HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't initialize heap free space")
|
|
|
|
|
|
|
|
|
|
/* Construct user data */
|
|
|
|
|
udata.hdr = hdr;
|
|
|
|
|
|
|
|
|
|
/* Add to the free space for the heap */
|
2018-03-16 05:54:30 +08:00
|
|
|
|
if(H5FS_sect_add(hdr->f, hdr->fspace, (H5FS_section_info_t *)node, flags, &udata) < 0)
|
2006-07-25 09:40:00 +08:00
|
|
|
|
HGOTO_ERROR(H5E_HEAP, H5E_CANTINSERT, FAIL, "can't add section to heap free space")
|
|
|
|
|
|
|
|
|
|
done:
|
|
|
|
|
FUNC_LEAVE_NOAPI(ret_value)
|
2018-03-16 05:54:30 +08:00
|
|
|
|
} /* end H5HF__space_add() */
|
2006-07-25 09:40:00 +08:00
|
|
|
|
|
2006-05-15 12:35:53 +08:00
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
2018-03-16 05:54:30 +08:00
|
|
|
|
* Function: H5HF__space_find
|
2006-05-15 12:35:53 +08:00
|
|
|
|
*
|
|
|
|
|
* Purpose: Attempt to find space in a fractal heap
|
|
|
|
|
*
|
|
|
|
|
* Return: Success: non-negative
|
|
|
|
|
* Failure: negative
|
|
|
|
|
*
|
|
|
|
|
* Programmer: Quincey Koziol
|
|
|
|
|
* koziol@ncsa.uiuc.edu
|
|
|
|
|
* May 2 2006
|
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
htri_t
|
2018-03-16 05:54:30 +08:00
|
|
|
|
H5HF__space_find(H5HF_hdr_t *hdr, hsize_t request, H5HF_free_section_t **node)
|
2006-05-15 12:35:53 +08:00
|
|
|
|
{
|
[svn-r14364] Description:
Avoid creating free space manager for fractal heap when just performing
queries.
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
2008-01-04 03:01:17 +08:00
|
|
|
|
htri_t node_found = FALSE; /* Whether an existing free list node was found */
|
2015-09-14 11:58:59 +08:00
|
|
|
|
htri_t ret_value = FAIL; /* Return value */
|
2006-05-15 12:35:53 +08:00
|
|
|
|
|
2018-03-16 05:54:30 +08:00
|
|
|
|
FUNC_ENTER_PACKAGE
|
2006-05-15 12:35:53 +08:00
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Check arguments.
|
|
|
|
|
*/
|
|
|
|
|
HDassert(hdr);
|
|
|
|
|
HDassert(request);
|
|
|
|
|
HDassert(node);
|
|
|
|
|
|
|
|
|
|
/* Check if the free space for the heap has been initialized */
|
2006-06-19 18:06:10 +08:00
|
|
|
|
if(!hdr->fspace)
|
2018-03-16 05:54:30 +08:00
|
|
|
|
if(H5HF__space_start(hdr, FALSE) < 0)
|
2006-05-15 12:35:53 +08:00
|
|
|
|
HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't initialize heap free space")
|
|
|
|
|
|
|
|
|
|
/* Search for free space in the heap */
|
[svn-r14364] Description:
Avoid creating free space manager for fractal heap when just performing
queries.
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
2008-01-04 03:01:17 +08:00
|
|
|
|
if(hdr->fspace)
|
2018-03-16 05:54:30 +08:00
|
|
|
|
if((node_found = H5FS_sect_find(hdr->f, hdr->fspace, request, (H5FS_section_info_t **)node)) < 0)
|
[svn-r14364] Description:
Avoid creating free space manager for fractal heap when just performing
queries.
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
2008-01-04 03:01:17 +08:00
|
|
|
|
HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "can't locate free space in fractal heap")
|
2006-05-15 12:35:53 +08:00
|
|
|
|
|
|
|
|
|
/* Set return value */
|
|
|
|
|
ret_value = node_found;
|
|
|
|
|
|
|
|
|
|
done:
|
|
|
|
|
FUNC_LEAVE_NOAPI(ret_value)
|
2018-03-16 05:54:30 +08:00
|
|
|
|
} /* end H5HF__space_find() */
|
2006-05-15 12:35:53 +08:00
|
|
|
|
|
[svn-r22233] Description:
Correct several errors in fractal heap code: root indirect block was
getting pinned/protected more than once, "single" free space sections weren't
getting "re-parented" correctly when the heap transitioned between having a
root indirect block and a root direct block, and several related issues. Also
cleaned up some warnings in library/tests.
Tested on:
FreeBSD/32 8.2 (loyalty) w/gcc4.6, w/C++ & FORTRAN, in debug mode
FreeBSD/64 8.2 (freedom) w/gcc4.6, w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x,
w/C++ & FORTRAN, w/threadsafe, in debug mode
Linux/64-amd64 2.6 (koala) w/Intel compilers, w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Mac OSX/64 10.7.3 (amazon) w/debug
2012-04-02 07:53:17 +08:00
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
|
* Function: H5HF_space_revert_root_cb
|
|
|
|
|
*
|
|
|
|
|
* Purpose: Callback routine from iterator, to reset 'parent' pointers in
|
|
|
|
|
* sections, when the heap is changing from having a root indirect
|
|
|
|
|
* block to a direct block.
|
|
|
|
|
*
|
|
|
|
|
* Return: Success: non-negative
|
|
|
|
|
* Failure: negative
|
|
|
|
|
*
|
|
|
|
|
* Programmer: Quincey Koziol
|
|
|
|
|
* koziol@hdfgroup.org
|
|
|
|
|
* Feb 24 2012
|
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
static herr_t
|
2015-06-02 03:38:09 +08:00
|
|
|
|
H5HF_space_revert_root_cb(H5FS_section_info_t *_sect, void H5_ATTR_UNUSED *_udata)
|
[svn-r22233] Description:
Correct several errors in fractal heap code: root indirect block was
getting pinned/protected more than once, "single" free space sections weren't
getting "re-parented" correctly when the heap transitioned between having a
root indirect block and a root direct block, and several related issues. Also
cleaned up some warnings in library/tests.
Tested on:
FreeBSD/32 8.2 (loyalty) w/gcc4.6, w/C++ & FORTRAN, in debug mode
FreeBSD/64 8.2 (freedom) w/gcc4.6, w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x,
w/C++ & FORTRAN, w/threadsafe, in debug mode
Linux/64-amd64 2.6 (koala) w/Intel compilers, w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Mac OSX/64 10.7.3 (amazon) w/debug
2012-04-02 07:53:17 +08:00
|
|
|
|
{
|
|
|
|
|
H5HF_free_section_t *sect = (H5HF_free_section_t *)_sect; /* Section to dump info */
|
|
|
|
|
herr_t ret_value = SUCCEED; /* Return value */
|
|
|
|
|
|
|
|
|
|
FUNC_ENTER_NOAPI_NOINIT
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Check arguments.
|
|
|
|
|
*/
|
|
|
|
|
HDassert(sect);
|
|
|
|
|
|
|
|
|
|
/* Only modify "live" single blocks... */
|
|
|
|
|
if(sect->sect_info.type == H5HF_FSPACE_SECT_SINGLE && sect->sect_info.state == H5FS_SECT_LIVE) {
|
|
|
|
|
/* Release hold on previous indirect block (we must have one) */
|
|
|
|
|
HDassert(sect->u.single.parent);
|
2018-03-16 05:54:30 +08:00
|
|
|
|
if(H5HF__iblock_decr(sect->u.single.parent) < 0)
|
[svn-r22233] Description:
Correct several errors in fractal heap code: root indirect block was
getting pinned/protected more than once, "single" free space sections weren't
getting "re-parented" correctly when the heap transitioned between having a
root indirect block and a root direct block, and several related issues. Also
cleaned up some warnings in library/tests.
Tested on:
FreeBSD/32 8.2 (loyalty) w/gcc4.6, w/C++ & FORTRAN, in debug mode
FreeBSD/64 8.2 (freedom) w/gcc4.6, w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x,
w/C++ & FORTRAN, w/threadsafe, in debug mode
Linux/64-amd64 2.6 (koala) w/Intel compilers, w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Mac OSX/64 10.7.3 (amazon) w/debug
2012-04-02 07:53:17 +08:00
|
|
|
|
HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't decrement reference count on section's indirect block")
|
|
|
|
|
|
|
|
|
|
/* Reset parent information */
|
|
|
|
|
sect->u.single.parent = NULL;
|
|
|
|
|
sect->u.single.par_entry = 0;
|
|
|
|
|
} /* end if */
|
|
|
|
|
|
|
|
|
|
done:
|
|
|
|
|
FUNC_LEAVE_NOAPI(ret_value)
|
|
|
|
|
} /* end H5HF_space_revert_root_cb() */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
2018-03-16 05:54:30 +08:00
|
|
|
|
* Function: H5HF__space_revert_root
|
[svn-r22233] Description:
Correct several errors in fractal heap code: root indirect block was
getting pinned/protected more than once, "single" free space sections weren't
getting "re-parented" correctly when the heap transitioned between having a
root indirect block and a root direct block, and several related issues. Also
cleaned up some warnings in library/tests.
Tested on:
FreeBSD/32 8.2 (loyalty) w/gcc4.6, w/C++ & FORTRAN, in debug mode
FreeBSD/64 8.2 (freedom) w/gcc4.6, w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x,
w/C++ & FORTRAN, w/threadsafe, in debug mode
Linux/64-amd64 2.6 (koala) w/Intel compilers, w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Mac OSX/64 10.7.3 (amazon) w/debug
2012-04-02 07:53:17 +08:00
|
|
|
|
*
|
|
|
|
|
* Purpose: Reset 'parent' pointers in sections, when the heap is
|
|
|
|
|
* changing from having a root indirect block to a direct block.
|
|
|
|
|
*
|
|
|
|
|
* Return: Success: non-negative
|
|
|
|
|
* Failure: negative
|
|
|
|
|
*
|
|
|
|
|
* Programmer: Quincey Koziol
|
|
|
|
|
* koziol@hdfgroup.org
|
|
|
|
|
* Feb 23 2012
|
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
herr_t
|
2018-03-16 05:54:30 +08:00
|
|
|
|
H5HF__space_revert_root(const H5HF_hdr_t *hdr)
|
[svn-r22233] Description:
Correct several errors in fractal heap code: root indirect block was
getting pinned/protected more than once, "single" free space sections weren't
getting "re-parented" correctly when the heap transitioned between having a
root indirect block and a root direct block, and several related issues. Also
cleaned up some warnings in library/tests.
Tested on:
FreeBSD/32 8.2 (loyalty) w/gcc4.6, w/C++ & FORTRAN, in debug mode
FreeBSD/64 8.2 (freedom) w/gcc4.6, w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x,
w/C++ & FORTRAN, w/threadsafe, in debug mode
Linux/64-amd64 2.6 (koala) w/Intel compilers, w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Mac OSX/64 10.7.3 (amazon) w/debug
2012-04-02 07:53:17 +08:00
|
|
|
|
{
|
|
|
|
|
herr_t ret_value = SUCCEED; /* Return value */
|
|
|
|
|
|
2018-03-16 05:54:30 +08:00
|
|
|
|
FUNC_ENTER_PACKAGE
|
[svn-r22233] Description:
Correct several errors in fractal heap code: root indirect block was
getting pinned/protected more than once, "single" free space sections weren't
getting "re-parented" correctly when the heap transitioned between having a
root indirect block and a root direct block, and several related issues. Also
cleaned up some warnings in library/tests.
Tested on:
FreeBSD/32 8.2 (loyalty) w/gcc4.6, w/C++ & FORTRAN, in debug mode
FreeBSD/64 8.2 (freedom) w/gcc4.6, w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x,
w/C++ & FORTRAN, w/threadsafe, in debug mode
Linux/64-amd64 2.6 (koala) w/Intel compilers, w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Mac OSX/64 10.7.3 (amazon) w/debug
2012-04-02 07:53:17 +08:00
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Check arguments.
|
|
|
|
|
*/
|
|
|
|
|
HDassert(hdr);
|
|
|
|
|
|
|
|
|
|
/* Only need to scan the sections if the free space has been initialized */
|
2018-03-16 05:54:30 +08:00
|
|
|
|
if(hdr->fspace)
|
2018-09-21 04:38:40 +08:00
|
|
|
|
/* Iterate over all sections, resetting the parent pointers in 'single' sections */
|
2018-03-16 05:54:30 +08:00
|
|
|
|
if(H5FS_sect_iterate(hdr->f, hdr->fspace, H5HF_space_revert_root_cb, NULL) < 0)
|
[svn-r22233] Description:
Correct several errors in fractal heap code: root indirect block was
getting pinned/protected more than once, "single" free space sections weren't
getting "re-parented" correctly when the heap transitioned between having a
root indirect block and a root direct block, and several related issues. Also
cleaned up some warnings in library/tests.
Tested on:
FreeBSD/32 8.2 (loyalty) w/gcc4.6, w/C++ & FORTRAN, in debug mode
FreeBSD/64 8.2 (freedom) w/gcc4.6, w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x,
w/C++ & FORTRAN, w/threadsafe, in debug mode
Linux/64-amd64 2.6 (koala) w/Intel compilers, w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Mac OSX/64 10.7.3 (amazon) w/debug
2012-04-02 07:53:17 +08:00
|
|
|
|
HGOTO_ERROR(H5E_FSPACE, H5E_BADITER, FAIL, "can't iterate over sections to reset parent pointers")
|
|
|
|
|
|
|
|
|
|
done:
|
|
|
|
|
FUNC_LEAVE_NOAPI(ret_value)
|
2018-03-16 05:54:30 +08:00
|
|
|
|
} /* end H5HF__space_revert_root() */
|
[svn-r22233] Description:
Correct several errors in fractal heap code: root indirect block was
getting pinned/protected more than once, "single" free space sections weren't
getting "re-parented" correctly when the heap transitioned between having a
root indirect block and a root direct block, and several related issues. Also
cleaned up some warnings in library/tests.
Tested on:
FreeBSD/32 8.2 (loyalty) w/gcc4.6, w/C++ & FORTRAN, in debug mode
FreeBSD/64 8.2 (freedom) w/gcc4.6, w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x,
w/C++ & FORTRAN, w/threadsafe, in debug mode
Linux/64-amd64 2.6 (koala) w/Intel compilers, w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Mac OSX/64 10.7.3 (amazon) w/debug
2012-04-02 07:53:17 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
|
* Function: H5HF_space_create_root_cb
|
|
|
|
|
*
|
|
|
|
|
* Purpose: Callback routine from iterator, to set 'parent' pointers in
|
|
|
|
|
* sections to newly created root indirect block, when the heap
|
|
|
|
|
* is changing from having a root direct block to an indirect block.
|
|
|
|
|
*
|
|
|
|
|
* Return: Success: non-negative
|
|
|
|
|
* Failure: negative
|
|
|
|
|
*
|
|
|
|
|
* Programmer: Quincey Koziol
|
|
|
|
|
* koziol@hdfgroup.org
|
|
|
|
|
* Feb 24 2012
|
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
static herr_t
|
|
|
|
|
H5HF_space_create_root_cb(H5FS_section_info_t *_sect, void *_udata)
|
|
|
|
|
{
|
|
|
|
|
H5HF_free_section_t *sect = (H5HF_free_section_t *)_sect; /* Section to dump info */
|
|
|
|
|
H5HF_indirect_t *root_iblock = (H5HF_indirect_t *)_udata; /* User data for callback */
|
|
|
|
|
herr_t ret_value = SUCCEED; /* Return value */
|
|
|
|
|
|
|
|
|
|
FUNC_ENTER_NOAPI_NOINIT
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Check arguments.
|
|
|
|
|
*/
|
|
|
|
|
HDassert(sect);
|
|
|
|
|
HDassert(root_iblock);
|
|
|
|
|
|
|
|
|
|
/* Sanity check sections */
|
|
|
|
|
/* (If we are switching from a direct block for the root block of the heap, */
|
|
|
|
|
/* there should only be 'single' type sections. -QAK) */
|
|
|
|
|
HDassert(sect->sect_info.type == H5HF_FSPACE_SECT_SINGLE);
|
|
|
|
|
|
|
|
|
|
/* Increment ref. count on new root indirect block */
|
|
|
|
|
if(H5HF_iblock_incr(root_iblock) < 0)
|
|
|
|
|
HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, FAIL, "can't increment reference count on section's indirect block")
|
|
|
|
|
|
|
|
|
|
/* Set parent info ("live" section must _NOT_ have a parent right now) */
|
|
|
|
|
if(sect->sect_info.state == H5FS_SECT_SERIALIZED)
|
|
|
|
|
sect->sect_info.state = H5FS_SECT_LIVE; /* Mark "live" now */
|
|
|
|
|
else
|
|
|
|
|
HDassert(!sect->u.single.parent);
|
|
|
|
|
sect->u.single.parent = root_iblock;
|
|
|
|
|
sect->u.single.par_entry = 0;
|
|
|
|
|
|
|
|
|
|
done:
|
|
|
|
|
FUNC_LEAVE_NOAPI(ret_value)
|
|
|
|
|
} /* end H5HF_space_create_root_cb() */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
2018-03-16 05:54:30 +08:00
|
|
|
|
* Function: H5HF__space_create_root
|
[svn-r22233] Description:
Correct several errors in fractal heap code: root indirect block was
getting pinned/protected more than once, "single" free space sections weren't
getting "re-parented" correctly when the heap transitioned between having a
root indirect block and a root direct block, and several related issues. Also
cleaned up some warnings in library/tests.
Tested on:
FreeBSD/32 8.2 (loyalty) w/gcc4.6, w/C++ & FORTRAN, in debug mode
FreeBSD/64 8.2 (freedom) w/gcc4.6, w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x,
w/C++ & FORTRAN, w/threadsafe, in debug mode
Linux/64-amd64 2.6 (koala) w/Intel compilers, w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Mac OSX/64 10.7.3 (amazon) w/debug
2012-04-02 07:53:17 +08:00
|
|
|
|
*
|
|
|
|
|
* Purpose: Set 'parent' pointers in sections to new indirect block, when
|
|
|
|
|
* the heap is changing from having a root direct block to a
|
|
|
|
|
* indirect block.
|
|
|
|
|
*
|
|
|
|
|
* Return: Success: non-negative
|
|
|
|
|
* Failure: negative
|
|
|
|
|
*
|
|
|
|
|
* Programmer: Quincey Koziol
|
|
|
|
|
* koziol@hdfgroup.org
|
|
|
|
|
* Feb 24 2012
|
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
herr_t
|
2018-03-16 05:54:30 +08:00
|
|
|
|
H5HF__space_create_root(const H5HF_hdr_t *hdr, H5HF_indirect_t *root_iblock)
|
[svn-r22233] Description:
Correct several errors in fractal heap code: root indirect block was
getting pinned/protected more than once, "single" free space sections weren't
getting "re-parented" correctly when the heap transitioned between having a
root indirect block and a root direct block, and several related issues. Also
cleaned up some warnings in library/tests.
Tested on:
FreeBSD/32 8.2 (loyalty) w/gcc4.6, w/C++ & FORTRAN, in debug mode
FreeBSD/64 8.2 (freedom) w/gcc4.6, w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x,
w/C++ & FORTRAN, w/threadsafe, in debug mode
Linux/64-amd64 2.6 (koala) w/Intel compilers, w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Mac OSX/64 10.7.3 (amazon) w/debug
2012-04-02 07:53:17 +08:00
|
|
|
|
{
|
|
|
|
|
herr_t ret_value = SUCCEED; /* Return value */
|
|
|
|
|
|
2018-03-16 05:54:30 +08:00
|
|
|
|
FUNC_ENTER_PACKAGE
|
[svn-r22233] Description:
Correct several errors in fractal heap code: root indirect block was
getting pinned/protected more than once, "single" free space sections weren't
getting "re-parented" correctly when the heap transitioned between having a
root indirect block and a root direct block, and several related issues. Also
cleaned up some warnings in library/tests.
Tested on:
FreeBSD/32 8.2 (loyalty) w/gcc4.6, w/C++ & FORTRAN, in debug mode
FreeBSD/64 8.2 (freedom) w/gcc4.6, w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x,
w/C++ & FORTRAN, w/threadsafe, in debug mode
Linux/64-amd64 2.6 (koala) w/Intel compilers, w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Mac OSX/64 10.7.3 (amazon) w/debug
2012-04-02 07:53:17 +08:00
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Check arguments.
|
|
|
|
|
*/
|
|
|
|
|
HDassert(hdr);
|
|
|
|
|
HDassert(root_iblock);
|
|
|
|
|
|
|
|
|
|
/* Only need to scan the sections if the free space has been initialized */
|
2018-03-16 05:54:30 +08:00
|
|
|
|
if(hdr->fspace)
|
2018-09-21 04:38:40 +08:00
|
|
|
|
/* Iterate over all sections, seting the parent pointers in 'single' sections to the new indirect block */
|
2018-03-16 05:54:30 +08:00
|
|
|
|
if(H5FS_sect_iterate(hdr->f, hdr->fspace, H5HF_space_create_root_cb, root_iblock) < 0)
|
[svn-r22233] Description:
Correct several errors in fractal heap code: root indirect block was
getting pinned/protected more than once, "single" free space sections weren't
getting "re-parented" correctly when the heap transitioned between having a
root indirect block and a root direct block, and several related issues. Also
cleaned up some warnings in library/tests.
Tested on:
FreeBSD/32 8.2 (loyalty) w/gcc4.6, w/C++ & FORTRAN, in debug mode
FreeBSD/64 8.2 (freedom) w/gcc4.6, w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x,
w/C++ & FORTRAN, w/threadsafe, in debug mode
Linux/64-amd64 2.6 (koala) w/Intel compilers, w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Mac OSX/64 10.7.3 (amazon) w/debug
2012-04-02 07:53:17 +08:00
|
|
|
|
HGOTO_ERROR(H5E_FSPACE, H5E_BADITER, FAIL, "can't iterate over sections to set parent pointers")
|
|
|
|
|
|
|
|
|
|
done:
|
|
|
|
|
FUNC_LEAVE_NOAPI(ret_value)
|
2018-03-16 05:54:30 +08:00
|
|
|
|
} /* end H5HF__space_create_root() */
|
[svn-r22233] Description:
Correct several errors in fractal heap code: root indirect block was
getting pinned/protected more than once, "single" free space sections weren't
getting "re-parented" correctly when the heap transitioned between having a
root indirect block and a root direct block, and several related issues. Also
cleaned up some warnings in library/tests.
Tested on:
FreeBSD/32 8.2 (loyalty) w/gcc4.6, w/C++ & FORTRAN, in debug mode
FreeBSD/64 8.2 (freedom) w/gcc4.6, w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x,
w/C++ & FORTRAN, w/threadsafe, in debug mode
Linux/64-amd64 2.6 (koala) w/Intel compilers, w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Mac OSX/64 10.7.3 (amazon) w/debug
2012-04-02 07:53:17 +08:00
|
|
|
|
|
2007-08-14 21:33:14 +08:00
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
2018-03-16 05:54:30 +08:00
|
|
|
|
* Function: H5HF__space_size
|
2007-08-14 21:33:14 +08:00
|
|
|
|
*
|
|
|
|
|
* Purpose: Query the size of the heap's free space info on disk
|
|
|
|
|
*
|
|
|
|
|
* Return: Success: non-negative
|
|
|
|
|
* Failure: negative
|
|
|
|
|
*
|
|
|
|
|
* Programmer: Quincey Koziol
|
|
|
|
|
* koziol@hdfgroup.org
|
|
|
|
|
* August 14 2007
|
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
herr_t
|
2018-03-16 05:54:30 +08:00
|
|
|
|
H5HF__space_size(H5HF_hdr_t *hdr, hsize_t *fs_size)
|
2007-08-14 21:33:14 +08:00
|
|
|
|
{
|
|
|
|
|
herr_t ret_value = SUCCEED; /* Return value */
|
|
|
|
|
|
2018-03-16 05:54:30 +08:00
|
|
|
|
FUNC_ENTER_PACKAGE
|
2007-08-14 21:33:14 +08:00
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Check arguments.
|
|
|
|
|
*/
|
|
|
|
|
HDassert(hdr);
|
|
|
|
|
HDassert(fs_size);
|
|
|
|
|
|
|
|
|
|
/* Check if the free space for the heap has been initialized */
|
|
|
|
|
if(!hdr->fspace)
|
2018-03-16 05:54:30 +08:00
|
|
|
|
if(H5HF__space_start(hdr, FALSE) < 0)
|
2007-08-14 21:33:14 +08:00
|
|
|
|
HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't initialize heap free space")
|
|
|
|
|
|
|
|
|
|
/* Get free space metadata size */
|
[svn-r14364] Description:
Avoid creating free space manager for fractal heap when just performing
queries.
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
2008-01-04 03:01:17 +08:00
|
|
|
|
if(hdr->fspace) {
|
|
|
|
|
if(H5FS_size(hdr->f, hdr->fspace, fs_size) < 0)
|
|
|
|
|
HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "can't retrieve FS meta storage info")
|
|
|
|
|
} /* end if */
|
|
|
|
|
else
|
|
|
|
|
*fs_size = 0;
|
2007-08-14 21:33:14 +08:00
|
|
|
|
|
|
|
|
|
done:
|
|
|
|
|
FUNC_LEAVE_NOAPI(ret_value)
|
2018-03-16 05:54:30 +08:00
|
|
|
|
} /* end H5HF__space_size() */
|
2007-08-14 21:33:14 +08:00
|
|
|
|
|
2006-05-15 12:35:53 +08:00
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
2018-03-16 05:54:30 +08:00
|
|
|
|
* Function: H5HF__space_remove
|
2006-05-15 12:35:53 +08:00
|
|
|
|
*
|
2006-07-25 09:40:00 +08:00
|
|
|
|
* Purpose: Remove a section from the free space for the heap
|
2006-05-15 12:35:53 +08:00
|
|
|
|
*
|
|
|
|
|
* Return: Success: non-negative
|
|
|
|
|
* Failure: negative
|
|
|
|
|
*
|
|
|
|
|
* Programmer: Quincey Koziol
|
|
|
|
|
* koziol@ncsa.uiuc.edu
|
2006-07-25 09:40:00 +08:00
|
|
|
|
* July 24 2006
|
2006-05-23 00:43:45 +08:00
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
herr_t
|
2018-03-16 05:54:30 +08:00
|
|
|
|
H5HF__space_remove(H5HF_hdr_t *hdr, H5HF_free_section_t *node)
|
2006-05-23 00:43:45 +08:00
|
|
|
|
{
|
|
|
|
|
herr_t ret_value = SUCCEED; /* Return value */
|
|
|
|
|
|
2018-03-16 05:54:30 +08:00
|
|
|
|
FUNC_ENTER_PACKAGE
|
2006-05-23 00:43:45 +08:00
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Check arguments.
|
|
|
|
|
*/
|
|
|
|
|
HDassert(hdr);
|
2006-07-25 09:40:00 +08:00
|
|
|
|
HDassert(hdr->fspace);
|
2006-05-23 00:43:45 +08:00
|
|
|
|
HDassert(node);
|
|
|
|
|
|
2006-07-25 09:40:00 +08:00
|
|
|
|
/* Remove from the free space for the heap */
|
2018-03-16 05:54:30 +08:00
|
|
|
|
if(H5FS_sect_remove(hdr->f, hdr->fspace, (H5FS_section_info_t *)node) < 0)
|
2006-07-25 09:40:00 +08:00
|
|
|
|
HGOTO_ERROR(H5E_HEAP, H5E_CANTREMOVE, FAIL, "can't remove section from heap free space")
|
2006-05-23 00:43:45 +08:00
|
|
|
|
|
|
|
|
|
done:
|
|
|
|
|
FUNC_LEAVE_NOAPI(ret_value)
|
2018-03-16 05:54:30 +08:00
|
|
|
|
} /* end H5HF__space_remove() */
|
2006-05-23 00:43:45 +08:00
|
|
|
|
|
2006-05-15 12:35:53 +08:00
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
2018-03-16 05:54:30 +08:00
|
|
|
|
* Function: H5HF__space_close
|
2006-05-15 12:35:53 +08:00
|
|
|
|
*
|
|
|
|
|
* Purpose: Close the free space for the heap
|
|
|
|
|
*
|
|
|
|
|
* Return: Success: non-negative
|
|
|
|
|
*
|
|
|
|
|
* Failure: negative
|
|
|
|
|
*
|
|
|
|
|
* Programmer: Quincey Koziol
|
|
|
|
|
* koziol@ncsa.uiuc.edu
|
|
|
|
|
* May 2 2006
|
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
herr_t
|
2018-03-16 05:54:30 +08:00
|
|
|
|
H5HF__space_close(H5HF_hdr_t *hdr)
|
2006-05-15 12:35:53 +08:00
|
|
|
|
{
|
|
|
|
|
herr_t ret_value = SUCCEED; /* Return value */
|
|
|
|
|
|
2018-03-16 05:54:30 +08:00
|
|
|
|
FUNC_ENTER_PACKAGE
|
2006-05-15 12:35:53 +08:00
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Check arguments.
|
|
|
|
|
*/
|
|
|
|
|
HDassert(hdr);
|
|
|
|
|
|
|
|
|
|
/* Check if the free space was ever opened */
|
2006-06-19 18:06:10 +08:00
|
|
|
|
if(hdr->fspace) {
|
|
|
|
|
hsize_t nsects; /* Number of sections for this heap */
|
|
|
|
|
|
|
|
|
|
/* Retrieve the number of sections for this heap */
|
[svn-r15800] Description:
Bring file free space branch changes through r15795 into trunk, which
includes a fair bit of code cleanup & rearrangement along with a couple of
bug fixes also.
Tested on:
Mac OS X/32 10.5.5 (amazon) in debug mode
Mac OS X/32 10.5.5 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) 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
2008-10-07 12:17:35 +08:00
|
|
|
|
if(H5FS_sect_stats(hdr->fspace, NULL, &nsects) < 0)
|
2006-06-19 18:06:10 +08:00
|
|
|
|
HGOTO_ERROR(H5E_HEAP, H5E_CANTCOUNT, FAIL, "can't query free space section count")
|
|
|
|
|
#ifdef QAK
|
|
|
|
|
HDfprintf(stderr, "%s: nsects = %Hu\n", FUNC, nsects);
|
|
|
|
|
#endif /* QAK */
|
2006-05-15 12:35:53 +08:00
|
|
|
|
|
|
|
|
|
/* Close the free space for the heap */
|
2018-03-16 05:54:30 +08:00
|
|
|
|
if(H5FS_close(hdr->f, hdr->fspace) < 0)
|
2006-05-15 12:35:53 +08:00
|
|
|
|
HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't release free space info")
|
|
|
|
|
hdr->fspace = NULL;
|
|
|
|
|
|
2006-06-19 18:06:10 +08:00
|
|
|
|
/* Check if we can delete the free space manager for this heap */
|
|
|
|
|
if(!nsects) {
|
2018-03-16 05:54:30 +08:00
|
|
|
|
if(H5FS_delete(hdr->f, hdr->fs_addr) < 0)
|
2006-06-19 18:06:10 +08:00
|
|
|
|
HGOTO_ERROR(H5E_HEAP, H5E_CANTDELETE, FAIL, "can't delete free space info")
|
|
|
|
|
hdr->fs_addr = HADDR_UNDEF;
|
|
|
|
|
} /* end if */
|
2006-05-15 12:35:53 +08:00
|
|
|
|
} /* end if */
|
|
|
|
|
|
|
|
|
|
done:
|
|
|
|
|
FUNC_LEAVE_NOAPI(ret_value)
|
2018-03-16 05:54:30 +08:00
|
|
|
|
} /* end H5HF__space_close() */
|
2006-05-15 12:35:53 +08:00
|
|
|
|
|
2006-08-08 00:49:18 +08:00
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
2018-03-16 05:54:30 +08:00
|
|
|
|
* Function: H5HF__space_delete
|
2006-08-08 00:49:18 +08:00
|
|
|
|
*
|
|
|
|
|
* Purpose: Delete the free space manager for the heap
|
|
|
|
|
*
|
|
|
|
|
* Return: Success: non-negative
|
|
|
|
|
* Failure: negative
|
|
|
|
|
*
|
|
|
|
|
* Programmer: Quincey Koziol
|
|
|
|
|
* koziol@ncsa.uiuc.edu
|
|
|
|
|
* Aug 7 2006
|
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
herr_t
|
2018-03-16 05:54:30 +08:00
|
|
|
|
H5HF__space_delete(H5HF_hdr_t *hdr)
|
2006-08-08 00:49:18 +08:00
|
|
|
|
{
|
|
|
|
|
herr_t ret_value = SUCCEED; /* Return value */
|
|
|
|
|
|
2018-03-16 05:54:30 +08:00
|
|
|
|
FUNC_ENTER_PACKAGE
|
2006-08-08 00:49:18 +08:00
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Check arguments.
|
|
|
|
|
*/
|
|
|
|
|
HDassert(hdr);
|
|
|
|
|
|
|
|
|
|
/* Delete the free space manager */
|
2018-03-16 05:54:30 +08:00
|
|
|
|
if(H5FS_delete(hdr->f, hdr->fs_addr) < 0)
|
2006-08-08 00:49:18 +08:00
|
|
|
|
HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "can't delete to free space manager")
|
|
|
|
|
|
|
|
|
|
done:
|
|
|
|
|
FUNC_LEAVE_NOAPI(ret_value)
|
2018-03-16 05:54:30 +08:00
|
|
|
|
} /* end H5HF__space_delete() */
|
2006-08-08 00:49:18 +08:00
|
|
|
|
|
2006-07-22 09:55:14 +08:00
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
2018-03-16 05:54:30 +08:00
|
|
|
|
* Function: H5HF__space_sect_change_class
|
2006-07-22 09:55:14 +08:00
|
|
|
|
*
|
|
|
|
|
* Purpose: Change a section's class
|
|
|
|
|
*
|
|
|
|
|
* Return: Success: non-negative
|
|
|
|
|
*
|
|
|
|
|
* Failure: negative
|
|
|
|
|
*
|
|
|
|
|
* Programmer: Quincey Koziol
|
|
|
|
|
* koziol@ncsa.uiuc.edu
|
|
|
|
|
* July 10 2006
|
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
herr_t
|
2018-09-21 04:38:40 +08:00
|
|
|
|
H5HF__space_sect_change_class(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, uint16_t new_class)
|
2006-07-22 09:55:14 +08:00
|
|
|
|
{
|
|
|
|
|
herr_t ret_value = SUCCEED; /* Return value */
|
|
|
|
|
|
2018-03-16 05:54:30 +08:00
|
|
|
|
FUNC_ENTER_PACKAGE
|
2006-07-25 09:40:00 +08:00
|
|
|
|
#ifdef QAK
|
|
|
|
|
HDfprintf(stderr, "%s: Called\n", FUNC);
|
|
|
|
|
#endif /* QAK */
|
2006-07-22 09:55:14 +08:00
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Check arguments.
|
|
|
|
|
*/
|
|
|
|
|
HDassert(hdr);
|
|
|
|
|
HDassert(hdr->fspace);
|
|
|
|
|
HDassert(sect);
|
|
|
|
|
|
|
|
|
|
/* Notify the free space manager that a section has changed class */
|
2018-03-16 05:54:30 +08:00
|
|
|
|
if(H5FS_sect_change_class(hdr->f, hdr->fspace, (H5FS_section_info_t *)sect, new_class) < 0)
|
2006-07-22 09:55:14 +08:00
|
|
|
|
HGOTO_ERROR(H5E_HEAP, H5E_CANTMODIFY, FAIL, "can't modify class of free space section")
|
|
|
|
|
|
|
|
|
|
done:
|
|
|
|
|
FUNC_LEAVE_NOAPI(ret_value)
|
2018-03-16 05:54:30 +08:00
|
|
|
|
} /* end H5HF__space_sect_change_class() */
|
2006-07-22 09:55:14 +08:00
|
|
|
|
|