diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2002-05-10 18:38:10 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2002-05-10 18:38:10 (GMT) |
commit | 084b35362bfac78604b02654cdc2067488c00300 (patch) | |
tree | e67284d7304850ef0428155c54a1d3d48c06875f /src/H5F.c | |
parent | 9815305745d7317d7bd6cee494a42bc2a62001c6 (diff) | |
download | hdf5-084b35362bfac78604b02654cdc2067488c00300.zip hdf5-084b35362bfac78604b02654cdc2067488c00300.tar.gz hdf5-084b35362bfac78604b02654cdc2067488c00300.tar.bz2 |
[svn-r5393] Purpose:
New Feature
Description:
The VFL flush function is called immediately before a file is closed.
This can cause duplicate syncronization actions to occur, if the VFL
close function also performs them.
Solution:
Added 'closing' parameter to VFL 'flush' operation. This allows the VFL
flush function to bypass operations that will be duplicated within the VFL
close function.
Additionally, use the 'closing' parameter to bypass calls to MPI_File_sync()
when set. Since MPI_File_close() also syncronizes the file, this avoids
the terrible performance hit taken when calling MPI_File_sync() as the file
is closing.
Platforms tested:
IRIX64 6.5 (modi4)
Diffstat (limited to 'src/H5F.c')
-rw-r--r-- | src/H5F.c | 28 |
1 files changed, 17 insertions, 11 deletions
@@ -65,7 +65,7 @@ typedef struct H5F_olist_t { static H5F_t *H5F_new(H5F_file_t *shared, hid_t fcpl_id, hid_t fapl_id); static herr_t H5F_dest(H5F_t *f); static herr_t H5F_flush(H5F_t *f, H5F_scope_t scope, hbool_t invalidate, - hbool_t alloc_only); + hbool_t alloc_only, hbool_t closing); static haddr_t H5F_locate_signature(H5FD_t *file); static int H5F_flush_all_cb(H5F_t *f, hid_t fid, const void *_invalidate); static herr_t H5F_get_obj_count(H5F_t *f, unsigned types, @@ -631,7 +631,7 @@ static int H5F_flush_all_cb(H5F_t *f, hid_t UNUSED fid, const void *_invalidate) { hbool_t invalidate = *((const hbool_t*)_invalidate); - H5F_flush(f, H5F_SCOPE_LOCAL, invalidate, FALSE); + H5F_flush(f, H5F_SCOPE_LOCAL, invalidate, FALSE, FALSE); return 0; } @@ -1747,7 +1747,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) shared->boot_addr = userblock_size; shared->base_addr = shared->boot_addr; shared->consist_flags = 0x03; - if (H5F_flush(file, H5F_SCOPE_LOCAL, FALSE, TRUE)<0) + if (H5F_flush(file, H5F_SCOPE_LOCAL, FALSE, TRUE, FALSE)<0) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to write file superblock"); /* Create and open the root group */ @@ -2222,7 +2222,7 @@ H5Fflush(hid_t object_id, H5F_scope_t scope) } /* Flush the file */ - if (H5F_flush(f, scope, FALSE, FALSE)<0) { + if (H5F_flush(f, scope, FALSE, FALSE, FALSE)<0) { HRETURN_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "flush failed"); } @@ -2268,11 +2268,17 @@ H5Fflush(hid_t object_id, H5F_scope_t scope) * Raymond Lu, 2001-10-14 * Changed to new generic property list. * + * Quincey Koziol, 2002-05-10 + * Added new 'closing' parameter to indicate that this function + * is being called immediately before a file is closed. This + * may allow some file drivers to bypass duplicating certain + * syncronizations that are already performed when a file + * closes. *------------------------------------------------------------------------- */ static herr_t H5F_flush(H5F_t *f, H5F_scope_t scope, hbool_t invalidate, - hbool_t alloc_only) + hbool_t alloc_only, hbool_t closing) { uint8_t sbuf[2048], dbuf[2048], *p=NULL; unsigned nerrors=0, i; @@ -2303,7 +2309,7 @@ H5F_flush(H5F_t *f, H5F_scope_t scope, hbool_t invalidate, } if (H5F_SCOPE_DOWN==scope) { for (i=0; i<f->mtab.nmounts; i++) { - if (H5F_flush(f->mtab.child[i].file, scope, invalidate, FALSE)<0) + if (H5F_flush(f->mtab.child[i].file, scope, invalidate, FALSE, closing)<0) nerrors++; } } @@ -2431,7 +2437,7 @@ H5F_flush(H5F_t *f, H5F_scope_t scope, hbool_t invalidate, } /* end else */ /* Flush file buffers to disk */ - if (!alloc_only && H5FD_flush(f->shared->lf)<0) + if (!alloc_only && H5FD_flush(f->shared->lf, closing)<0) HRETURN_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "low level flush failed"); /* Check flush errors for children - errors are already on the stack */ @@ -2490,7 +2496,7 @@ H5F_close(H5F_t *f) * count, flush the file, and return. */ if (f->nrefs>1) { - if (H5F_flush(f, H5F_SCOPE_LOCAL, FALSE, FALSE)<0) { + if (H5F_flush(f, H5F_SCOPE_LOCAL, FALSE, FALSE, FALSE)<0) { HRETURN_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush cache"); } @@ -2516,7 +2522,7 @@ H5F_close(H5F_t *f) assert(1==f->nrefs); if (1==f->shared->nrefs) { /* Flush and destroy all caches */ - if (H5F_flush(f, H5F_SCOPE_LOCAL, TRUE, FALSE)<0) { + if (H5F_flush(f, H5F_SCOPE_LOCAL, TRUE, FALSE, TRUE)<0) { HRETURN_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush cache"); } @@ -2551,7 +2557,7 @@ H5F_close(H5F_t *f) * instead. */ if (f->nopen_objs>0) { - if (H5F_flush(f, H5F_SCOPE_LOCAL, FALSE, FALSE)<0) + if (H5F_flush(f, H5F_SCOPE_LOCAL, FALSE, FALSE, TRUE)<0) HRETURN_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush cache"); #ifdef H5F_DEBUG @@ -2619,7 +2625,7 @@ H5F_close(H5F_t *f) * this file are closed the flush isn't really necessary, but lets * just be safe. */ - if (H5F_flush(f, H5F_SCOPE_LOCAL, TRUE, FALSE)<0) { + if (H5F_flush(f, H5F_SCOPE_LOCAL, TRUE, FALSE, FALSE)<0) { HRETURN_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush cache"); } |