summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVailin Choi <vchoi@hdfgroup.org>2015-03-03 05:08:02 (GMT)
committerVailin Choi <vchoi@hdfgroup.org>2015-03-03 05:08:02 (GMT)
commit394f6f50bfaeef0a68b7c363db523305aa0882e2 (patch)
treea8f3107b005e099fdd0e3fdaeee2ebda30c56912 /src
parent690b832ce1de4698a7fbe1f49b3c71d8c0a5fc14 (diff)
downloadhdf5-394f6f50bfaeef0a68b7c363db523305aa0882e2.zip
hdf5-394f6f50bfaeef0a68b7c363db523305aa0882e2.tar.gz
hdf5-394f6f50bfaeef0a68b7c363db523305aa0882e2.tar.bz2
[svn-r26345] Bring revisions #25902 - #25971 from trunk to revise_chunks.
h5committested.
Diffstat (limited to 'src')
-rw-r--r--src/H5F.c11
-rw-r--r--src/H5FD.c6
-rw-r--r--src/H5FDcore.c6
-rw-r--r--src/H5FDdirect.c6
-rw-r--r--src/H5FDfamily.c10
-rw-r--r--src/H5FDint.c11
-rw-r--r--src/H5FDlog.c6
-rw-r--r--src/H5FDmpio.c52
-rw-r--r--src/H5FDmulti.c88
-rw-r--r--src/H5FDprivate.h2
-rw-r--r--src/H5FDpublic.h4
-rw-r--r--src/H5FDsec2.c6
-rw-r--r--src/H5FDstdio.c6
-rw-r--r--src/H5Fint.c2
-rw-r--r--src/H5Fsuper_cache.c47
-rw-r--r--src/H5Ofill.c4
-rw-r--r--src/H5Smpio.c9
-rw-r--r--src/H5public.h4
-rw-r--r--src/Makefile.in2
19 files changed, 179 insertions, 103 deletions
diff --git a/src/H5F.c b/src/H5F.c
index dd9e638..3056a92 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -980,6 +980,8 @@ H5Fget_filesize(hid_t file_id, hsize_t *size)
{
H5F_t *file; /* File object for file ID */
haddr_t eof; /* End of file address */
+ haddr_t eoa; /* End of allocation address */
+ haddr_t max_eof_eoa; /* Maximum of the EOA & EOF */
haddr_t base_addr; /* Base address for the file */
herr_t ret_value = SUCCEED; /* Return value */
@@ -991,12 +993,15 @@ H5Fget_filesize(hid_t file_id, hsize_t *size)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID")
/* Go get the actual file size */
- if(HADDR_UNDEF == (eof = H5FD_get_eof(file->shared->lf)))
- HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get file size")
+ eof = H5FD_get_eof(file->shared->lf, H5FD_MEM_DEFAULT);
+ eoa = H5FD_get_eoa(file->shared->lf, H5FD_MEM_DEFAULT);
+ max_eof_eoa = MAX(eof, eoa);
+ if(HADDR_UNDEF == max_eof_eoa)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "file get eof/eoa requests failed")
base_addr = H5FD_get_base_addr(file->shared->lf);
if(size)
- *size = (hsize_t)(eof + base_addr); /* Convert relative base address for file to absolute address */
+ *size = (hsize_t)(max_eof_eoa + base_addr); /* Convert relative base address for file to absolute address */
done:
FUNC_LEAVE_API(ret_value)
diff --git a/src/H5FD.c b/src/H5FD.c
index c556cd0..bbadd33 100644
--- a/src/H5FD.c
+++ b/src/H5FD.c
@@ -1521,19 +1521,19 @@ done:
*-------------------------------------------------------------------------
*/
haddr_t
-H5FDget_eof(H5FD_t *file)
+H5FDget_eof(H5FD_t *file, H5FD_mem_t type)
{
haddr_t ret_value;
FUNC_ENTER_API(HADDR_UNDEF)
- H5TRACE1("a", "*x", file);
+ H5TRACE2("a", "*xMt", file, type);
/* Check arguments */
if(!file || !file->cls)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "invalid file pointer")
/* The real work */
- if(HADDR_UNDEF == (ret_value = H5FD_get_eof(file)))
+ if(HADDR_UNDEF == (ret_value = H5FD_get_eof(file, type)))
HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "file get eof request failed")
/* (Note compensating for base address subtraction in internal routine) */
diff --git a/src/H5FDcore.c b/src/H5FDcore.c
index d604a8a..484c481 100644
--- a/src/H5FDcore.c
+++ b/src/H5FDcore.c
@@ -141,7 +141,7 @@ static int H5FD_core_cmp(const H5FD_t *_f1, const H5FD_t *_f2);
static herr_t H5FD_core_query(const H5FD_t *_f1, unsigned long *flags);
static haddr_t H5FD_core_get_eoa(const H5FD_t *_file, H5FD_mem_t type);
static herr_t H5FD_core_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr);
-static haddr_t H5FD_core_get_eof(const H5FD_t *_file);
+static haddr_t H5FD_core_get_eof(const H5FD_t *_file, H5FD_mem_t type);
static herr_t H5FD_core_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle);
static herr_t H5FD_core_read(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr,
size_t size, void *buf);
@@ -1133,13 +1133,13 @@ done:
*-------------------------------------------------------------------------
*/
static haddr_t
-H5FD_core_get_eof(const H5FD_t *_file)
+H5FD_core_get_eof(const H5FD_t *_file, H5FD_mem_t UNUSED type)
{
const H5FD_core_t *file = (const H5FD_core_t*)_file;
FUNC_ENTER_NOAPI_NOINIT_NOERR
- FUNC_LEAVE_NOAPI(MAX(file->eof, file->eoa))
+ FUNC_LEAVE_NOAPI(file->eof)
}
diff --git a/src/H5FDdirect.c b/src/H5FDdirect.c
index 19f9bda..9a9d6df 100644
--- a/src/H5FDdirect.c
+++ b/src/H5FDdirect.c
@@ -140,7 +140,7 @@ static int H5FD_direct_cmp(const H5FD_t *_f1, const H5FD_t *_f2);
static herr_t H5FD_direct_query(const H5FD_t *_f1, unsigned long *flags);
static haddr_t H5FD_direct_get_eoa(const H5FD_t *_file, H5FD_mem_t type);
static herr_t H5FD_direct_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr);
-static haddr_t H5FD_direct_get_eof(const H5FD_t *_file);
+static haddr_t H5FD_direct_get_eof(const H5FD_t *_file, H5FD_mem_t type);
static herr_t H5FD_direct_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle);
static herr_t H5FD_direct_read(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr,
size_t size, void *buf);
@@ -817,13 +817,13 @@ H5FD_direct_set_eoa(H5FD_t *_file, H5FD_mem_t UNUSED type, haddr_t addr)
*-------------------------------------------------------------------------
*/
static haddr_t
-H5FD_direct_get_eof(const H5FD_t *_file)
+H5FD_direct_get_eof(const H5FD_t *_file, H5FD_mem_t UNUSED type)
{
const H5FD_direct_t *file = (const H5FD_direct_t*)_file;
FUNC_ENTER_NOAPI_NOINIT
- FUNC_LEAVE_NOAPI(MAX(file->eof, file->eoa))
+ FUNC_LEAVE_NOAPI(file->eof)
}
diff --git a/src/H5FDfamily.c b/src/H5FDfamily.c
index 1728d13..ad703ef 100644
--- a/src/H5FDfamily.c
+++ b/src/H5FDfamily.c
@@ -99,7 +99,7 @@ static int H5FD_family_cmp(const H5FD_t *_f1, const H5FD_t *_f2);
static herr_t H5FD_family_query(const H5FD_t *_f1, unsigned long *flags);
static haddr_t H5FD_family_get_eoa(const H5FD_t *_file, H5FD_mem_t type);
static herr_t H5FD_family_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t eoa);
-static haddr_t H5FD_family_get_eof(const H5FD_t *_file);
+static haddr_t H5FD_family_get_eof(const H5FD_t *_file, H5FD_mem_t type);
static herr_t H5FD_family_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle);
static herr_t H5FD_family_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr,
size_t size, void *_buf/*out*/);
@@ -757,7 +757,7 @@ H5FD_family_open(const char *name, unsigned flags, hid_t fapl_id,
* smaller than the size specified through H5Pset_fapl_family(). Update the actual
* member size.
*/
- if ((eof=H5FDget_eof(file->memb[0]))) file->memb_size = eof;
+ if ((eof=H5FDget_eof(file->memb[0], H5FD_MEM_DEFAULT))) file->memb_size = eof;
ret_value=(H5FD_t *)file;
@@ -1047,7 +1047,7 @@ done:
*-------------------------------------------------------------------------
*/
static haddr_t
-H5FD_family_get_eof(const H5FD_t *_file)
+H5FD_family_get_eof(const H5FD_t *_file, H5FD_mem_t type)
{
const H5FD_family_t *file = (const H5FD_family_t*)_file;
haddr_t eof=0;
@@ -1063,7 +1063,7 @@ H5FD_family_get_eof(const H5FD_t *_file)
*/
HDassert(file->nmembs > 0);
for(i = (int)file->nmembs - 1; i >= 0; --i) {
- if((eof = H5FD_get_eof(file->memb[i])) != 0)
+ if((eof = H5FD_get_eof(file->memb[i], type)) != 0)
break;
if(0 == i)
break;
@@ -1079,7 +1079,7 @@ H5FD_family_get_eof(const H5FD_t *_file)
eof += ((unsigned)i)*file->memb_size;
/* Set return value */
- ret_value = MAX(eof, file->eoa);
+ ret_value = eof;
FUNC_LEAVE_NOAPI(ret_value)
}
diff --git a/src/H5FDint.c b/src/H5FDint.c
index 9f02a25..4f3c234 100644
--- a/src/H5FDint.c
+++ b/src/H5FDint.c
@@ -120,7 +120,7 @@ H5FD_int_init_interface(void)
herr_t
H5FD_locate_signature(H5FD_t *file, const H5P_genplist_t *dxpl, haddr_t *sig_addr)
{
- haddr_t addr, eoa;
+ haddr_t addr, eoa, eof;
uint8_t buf[H5F_SIGNATURE_LEN];
unsigned n, maxpow;
herr_t ret_value = SUCCEED; /* Return value */
@@ -128,7 +128,10 @@ H5FD_locate_signature(H5FD_t *file, const H5P_genplist_t *dxpl, haddr_t *sig_add
FUNC_ENTER_NOAPI_NOINIT
/* Find the least N such that 2^N is larger than the file size */
- if(HADDR_UNDEF == (addr = H5FD_get_eof(file)) || HADDR_UNDEF == (eoa = H5FD_get_eoa(file, H5FD_MEM_SUPER)))
+ eof = H5FD_get_eof(file, H5FD_MEM_SUPER);
+ eoa = H5FD_get_eoa(file, H5FD_MEM_SUPER);
+ addr = MAX(eof, eoa);
+ if(HADDR_UNDEF == addr)
HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to obtain EOF/EOA value")
for(maxpow = 0; addr; maxpow++)
addr >>= 1;
@@ -348,7 +351,7 @@ done:
*-------------------------------------------------------------------------
*/
haddr_t
-H5FD_get_eof(const H5FD_t *file)
+H5FD_get_eof(const H5FD_t *file, H5FD_mem_t type)
{
haddr_t ret_value;
@@ -358,7 +361,7 @@ H5FD_get_eof(const H5FD_t *file)
/* Dispatch to driver */
if(file->cls->get_eof) {
- if(HADDR_UNDEF == (ret_value = (file->cls->get_eof)(file)))
+ if(HADDR_UNDEF == (ret_value = (file->cls->get_eof)(file, type)))
HGOTO_ERROR(H5E_VFL, H5E_CANTGET, HADDR_UNDEF, "driver get_eof request failed")
} /* end if */
else
diff --git a/src/H5FDlog.c b/src/H5FDlog.c
index ca6cada..5d98955 100644
--- a/src/H5FDlog.c
+++ b/src/H5FDlog.c
@@ -183,7 +183,7 @@ static herr_t H5FD_log_query(const H5FD_t *_f1, unsigned long *flags);
static haddr_t H5FD_log_alloc(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size);
static haddr_t H5FD_log_get_eoa(const H5FD_t *_file, H5FD_mem_t type);
static herr_t H5FD_log_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr);
-static haddr_t H5FD_log_get_eof(const H5FD_t *_file);
+static haddr_t H5FD_log_get_eof(const H5FD_t *_file, H5FD_mem_t type);
static herr_t H5FD_log_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle);
static herr_t H5FD_log_read(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr,
size_t size, void *buf);
@@ -1071,13 +1071,13 @@ H5FD_log_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr)
*-------------------------------------------------------------------------
*/
static haddr_t
-H5FD_log_get_eof(const H5FD_t *_file)
+H5FD_log_get_eof(const H5FD_t *_file, H5FD_mem_t UNUSED type)
{
const H5FD_log_t *file = (const H5FD_log_t *)_file;
FUNC_ENTER_NOAPI_NOINIT_NOERR
- FUNC_LEAVE_NOAPI(MAX(file->eof, file->eoa))
+ FUNC_LEAVE_NOAPI(file->eof)
} /* end H5FD_log_get_eof() */
diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c
index 73237b7..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;
@@ -1454,10 +1456,16 @@ H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t dxpl_id, haddr_t add
int mpi_code; /* mpi return code */
MPI_Datatype buf_type = MPI_BYTE; /* MPI description of the selection in memory */
int size_i; /* Integer copy of 'size' to read */
+#if MPI_VERSION >= 3
MPI_Count bytes_read; /* Number of bytes read in */
- int n;
MPI_Count type_size; /* MPI datatype used for I/O's size */
MPI_Count io_size; /* Actual number of bytes requested */
+#else
+ int bytes_read; /* Number of bytes read in */
+ int type_size; /* MPI datatype used for I/O's size */
+ int io_size; /* Actual number of bytes requested */
+#endif
+ int n;
H5P_genplist_t *plist = NULL; /* Property list pointer */
hbool_t use_view_this_time = FALSE;
herr_t ret_value = SUCCEED;
@@ -1574,11 +1582,19 @@ H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t dxpl_id, haddr_t add
}
/* How many bytes were actually read? */
- if (MPI_SUCCESS != (mpi_code=MPI_Get_elements_x(&mpi_stat, buf_type, &bytes_read)))
+#if MPI_VERSION >= 3
+ if (MPI_SUCCESS != (mpi_code = MPI_Get_elements_x(&mpi_stat, buf_type, &bytes_read)))
+#else
+ if (MPI_SUCCESS != (mpi_code = MPI_Get_elements(&mpi_stat, MPI_BYTE, &bytes_read)))
+#endif
HMPI_GOTO_ERROR(FAIL, "MPI_Get_elements failed", mpi_code)
/* Get the type's size */
- if (MPI_SUCCESS != (mpi_code=MPI_Type_size_x(buf_type,&type_size)))
+#if MPI_VERSION >= 3
+ if (MPI_SUCCESS != (mpi_code = MPI_Type_size_x(buf_type, &type_size)))
+#else
+ if (MPI_SUCCESS != (mpi_code = MPI_Type_size(buf_type, &type_size)))
+#endif
HMPI_GOTO_ERROR(FAIL, "MPI_Type_size failed", mpi_code)
/* Compute the actual number of bytes requested */
@@ -1734,10 +1750,16 @@ H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr,
MPI_Status mpi_stat; /* Status from I/O operation */
MPI_Datatype buf_type = MPI_BYTE; /* MPI description of the selection in memory */
int mpi_code; /* MPI return code */
+#if MPI_VERSION >= 3
MPI_Count bytes_written;
- int size_i;
MPI_Count type_size; /* MPI datatype used for I/O's size */
MPI_Count io_size; /* Actual number of bytes requested */
+#else
+ int bytes_written;
+ int type_size; /* MPI datatype used for I/O's size */
+ int io_size; /* Actual number of bytes requested */
+#endif
+ int size_i;
hbool_t use_view_this_time = FALSE;
H5P_genplist_t *plist = NULL; /* Property list pointer */
herr_t ret_value = SUCCEED;
@@ -1864,11 +1886,19 @@ H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr,
}
/* How many bytes were actually written? */
+#if MPI_VERSION >= 3
if(MPI_SUCCESS != (mpi_code = MPI_Get_elements_x(&mpi_stat, buf_type, &bytes_written)))
+#else
+ if(MPI_SUCCESS != (mpi_code = MPI_Get_elements(&mpi_stat, MPI_BYTE, &bytes_written)))
+#endif
HMPI_GOTO_ERROR(FAIL, "MPI_Get_elements failed", mpi_code)
/* Get the type's size */
+#if MPI_VERSION >= 3
if(MPI_SUCCESS != (mpi_code = MPI_Type_size_x(buf_type, &type_size)))
+#else
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_size(buf_type, &type_size)))
+#endif
HMPI_GOTO_ERROR(FAIL, "MPI_Type_size failed", mpi_code)
/* Compute the actual number of bytes requested */
@@ -1878,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'])
diff --git a/src/H5FDmulti.c b/src/H5FDmulti.c
index b7caa68..b1f094c 100644
--- a/src/H5FDmulti.c
+++ b/src/H5FDmulti.c
@@ -43,10 +43,6 @@
*/
#define H5FD_MULTI_DEBUG
-/* Our version of MAX */
-#undef MAX
-#define MAX(X,Y) ((X)>(Y)?(X):(Y))
-
#ifndef FALSE
#define FALSE 0
#endif
@@ -135,7 +131,7 @@ static herr_t H5FD_multi_query(const H5FD_t *_f1, unsigned long *flags);
static herr_t H5FD_multi_get_type_map(const H5FD_t *file, H5FD_mem_t *type_map);
static haddr_t H5FD_multi_get_eoa(const H5FD_t *_file, H5FD_mem_t type);
static herr_t H5FD_multi_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t eoa);
-static haddr_t H5FD_multi_get_eof(const H5FD_t *_file);
+static haddr_t H5FD_multi_get_eof(const H5FD_t *_file, H5FD_mem_t type);
static herr_t H5FD_multi_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle);
static haddr_t H5FD_multi_alloc(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size);
static herr_t H5FD_multi_free(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr,
@@ -1430,54 +1426,70 @@ H5FD_multi_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t eoa)
*-------------------------------------------------------------------------
*/
static haddr_t
-H5FD_multi_get_eof(const H5FD_t *_file)
+H5FD_multi_get_eof(const H5FD_t *_file, H5FD_mem_t type)
{
const H5FD_multi_t *file = (const H5FD_multi_t*)_file;
- haddr_t eof=0, tmp_eof;
- haddr_t eoa=0, tmp_eoa;
+ haddr_t eof = 0;
static const char *func="H5FD_multi_get_eof"; /* Function Name for error reporting */
/* Clear the error stack */
H5Eclear2(H5E_DEFAULT);
- UNIQUE_MEMBERS(file->fa.memb_map, mt) {
- if (file->memb[mt]) {
- /* Retrieve EOF */
- H5E_BEGIN_TRY {
- tmp_eof = H5FDget_eof(file->memb[mt]);
- } H5E_END_TRY;
+ if(H5FD_MEM_DEFAULT == type) {
+ UNIQUE_MEMBERS(file->fa.memb_map, mt) {
+ haddr_t tmp_eof;
+
+ if(file->memb[mt]) {
+ /* Retrieve EOF */
+ H5E_BEGIN_TRY {
+ tmp_eof = H5FDget_eof(file->memb[mt], type);
+ } H5E_END_TRY;
+
+ if(HADDR_UNDEF == tmp_eof)
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "member file has unknown eof", HADDR_UNDEF)
+ if(tmp_eof > 0)
+ tmp_eof += file->fa.memb_addr[mt];
+ } else if(file->fa.relax) {
+ /*
+ * The member is not open yet (maybe it doesn't exist). Make the
+ * best guess about the end-of-file.
+ */
+ tmp_eof = file->memb_next[mt];
+ assert(HADDR_UNDEF != tmp_eof);
+ } else {
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "bad eof", HADDR_UNDEF)
+ }
+ if(tmp_eof > eof)
+ eof = tmp_eof;
+ } END_MEMBERS;
+ } else {
+ H5FD_mem_t mmt = file->fa.memb_map[type];
- if (HADDR_UNDEF==tmp_eof)
- H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "member file has unknown eof", HADDR_UNDEF)
- if (tmp_eof>0) tmp_eof += file->fa.memb_addr[mt];
+ if(H5FD_MEM_DEFAULT == mmt)
+ mmt = type;
- /* Retrieve EOA */
- H5E_BEGIN_TRY {
- tmp_eoa = H5FDget_eoa(file->memb[mt], mt);
- } H5E_END_TRY;
+ if(file->memb[mmt]) {
+ /* Retrieve EOF */
+ H5E_BEGIN_TRY {
+ eof = H5FDget_eof(file->memb[mmt], mmt);
+ } H5E_END_TRY;
- if (HADDR_UNDEF==tmp_eoa)
- H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "member file has unknown eoa", HADDR_UNDEF)
- if (tmp_eoa>0) tmp_eoa += file->fa.memb_addr[mt];
- } else if (file->fa.relax) {
+ if(HADDR_UNDEF == eof)
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "member file has unknown eof", HADDR_UNDEF)
+ if(eof > 0)
+ eof += file->fa.memb_addr[mmt];
+ } else if(file->fa.relax) {
/*
* The member is not open yet (maybe it doesn't exist). Make the
* best guess about the end-of-file.
*/
- tmp_eof = file->memb_next[mt];
- assert(HADDR_UNDEF!=tmp_eof);
-
- tmp_eoa = file->memb_next[mt];
- assert(HADDR_UNDEF!=tmp_eoa);
- } else {
+ eof = file->memb_next[mmt];
+ assert(HADDR_UNDEF != eof);
+ } else {
H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "bad eof", HADDR_UNDEF)
- }
-
- if (tmp_eof>eof) eof = tmp_eof;
- if (tmp_eoa>eoa) eoa = tmp_eoa;
- } END_MEMBERS;
-
- return MAX(eoa, eof);
+ }
+ }
+ return eof;
}
diff --git a/src/H5FDprivate.h b/src/H5FDprivate.h
index 33332d7..7c2a564 100644
--- a/src/H5FDprivate.h
+++ b/src/H5FDprivate.h
@@ -130,7 +130,7 @@ H5_DLL htri_t H5FD_try_extend(H5FD_t *file, H5FD_mem_t type, struct H5F_t *f,
haddr_t blk_end, hsize_t extra_requested);
H5_DLL haddr_t H5FD_get_eoa(const H5FD_t *file, H5FD_mem_t type);
H5_DLL herr_t H5FD_set_eoa(H5FD_t *file, H5FD_mem_t type, haddr_t addr);
-H5_DLL haddr_t H5FD_get_eof(const H5FD_t *file);
+H5_DLL haddr_t H5FD_get_eof(const H5FD_t *file, H5FD_mem_t type);
H5_DLL haddr_t H5FD_get_maxaddr(const H5FD_t *file);
H5_DLL herr_t H5FD_get_feature_flags(const H5FD_t *file, unsigned long *feature_flags);
H5_DLL herr_t H5FD_get_fs_type_map(const H5FD_t *file, H5FD_mem_t *type_map);
diff --git a/src/H5FDpublic.h b/src/H5FDpublic.h
index ed50bc7..87edf50 100644
--- a/src/H5FDpublic.h
+++ b/src/H5FDpublic.h
@@ -267,7 +267,7 @@ typedef struct H5FD_class_t {
haddr_t addr, hsize_t size);
haddr_t (*get_eoa)(const H5FD_t *file, H5FD_mem_t type);
herr_t (*set_eoa)(H5FD_t *file, H5FD_mem_t type, haddr_t addr);
- haddr_t (*get_eof)(const H5FD_t *file);
+ haddr_t (*get_eof)(const H5FD_t *file, H5FD_mem_t type);
herr_t (*get_handle)(H5FD_t *file, hid_t fapl, void**file_handle);
herr_t (*read)(H5FD_t *file, H5FD_mem_t type, hid_t dxpl,
haddr_t addr, size_t size, void *buffer);
@@ -348,7 +348,7 @@ H5_DLL herr_t H5FDfree(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id,
haddr_t addr, hsize_t size);
H5_DLL haddr_t H5FDget_eoa(H5FD_t *file, H5FD_mem_t type);
H5_DLL herr_t H5FDset_eoa(H5FD_t *file, H5FD_mem_t type, haddr_t eoa);
-H5_DLL haddr_t H5FDget_eof(H5FD_t *file);
+H5_DLL haddr_t H5FDget_eof(H5FD_t *file, H5FD_mem_t type);
H5_DLL herr_t H5FDget_vfd_handle(H5FD_t *file, hid_t fapl, void**file_handle);
H5_DLL herr_t H5FDread(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id,
haddr_t addr, size_t size, void *buf/*out*/);
diff --git a/src/H5FDsec2.c b/src/H5FDsec2.c
index d7c3c81..b6cdef5 100644
--- a/src/H5FDsec2.c
+++ b/src/H5FDsec2.c
@@ -141,7 +141,7 @@ static int H5FD_sec2_cmp(const H5FD_t *_f1, const H5FD_t *_f2);
static herr_t H5FD_sec2_query(const H5FD_t *_f1, unsigned long *flags);
static haddr_t H5FD_sec2_get_eoa(const H5FD_t *_file, H5FD_mem_t type);
static herr_t H5FD_sec2_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr);
-static haddr_t H5FD_sec2_get_eof(const H5FD_t *_file);
+static haddr_t H5FD_sec2_get_eof(const H5FD_t *_file, H5FD_mem_t type);
static herr_t H5FD_sec2_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle);
static herr_t H5FD_sec2_read(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr,
size_t size, void *buf);
@@ -631,13 +631,13 @@ H5FD_sec2_set_eoa(H5FD_t *_file, H5FD_mem_t UNUSED type, haddr_t addr)
*-------------------------------------------------------------------------
*/
static haddr_t
-H5FD_sec2_get_eof(const H5FD_t *_file)
+H5FD_sec2_get_eof(const H5FD_t *_file, H5FD_mem_t UNUSED type)
{
const H5FD_sec2_t *file = (const H5FD_sec2_t *)_file;
FUNC_ENTER_NOAPI_NOINIT_NOERR
- FUNC_LEAVE_NOAPI(MAX(file->eof, file->eoa))
+ FUNC_LEAVE_NOAPI(file->eof)
} /* end H5FD_sec2_get_eof() */
diff --git a/src/H5FDstdio.c b/src/H5FDstdio.c
index 36c21e1..ee97929 100644
--- a/src/H5FDstdio.c
+++ b/src/H5FDstdio.c
@@ -188,7 +188,7 @@ static herr_t H5FD_stdio_query(const H5FD_t *_f1, unsigned long *flags);
static haddr_t H5FD_stdio_alloc(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size);
static haddr_t H5FD_stdio_get_eoa(const H5FD_t *_file, H5FD_mem_t type);
static herr_t H5FD_stdio_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr);
-static haddr_t H5FD_stdio_get_eof(const H5FD_t *_file);
+static haddr_t H5FD_stdio_get_eof(const H5FD_t *_file, H5FD_mem_t type);
static herr_t H5FD_stdio_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle);
static herr_t H5FD_stdio_read(H5FD_t *lf, H5FD_mem_t type, hid_t fapl_id, haddr_t addr,
size_t size, void *buf);
@@ -726,14 +726,14 @@ H5FD_stdio_set_eoa(H5FD_t *_file, H5FD_mem_t /*UNUSED*/ type, haddr_t addr)
*-------------------------------------------------------------------------
*/
static haddr_t
-H5FD_stdio_get_eof(const H5FD_t *_file)
+H5FD_stdio_get_eof(const H5FD_t *_file, H5FD_mem_t /*UNUSED*/ type)
{
const H5FD_stdio_t *file = (const H5FD_stdio_t *)_file;
/* Clear the error stack */
H5Eclear2(H5E_DEFAULT);
- return MAX(file->eof, file->eoa);
+ return(file->eof);
} /* end H5FD_stdio_get_eof() */
diff --git a/src/H5Fint.c b/src/H5Fint.c
index 91a77af..02fedef 100644
--- a/src/H5Fint.c
+++ b/src/H5Fint.c
@@ -1074,7 +1074,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id,
* Read or write the file superblock, depending on whether the file is
* empty or not.
*/
- if(0 == H5FD_get_eof(lf) && (flags & H5F_ACC_RDWR)) {
+ if(0 == (MAX(H5FD_get_eof(lf, H5FD_MEM_SUPER), H5FD_get_eoa(lf, H5FD_MEM_SUPER))) && (flags & H5F_ACC_RDWR)) {
/*
* We've just opened a fresh new file (or truncated one). We need
* to create & write the superblock.
diff --git a/src/H5Fsuper_cache.c b/src/H5Fsuper_cache.c
index ddcc680..5fc1c7c 100644
--- a/src/H5Fsuper_cache.c
+++ b/src/H5Fsuper_cache.c
@@ -120,7 +120,7 @@ H5F_sblock_load(H5F_t *f, hid_t dxpl_id, haddr_t UNUSED addr, void *_udata)
H5P_genplist_t *c_plist; /* File creation property list */
H5F_file_t *shared; /* shared part of `file' */
H5FD_t *lf; /* file driver part of `shared' */
- haddr_t stored_eoa; /*relative end-of-addr in file */
+ haddr_t stored_eof; /* stored end-of-file address in file */
haddr_t eof; /* end of file address */
uint8_t sizeof_addr; /* Size of offsets in the file (in bytes) */
uint8_t sizeof_size; /* Size of lengths in the file (in bytes) */
@@ -288,7 +288,7 @@ H5F_sblock_load(H5F_t *f, hid_t dxpl_id, haddr_t UNUSED addr, void *_udata)
/* Remainder of "variable-sized" portion of superblock */
H5F_addr_decode(f, (const uint8_t **)&p, &sblock->base_addr/*out*/);
H5F_addr_decode(f, (const uint8_t **)&p, &sblock->ext_addr/*out*/);
- H5F_addr_decode(f, (const uint8_t **)&p, &stored_eoa/*out*/);
+ H5F_addr_decode(f, (const uint8_t **)&p, &stored_eof/*out*/);
H5F_addr_decode(f, (const uint8_t **)&p, &sblock->driver_addr/*out*/);
/* Allocate space for the root group symbol table entry */
@@ -310,10 +310,10 @@ H5F_sblock_load(H5F_t *f, hid_t dxpl_id, haddr_t UNUSED addr, void *_udata)
if(!H5F_addr_eq(base_addr, sblock->base_addr)) {
/* Check if the superblock moved earlier in the file */
if(H5F_addr_lt(base_addr, sblock->base_addr))
- stored_eoa -= (sblock->base_addr - base_addr);
+ stored_eof -= (sblock->base_addr - base_addr);
else
/* The superblock moved later in the file */
- stored_eoa += (base_addr - sblock->base_addr);
+ stored_eof += (base_addr - sblock->base_addr);
/* Adjust base address for offsets of the HDF5 data in the file */
sblock->base_addr = base_addr;
@@ -420,7 +420,7 @@ H5F_sblock_load(H5F_t *f, hid_t dxpl_id, haddr_t UNUSED addr, void *_udata)
/* Base, superblock extension, end of file & root group object header addresses */
H5F_addr_decode(f, (const uint8_t **)&p, &sblock->base_addr/*out*/);
H5F_addr_decode(f, (const uint8_t **)&p, &sblock->ext_addr/*out*/);
- H5F_addr_decode(f, (const uint8_t **)&p, &stored_eoa/*out*/);
+ H5F_addr_decode(f, (const uint8_t **)&p, &stored_eof/*out*/);
H5F_addr_decode(f, (const uint8_t **)&p, &sblock->root_addr/*out*/);
/* Compute checksum for superblock */
@@ -440,10 +440,10 @@ H5F_sblock_load(H5F_t *f, hid_t dxpl_id, haddr_t UNUSED addr, void *_udata)
if(!H5F_addr_eq(base_addr, sblock->base_addr)) {
/* Check if the superblock moved earlier in the file */
if(H5F_addr_lt(base_addr, sblock->base_addr))
- stored_eoa -= (sblock->base_addr - base_addr);
+ stored_eof -= (sblock->base_addr - base_addr);
else
/* The superblock moved later in the file */
- stored_eoa += (base_addr - sblock->base_addr);
+ stored_eof += (base_addr - sblock->base_addr);
/* Adjust base address for offsets of the HDF5 data in the file */
sblock->base_addr = base_addr;
@@ -480,12 +480,12 @@ H5F_sblock_load(H5F_t *f, hid_t dxpl_id, haddr_t UNUSED addr, void *_udata)
* been flushed to disk by the single writer process.)
*/
if (!(H5F_INTENT(f) & H5F_ACC_SWMR_READ)) {
- if(HADDR_UNDEF == (eof = H5FD_get_eof(lf)))
+ if(HADDR_UNDEF == (eof = H5FD_get_eof(lf, H5FD_MEM_DEFAULT)))
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to determine file size")
/* (Account for the stored EOA being absolute offset -QAK) */
- if((eof + sblock->base_addr) < stored_eoa)
- HGOTO_ERROR(H5E_FILE, H5E_TRUNCATED, NULL, "truncated file: eof = %llu, sblock->base_addr = %llu, stored_eoa = %llu", (unsigned long long)eof, (unsigned long long)sblock->base_addr, (unsigned long long)stored_eoa)
+ if((eof + sblock->base_addr) < stored_eof)
+ HGOTO_ERROR(H5E_FILE, H5E_TRUNCATED, NULL, "truncated file: eof = %llu, sblock->base_addr = %llu, stored_eof = %llu", (unsigned long long)eof, (unsigned long long)sblock->base_addr, (unsigned long long)stored_eof)
} /* end if */
/*
@@ -493,7 +493,7 @@ H5F_sblock_load(H5F_t *f, hid_t dxpl_id, haddr_t UNUSED addr, void *_udata)
* allocated so that it knows how to allocate additional memory.
*/
/* (Account for the stored EOA being absolute offset -NAF) */
- if(H5FD_set_eoa(lf, H5FD_MEM_SUPER, stored_eoa - sblock->base_addr) < 0)
+ if(H5FD_set_eoa(lf, H5FD_MEM_SUPER, stored_eof - sblock->base_addr) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to set end-of-address marker for file")
/* Read the file's superblock extension, if there is one. */
@@ -512,7 +512,7 @@ H5F_sblock_load(H5F_t *f, hid_t dxpl_id, haddr_t UNUSED addr, void *_udata)
/* Check for superblock extension being located "outside" the stored
* 'eoa' value, which can occur with the split/multi VFD.
*/
- if(H5F_addr_gt(sblock->ext_addr, stored_eoa)) {
+ if(H5F_addr_gt(sblock->ext_addr, stored_eof)) {
/* Set the 'eoa' for the object header memory type large enough
* to give some room for a reasonably sized superblock extension.
* (This is _rather_ a kludge -QAK)
@@ -669,7 +669,7 @@ H5F_sblock_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t UNUSED addr,
H5P_genplist_t *dxpl; /* DXPL object */
uint8_t buf[H5F_MAX_SUPERBLOCK_SIZE + H5F_MAX_DRVINFOBLOCK_SIZE]; /* Superblock & driver info blockencoding buffer */
uint8_t *p; /* Ptr into encoding buffer */
- haddr_t rel_eoa; /* Relative EOA for file */
+ haddr_t rel_eof; /* Relative EOF for file */
size_t superblock_size; /* Size of superblock, in bytes */
size_t driver_size; /* Size of driver info block (bytes)*/
@@ -709,8 +709,15 @@ H5F_sblock_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t UNUSED addr,
/* Encode the address of global free-space index */
H5F_addr_encode(f, &p, sblock->ext_addr);
- rel_eoa = H5FD_get_eoa(f->shared->lf, H5FD_MEM_SUPER);
- H5F_addr_encode(f, &p, (rel_eoa + sblock->base_addr));
+
+ /* Encode the end-of-file address. Note that at this point in time,
+ * the EOF value itself may not be reflective of the file's size, as
+ * we will eventually truncate the file to match the EOA value. As
+ * such, use the EOA value in its place, knowing that the current EOF
+ * value will ultimately match it. */
+ if ((rel_eof = H5FD_get_eoa(f->shared->lf, H5FD_MEM_SUPER)) == HADDR_UNDEF)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "driver get_eoa request failed")
+ H5F_addr_encode(f, &p, (rel_eof + sblock->base_addr));
/* Encode the driver informaton block address */
H5F_addr_encode(f, &p, sblock->driver_addr);
@@ -769,8 +776,14 @@ H5F_sblock_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t UNUSED addr,
/* Encode the address of the superblock extension */
H5F_addr_encode(f, &p, sblock->ext_addr);
- rel_eoa = H5FD_get_eoa(f->shared->lf, H5FD_MEM_SUPER);
- H5F_addr_encode(f, &p, (rel_eoa + sblock->base_addr));
+ /* At this point in time, the EOF value itself may
+ * not be reflective of the file's size, since we'll eventually
+ * truncate it to match the EOA value. As such, use the EOA value
+ * in its place, knowing that the current EOF value will
+ * ultimately match it. */
+ if ((rel_eof = H5FD_get_eoa(f->shared->lf, H5FD_MEM_SUPER)) == HADDR_UNDEF)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "driver get_eoa request failed")
+ H5F_addr_encode(f, &p, rel_eof + sblock->base_addr);
/* Retrieve information for root group */
if(NULL == (root_oloc = H5G_oloc(f->shared->root_grp)))
diff --git a/src/H5Ofill.c b/src/H5Ofill.c
index 1e8ccb1..a0fc42e 100644
--- a/src/H5Ofill.c
+++ b/src/H5Ofill.c
@@ -890,7 +890,7 @@ H5O_fill_debug(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *_fill, FILE *s
else
fprintf(stream, "<dataset type>\n");
- FUNC_LEAVE_NOAPI(SUCCEED);
+ FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5O_fill_debug() */
@@ -993,7 +993,7 @@ done:
if(bkg)
H5MM_xfree(bkg);
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_fill_convert() */
diff --git a/src/H5Smpio.c b/src/H5Smpio.c
index 9a1b5a6..def7598 100644
--- a/src/H5Smpio.c
+++ b/src/H5Smpio.c
@@ -168,18 +168,23 @@ H5S_mpio_create_point_datatype (size_t elmt_size, hsize_t num_points,
if(MPI_SUCCESS != (mpi_code = MPI_Type_contiguous((int)elmt_size, MPI_BYTE, &elmt_type)))
HMPI_GOTO_ERROR(FAIL, "MPI_Type_contiguous failed", mpi_code)
elmt_type_created = TRUE;
-
+
+#if MPI_VERSION >= 3
+ /* Create an MPI datatype for the whole point selection */
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed_block((int)num_points, 1, disp, elmt_type, new_type)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_indexed_block failed", mpi_code)
+#else
/* Allocate block sizes for MPI datatype call */
if(NULL == (blocks = (int *)H5MM_malloc(sizeof(int) * num_points)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of blocks")
- /* Would be nice to have Create_Hindexed_block to avoid this array of all ones */
for(u = 0; u < num_points; u++)
blocks[u] = 1;
/* Create an MPI datatype for the whole point selection */
if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed((int)num_points, blocks, disp, elmt_type, new_type)))
HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_indexed_block failed", mpi_code)
+#endif
/* Commit MPI datatype for later use */
if(MPI_SUCCESS != (mpi_code = MPI_Type_commit(new_type)))
diff --git a/src/H5public.h b/src/H5public.h
index 1e768fe..b01ecc9 100644
--- a/src/H5public.h
+++ b/src/H5public.h
@@ -94,10 +94,10 @@ extern "C" {
/* Version numbers */
#define H5_VERS_MAJOR 1 /* For major interface/format changes */
#define H5_VERS_MINOR 9 /* For minor interface/format changes */
-#define H5_VERS_RELEASE 207 /* For tweaks, bug-fixes, or development */
+#define H5_VERS_RELEASE 210 /* For tweaks, bug-fixes, or development */
#define H5_VERS_SUBRELEASE "swmr0" /* For pre-releases like snap0 */
/* Empty string for real releases. */
-#define H5_VERS_INFO "HDF5 library version: 1.9.207-swmr0" /* Full version string */
+#define H5_VERS_INFO "HDF5 library version: 1.9.210-swmr0" /* Full version string */
#define H5check() H5check_version(H5_VERS_MAJOR,H5_VERS_MINOR, \
H5_VERS_RELEASE)
diff --git a/src/Makefile.in b/src/Makefile.in
index 10d52cb..b944ca1 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -736,7 +736,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog
# After making changes, run bin/reconfigure to update other configure related
# files like Makefile.in.
LT_VERS_INTERFACE = 6
-LT_VERS_REVISION = 197
+LT_VERS_REVISION = 200
LT_VERS_AGE = 0
# Our main target, the HDF5 library