summaryrefslogtreecommitdiffstats
path: root/src/H5FDfamily.c
diff options
context:
space:
mode:
authorRaymond Lu <songyulu@hdfgroup.org>2005-06-02 21:00:23 (GMT)
committerRaymond Lu <songyulu@hdfgroup.org>2005-06-02 21:00:23 (GMT)
commit769694294033cf2021b506cde1302af5fdb2ebff (patch)
tree6eb63c4e19e009f217164f91d16250cb21edbbc5 /src/H5FDfamily.c
parentc02d9c7c0d4e526837445306bb35eb108db92ff5 (diff)
downloadhdf5-769694294033cf2021b506cde1302af5fdb2ebff.zip
hdf5-769694294033cf2021b506cde1302af5fdb2ebff.tar.gz
hdf5-769694294033cf2021b506cde1302af5fdb2ebff.tar.bz2
[svn-r10847] Purpose: Bug fix
Description: See details from Bug #213. Family member file size wasn't saved anywhere in file. When family file is opened, the first member size determine the member size. Solution: This is the fourth step of checkin. A test suit is added for h5repart, including a program to generate the test files, a script file to run h5repart, and a program to verify repartitioned files can be opened by the library. There's a change from the first step of checkin. Family name template is no longer saved in the superblock because different pathname can make the name different. In the third step of checkin, h5repart has been modified. If h5repart is used to change the size of family member file, the new size(actual member size) is saved in the superblock. In the second step of checkin, multi driver is checked against the driver name saved in superblock. Wrong driver will result in a failure with an error message indicating multi driver should be used. This change includes split driver because it's a special case for multi driver. In the first step of checkin. Family member size and name template(unused at this stage) are saved in file superblock. When file is reopened,the size passed in thrin superblock. A different size will trigger a failure with an error message indicating the right size. Wrong driver to open family file will cause a failure, too. Platforms tested: h5committest and fuss. Misc. update: MANIFEST
Diffstat (limited to 'src/H5FDfamily.c')
-rw-r--r--src/H5FDfamily.c45
1 files changed, 24 insertions, 21 deletions
diff --git a/src/H5FDfamily.c b/src/H5FDfamily.c
index d4397e9..793c792 100644
--- a/src/H5FDfamily.c
+++ b/src/H5FDfamily.c
@@ -60,6 +60,8 @@ typedef struct H5FD_family_t {
hid_t memb_fapl_id; /*file access property list for members */
hsize_t memb_size; /*actual size of each member file */
hsize_t pmem_size; /*member size passed in from property */
+ hsize_t mem_newsize; /*new member size passed in as private property.
+ *It's used only by h5repart */
unsigned nmembs; /*number of family members */
unsigned amembs; /*number of member slots allocated */
H5FD_t **memb; /*dynamic array of member pointers */
@@ -584,9 +586,6 @@ H5FD_family_sb_size(H5FD_t *_file)
* enough for now. */
ret_value += 8;
- /* name template, NULL termination included */
- ret_value += HDstrlen(file->name) + 1;
-
done:
FUNC_LEAVE_NOAPI(ret_value)
}
@@ -627,12 +626,8 @@ H5FD_family_sb_encode(H5FD_t *_file, char *name/*out*/,
name[8] = '\0';
/* copy member file size */
- UINT64ENCODE(buf, file->memb_size);
- p += 8;
+ UINT64ENCODE(p, file->memb_size);
- /* copy name template */
- HDmemcpy(p, file->name, HDstrlen(file->name) + 1);
-
done:
FUNC_LEAVE_NOAPI(ret_value)
}
@@ -641,12 +636,11 @@ done:
/*-------------------------------------------------------------------------
* Function: H5FD_family_sb_decode
*
- * Purpose: Decodes the superblock information for this driver. The NAME
- * argument is the eight-character (plus null termination) name
- * stored in the file.
- *
- * The FILE argument is updated according to the information in
- * the superblock.
+ * Purpose: This function has 2 seperate purpose. One is to decodes the
+ * superblock information for this driver. The NAME argument is
+ * the eight-character (plus null termination) name stored in i
+ * the file. The FILE argument is updated according to the
+ * information in the superblock.
*
* Return: Success: 0
*
@@ -663,7 +657,6 @@ static herr_t
H5FD_family_sb_decode(H5FD_t *_file, const char *name, const unsigned char *buf)
{
H5FD_family_t *file = (H5FD_family_t*)_file;
- unsigned char *p = buf;
uint64_t msize;
char err_msg[128];
herr_t ret_value=SUCCEED; /* Return value */
@@ -671,13 +664,14 @@ H5FD_family_sb_decode(H5FD_t *_file, const char *name, const unsigned char *buf)
FUNC_ENTER_NOAPI(H5FD_family_sb_decode, FAIL)
/* Read member file size. Skip name template for now although it's saved. */
- UINT64DECODE(p, msize);
+ UINT64DECODE(buf, msize);
- /* For h5repart only. Member size 1 is used to signal h5repart is being used to
- * change member file size. Encode the new size. */
- if(file->pmem_size == 1) {
- msize = file->memb_size;
- UINT64ENCODE(p, msize);
+ /* For h5repart only. Private property of new member size is used to signal
+ * h5repart is being used to change member file size. h5repart will open
+ * files for read and write. When the files are closed, metadata will be
+ * flushed to the files and updated this new size */
+ if(file->mem_newsize) {
+ file->memb_size = file->mem_newsize;
HGOTO_DONE(ret_value)
}
@@ -742,6 +736,7 @@ H5FD_family_open(const char *name, unsigned flags, hid_t fapl_id,
H5FD_t *ret_value=NULL;
char memb_name[4096], temp[4096];
hsize_t eof=HADDR_UNDEF;
+ hsize_t fam_newsize = 0;
unsigned t_flags = flags & ~H5F_ACC_CREAT;
H5P_genplist_t *plist; /* Property list pointer */
@@ -762,12 +757,19 @@ H5FD_family_open(const char *name, unsigned flags, hid_t fapl_id,
HGOTO_ERROR(H5E_VFL, H5E_CANTINC, NULL, "unable to increment ref count on VFL driver")
file->memb_size = 1024*1024*1024; /*1GB. Actual member size to be updated later */
file->pmem_size = 1024*1024*1024; /*1GB. Member size passed in through property */
+ file->mem_newsize = 0; /*New member size used by h5repart only */
} else {
H5FD_family_fapl_t *fa;
if(NULL == (plist = H5I_object(fapl_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list")
fa = H5P_get_driver_info(plist);
+
+ /* New family file size. It's used by h5repart only. */
+ if(H5P_exist_plist(plist, H5F_ACS_FAMILY_NEWSIZE_NAME) > 0)
+ if(H5P_get(plist, H5F_ACS_FAMILY_NEWSIZE_NAME, &fam_newsize) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get new family member size")
+
if(fa->memb_fapl_id==H5P_FILE_ACCESS_DEFAULT) {
if(H5I_inc_ref(fa->memb_fapl_id)<0)
HGOTO_ERROR(H5E_VFL, H5E_CANTINC, NULL, "unable to increment ref count on VFL driver")
@@ -780,6 +782,7 @@ H5FD_family_open(const char *name, unsigned flags, hid_t fapl_id,
} /* end else */
file->memb_size = fa->memb_size; /* Actual member size to be updated later */
file->pmem_size = fa->memb_size; /* Member size passed in through property */
+ file->mem_newsize = fam_newsize; /* New member size passed in through property */
}
file->name = H5MM_strdup(name);
file->flags = flags;