diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2009-08-20 20:30:35 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2009-08-20 20:30:35 (GMT) |
commit | ea5f97cf8f38e5832656c2c44507cce3e548058f (patch) | |
tree | 2cc1593fe66b33a42e0d5763316271a9f8c98eb5 /src/H5F.c | |
parent | 7b6f8492867941f510a32897b0e94ebce394cdd7 (diff) | |
download | hdf5-ea5f97cf8f38e5832656c2c44507cce3e548058f.zip hdf5-ea5f97cf8f38e5832656c2c44507cce3e548058f.tar.gz hdf5-ea5f97cf8f38e5832656c2c44507cce3e548058f.tar.bz2 |
[svn-r17398] Description:
First set of changes to move VFD 'truncate' call out of H5F_flush and defer
it until the file is closed.
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 (kagiso) 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 production mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
Mac OS X/32 10.5.8 (amazon) in debug mode
Mac OS X/32 10.5.8 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
Diffstat (limited to 'src/H5F.c')
-rw-r--r-- | src/H5F.c | 29 |
1 files changed, 20 insertions, 9 deletions
@@ -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; |