summaryrefslogtreecommitdiffstats
path: root/tools/h5repack/h5repack_copy.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/h5repack/h5repack_copy.c')
-rw-r--r--tools/h5repack/h5repack_copy.c46
1 files changed, 45 insertions, 1 deletions
diff --git a/tools/h5repack/h5repack_copy.c b/tools/h5repack/h5repack_copy.c
index 0fb8fc8..77c03d2 100644
--- a/tools/h5repack/h5repack_copy.c
+++ b/tools/h5repack/h5repack_copy.c
@@ -104,7 +104,7 @@ int copy_objects(const char* fnamein,
goto out;
}
- /* get user block size */
+ /* get user block size and file space strategy/threshold */
{
hid_t fcpl_in; /* file creation property list ID for input file */
@@ -120,6 +120,24 @@ int copy_objects(const char* fnamein,
goto out;
}
+ if(!options->fs_strategy)
+ {
+ if(H5Pget_file_space(fcpl_in, &options->fs_strategy, NULL) < 0)
+ {
+ error_msg(progname, "failed to retrieve file space strategy\n");
+ goto out;
+ }
+ }
+
+ if(!options->fs_threshold)
+ {
+ if(H5Pget_file_space(fcpl_in, NULL, &options->fs_threshold) < 0)
+ {
+ error_msg(progname, "failed to retrieve file space threshold\n");
+ goto out;
+ }
+ }
+
if(H5Pclose(fcpl_in) < 0)
{
error_msg(progname, "failed to close property list\n");
@@ -316,6 +334,32 @@ int copy_objects(const char* fnamein,
}
+ /* either use the FCPL already created or create a new one */
+ if(fcpl != H5P_DEFAULT)
+ {
+ /* set file space strategy and free space threshold */
+ if(H5Pset_file_space(fcpl, options->fs_strategy, options->fs_threshold) < 0)
+ {
+ error_msg(progname, "failed to set file space strategy & threshold\n");
+ goto out;
+ }
+ }
+ else
+ {
+ /* create a file creation property list */
+ if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ {
+ error_msg(progname, "fail to create a file creation property list\n");
+ goto out;
+ }
+
+ /* set file space strategy and free space threshold */
+ if(H5Pset_file_space(fcpl, options->fs_strategy, options->fs_threshold) < 0)
+ {
+ error_msg(progname, "failed to set file space strategy & threshold \n");
+ goto out;
+ }
+ }
/*-------------------------------------------------------------------------
* create the output file