summaryrefslogtreecommitdiffstats
path: root/src/H5FDmpio.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2014-12-29 06:02:06 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2014-12-29 06:02:06 (GMT)
commitb65eae7aeeabcb15b2ef002692e1d0435902d44a (patch)
tree78fb110371c0d23995028fa7fe5c59726b599d5c /src/H5FDmpio.c
parent662892e8b18db2dd5c1ebcd923c246adb4fe0fac (diff)
downloadhdf5-b65eae7aeeabcb15b2ef002692e1d0435902d44a.zip
hdf5-b65eae7aeeabcb15b2ef002692e1d0435902d44a.tar.gz
hdf5-b65eae7aeeabcb15b2ef002692e1d0435902d44a.tar.bz2
[svn-r25929] Description:
Clean up EOF code within library and add 'mem_type' parameter to 'get_eof' VFD callback, to avoid various ambiguous situations, particularly with the multi VFD. (Supports changes for 'avoid_truncate' feature also) Tested on: MacOSX/64 10.10.1 (amazon) w/serial & parallel h5committest forthcoming
Diffstat (limited to 'src/H5FDmpio.c')
-rw-r--r--src/H5FDmpio.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c
index 89f1432..70cf49a 100644
--- a/src/H5FDmpio.c
+++ b/src/H5FDmpio.c
@@ -69,6 +69,7 @@ typedef struct H5FD_mpio_t {
haddr_t eof; /*end-of-file marker */
haddr_t eoa; /*end-of-address marker */
haddr_t last_eoa; /* Last known end-of-address marker */
+ haddr_t local_eof; /* Local end-of-file address for each process */
} H5FD_mpio_t;
/* Private Prototypes */
@@ -84,7 +85,7 @@ static herr_t H5FD_mpio_close(H5FD_t *_file);
static herr_t H5FD_mpio_query(const H5FD_t *_f1, unsigned long *flags);
static haddr_t H5FD_mpio_get_eoa(const H5FD_t *_file, H5FD_mem_t type);
static herr_t H5FD_mpio_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr);
-static haddr_t H5FD_mpio_get_eof(const H5FD_t *_file);
+static haddr_t H5FD_mpio_get_eof(const H5FD_t *_file, H5FD_mem_t type);
static herr_t H5FD_mpio_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle);
static herr_t H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr,
size_t size, void *buf);
@@ -1107,6 +1108,7 @@ H5FD_mpio_open(const char *name, unsigned flags, hid_t fapl_id,
/* Set the size of the file (from library's perspective) */
file->eof = H5FD_mpi_MPIOff_to_haddr(size);
+ file->local_eof = file->eof;
/* Set return value */
ret_value=(H5FD_t*)file;
@@ -1331,7 +1333,7 @@ H5FD_mpio_set_eoa(H5FD_t *_file, H5FD_mem_t UNUSED type, haddr_t addr)
*-------------------------------------------------------------------------
*/
static haddr_t
-H5FD_mpio_get_eof(const H5FD_t *_file)
+H5FD_mpio_get_eof(const H5FD_t *_file, H5FD_mem_t UNUSED type)
{
const H5FD_mpio_t *file = (const H5FD_mpio_t*)_file;
@@ -1906,9 +1908,17 @@ H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr,
if(bytes_written != io_size)
HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed")
- /* Forget the EOF value (see H5FD_mpio_get_eof()) --rpm 1999-08-06 */
+ /* Each process will keep track of its perceived EOF value locally, and
+ * ultimately we will reduce this value to the maximum amongst all
+ * processes, but until then keep the actual eof at HADDR_UNDEF just in
+ * case something bad happens before that point. (rather have a value
+ * we know is wrong sitting around rather than one that could only
+ * potentially be wrong.) */
file->eof = HADDR_UNDEF;
+ if(bytes_written && ((bytes_written + addr) > file->local_eof))
+ file->local_eof = addr + bytes_written;
+
done:
#ifdef H5FDmpio_DEBUG
if(H5FD_mpio_Debug[(int)'t'])