diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2011-07-20 22:25:51 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2011-07-20 22:25:51 (GMT) |
commit | a42f3b9ddaca2f2d566f38bebdd419a3c941669a (patch) | |
tree | 25a72d07ec797cefb5364ea6baf17818f5ffe1a5 /src/H5HGcache.c | |
parent | 7beed66358ff6c3d664526bc6e7b9d5990238331 (diff) | |
download | hdf5-a42f3b9ddaca2f2d566f38bebdd419a3c941669a.zip hdf5-a42f3b9ddaca2f2d566f38bebdd419a3c941669a.tar.gz hdf5-a42f3b9ddaca2f2d566f38bebdd419a3c941669a.tar.bz2 |
[svn-r21134] Description:
Bring r21133 from trunk to 1.8 branch:
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
Diffstat (limited to 'src/H5HGcache.c')
-rw-r--r-- | src/H5HGcache.c | 32 |
1 files changed, 5 insertions, 27 deletions
diff --git a/src/H5HGcache.c b/src/H5HGcache.c index 280d70e..eb71dfb 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 */ @@ -130,7 +129,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) @@ -251,30 +250,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; |