diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2009-06-11 21:22:11 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2009-06-11 21:22:11 (GMT) |
commit | b127ee77c07c5780836d284de0bccdefb08290b4 (patch) | |
tree | c86d8338d9caa2a3b9b0e429c5a1ba175e5ccc73 /src/H5HFdblock.c | |
parent | 74af8cfa9234643684e592e00f3cc2c7fce66571 (diff) | |
download | hdf5-b127ee77c07c5780836d284de0bccdefb08290b4.zip hdf5-b127ee77c07c5780836d284de0bccdefb08290b4.tar.gz hdf5-b127ee77c07c5780836d284de0bccdefb08290b4.tar.bz2 |
[svn-r17038] Description:
Switch fractal heap direct blocks to use temporary file space, until they
are flushed, which makes allocation of space in file more efficient,
particularly for heaps with I/O filters.
Tested on:
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 debug mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
Mac OS X/32 10.5.7 (amazon) in debug mode
Mac OS X/32 10.5.7 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
Diffstat (limited to 'src/H5HFdblock.c')
-rw-r--r-- | src/H5HFdblock.c | 40 |
1 files changed, 22 insertions, 18 deletions
diff --git a/src/H5HFdblock.c b/src/H5HFdblock.c index c14249c..7e68533 100644 --- a/src/H5HFdblock.c +++ b/src/H5HFdblock.c @@ -148,8 +148,8 @@ H5HF_man_dblock_create(hid_t dxpl_id, H5HF_hdr_t *hdr, H5HF_indirect_t *par_iblo HDmemset(dblock->blk, 0, dblock->size); #endif /* H5_CLEAR_MEMORY */ - /* Allocate space for the direct block on disk */ - if(HADDR_UNDEF == (dblock_addr = H5MF_alloc(hdr->f, H5FD_MEM_FHEAP_DBLOCK, dxpl_id, (hsize_t)dblock->size))) + /* Allocate [temporary] space for the direct block on disk */ + if(HADDR_UNDEF == (dblock_addr = H5MF_alloc_tmp(hdr->f, (hsize_t)dblock->size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "file allocation failed for fractal heap direct block") #ifdef QAK HDfprintf(stderr, "%s: direct block address = %a\n", FUNC, dblock_addr); @@ -695,22 +695,26 @@ HDfprintf(stderr, "%s: Done expunging direct block from cache\n", FUNC); #endif /* QAK */ } /* end if */ - /* Release direct block's disk space */ - /* (XXX: Under the best of circumstances, this block's space in the file - * would be freed in the H5AC_expunge_entry() call above (and the - * H5AC__FREE_FILE_SPACE_FLAG used there), but since the direct - * block structure might have a different size on disk than in - * the heap's 'abstract' address space, we would need to set the - * "file_size" field for the direct block structure. In order to - * do that, we'd have to protect/unprotect the direct block and - * that would add a bunch of unnecessary overhead to the process, - * so we just release the file space here, directly. When the - * revised metadata cache is operating, it will "know" the file - * size of each entry in the cache and we can the the - * H5AC_expunge_entry() method. -QAK) - */ - if(H5MF_xfree(f, H5FD_MEM_FHEAP_DBLOCK, dxpl_id, dblock_addr, dblock_size) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to free fractal heap direct block") + /* Check if the direct block is NOT currently allocated in temp. file space */ + /* (temp. file space does not need to be freed) */ + if(!H5F_IS_TMP_ADDR(f, dblock_addr)) { + /* Release direct block's disk space */ + /* (XXX: Under the best of circumstances, this block's space in the file + * would be freed in the H5AC_expunge_entry() call above (and the + * H5AC__FREE_FILE_SPACE_FLAG used there), but since the direct + * block structure might have a different size on disk than in + * the heap's 'abstract' address space, we would need to set the + * "file_size" field for the direct block structure. In order to + * do that, we'd have to protect/unprotect the direct block and + * that would add a bunch of unnecessary overhead to the process, + * so we just release the file space here, directly. When the + * revised metadata cache is operating, it will "know" the file + * size of each entry in the cache and we can the the + * H5AC_expunge_entry() method. -QAK) + */ + if(H5MF_xfree(f, H5FD_MEM_FHEAP_DBLOCK, dxpl_id, dblock_addr, dblock_size) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to free fractal heap direct block") + } /* end if */ done: FUNC_LEAVE_NOAPI(ret_value) |