summaryrefslogtreecommitdiffstats
path: root/src/H5FDfamily.c
diff options
context:
space:
mode:
authorRaymond Lu <songyulu@hdfgroup.org>2004-11-16 16:38:28 (GMT)
committerRaymond Lu <songyulu@hdfgroup.org>2004-11-16 16:38:28 (GMT)
commit22a72b911eda2f413691eed0ef2862025827a858 (patch)
tree9241588c45829e4431aa8979b6c5d39a7014e9ed /src/H5FDfamily.c
parentb950cebd9ec030b0f13c6fc9f17ea381c3afa2a6 (diff)
downloadhdf5-22a72b911eda2f413691eed0ef2862025827a858.zip
hdf5-22a72b911eda2f413691eed0ef2862025827a858.tar.gz
hdf5-22a72b911eda2f413691eed0ef2862025827a858.tar.bz2
[svn-r9531] Purpose: Bug fix(#213)
Description: H5Pset_fapl_family sets family member size only for creating new file. The file doesn't keep this size information. When the file is re-opened, the size of first member file is used as the member size. Solution: Assume user knows the original member size and sets it through H5Pset_fapl_family. That will be the member size. User can pass in value 0 as member size if he doesn't know the original member size. Library will choose the size of current first member size as the member file size. Platforms tested: h5committest and fuss.
Diffstat (limited to 'src/H5FDfamily.c')
-rw-r--r--src/H5FDfamily.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/src/H5FDfamily.c b/src/H5FDfamily.c
index 7d35b41..d22bc27 100644
--- a/src/H5FDfamily.c
+++ b/src/H5FDfamily.c
@@ -580,7 +580,7 @@ H5FD_family_open(const char *name, unsigned flags, hid_t fapl_id,
hsize_t eof;
unsigned t_flags = flags & ~H5F_ACC_CREAT;
H5P_genplist_t *plist; /* Property list pointer */
-
+
FUNC_ENTER_NOAPI(H5FD_family_open, NULL)
/* Check arguments */
@@ -621,6 +621,7 @@ H5FD_family_open(const char *name, unsigned flags, hid_t fapl_id,
/* Check that names are unique */
sprintf(memb_name, name, 0);
sprintf(temp, name, 1);
+
if (!strcmp(memb_name, temp))
HGOTO_ERROR(H5E_FILE, H5E_FILEEXISTS, NULL, "file names not unique")
@@ -656,14 +657,18 @@ H5FD_family_open(const char *name, unsigned flags, hid_t fapl_id,
}
file->nmembs++;
}
-
- /*
- * The size of the first member determines the size of all the members,
- * but if the size of the first member is zero then use the member size
- * from the file access property list.
+
+ /*
+ * Check if user sets member size smaller than existing first member file size.
+ * Return failure if so. If the member size coming from access property list is
+ * 0, then set the member size to be the current first member file size.
*/
- if ((eof=H5FDget_eof(file->memb[0])))
+ if(HADDR_UNDEF==(eof = H5FD_get_eof(file->memb[0])))
+ HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, NULL, "file get eof request failed")
+ if(file->memb_size==0 && eof)
file->memb_size = eof;
+ if(eof && file->memb_size<eof)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "trying to set member size smaller than existing member file size")
ret_value=(H5FD_t *)file;
@@ -675,7 +680,7 @@ done:
for (u=0; u<file->nmembs; u++)
if (file->memb[u])
- if (H5FDclose(file->memb[u])<0)
+ if (H5FD_close(file->memb[u])<0)
nerrors++;
if (nerrors)
HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, NULL, "unable to close member files")
@@ -812,7 +817,9 @@ H5FD_family_query(const H5FD_t UNUSED * _f, unsigned long *flags /* out */)
if(flags) {
*flags=0;
*flags|=H5FD_FEAT_AGGREGATE_METADATA; /* OK to aggregate metadata allocations */
- *flags|=H5FD_FEAT_ACCUMULATE_METADATA; /* OK to accumulate metadata for faster writes */
+ /**flags|=H5FD_FEAT_ACCUMULATE_METADATA;*/ /* OK to accumulate metadata for faster writes.
+ * - Turn it off temporarily because there's a bug
+ * when trying to flush metadata during closing. */
*flags|=H5FD_FEAT_DATA_SIEVE; /* OK to perform data sieving for faster raw data reads & writes */
*flags|=H5FD_FEAT_AGGREGATE_SMALLDATA; /* OK to aggregate "small" raw data allocations */
}