summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2011-07-20 21:47:15 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2011-07-20 21:47:15 (GMT)
commit08bb61054759d30c048af7baf1ca144b93ac9ce0 (patch)
tree6267483df5703b615d7b657145fa9bbe80ee8ee7
parent0a5bcc1df0ee1008e7c967facaa8b06797b669e1 (diff)
downloadhdf5-08bb61054759d30c048af7baf1ca144b93ac9ce0.zip
hdf5-08bb61054759d30c048af7baf1ca144b93ac9ce0.tar.gz
hdf5-08bb61054759d30c048af7baf1ca144b93ac9ce0.tar.bz2
[svn-r21133] Description:
More code cleanups to reduce coupling between packages that use the H5F internal routines, but really aren't part of the H5F "package". 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 Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN, w/szip filter, w/threadsafe, in production mode Linux/PPC 2.6 (heiwa) w/C++ & FORTRAN, w/threadsafe, in debug mode Mac OS X/32 10.6.8 (amazon) in debug mode
-rw-r--r--MANIFEST2
-rw-r--r--src/CMakeLists.txt2
-rw-r--r--src/H5Fcwfs.c323
-rw-r--r--src/H5Fpkg.h4
-rw-r--r--src/H5Fprivate.h12
-rw-r--r--src/H5Fquery.c23
-rw-r--r--src/H5HG.c147
-rw-r--r--src/H5HGcache.c32
-rw-r--r--src/H5HGdbg.c58
-rw-r--r--src/H5HGpkg.h6
-rw-r--r--src/H5HGprivate.h32
-rw-r--r--src/H5HGquery.c145
-rw-r--r--src/H5L.c9
-rw-r--r--src/H5MFaggr.c2
-rw-r--r--src/H5O.c2
-rw-r--r--src/H5Oshared.c11
-rwxr-xr-xsrc/Makefile.am5
-rw-r--r--src/Makefile.in10
18 files changed, 633 insertions, 192 deletions
diff --git a/MANIFEST b/MANIFEST
index ba0db41..e0dd98e 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -520,6 +520,7 @@
./src/H5EAtest.c
./src/H5F.c
./src/H5Faccum.c
+./src/H5Fcwfs.c
./src/H5Fdbg.c
./src/H5Fdeprec.c
./src/H5Fefc.c
@@ -632,6 +633,7 @@
./src/H5HGpkg.h
./src/H5HGprivate.h
./src/H5HGpublic.h
+./src/H5HGquery.c
./src/H5HL.c
./src/H5HLcache.c
./src/H5HLdbg.c
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 90f63cb..7fd40c0 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -143,6 +143,7 @@ IDE_GENERATED_PROPERTIES ("H5EA" "${H5EA_HDRS}" "${H5EA_SRCS}" )
SET (H5F_SRCS
${HDF5_SRC_DIR}/H5F.c
${HDF5_SRC_DIR}/H5Faccum.c
+ ${HDF5_SRC_DIR}/H5Fcwfs.c
${HDF5_SRC_DIR}/H5Fdbg.c
${HDF5_SRC_DIR}/H5Fdeprec.c
${HDF5_SRC_DIR}/H5Fefc.c
@@ -282,6 +283,7 @@ SET (H5HG_SRCS
${HDF5_SRC_DIR}/H5HG.c
${HDF5_SRC_DIR}/H5HGcache.c
${HDF5_SRC_DIR}/H5HGdbg.c
+ ${HDF5_SRC_DIR}/H5HGquery.c
)
SET (H5HG_HDRS
diff --git a/src/H5Fcwfs.c b/src/H5Fcwfs.c
new file mode 100644
index 0000000..cc3cbd6
--- /dev/null
+++ b/src/H5Fcwfs.c
@@ -0,0 +1,323 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * 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://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
+ * access to either file, you may request a copy from help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * Programmer: Quincey Koziol <koziol@hdfgroup.org>
+ * Tuesday, July 19, 2011
+ *
+ * Purpose: Each file has a small cache of global heap collections called
+ * the CWFS list and recently accessed collections with free
+ * space appear on this list. As collections are accessed the
+ * collection is moved toward the front of the list. New
+ * collections are added to the front of the list while old
+ * collections are added to the end of the list.
+ *
+ * The collection model reduces the overhead which would be
+ * incurred if the global heap were a single object, and the
+ * CWFS list allows the library to cheaply choose a collection
+ * for a new object based on object size, amount of free space
+ * in the collection, and temporal locality.
+ */
+
+/****************/
+/* Module Setup */
+/****************/
+
+#define H5F_PACKAGE /*suppress error about including H5Fpkg */
+
+
+/***********/
+/* Headers */
+/***********/
+#include "H5private.h" /* Generic Functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Fpkg.h" /* File access */
+#include "H5HGprivate.h" /* Global heaps */
+#include "H5MFprivate.h" /* File memory management */
+#include "H5MMprivate.h" /* Memory management */
+
+
+/****************/
+/* Local Macros */
+/****************/
+
+/*
+ * Maximum length of the CWFS list, the list of remembered collections that
+ * have free space.
+ */
+#define H5F_NCWFS 16
+
+
+/******************/
+/* Local Typedefs */
+/******************/
+
+
+/********************/
+/* Package Typedefs */
+/********************/
+
+
+/********************/
+/* Local Prototypes */
+/********************/
+
+
+/*********************/
+/* Package Variables */
+/*********************/
+
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+
+/*******************/
+/* Local Variables */
+/*******************/
+
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5F_cwfs_add
+ *
+ * Purpose: Add a global heap collection to the CWFS for a file.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * Tuesday, July 19, 2011
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5F_cwfs_add(H5F_t *f, H5HG_heap_t *heap)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(H5F_cwfs_add, FAIL)
+
+ /* Check args */
+ HDassert(f);
+ HDassert(f->shared);
+ HDassert(heap);
+
+ /*
+ * Add the new heap to the CWFS list, removing some other entry if
+ * necessary to make room. We remove the right-most entry that has less
+ * free space than this heap.
+ */
+ if(NULL == f->shared->cwfs) {
+ if(NULL == (f->shared->cwfs = (H5HG_heap_t **)H5MM_malloc(H5F_NCWFS * sizeof(H5HG_heap_t *))))
+ HGOTO_ERROR(H5E_FILE, H5E_CANTALLOC, FAIL, "can't allocate CWFS for file")
+ f->shared->cwfs[0] = heap;
+ f->shared->ncwfs = 1;
+ } else if(H5F_NCWFS == f->shared->ncwfs) {
+ int i; /* Local index variable */
+
+ for(i = H5F_NCWFS - 1; i >= 0; --i)
+ if(H5HG_FREE_SIZE(f->shared->cwfs[i]) < H5HG_FREE_SIZE(heap)) {
+ HDmemmove(f->shared->cwfs + 1, f->shared->cwfs, (size_t)i * sizeof(H5HG_heap_t *));
+ f->shared->cwfs[0] = heap;
+ break;
+ } /* end if */
+ } else {
+ HDmemmove(f->shared->cwfs + 1, f->shared->cwfs, f->shared->ncwfs * sizeof(H5HG_heap_t *));
+ f->shared->cwfs[0] = heap;
+ f->shared->ncwfs += 1;
+ } /* end else */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5F_cwfs_add() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5F_cwfs_find_free_heap
+ *
+ * Purpose: Find a global heap collection with free space for storing
+ * a new object.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * Wednesday, July 20, 2011
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5F_cwfs_find_free_heap(H5F_t *f, hid_t dxpl_id, size_t need, haddr_t *addr)
+{
+ unsigned cwfsno; /* Local index for iterating over collections */
+ hbool_t found = FALSE; /* Flag to indicate a heap with enough space was found */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(H5F_cwfs_find_free_heap, FAIL)
+
+ /* Check args */
+ HDassert(f);
+ HDassert(f->shared);
+ HDassert(addr);
+
+ /* Note that we don't have metadata cache locks on the entries in
+ * f->shared->cwfs.
+ *
+ * In the current situation, this doesn't matter, as we are single
+ * threaded, and as best I can tell, entries are added to and deleted
+ * from f->shared->cwfs as they are added to and deleted from the
+ * metadata cache.
+ *
+ * To be proper, we should either lock each entry in f->shared->cwfs
+ * as we examine it, or lock the whole array. However, at present
+ * I don't see the point as there will be significant overhead,
+ * and protecting and unprotecting all the collections in the global
+ * heap on a regular basis will skew the replacement policy.
+ *
+ * JRM - 5/24/04
+ */
+ for(cwfsno = 0; cwfsno < f->shared->ncwfs; cwfsno++)
+ if(H5HG_FREE_SIZE(f->shared->cwfs[cwfsno]) >= need) {
+ *addr = H5HG_ADDR(f->shared->cwfs[cwfsno]);
+ found = TRUE;
+ break;
+ } /* end if */
+
+ /*
+ * If we didn't find any collection with enough free space the check if
+ * we can extend any of the collections to make enough room.
+ */
+ if(!found) {
+ size_t new_need;
+
+ for(cwfsno = 0; cwfsno < f->shared->ncwfs; cwfsno++) {
+ new_need = need;
+ new_need -= H5HG_FREE_SIZE(f->shared->cwfs[cwfsno]);
+ new_need = MAX(H5HG_SIZE(f->shared->cwfs[cwfsno]), new_need);
+
+ if((H5HG_SIZE(f->shared->cwfs[cwfsno]) + new_need) <= H5HG_MAXSIZE) {
+ htri_t extended; /* Whether the heap was extended */
+
+ extended = H5MF_try_extend(f, dxpl_id, H5FD_MEM_GHEAP, H5HG_ADDR(f->shared->cwfs[cwfsno]), (hsize_t)H5HG_SIZE(f->shared->cwfs[cwfsno]), (hsize_t)new_need);
+ if(extended < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTEXTEND, FAIL, "error trying to extend heap")
+ else if(extended == TRUE) {
+ if(H5HG_extend(f, dxpl_id, H5HG_ADDR(f->shared->cwfs[cwfsno]), new_need) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTRESIZE, FAIL, "unable to extend global heap collection")
+ *addr = H5HG_ADDR(f->shared->cwfs[cwfsno]);
+ found = TRUE;
+ break;
+ } /* end if */
+ } /* end if */
+ } /* end for */
+ } /* end if */
+
+ if(found) {
+ /* Move the collection forward in the CWFS list, if it's not
+ * already at the front
+ */
+ if(cwfsno > 0) {
+ H5HG_heap_t *tmp = f->shared->cwfs[cwfsno];
+
+ f->shared->cwfs[cwfsno] = f->shared->cwfs[cwfsno - 1];
+ f->shared->cwfs[cwfsno - 1] = tmp;
+ } /* end if */
+ } /* end if */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5F_cwfs_find_free_heap() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5F_cwfs_advance_heap
+ *
+ * Purpose: Advance a heap in the CWFS
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * Wednesday, July 20, 2011
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5F_cwfs_advance_heap(H5F_t *f, H5HG_heap_t *heap, hbool_t add_heap)
+{
+ unsigned u; /* Local index variable */
+
+ FUNC_ENTER_NOAPI_NOFUNC(H5F_cwfs_advance_heap)
+
+ /* Check args */
+ HDassert(f);
+ HDassert(f->shared);
+ HDassert(heap);
+
+ for(u = 0; u < f->shared->ncwfs; u++)
+ if(f->shared->cwfs[u] == heap) {
+ if(u) {
+ f->shared->cwfs[u] = f->shared->cwfs[u - 1];
+ f->shared->cwfs[u - 1] = heap;
+ } /* end if */
+ break;
+ } /* end if */
+ if(add_heap && u >= f->shared->ncwfs) {
+ f->shared->ncwfs = MIN(f->shared->ncwfs + 1, H5F_NCWFS);
+ f->shared->cwfs[f->shared->ncwfs - 1] = heap;
+ } /* end if */
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* H5F_cwfs_advance_heap() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5F_cwfs_remove_heap
+ *
+ * Purpose: Remove a heap from the CWFS
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * Wednesday, July 20, 2011
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5F_cwfs_remove_heap(H5F_file_t *shared, H5HG_heap_t *heap)
+{
+ unsigned u; /* Local index variable */
+
+ FUNC_ENTER_NOAPI_NOFUNC(H5F_cwfs_remove_heap)
+
+ /* Check args */
+ HDassert(shared);
+ HDassert(heap);
+
+ /* Remove the heap from the CWFS list */
+ for(u = 0; u < shared->ncwfs; u++) {
+ if(shared->cwfs[u] == heap) {
+ shared->ncwfs -= 1;
+ HDmemmove(shared->cwfs + u, shared->cwfs + u + 1, (shared->ncwfs - u) * sizeof(H5HG_heap_t *));
+ break;
+ } /* end if */
+ } /* end for */
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* H5F_cwfs_remove_heap() */
+
diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h
index 837458e..334879c 100644
--- a/src/H5Fpkg.h
+++ b/src/H5Fpkg.h
@@ -198,7 +198,7 @@ typedef struct H5F_super_t {
* count in this struct indicates the number of H5F_t structs which are
* pointing to this struct.
*/
-typedef struct H5F_file_t {
+struct H5F_file_t {
H5FD_t *lf; /* Lower level file handle for I/O */
H5F_super_t *sblock; /* Pointer to (pinned) superblock for file */
unsigned nrefs; /* Ref count for times file is opened */
@@ -255,7 +255,7 @@ typedef struct H5F_file_t {
/* Metadata accumulator information */
H5F_meta_accum_t accum; /* Metadata accumulator info */
-} H5F_file_t;
+};
/*
* This is the top-level file descriptor. One of these structures is
diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h
index 274a387..4bb3002 100644
--- a/src/H5Fprivate.h
+++ b/src/H5Fprivate.h
@@ -35,6 +35,7 @@
/* Main file structure */
typedef struct H5F_t H5F_t;
+typedef struct H5F_file_t H5F_file_t;
/* Block aggregation structure */
typedef struct H5F_blk_aggr_t H5F_blk_aggr_t;
@@ -239,6 +240,7 @@ typedef struct H5F_blk_aggr_t H5F_blk_aggr_t;
#define H5F_OPEN_NAME(F) ((F)->open_name)
#define H5F_ACTUAL_NAME(F) ((F)->actual_name)
#define H5F_EXTPATH(F) ((F)->extpath)
+#define H5F_SHARED(F) ((F)->shared)
#define H5F_PARENT(F) ((F)->parent)
#define H5F_SAME_SHARED(F1, F2) ((F1)->shared == (F2)->shared))
#define H5F_FCPL(F) ((F)->shared->fcpl_id)
@@ -267,6 +269,7 @@ typedef struct H5F_blk_aggr_t H5F_blk_aggr_t;
#define H5F_OPEN_NAME(F) (H5F_get_open_name(F))
#define H5F_ACTUAL_NAME(F) (H5F_get_actual_name(F))
#define H5F_EXTPATH(F) (H5F_get_extpath(F))
+#define H5F_SHARED(F) (H5F_get_shared(F))
#define H5F_PARENT(F) (H5F_get_parent(F))
#define H5F_SAME_SHARED(F1, F2) (H5F_same_shared((F1), (F2)))
#define H5F_FCPL(F) (H5F_get_fcpl(F))
@@ -477,6 +480,7 @@ typedef struct H5F_blk_aggr_t H5F_blk_aggr_t;
struct H5B_class_t;
struct H5RC_t;
struct H5O_loc_t;
+struct H5HG_heap_t;
/* Private functions */
H5_DLL H5F_t *H5F_open(const char *name, unsigned flags, hid_t fcpl_id,
@@ -491,6 +495,7 @@ H5_DLL hid_t H5F_get_access_plist(H5F_t *f, hbool_t app_ref);
H5_DLL char *H5F_get_open_name(const H5F_t *f);
H5_DLL char *H5F_get_actual_name(const H5F_t *f);
H5_DLL char *H5F_get_extpath(const H5F_t *f);
+H5_DLL H5F_file_t *H5F_get_shared(const H5F_t *f);
H5_DLL H5F_t *H5F_get_parent(const H5F_t *f);
H5_DLL hbool_t H5F_same_shared(const H5F_t *f1, const H5F_t *f2);
H5_DLL hid_t H5F_get_id(H5F_t *file, hbool_t app_ref);
@@ -567,6 +572,13 @@ H5_DLL H5F_t *H5F_efc_open(H5F_t *parent, const char *name, unsigned flags,
hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id);
H5_DLL herr_t H5F_efc_close(H5F_t *parent, H5F_t *file);
+/* Global heap CWFS routines */
+H5_DLL herr_t H5F_cwfs_add(H5F_t *f, struct H5HG_heap_t *heap);
+H5_DLL herr_t H5F_cwfs_find_free_heap(H5F_t *f, hid_t dxpl_id, size_t need, haddr_t *addr);
+H5_DLL herr_t H5F_cwfs_advance_heap(H5F_t *f, struct H5HG_heap_t *heap,
+ hbool_t add_heap);
+H5_DLL herr_t H5F_cwfs_remove_heap(H5F_file_t *shared, struct H5HG_heap_t *heap);
+
/* Debugging functions */
H5_DLL herr_t H5F_debug(H5F_t *f, FILE * stream, int indent, int fwidth);
diff --git a/src/H5Fquery.c b/src/H5Fquery.c
index 9c042d7..bc9bc3d 100644
--- a/src/H5Fquery.c
+++ b/src/H5Fquery.c
@@ -181,6 +181,29 @@ H5F_get_extpath(const H5F_t *f)
/*-------------------------------------------------------------------------
+ * Function: H5F_get_shared
+ *
+ * Purpose: Retrieve the file's 'shared' pointer
+ *
+ * Return: 'shared' on success/abort on failure (shouldn't fail)
+ *
+ * Programmer: Quincey Koziol, July 20, 2011
+ *
+ *-------------------------------------------------------------------------
+ */
+H5F_file_t *
+H5F_get_shared(const H5F_t *f)
+{
+ /* Use FUNC_ENTER_NOAPI_NOINIT_NOFUNC here to avoid performance issues */
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5F_get_shared)
+
+ HDassert(f);
+
+ FUNC_LEAVE_NOAPI(f->shared)
+} /* end H5F_get_shared() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5F_get_parent
*
* Purpose: Retrieve the file's 'parent' pointer
diff --git a/src/H5HG.c b/src/H5HG.c
index 2d3cc20..d30d299 100644
--- a/src/H5HG.c
+++ b/src/H5HG.c
@@ -41,7 +41,6 @@
/* Module Setup */
/****************/
-#define H5F_PACKAGE /*suppress error about including H5Fpkg */
#define H5HG_PACKAGE /*suppress error about including H5HGpkg */
@@ -50,7 +49,7 @@
/***********/
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
-#include "H5Fpkg.h" /* File access */
+#include "H5Fprivate.h" /* File access */
#include "H5HGpkg.h" /* Global heaps */
#include "H5MFprivate.h" /* File memory management */
#include "H5MMprivate.h" /* Memory management */
@@ -61,13 +60,6 @@
/****************/
/*
- * Limit global heap collections to the some reasonable size. This is
- * fairly arbitrary, but needs to be small enough that no more than H5HG_MAXIDX
- * objects will be allocated from a single heap.
- */
-#define H5HG_MAXSIZE 65536
-
-/*
* The maximum number of links allowed to a global heap object.
*/
#define H5HG_MAXLINK 65535
@@ -164,7 +156,7 @@ H5HG_create(H5F_t *f, hid_t dxpl_id, size_t size)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, "memory allocation failed")
heap->addr = addr;
heap->size = size;
- heap->shared = f->shared;
+ heap->shared = H5F_SHARED(f);
if(NULL == (heap->chunk = H5FL_BLK_MALLOC(gheap_chunk, size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, "memory allocation failed")
@@ -212,19 +204,8 @@ HDmemset(heap->chunk, 0, size);
#endif /* OLD_WAY */
/* Add this heap to the beginning of the CWFS list */
- if(NULL == f->shared->cwfs) {
- f->shared->cwfs = (H5HG_heap_t **)H5MM_malloc(H5HG_NCWFS * sizeof(H5HG_heap_t *));
- if(NULL == (f->shared->cwfs))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, "memory allocation failed")
- f->shared->cwfs[0] = heap;
- f->shared->ncwfs = 1;
- } /* end if */
- else {
- HDmemmove(f->shared->cwfs + 1, f->shared->cwfs,
- MIN(f->shared->ncwfs, H5HG_NCWFS - 1) * sizeof(H5HG_heap_t *));
- f->shared->cwfs[0] = heap;
- f->shared->ncwfs = MIN(H5HG_NCWFS, f->shared->ncwfs + 1);
- } /* end else */
+ if(H5F_cwfs_add(f, heap) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, HADDR_UNDEF, "unable to add global heap collection to file's CWFS")
/* Add the heap to the cache */
if(H5AC_insert_entry(f, dxpl_id, H5AC_GHEAP, addr, heap, H5AC__NO_FLAGS_SET) < 0)
@@ -441,7 +422,7 @@ done:
*
*-------------------------------------------------------------------------
*/
-static herr_t
+herr_t
H5HG_extend(H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t need)
{
H5HG_heap_t *heap = NULL; /* Pointer to heap to extend */
@@ -537,12 +518,10 @@ herr_t
H5HG_insert(H5F_t *f, hid_t dxpl_id, size_t size, void *obj, H5HG_t *hobj/*out*/)
{
size_t need; /*total space needed for object */
- unsigned cwfsno;
size_t idx;
- haddr_t addr = HADDR_UNDEF;
+ haddr_t addr; /* Address of heap to add object within */
H5HG_heap_t *heap = NULL;
unsigned heap_flags = H5AC__NO_FLAGS_SET;
- hbool_t found = FALSE; /* Flag to indicate a heap with enough space was found */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_TAG(H5HG_insert, dxpl_id, H5AC__GLOBALHEAP_TAG, FAIL)
@@ -558,81 +537,23 @@ H5HG_insert(H5F_t *f, hid_t dxpl_id, size_t size, void *obj, H5HG_t *hobj/*out*/
/* Find a large enough collection on the CWFS list */
need = H5HG_SIZEOF_OBJHDR(f) + H5HG_ALIGN(size);
- /* Note that we don't have metadata cache locks on the entries in
- * f->shared->cwfs.
- *
- * In the current situation, this doesn't matter, as we are single
- * threaded, and as best I can tell, entries are added to and deleted
- * from f->shared->cwfs as they are added to and deleted from the
- * metadata cache.
- *
- * To be proper, we should either lock each entry in f->shared->cwfs
- * as we examine it, or lock the whole array. However, at present
- * I don't see the point as there will be significant overhead,
- * and protecting and unprotecting all the collections in the global
- * heap on a regular basis will skew the replacement policy.
- *
- * JRM - 5/24/04
- */
- for(cwfsno = 0; cwfsno < f->shared->ncwfs; cwfsno++)
- if(f->shared->cwfs[cwfsno]->obj[0].size >= need) {
- addr = f->shared->cwfs[cwfsno]->addr;
- found = TRUE;
- break;
- } /* end if */
-
- /*
- * If we didn't find any collection with enough free space the check if
- * we can extend any of the collections to make enough room.
- */
- if(!found) {
- size_t new_need;
-
- for(cwfsno = 0; cwfsno < f->shared->ncwfs; cwfsno++) {
- new_need = need;
- new_need -= f->shared->cwfs[cwfsno]->obj[0].size;
- new_need = MAX(f->shared->cwfs[cwfsno]->size, new_need);
-
- if((f->shared->cwfs[cwfsno]->size + new_need) <= H5HG_MAXSIZE) {
- htri_t extended; /* Whether the heap was extended */
-
- extended = H5MF_try_extend(f, dxpl_id, H5FD_MEM_GHEAP, f->shared->cwfs[cwfsno]->addr, (hsize_t)f->shared->cwfs[cwfsno]->size, (hsize_t)new_need);
- if(extended < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTEXTEND, FAIL, "error trying to extend heap")
- else if(extended == TRUE) {
- if(H5HG_extend(f, dxpl_id, f->shared->cwfs[cwfsno]->addr, new_need) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTRESIZE, FAIL, "unable to extend global heap collection")
- addr = f->shared->cwfs[cwfsno]->addr;
- found = TRUE;
- break;
- } /* end if */
- } /* end if */
- } /* end for */
- } /* end if */
+ /* Look for a heap in the file's CWFS that has enough space for the object */
+ addr = HADDR_UNDEF;
+ if(H5F_cwfs_find_free_heap(f, dxpl_id, need, &addr) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_NOTFOUND, FAIL, "error trying to locate heap")
/*
* If we didn't find any collection with enough free space then allocate a
* new collection large enough for the message plus the collection header.
*/
- if(!found) {
- addr = H5HG_create(f, dxpl_id, need+H5HG_SIZEOF_HDR (f));
+ if(!H5F_addr_defined(addr)) {
+ addr = H5HG_create(f, dxpl_id, need + H5HG_SIZEOF_HDR(f));
if(!H5F_addr_defined(addr))
HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "unable to allocate a global heap collection")
} /* end if */
- else {
- /* Move the collection forward in the CWFS list, if it's not
- * already at the front
- */
- if(cwfsno > 0) {
- H5HG_heap_t *tmp = f->shared->cwfs[cwfsno];
-
- f->shared->cwfs[cwfsno] = f->shared->cwfs[cwfsno - 1];
- f->shared->cwfs[cwfsno - 1] = tmp;
- --cwfsno;
- } /* end if */
- } /* end else */
HDassert(H5F_addr_defined(addr));
+
if(NULL == (heap = H5HG_protect(f, dxpl_id, addr, H5AC_WRITE)))
HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect global heap")
@@ -715,16 +636,8 @@ H5HG_read(H5F_t *f, hid_t dxpl_id, H5HG_t *hobj, void *object/*out*/,
* with the H5AC_protect(), but it won't hurt to do it twice.
*/
if(heap->obj[0].begin) {
- unsigned u; /* Local index variable */
-
- for(u = 0; u < f->shared->ncwfs; u++)
- if(f->shared->cwfs[u] == heap) {
- if(u) {
- f->shared->cwfs[u] = f->shared->cwfs[u - 1];
- f->shared->cwfs[u - 1] = heap;
- } /* end if */
- break;
- } /* end if */
+ if(H5F_cwfs_advance_heap(f, heap, FALSE) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTMODIFY, NULL, "can't adjust file's CWFS")
} /* end if */
/* If the caller would like to know the heap object's size, set that */
@@ -887,18 +800,8 @@ H5HG_remove (H5F_t *f, hid_t dxpl_id, H5HG_t *hobj)
* H5AC_protect() might have done that too, but that's okay. If the
* heap isn't on the CWFS list then add it to the end.
*/
- for(u = 0; u < f->shared->ncwfs; u++)
- if(f->shared->cwfs[u] == heap) {
- if(u) {
- f->shared->cwfs[u] = f->shared->cwfs[u - 1];
- f->shared->cwfs[u - 1] = heap;
- } /* end if */
- break;
- } /* end if */
- if(u >= f->shared->ncwfs) {
- f->shared->ncwfs = MIN(f->shared->ncwfs + 1, H5HG_NCWFS);
- f->shared->cwfs[f->shared->ncwfs - 1] = heap;
- } /* end if */
+ if(H5F_cwfs_advance_heap(f, heap, TRUE) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTMODIFY, FAIL, "can't adjust file's CWFS")
} /* end else */
done:
@@ -924,21 +827,16 @@ done:
herr_t
H5HG_free(H5HG_heap_t *heap)
{
- unsigned u; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HG_free)
+ FUNC_ENTER_NOAPI(H5HG_free, FAIL)
/* Check arguments */
HDassert(heap);
/* Remove the heap from the CWFS list */
- for(u = 0; u < heap->shared->ncwfs; u++) {
- if(heap->shared->cwfs[u] == heap) {
- heap->shared->ncwfs -= 1;
- HDmemmove(heap->shared->cwfs + u, heap->shared->cwfs + u + 1, (heap->shared->ncwfs - u) * sizeof(H5HG_heap_t *));
- break;
- } /* end if */
- } /* end for */
+ if(H5F_cwfs_remove_heap(heap->shared, heap) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTREMOVE, FAIL, "can't remove heap from file's CWFS")
if(heap->chunk)
heap->chunk = H5FL_BLK_FREE(gheap_chunk, heap->chunk);
@@ -946,6 +844,7 @@ H5HG_free(H5HG_heap_t *heap)
heap->obj = H5FL_SEQ_FREE(H5HG_obj_t, heap->obj);
heap = H5FL_FREE(H5HG_heap_t, heap);
- FUNC_LEAVE_NOAPI(SUCCEED)
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
} /* H5HG_free() */
diff --git a/src/H5HGcache.c b/src/H5HGcache.c
index a3cf5b1..c26d2f7 100644
--- a/src/H5HGcache.c
+++ b/src/H5HGcache.c
@@ -28,7 +28,6 @@
/* Module Setup */
/****************/
-#define H5F_PACKAGE /*suppress error about including H5Fpkg */
#define H5HG_PACKAGE /*suppress error about including H5HGpkg */
@@ -37,7 +36,7 @@
/***********/
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
-#include "H5Fpkg.h" /* File access */
+#include "H5Fprivate.h" /* File access */
#include "H5HGpkg.h" /* Global heaps */
#include "H5MFprivate.h" /* File memory management */
#include "H5MMprivate.h" /* Memory management */
@@ -131,7 +130,7 @@ H5HG_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata)
/* Read the initial 4k page */
if(NULL == (heap = H5FL_CALLOC(H5HG_heap_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
- heap->shared = f->shared;
+ heap->shared = H5F_SHARED(f);
if(NULL == (heap->chunk = H5FL_BLK_MALLOC(gheap_chunk, (size_t)H5HG_MINSIZE)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
if(H5F_block_read(f, H5FD_MEM_GHEAP, addr, (size_t)H5HG_MINSIZE, dxpl_id, heap->chunk) < 0)
@@ -252,30 +251,9 @@ H5HG_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata)
HDassert(max_idx < heap->nused);
- /*
- * Add the new heap to the CWFS list, removing some other entry if
- * necessary to make room. We remove the right-most entry that has less
- * free space than this heap.
- */
- if(!f->shared->cwfs) {
- if(NULL == (f->shared->cwfs = (H5HG_heap_t **)H5MM_malloc(H5HG_NCWFS * sizeof(H5HG_heap_t *))))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
- f->shared->ncwfs = 1;
- f->shared->cwfs[0] = heap;
- } else if(H5HG_NCWFS == f->shared->ncwfs) {
- int i; /* Local index variable */
-
- for(i = H5HG_NCWFS - 1; i >= 0; --i)
- if(f->shared->cwfs[i]->obj[0].size < heap->obj[0].size) {
- HDmemmove(f->shared->cwfs + 1, f->shared->cwfs, i * sizeof(H5HG_heap_t *));
- f->shared->cwfs[0] = heap;
- break;
- } /* end if */
- } else {
- HDmemmove(f->shared->cwfs + 1, f->shared->cwfs, f->shared->ncwfs * sizeof(H5HG_heap_t *));
- f->shared->ncwfs += 1;
- f->shared->cwfs[0] = heap;
- } /* end else */
+ /* Add the new heap to the CWFS list for the file */
+ if(H5F_cwfs_add(f, heap) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, NULL, "unable to add global heap collection to file's CWFS")
ret_value = heap;
diff --git a/src/H5HGdbg.c b/src/H5HGdbg.c
index f301701..c263155 100644
--- a/src/H5HGdbg.c
+++ b/src/H5HGdbg.c
@@ -18,15 +18,58 @@
*
* Purpose: Global Heap object debugging functions.
*/
+
+/****************/
+/* Module Setup */
+/****************/
+
#define H5HG_PACKAGE /*suppress error about including H5HGpkg */
+/***********/
+/* Headers */
+/***********/
#include "H5private.h" /* Generic Functions */
#include "H5ACprivate.h" /* Metadata cache */
#include "H5Eprivate.h" /* Error handling */
#include "H5HGpkg.h" /* Global heaps */
#include "H5Iprivate.h" /* ID Functions */
+/****************/
+/* Local Macros */
+/****************/
+
+
+/******************/
+/* Local Typedefs */
+/******************/
+
+
+/********************/
+/* Package Typedefs */
+/********************/
+
+
+/********************/
+/* Local Prototypes */
+/********************/
+
+
+/*********************/
+/* Package Variables */
+/*********************/
+
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+
+/*******************/
+/* Local Variables */
+/*******************/
+
+
/*-------------------------------------------------------------------------
* Function: H5HG_debug
@@ -39,18 +82,6 @@
* matzke@llnl.gov
* Mar 27, 1998
*
- * Modifications:
- * Robb Matzke, 1999-07-28
- * The ADDR argument is passed by value.
- *
- * Robb Matzke, LLNL, 2003-06-05
- * The size does not include the object header, just the data.
- *
- * John Mainzer, 6/17/05
- * Modified the function to use the new dirtied parameter of
- * of H5AC_unprotect() instead of modifying the is_dirty
- * field of the cache info.
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -142,4 +173,5 @@ done:
HDONE_ERROR(H5E_HEAP, H5E_PROTECT, FAIL, "unable to release object header");
FUNC_LEAVE_NOAPI(ret_value);
-}
+} /* end H5HG_debug() */
+
diff --git a/src/H5HGpkg.h b/src/H5HGpkg.h
index 6c60656..5d4234f 100644
--- a/src/H5HGpkg.h
+++ b/src/H5HGpkg.h
@@ -71,12 +71,6 @@ H5FL_BLK_EXTERN(gheap_chunk);
#define H5HG_MINSIZE 4096
/*
- * Maximum length of the CWFS list, the list of remembered collections that
- * have free space.
- */
-#define H5HG_NCWFS 16
-
-/*
* Pad all global heap messages to a multiple of eight bytes so we can load
* the entire collection into memory and operate on it there. Eight should
* be sufficient for machines that have alignment constraints because our
diff --git a/src/H5HGprivate.h b/src/H5HGprivate.h
index b6cdb4a..3765c47 100644
--- a/src/H5HGprivate.h
+++ b/src/H5HGprivate.h
@@ -35,14 +35,44 @@ typedef struct H5HG_t {
/* Typedef for heap in memory (defined in H5HGpkg.h) */
typedef struct H5HG_heap_t H5HG_heap_t;
+
+/*
+ * Limit global heap collections to the some reasonable size. This is
+ * fairly arbitrary, but needs to be small enough that no more than H5HG_MAXIDX
+ * objects will be allocated from a single heap.
+ */
+#define H5HG_MAXSIZE 65536
+
+/* If the module using this macro is allowed access to the private variables, access them directly */
+#ifdef H5HG_PACKAGE
+#define H5HG_ADDR(H) ((H)->addr)
+#define H5HG_SIZE(H) ((H)->size)
+#define H5HG_FREE_SIZE(H) ((H)->obj[0].size)
+#else /* H5HG_PACKAGE */
+#define H5HG_ADDR(H) (H5HG_get_addr(H))
+#define H5HG_SIZE(H) (H5HG_get_size(H))
+#define H5HG_FREE_SIZE(H) (H5HG_get_free_size(H))
+#endif /* H5HG_PACKAGE */
+
+
+/* Main global heap routines */
H5_DLL herr_t H5HG_insert(H5F_t *f, hid_t dxpl_id, size_t size, void *obj,
H5HG_t *hobj/*out*/);
H5_DLL void *H5HG_read(H5F_t *f, hid_t dxpl_id, H5HG_t *hobj, void *object, size_t *buf_size/*out*/);
H5_DLL int H5HG_link(H5F_t *f, hid_t dxpl_id, const H5HG_t *hobj, int adjust);
H5_DLL herr_t H5HG_remove(H5F_t *f, hid_t dxpl_id, H5HG_t *hobj);
+/* Support routines */
+H5_DLL herr_t H5HG_extend(H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t need);
+
+/* Query routines */
+H5_DLL haddr_t H5HG_get_addr(const H5HG_heap_t *h);
+H5_DLL size_t H5HG_get_size(const H5HG_heap_t *h);
+H5_DLL size_t H5HG_get_free_size(const H5HG_heap_t *h);
+
/* Debugging functions */
H5_DLL herr_t H5HG_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent,
int fwidth);
-#endif
+#endif /* _H5HGprivate_H */
+
diff --git a/src/H5HGquery.c b/src/H5HGquery.c
new file mode 100644
index 0000000..ae0a2b7
--- /dev/null
+++ b/src/H5HGquery.c
@@ -0,0 +1,145 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * 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://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
+ * access to either file, you may request a copy from help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * Programmer: Quincey Koziol <koziol@hdfgroup.org>
+ * Wednesday, July 20, 2011
+ *
+ * Purpose: Query routines for global heaps.
+ *
+ */
+
+/****************/
+/* Module Setup */
+/****************/
+
+#define H5HG_PACKAGE /*suppress error about including H5HGpkg */
+
+
+/***********/
+/* Headers */
+/***********/
+#include "H5private.h" /* Generic Functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5HGpkg.h" /* Global heaps */
+
+
+/****************/
+/* Local Macros */
+/****************/
+
+
+/******************/
+/* Local Typedefs */
+/******************/
+
+
+/********************/
+/* Package Typedefs */
+/********************/
+
+
+/********************/
+/* Local Prototypes */
+/********************/
+
+
+/*********************/
+/* Package Variables */
+/*********************/
+
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+
+/*******************/
+/* Local Variables */
+/*******************/
+
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5HG_get_addr
+ *
+ * Purpose: Query the address of a global heap object.
+ *
+ * Return: Address of heap on success/abort on failure (shouldn't fail)
+ *
+ * Programmer: Quincey Koziol
+ * Wednesday, July 20, 2011
+ *
+ *-------------------------------------------------------------------------
+ */
+haddr_t
+H5HG_get_addr(const H5HG_heap_t *heap)
+{
+ /* Use FUNC_ENTER_NOAPI_NOINIT_NOFUNC here to avoid performance issues */
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HG_get_addr)
+
+ HDassert(heap);
+
+ FUNC_LEAVE_NOAPI(heap->addr)
+} /* H5HG_get_addr() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5HG_get_size
+ *
+ * Purpose: Query the size of a global heap object.
+ *
+ * Return: Size of heap on success/abort on failure (shouldn't fail)
+ *
+ * Programmer: Quincey Koziol
+ * Wednesday, July 20, 2011
+ *
+ *-------------------------------------------------------------------------
+ */
+size_t
+H5HG_get_size(const H5HG_heap_t *heap)
+{
+ /* Use FUNC_ENTER_NOAPI_NOINIT_NOFUNC here to avoid performance issues */
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HG_get_size)
+
+ HDassert(heap);
+
+ FUNC_LEAVE_NOAPI(heap->size)
+} /* H5HG_get_size() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5HG_get_free_size
+ *
+ * Purpose: Query the free size of a global heap object.
+ *
+ * Return: Free size of heap on success/abort on failure (shouldn't fail)
+ *
+ * Programmer: Quincey Koziol
+ * Wednesday, July 20, 2011
+ *
+ *-------------------------------------------------------------------------
+ */
+size_t
+H5HG_get_free_size(const H5HG_heap_t *heap)
+{
+ /* Use FUNC_ENTER_NOAPI_NOINIT_NOFUNC here to avoid performance issues */
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HG_get_free_size)
+
+ HDassert(heap);
+
+ FUNC_LEAVE_NOAPI(heap->obj[0].size)
+} /* H5HG_get_free_size() */
+
diff --git a/src/H5L.c b/src/H5L.c
index 2a9d591..17b7598 100644
--- a/src/H5L.c
+++ b/src/H5L.c
@@ -17,7 +17,6 @@
/* Module Setup */
/****************/
-#define H5F_PACKAGE /*suppress error about including H5Fpkg */
#define H5G_PACKAGE /*suppress error about including H5Gpkg */
#define H5L_PACKAGE /*suppress error about including H5Lpkg */
@@ -32,7 +31,7 @@
#include "H5Dprivate.h" /* Datasets */
#include "H5Eprivate.h" /* Error handling */
#include "H5Gpkg.h" /* Groups */
-#include "H5Fpkg.h" /* File access */
+#include "H5Fprivate.h" /* File access */
#include "H5Iprivate.h" /* IDs */
#include "H5Lpkg.h" /* Links */
#include "H5MMprivate.h" /* Memory management */
@@ -1697,7 +1696,7 @@ H5L_link_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t UNUSED
} /* end if */
else {
/* Check that both objects are in same file */
- if(grp_loc->oloc->file->shared != udata->file->shared)
+ if(!H5F_SAME_SHARED(grp_loc->oloc->file, udata->file))
HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "interfile hard links are not allowed")
} /* end else */
} /* end if */
@@ -1776,7 +1775,7 @@ done:
oloc.file = grp_loc->oloc->file;
oloc.addr = udata->lnk->u.hard.addr;
- /* Decrement refcount on superblock extension's object header in memory */
+ /* Decrement refcount on new object's object header in memory */
if(H5O_dec_rc_by_loc(&oloc, udata->dxpl_id) < 0)
HDONE_ERROR(H5E_LINK, H5E_CANTDEC, FAIL, "unable to decrement refcount on newly created object")
} /* end if */
@@ -2429,7 +2428,7 @@ H5L_move_dest_cb(H5G_loc_t *grp_loc/*in*/, const char *name,
/* Check for crossing file boundaries with a new hard link */
if(udata->lnk->type == H5L_TYPE_HARD) {
/* Check that both objects are in same file */
- if(grp_loc->oloc->file->shared != udata->file->shared)
+ if(!H5F_SAME_SHARED(grp_loc->oloc->file, udata->file))
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "moving a link across files is not allowed")
} /* end if */
diff --git a/src/H5MFaggr.c b/src/H5MFaggr.c
index 9936c3b..e1af995 100644
--- a/src/H5MFaggr.c
+++ b/src/H5MFaggr.c
@@ -34,7 +34,7 @@
/***********/
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
-#include "H5Fpkg.h" /* File access */
+#include "H5Fpkg.h" /* File access */
#include "H5MFpkg.h" /* File memory management */
diff --git a/src/H5O.c b/src/H5O.c
index eb90a70..515c134 100644
--- a/src/H5O.c
+++ b/src/H5O.c
@@ -1122,7 +1122,7 @@ H5O_create(H5F_t *f, hid_t dxpl_id, size_t size_hint, size_t initial_rc,
/* check args */
HDassert(f);
- HDassert(f->intent & H5F_ACC_RDWR);
+ HDassert(H5F_INTENT(f) & H5F_ACC_RDWR);
HDassert(loc);
HDassert(TRUE == H5P_isa_class(ocpl_id, H5P_OBJECT_CREATE));
diff --git a/src/H5Oshared.c b/src/H5Oshared.c
index 376a2ad..4ba01ac 100644
--- a/src/H5Oshared.c
+++ b/src/H5Oshared.c
@@ -30,7 +30,6 @@
/* Module Setup */
/****************/
-#define H5F_PACKAGE /*suppress error about including H5Fpkg */
#define H5O_PACKAGE /*suppress error about including H5Opkg */
@@ -39,7 +38,7 @@
/***********/
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
-#include "H5Fpkg.h" /* File access */
+#include "H5Fprivate.h" /* File access */
#include "H5Gprivate.h" /* Groups */
#include "H5HFprivate.h" /* Fractal heap */
#include "H5Opkg.h" /* Object headers */
@@ -418,8 +417,8 @@ H5O_shared_encode(const H5F_t *f, uint8_t *buf/*out*/, const H5O_shared_t *sh_me
version = H5O_SHARED_VERSION_2; /* version 1 is no longer used */
} /* end else */
- *buf++ = version;
- *buf++ = (unsigned)sh_mesg->type;
+ *buf++ = (uint8_t)version;
+ *buf++ = (uint8_t)sh_mesg->type;
/* Encode either the heap ID of the message or the address of the
* object header that holds it.
@@ -483,8 +482,8 @@ H5O_shared_size(const H5F_t *f, const H5O_shared_t *sh_mesg)
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_shared_size)
if(sh_mesg->type == H5O_SHARE_TYPE_COMMITTED) {
- ret_value = 1 + /*version */
- 1 + /*the type field */
+ ret_value = (size_t)1 + /*version */
+ (size_t)1 + /*the type field */
H5F_SIZEOF_ADDR(f); /*sharing by another obj hdr */
} /* end if */
else {
diff --git a/src/Makefile.am b/src/Makefile.am
index ee0a3f5..d42af98 100755
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -53,7 +53,8 @@ libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \
H5E.c H5Edeprec.c H5Eint.c \
H5EA.c H5EAcache.c H5EAdbg.c H5EAdblkpage.c H5EAdblock.c H5EAhdr.c \
H5EAiblock.c H5EAint.c H5EAsblock.c H5EAstat.c H5EAtest.c \
- H5F.c H5Faccum.c H5Fdbg.c H5Fdeprec.c H5Fefc.c H5Ffake.c H5Fio.c \
+ H5F.c H5Faccum.c H5Fcwfs.c \
+ H5Fdbg.c H5Fdeprec.c H5Fefc.c H5Ffake.c H5Fio.c \
H5Fmount.c H5Fmpi.c H5Fquery.c \
H5Fsfile.c H5Fsuper.c H5Fsuper_cache.c H5Ftest.c \
H5FA.c H5FAcache.c H5FAdbg.c H5FAdblock.c H5FAdblkpage.c H5FAhdr.c \
@@ -70,7 +71,7 @@ libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \
H5HF.c H5HFbtree2.c H5HFcache.c H5HFdbg.c H5HFdblock.c H5HFdtable.c \
H5HFhdr.c H5HFhuge.c H5HFiblock.c H5HFiter.c H5HFman.c H5HFsection.c \
H5HFspace.c H5HFstat.c H5HFtest.c H5HFtiny.c \
- H5HG.c H5HGcache.c H5HGdbg.c \
+ H5HG.c H5HGcache.c H5HGdbg.c H5HGquery.c \
H5HL.c H5HLcache.c H5HLdbg.c H5HLint.c \
H5HP.c H5I.c H5Itest.c H5L.c H5Lexternal.c H5lib_settings.c \
H5MF.c H5MFaggr.c H5MFdbg.c H5MFsection.c \
diff --git a/src/Makefile.in b/src/Makefile.in
index 05c14b3..1276359 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -106,7 +106,7 @@ am_libhdf5_la_OBJECTS = H5.lo H5checksum.lo H5dbg.lo H5system.lo \
H5Dtest.lo H5E.lo H5Edeprec.lo H5Eint.lo H5EA.lo H5EAcache.lo \
H5EAdbg.lo H5EAdblkpage.lo H5EAdblock.lo H5EAhdr.lo \
H5EAiblock.lo H5EAint.lo H5EAsblock.lo H5EAstat.lo H5EAtest.lo \
- H5F.lo H5Faccum.lo H5Fdbg.lo H5Fdeprec.lo H5Fefc.lo H5Ffake.lo \
+ H5F.lo H5Faccum.lo H5Fcwfs.lo H5Fdbg.lo H5Fdeprec.lo H5Fefc.lo H5Ffake.lo \
H5Fio.lo H5Fmount.lo H5Fmpi.lo H5Fquery.lo H5Fsfile.lo \
H5Fsuper.lo H5Fsuper_cache.lo H5Ftest.lo H5FA.lo H5FAcache.lo \
H5FAdbg.lo H5FAdblock.lo H5FAdblkpage.lo H5FAhdr.lo \
@@ -121,7 +121,7 @@ am_libhdf5_la_OBJECTS = H5.lo H5checksum.lo H5dbg.lo H5system.lo \
H5HF.lo H5HFbtree2.lo H5HFcache.lo H5HFdbg.lo H5HFdblock.lo \
H5HFdtable.lo H5HFhdr.lo H5HFhuge.lo H5HFiblock.lo H5HFiter.lo \
H5HFman.lo H5HFsection.lo H5HFspace.lo H5HFstat.lo H5HFtest.lo \
- H5HFtiny.lo H5HG.lo H5HGcache.lo H5HGdbg.lo H5HL.lo \
+ H5HFtiny.lo H5HG.lo H5HGcache.lo H5HGdbg.lo H5HGquery.lo H5HL.lo \
H5HLcache.lo H5HLdbg.lo H5HLint.lo H5HP.lo H5I.lo H5Itest.lo \
H5L.lo H5Lexternal.lo H5lib_settings.lo H5MF.lo H5MFaggr.lo \
H5MFdbg.lo H5MFsection.lo H5MM.lo H5MP.lo H5MPtest.lo H5O.lo \
@@ -508,7 +508,7 @@ libhdf5_la_SOURCES = H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \
H5E.c H5Edeprec.c H5Eint.c \
H5EA.c H5EAcache.c H5EAdbg.c H5EAdblkpage.c H5EAdblock.c H5EAhdr.c \
H5EAiblock.c H5EAint.c H5EAsblock.c H5EAstat.c H5EAtest.c \
- H5F.c H5Faccum.c H5Fdbg.c H5Fdeprec.c H5Fefc.c H5Ffake.c H5Fio.c \
+ H5F.c H5Faccum.c H5Fcwfs.c H5Fdbg.c H5Fdeprec.c H5Fefc.c H5Ffake.c H5Fio.c \
H5Fmount.c H5Fmpi.c H5Fquery.c \
H5Fsfile.c H5Fsuper.c H5Fsuper_cache.c H5Ftest.c \
H5FA.c H5FAcache.c H5FAdbg.c H5FAdblock.c H5FAdblkpage.c H5FAhdr.c \
@@ -525,7 +525,7 @@ libhdf5_la_SOURCES = H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \
H5HF.c H5HFbtree2.c H5HFcache.c H5HFdbg.c H5HFdblock.c H5HFdtable.c \
H5HFhdr.c H5HFhuge.c H5HFiblock.c H5HFiter.c H5HFman.c H5HFsection.c \
H5HFspace.c H5HFstat.c H5HFtest.c H5HFtiny.c \
- H5HG.c H5HGcache.c H5HGdbg.c \
+ H5HG.c H5HGcache.c H5HGdbg.c H5HGquery.c \
H5HL.c H5HLcache.c H5HLdbg.c H5HLint.c \
H5HP.c H5I.c H5Itest.c H5L.c H5Lexternal.c H5lib_settings.c \
H5MF.c H5MFaggr.c H5MFdbg.c H5MFsection.c \
@@ -784,6 +784,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5FSstat.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5FStest.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Faccum.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Fcwfs.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Fdbg.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Fdeprec.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Fefc.Plo@am__quote@
@@ -833,6 +834,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5HG.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5HGcache.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5HGdbg.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5HGquery.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5HL.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5HLcache.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5HLdbg.Plo@am__quote@