summaryrefslogtreecommitdiffstats
path: root/src/H5FD.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2007-03-08 20:10:12 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2007-03-08 20:10:12 (GMT)
commit74a30fff3e0fcd8919ced487abd03eefd27d57c1 (patch)
tree2df0a0d2cfc51cce067f25e503e6dfd26c8e827d /src/H5FD.c
parent25bb6f5dd8af42d2facaab26f0cdeb7fc76456ae (diff)
downloadhdf5-74a30fff3e0fcd8919ced487abd03eefd27d57c1.zip
hdf5-74a30fff3e0fcd8919ced487abd03eefd27d57c1.tar.gz
hdf5-74a30fff3e0fcd8919ced487abd03eefd27d57c1.tar.bz2
[svn-r13477] Description:
The main purpose of this checkin was to eliminate the space used for tracking creation time indices when there is no way they can be used (i.e. attributes can't be shared in the file and the user hasn't turned on attribute creation tracking), however there were some other minor changes which crept in: - Fix a cache locking deadlock when a shared attribute and one of its components end up in the same fractal heap direct block. (This is fixed the "slow" way for right now, until John has time to add support for readers/writer locking to the cache. - Optimize attribute copying when a copy will be kept during a v2 B-tree search. - When freeing a block on disk, attempt to merge it with the metadata and "small data" aggregators. Tested on: Mac OS X/32 10.4.8 (amazon) FreeBSD/32 6.2 (duty)
Diffstat (limited to 'src/H5FD.c')
-rw-r--r--src/H5FD.c51
1 files changed, 51 insertions, 0 deletions
diff --git a/src/H5FD.c b/src/H5FD.c
index ce8d91f..d1cb7c1 100644
--- a/src/H5FD.c
+++ b/src/H5FD.c
@@ -2444,6 +2444,54 @@ HDfprintf(stderr, "%s: type = %u, addr = %a, size = %Hu\n", FUNC, (unsigned)type
/* Check if we increased the size of the largest block on the list */
file->maxsize = MAX(file->maxsize, last->size);
+ /* Check if this free block adjoins the "metadata aggregator" */
+ if(file->feature_flags & H5FD_FEAT_AGGREGATE_METADATA && file->eoma != 0) {
+ hbool_t adjoins = FALSE; /* Whether the block adjoined the metadata aggregator */
+
+ /* Does the new block adjoin the end of the metadata aggregator */
+ if((file->eoma + file->cur_meta_block_size) == last->addr) {
+ last->addr = file->eoma;
+ adjoins = TRUE;
+ } /* end if */
+ /* Does the new block adjoin the beginning of the metadata aggregator */
+ else if((last->addr + last->size) == file->eoma)
+ adjoins = TRUE;
+
+ /* Reset metadata aggregator information, if adjoined */
+ if(adjoins) {
+#ifdef H5FD_ALLOC_DEBUG
+HDfprintf(stderr, "%s: Adjoined metadata aggregator\n", FUNC);
+#endif /* H5FD_ALLOC_DEBUG */
+ last->size += file->cur_meta_block_size;
+ file->eoma = 0;
+ file->cur_meta_block_size = 0;
+ } /* end if */
+ } /* end if */
+
+ /* Check if this free block adjoins the "small data aggregator" */
+ if(file->feature_flags & H5FD_FEAT_AGGREGATE_SMALLDATA && file->eosda != 0) {
+ hbool_t adjoins = FALSE; /* Whether the block adjoined the small-data aggregator */
+
+ /* Does the new block adjoin the end of the small-data aggregator */
+ if((file->eosda + file->cur_sdata_block_size) == last->addr) {
+ last->addr = file->eosda;
+ adjoins = TRUE;
+ } /* end if */
+ /* Does the new block adjoin the beginning of the small-data aggregator */
+ else if((last->addr + last->size) == file->eosda)
+ adjoins = TRUE;
+
+ /* Reset small-data aggregator information, if adjoined */
+ if(adjoins) {
+#ifdef H5FD_ALLOC_DEBUG
+HDfprintf(stderr, "%s: Adjoined small data aggregator\n", FUNC);
+#endif /* H5FD_ALLOC_DEBUG */
+ last->size += file->cur_sdata_block_size;
+ file->eosda = 0;
+ file->cur_sdata_block_size = 0;
+ } /* end if */
+ } /* end if */
+
/* Check if this free block is at the end of file allocated space.
* Truncate it if this is true. */
if(file->cls->get_eoa) {
@@ -2451,6 +2499,9 @@ HDfprintf(stderr, "%s: type = %u, addr = %a, size = %Hu\n", FUNC, (unsigned)type
eoa = file->cls->get_eoa(file, type);
if(eoa == (last->addr + last->size)) {
+#ifdef H5FD_ALLOC_DEBUG
+HDfprintf(stderr, "%s: Reducing file size to = %a\n", FUNC, last->addr);
+#endif /* H5FD_ALLOC_DEBUG */
if(file->cls->set_eoa(file, type, last->addr) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "set end of space allocation request failed")