summaryrefslogtreecommitdiffstats
path: root/src
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
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')
-rw-r--r--src/H5E.c1
-rw-r--r--src/H5F.c8
-rw-r--r--src/H5FDfamily.c45
-rw-r--r--src/H5FLprivate.h2
-rw-r--r--src/H5Fprivate.h6
-rw-r--r--src/H5Pfapl.c2
6 files changed, 38 insertions, 26 deletions
diff --git a/src/H5E.c b/src/H5E.c
index 76e0e28..73843fc 100644
--- a/src/H5E.c
+++ b/src/H5E.c
@@ -2112,7 +2112,6 @@ H5E_walk_stack(const H5E_t *estack, H5E_direction_t direction, H5E_walk_t func,
/* Walk the stack if a callback function was given */
if(func) {
status=SUCCEED;
-
if (H5E_WALK_UPWARD==direction) {
for (i=0; i<(int)estack->nused && status>=0; i++)
status = (func)((unsigned)i, estack->slot+i, client_data);
diff --git a/src/H5F.c b/src/H5F.c
index 9cd0ddb..468fcaa 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -212,6 +212,7 @@ H5F_init_interface(void)
void *driver_info = H5F_ACS_FILE_DRV_INFO_DEF;
H5F_close_degree_t close_degree = H5F_CLOSE_DEGREE_DEF;
hsize_t family_offset = H5F_ACS_FAMILY_OFFSET_DEF;
+ hsize_t family_newsize = H5F_ACS_FAMILY_NEWSIZE_DEF;
H5FD_mem_t mem_type = H5F_ACS_MULTI_TYPE_DEF;
/* File mount property class variable.
@@ -361,7 +362,11 @@ H5F_init_interface(void)
/* Register the offset of family driver info */
if(H5P_register(acs_pclass,H5F_ACS_FAMILY_OFFSET_NAME,H5F_ACS_FAMILY_OFFSET_SIZE, &family_offset,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
-
+
+ /* Register the private property of new family file size. It's used by h5repart only. */
+ if(H5P_register(acs_pclass,H5F_ACS_FAMILY_NEWSIZE_NAME,H5F_ACS_FAMILY_NEWSIZE_SIZE, &family_newsize,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
+
/* Register the data type of multi driver info */
if(H5P_register(acs_pclass,H5F_ACS_MULTI_TYPE_NAME,H5F_ACS_MULTI_TYPE_SIZE, &mem_type,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
@@ -2630,7 +2635,6 @@ H5F_read_superblock(H5F_t *f, hid_t dxpl_id, H5G_entry_t *root_ent, haddr_t addr
if (H5FD_sb_decode(lf, driver_name, p) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to decode driver information")
- p += driver_size; /* advance past driver information section */
/* Compute driver info block checksum */
assert(sizeof(chksum) == sizeof(shared->drvr_chksum));
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;
diff --git a/src/H5FLprivate.h b/src/H5FLprivate.h
index 4c8fa94..1005eff 100644
--- a/src/H5FLprivate.h
+++ b/src/H5FLprivate.h
@@ -35,7 +35,7 @@
/* Private headers needed by this file */
/* Macros for turning off free lists in the library */
-/* #define H5_NO_FREE_LISTS */
+#define H5_NO_FREE_LISTS
#if defined H5_NO_FREE_LISTS || defined H5_USING_PURIFY
#define H5_NO_REG_FREE_LISTS
#define H5_NO_ARR_FREE_LISTS
diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h
index a04f73d..b5f9647 100644
--- a/src/H5Fprivate.h
+++ b/src/H5Fprivate.h
@@ -392,6 +392,12 @@ typedef struct H5F_t H5F_t;
#define H5F_ACS_FAMILY_OFFSET_SIZE sizeof(hsize_t)
#define H5F_ACS_FAMILY_OFFSET_DEF 0
+/* Definition for new member size of family driver. It's private
+ * property only used by h5repart */
+#define H5F_ACS_FAMILY_NEWSIZE_NAME "family_newsize"
+#define H5F_ACS_FAMILY_NEWSIZE_SIZE sizeof(hsize_t)
+#define H5F_ACS_FAMILY_NEWSIZE_DEF 0
+
/* Definition for data type in multi file driver */
#define H5F_ACS_MULTI_TYPE_NAME "multi_type"
#define H5F_ACS_MULTI_TYPE_SIZE sizeof(H5FD_mem_t)
diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c
index 8df6866..9868627 100644
--- a/src/H5Pfapl.c
+++ b/src/H5Pfapl.c
@@ -620,7 +620,7 @@ H5P_get_family_offset(H5P_genplist_t *plist, hsize_t *offset)
done:
FUNC_LEAVE_NOAPI(ret_value);
-}
+}
/*-------------------------------------------------------------------------