diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2009-08-20 21:54:04 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2009-08-20 21:54:04 (GMT) |
commit | 6ee76fffc7ef5689ab204a068e2c23b2d98ab595 (patch) | |
tree | 0697fdbe465ac1ffaaa730271b50a94c59b22c2f /src/H5F.c | |
parent | d96442aae5fe20ea2d6e7bfde75822bb09c9acbd (diff) | |
download | hdf5-6ee76fffc7ef5689ab204a068e2c23b2d98ab595.zip hdf5-6ee76fffc7ef5689ab204a068e2c23b2d98ab595.tar.gz hdf5-6ee76fffc7ef5689ab204a068e2c23b2d98ab595.tar.bz2 |
[svn-r17399] Description:
Bring r17393 and r17398 from trunk to 1.8 branch:
Bring back more changes from the file free space branch to the trunk. (17393)
First set of changes to move VFD 'truncate' call out of H5F_flush and defer
it until the file is closed. (17398)
Tested on:
FreeBSD/32 6.3 (duty) in debug mode
(h5committested on trunk)
Diffstat (limited to 'src/H5F.c')
-rw-r--r-- | src/H5F.c | 31 |
1 files changed, 21 insertions, 10 deletions
@@ -890,7 +890,7 @@ H5F_new(H5F_file_t *shared, hid_t fcpl_id, hid_t fapl_id, H5FD_t *lf) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get byte number for address") if(H5P_get(plist, H5F_CRT_OBJ_BYTE_NUM_NAME, &f->shared->sizeof_size) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get byte number for object size") - if(H5P_get(plist, H5F_CRT_SHMSG_NINDEXES_NAME, &f->shared->sohm_nindexes)<0) + if(H5P_get(plist, H5F_CRT_SHMSG_NINDEXES_NAME, &f->shared->sohm_nindexes) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get number of SOHM indexes") HDassert(f->shared->sohm_nindexes < 255); @@ -1083,10 +1083,18 @@ H5F_dest(H5F_t *f, hid_t dxpl_id) /* Push error, but keep going*/ HDONE_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "can't close property list") - /* Close low-level file */ + /* Only truncate the file on an orderly close, with write-access */ + if(f->closing && (H5F_ACC_RDWR & f->shared->flags)) { + /* Truncate the file to the current allocated size */ + if(H5FD_truncate(f->shared->lf, dxpl_id, (unsigned)TRUE) < 0) + /* Push error, but keep going*/ + HDONE_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL, "low level truncate failed") + } /* end if */ + + /* Close the file */ if(H5FD_close(f->shared->lf) < 0) /* Push error, but keep going*/ - HDONE_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "problems closing file") + HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "unable to close file") /* Free mount table */ f->shared->mtab.child = (H5F_mount_t *)H5MM_xfree(f->shared->mtab.child); @@ -1674,13 +1682,16 @@ H5F_flush(H5F_t *f, hid_t dxpl_id, H5F_scope_t scope, unsigned flags) if(H5MF_close(f, dxpl_id) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't release file free space info") } /* end if */ - - /* Truncate the file to the current allocated size */ - /* (needs to happen before superblock write, since the 'eoa' value is - * written in superblock -QAK) - */ - if(H5FD_truncate(f->shared->lf, dxpl_id, (unsigned)((flags & H5F_FLUSH_CLOSING) > 0)) < 0) - HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "low level truncate failed") + else { + /* Release any space allocated to space aggregators, so that the eoa value + * corresponds to the end of the space written to in the file. + */ + /* (needs to happen before superblock write, since the 'eoa' value is + * written in superblock -QAK) + */ + if(H5MF_free_aggrs(f, dxpl_id) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't release file space") + } /* end else */ /* Flush (and invalidate, if requested) the entire metadata cache */ H5AC_flags = 0; |