summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRaymond Lu <songyulu@hdfgroup.org>2011-06-23 16:40:31 (GMT)
committerRaymond Lu <songyulu@hdfgroup.org>2011-06-23 16:40:31 (GMT)
commit6e55bfba8a8c203aa0b06638de3655cf823b954e (patch)
treea008dc7c5b7939576713d4ef779c1b86f7053fa4 /src
parentb5fbe95269323490a89f6d580a215c4763c18a2a (diff)
downloadhdf5-6e55bfba8a8c203aa0b06638de3655cf823b954e.zip
hdf5-6e55bfba8a8c203aa0b06638de3655cf823b954e.tar.gz
hdf5-6e55bfba8a8c203aa0b06638de3655cf823b954e.tar.bz2
[svn-r21024] Bug fix for Issue 2598 - In v1.6 library, there was EOA for the whole MULTI file saved in the
super block. We took it out in v1.8 library because it's meaningless for the MULTI file. v1.8 library saves the EOA for the metadata file, instead. But this caused some backward compatibility problem. v1.8 library couldn't open the file created with v1.6 library. I fixed the problem by checking the EOA value to detect the file created with v1.6 library. Tested on jam, koala, and linew.
Diffstat (limited to 'src')
-rw-r--r--src/H5FDmulti.c22
-rw-r--r--src/H5FDsec2.c3
2 files changed, 24 insertions, 1 deletions
diff --git a/src/H5FDmulti.c b/src/H5FDmulti.c
index 328b530..0937ec0 100644
--- a/src/H5FDmulti.c
+++ b/src/H5FDmulti.c
@@ -83,6 +83,7 @@ typedef struct H5FD_multi_fapl_t {
hid_t memb_fapl[H5FD_MEM_NTYPES];/*member access properties */
char *memb_name[H5FD_MEM_NTYPES];/*name generators */
haddr_t memb_addr[H5FD_MEM_NTYPES];/*starting addr per member */
+ haddr_t memb_eoa[H5FD_MEM_NTYPES]; /*EOA for individual files */
hbool_t relax; /*less stringent error checking */
} H5FD_multi_fapl_t;
@@ -505,6 +506,9 @@ H5Pset_fapl_multi(hid_t fapl_id, const H5FD_mem_t *memb_map,
memcpy(fa.memb_addr, memb_addr, H5FD_MEM_NTYPES*sizeof(haddr_t));
fa.relax = relax;
+ /* Initialize all EOAs to zero */
+ memset(fa.memb_eoa, 0, H5FD_MEM_NTYPES*sizeof(haddr_t));
+
/* Patch up H5P_DEFAULT property lists for members */
for (mt=H5FD_MEM_DEFAULT; mt<H5FD_MEM_NTYPES; mt=(H5FD_mem_t)(mt+1)) {
if(fa.memb_fapl[mt]==H5P_DEFAULT)
@@ -969,6 +973,9 @@ H5FD_multi_sb_decode(H5FD_t *_file, const char *name, const unsigned char *buf)
if (file->memb[mt])
if(H5FDset_eoa(file->memb[mt], mt, memb_eoa[mt])<0)
H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_CANTSET, "set_eoa() failed", -1)
+
+ /* Save the individual EOAs in one place for later comparison (in H5FD_multi_set_eoa) */
+ file->fa.memb_eoa[mt] = memb_eoa[mt];
} END_MEMBERS;
return 0;
@@ -1563,6 +1570,10 @@ H5FD_multi_get_eoa(const H5FD_t *_file, H5FD_mem_t type)
* for MULTI file. This function only sets eoa for individual
* file.
*
+ * Raymond Lu
+ * 21 June 2011
+ * Backward compatibility of EOA. Please the comment in the
+ * code.
*-------------------------------------------------------------------------
*/
static herr_t
@@ -1580,6 +1591,17 @@ H5FD_multi_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t eoa)
if(H5FD_MEM_DEFAULT == mmt)
mmt = type;
+ /* Handle backward compatibility in a quick and simple way. v1.6 library had EOA for the entire virtual
+ * file. But it wasn't meaningful. So v1.8 library doesn't have it anymore. It saves the EOA for the
+ * metadata file, instead. Here we try to figure out whether the EOA is from a v1.6 file by comparing its
+ * value. If it is a big value, we assume it's from v1.6 and simply discard it. This is the normal case
+ * when the metadata file has the smallest starting address. If the metadata file has the biggest address,
+ * the EOAs of v1.6 and v1.8 files are the same. It won't cause any trouble. (Please see Issue 2598
+ * in Jira) SLU - 2011/6/21
+ */
+ if(H5FD_MEM_SUPER == type && file->fa.memb_eoa[H5FD_MEM_SUPER] > 0 && eoa > file->fa.memb_eoa[H5FD_MEM_SUPER])
+ return 0;
+
assert(eoa >= file->fa.memb_addr[mmt]);
assert(eoa < file->memb_next[mmt]);
diff --git a/src/H5FDsec2.c b/src/H5FDsec2.c
index 1153df7..5b9b22b 100644
--- a/src/H5FDsec2.c
+++ b/src/H5FDsec2.c
@@ -695,7 +695,8 @@ H5FD_sec2_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id,
if(REGION_OVERFLOW(addr, size))
HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow, addr = %llu", (unsigned long long)addr)
if((addr + size) > file->eoa)
- HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow, addr = %llu", (unsigned long long)addr)
+ HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow, addr = %llu, size=%lu, eoa=%llu",
+ (unsigned long long)addr, size, (unsigned long long)file->eoa)
/* Seek to the correct location */
if(addr != file->pos || OP_READ != file->op) {