2003-04-01 02:30:57 +08:00
|
|
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
2007-02-07 22:56:24 +08:00
|
|
|
* Copyright by The HDF Group. *
|
2003-04-01 02:30:57 +08:00
|
|
|
* Copyright by the Board of Trustees of the University of Illinois. *
|
|
|
|
* All rights reserved. *
|
|
|
|
* *
|
|
|
|
* This file is part of HDF5. The full HDF5 copyright notice, including *
|
|
|
|
* terms governing use, modification, and redistribution, is contained in *
|
2017-04-18 03:32:16 +08:00
|
|
|
* the COPYING file, which can be found at the root of the source code *
|
2021-02-17 22:52:04 +08:00
|
|
|
* distribution tree, or in https://www.hdfgroup.org/licenses. *
|
2017-04-18 03:32:16 +08:00
|
|
|
* If you do not have access to either file, you may request a copy from *
|
|
|
|
* help@hdfgroup.org. *
|
2003-04-01 02:30:57 +08:00
|
|
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
|
|
|
|
2002-08-21 00:18:02 +08:00
|
|
|
/*
|
2020-08-07 04:56:04 +08:00
|
|
|
* Programmer: Raymond Lu
|
2005-08-14 04:53:35 +08:00
|
|
|
* August 5, 2002
|
2002-08-21 00:18:02 +08:00
|
|
|
*
|
|
|
|
* Purpose: Compact dataset I/O functions. These routines are similar
|
2008-12-12 04:06:17 +08:00
|
|
|
* H5D_contig_* and H5D_chunk_*.
|
2002-08-21 00:18:02 +08:00
|
|
|
*/
|
|
|
|
|
2005-10-21 23:52:54 +08:00
|
|
|
/****************/
|
|
|
|
/* Module Setup */
|
|
|
|
/****************/
|
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
#include "H5Dmodule.h" /* This source code file is part of the H5D module */
|
2003-06-27 23:59:48 +08:00
|
|
|
|
2005-10-21 23:52:54 +08:00
|
|
|
/***********/
|
|
|
|
/* Headers */
|
|
|
|
/***********/
|
2020-09-30 22:27:10 +08:00
|
|
|
#include "H5private.h" /* Generic Functions */
|
|
|
|
#include "H5Dpkg.h" /* Dataset functions */
|
|
|
|
#include "H5Eprivate.h" /* Error handling */
|
|
|
|
#include "H5Fprivate.h" /* Files */
|
|
|
|
#include "H5FDprivate.h" /* File drivers */
|
|
|
|
#include "H5FLprivate.h" /* Free Lists */
|
|
|
|
#include "H5Iprivate.h" /* IDs */
|
|
|
|
#include "H5MMprivate.h" /* Memory management */
|
|
|
|
#include "H5Oprivate.h" /* Object headers */
|
|
|
|
#include "H5VMprivate.h" /* Vector and array functions */
|
2008-05-01 03:51:13 +08:00
|
|
|
|
2005-10-21 23:52:54 +08:00
|
|
|
/****************/
|
|
|
|
/* Local Macros */
|
|
|
|
/****************/
|
|
|
|
|
|
|
|
/******************/
|
|
|
|
/* Local Typedefs */
|
|
|
|
/******************/
|
|
|
|
|
2021-09-30 12:00:24 +08:00
|
|
|
/* Callback info for I/O operation when file driver
|
|
|
|
* wishes to do its own memory management
|
|
|
|
*/
|
|
|
|
typedef struct H5D_compact_iovv_memmanage_ud_t {
|
|
|
|
H5F_shared_t *f_sh; /* Shared file for dataset */
|
|
|
|
void * dstbuf; /* Pointer to buffer to be read into/written into */
|
|
|
|
const void * srcbuf; /* Pointer to buffer to be read from/written from */
|
|
|
|
} H5D_compact_iovv_memmanage_ud_t;
|
|
|
|
|
2005-10-21 23:52:54 +08:00
|
|
|
/********************/
|
|
|
|
/* Local Prototypes */
|
|
|
|
/********************/
|
|
|
|
|
2008-05-01 03:51:13 +08:00
|
|
|
/* Layout operation callbacks */
|
2020-09-30 22:27:10 +08:00
|
|
|
static herr_t H5D__compact_construct(H5F_t *f, H5D_t *dset);
|
2012-04-17 05:20:26 +08:00
|
|
|
static hbool_t H5D__compact_is_space_alloc(const H5O_storage_t *storage);
|
2020-09-30 22:27:10 +08:00
|
|
|
static herr_t H5D__compact_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
|
2021-11-20 22:34:50 +08:00
|
|
|
hsize_t nelmts, H5S_t *file_space, H5S_t *mem_space, H5D_chunk_map_t *cm);
|
2021-09-30 12:00:24 +08:00
|
|
|
static herr_t H5D__compact_iovv_memmanage_cb(hsize_t dst_off, hsize_t src_off, size_t len, void *_udata);
|
2020-09-30 22:27:10 +08:00
|
|
|
static ssize_t H5D__compact_readvv(const H5D_io_info_t *io_info, size_t dset_max_nseq, size_t *dset_curr_seq,
|
|
|
|
size_t dset_size_arr[], hsize_t dset_offset_arr[], size_t mem_max_nseq,
|
|
|
|
size_t *mem_curr_seq, size_t mem_size_arr[], hsize_t mem_offset_arr[]);
|
|
|
|
static ssize_t H5D__compact_writevv(const H5D_io_info_t *io_info, size_t dset_max_nseq, size_t *dset_curr_seq,
|
|
|
|
size_t dset_size_arr[], hsize_t dset_offset_arr[], size_t mem_max_nseq,
|
|
|
|
size_t *mem_curr_seq, size_t mem_size_arr[], hsize_t mem_offset_arr[]);
|
|
|
|
static herr_t H5D__compact_flush(H5D_t *dset);
|
|
|
|
static herr_t H5D__compact_dest(H5D_t *dset);
|
2008-05-01 03:51:13 +08:00
|
|
|
|
2005-10-21 23:52:54 +08:00
|
|
|
/*********************/
|
|
|
|
/* Package Variables */
|
|
|
|
/*********************/
|
|
|
|
|
2008-05-01 03:51:13 +08:00
|
|
|
/* Compact storage layout I/O ops */
|
2021-11-20 22:34:50 +08:00
|
|
|
const H5D_layout_ops_t H5D_LOPS_COMPACT[1] = {{
|
|
|
|
H5D__compact_construct, /* construct */
|
|
|
|
NULL, /* init */
|
|
|
|
H5D__compact_is_space_alloc, /* is_space_alloc */
|
|
|
|
NULL, /* is_data_cached */
|
|
|
|
H5D__compact_io_init, /* io_init */
|
|
|
|
H5D__contig_read, /* ser_read */
|
|
|
|
H5D__contig_write, /* ser_write */
|
2008-05-01 03:51:13 +08:00
|
|
|
#ifdef H5_HAVE_PARALLEL
|
2021-11-20 22:34:50 +08:00
|
|
|
NULL, /* par_read */
|
|
|
|
NULL, /* par_write */
|
|
|
|
#endif
|
|
|
|
H5D__compact_readvv, /* readvv */
|
|
|
|
H5D__compact_writevv, /* writevv */
|
|
|
|
H5D__compact_flush, /* flush */
|
|
|
|
NULL, /* io_term */
|
|
|
|
H5D__compact_dest /* dest */
|
|
|
|
}};
|
2008-05-01 03:51:13 +08:00
|
|
|
|
2005-10-21 23:52:54 +08:00
|
|
|
/*******************/
|
|
|
|
/* Local Variables */
|
|
|
|
/*******************/
|
|
|
|
|
2006-01-29 02:31:22 +08:00
|
|
|
/* Declare extern the free list to manage blocks of type conversion data */
|
|
|
|
H5FL_BLK_EXTERN(type_conv);
|
|
|
|
|
2007-06-08 11:06:56 +08:00
|
|
|
/*-------------------------------------------------------------------------
|
2012-04-17 05:20:26 +08:00
|
|
|
* Function: H5D__compact_fill
|
2007-06-08 11:06:56 +08:00
|
|
|
*
|
|
|
|
* Purpose: Write fill values to a compactly stored dataset.
|
|
|
|
*
|
|
|
|
* Return: Non-negative on success/Negative on failure
|
|
|
|
*
|
|
|
|
* Programmer: Quincey Koziol
|
|
|
|
* May 6, 2007
|
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
herr_t
|
2018-03-16 05:54:30 +08:00
|
|
|
H5D__compact_fill(const H5D_t *dset)
|
2007-06-08 11:06:56 +08:00
|
|
|
{
|
2020-09-30 22:27:10 +08:00
|
|
|
H5D_fill_buf_info_t fb_info; /* Dataset's fill buffer info */
|
|
|
|
hbool_t fb_info_init = FALSE; /* Whether the fill value buffer has been initialized */
|
|
|
|
herr_t ret_value = SUCCEED; /* Return value */
|
2007-06-08 11:06:56 +08:00
|
|
|
|
2012-04-17 05:20:26 +08:00
|
|
|
FUNC_ENTER_PACKAGE
|
2007-06-08 11:06:56 +08:00
|
|
|
|
|
|
|
/* Check args */
|
|
|
|
HDassert(dset && H5D_COMPACT == dset->shared->layout.type);
|
[svn-r17275] Description:
Refactor dataet storage information further, moving the chunk operations
into the storage struct and also fine-tune the chunk index structure for index
callbacks.
Tested on:
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (jam) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/Intel compilers w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in debug mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
Mac OS X/32 10.5.7 (amazon) in debug mode
Mac OS X/32 10.5.7 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
2009-07-31 01:51:49 +08:00
|
|
|
HDassert(dset->shared->layout.storage.u.compact.buf);
|
2007-06-08 11:06:56 +08:00
|
|
|
HDassert(dset->shared->type);
|
|
|
|
HDassert(dset->shared->space);
|
|
|
|
|
2007-06-27 01:46:35 +08:00
|
|
|
/* Initialize the fill value buffer */
|
|
|
|
/* (use the compact dataset storage buffer as the fill value buffer) */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5D__fill_init(&fb_info, dset->shared->layout.storage.u.compact.buf, NULL, NULL, NULL, NULL,
|
|
|
|
&dset->shared->dcpl_cache.fill, dset->shared->type, dset->shared->type_id, (size_t)0,
|
|
|
|
dset->shared->layout.storage.u.compact.size) < 0)
|
2007-06-27 01:46:35 +08:00
|
|
|
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize fill buffer info")
|
|
|
|
fb_info_init = TRUE;
|
|
|
|
|
|
|
|
/* Check for VL datatype & non-default fill value */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (fb_info.has_vlen_fill_type)
|
2007-06-27 01:46:35 +08:00
|
|
|
/* Fill the buffer with VL datatype fill values */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5D__fill_refill_vl(&fb_info, fb_info.elmts_per_buf) < 0)
|
2007-06-27 01:46:35 +08:00
|
|
|
HGOTO_ERROR(H5E_DATASET, H5E_CANTCONVERT, FAIL, "can't refill fill value buffer")
|
2007-06-08 11:06:56 +08:00
|
|
|
|
|
|
|
done:
|
2007-06-27 01:46:35 +08:00
|
|
|
/* Release the fill buffer info, if it's been initialized */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (fb_info_init && H5D__fill_term(&fb_info) < 0)
|
2007-07-05 23:43:22 +08:00
|
|
|
HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release fill buffer info")
|
2007-06-27 01:46:35 +08:00
|
|
|
|
2007-06-08 11:06:56 +08:00
|
|
|
FUNC_LEAVE_NOAPI(ret_value)
|
2012-04-17 05:20:26 +08:00
|
|
|
} /* end H5D__compact_fill() */
|
2007-06-08 11:06:56 +08:00
|
|
|
|
[svn-r15131] Description:
Finish omnibus chunked dataset I/O refactoring, to separate general
actions on chunked datasets from actions that are specific to using the v1
B-tree index.
Cleaned up a few bugs and added some additional tests also.
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.5.2 (amazon) in debug mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
2008-06-04 03:44:12 +08:00
|
|
|
/*-------------------------------------------------------------------------
|
2012-04-17 05:20:26 +08:00
|
|
|
* Function: H5D__compact_construct
|
[svn-r15131] Description:
Finish omnibus chunked dataset I/O refactoring, to separate general
actions on chunked datasets from actions that are specific to using the v1
B-tree index.
Cleaned up a few bugs and added some additional tests also.
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.5.2 (amazon) in debug mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
2008-06-04 03:44:12 +08:00
|
|
|
*
|
|
|
|
* Purpose: Constructs new compact layout information for dataset
|
|
|
|
*
|
|
|
|
* Return: Non-negative on success/Negative on failure
|
|
|
|
*
|
|
|
|
* Programmer: Quincey Koziol
|
|
|
|
* Thursday, May 22, 2008
|
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
static herr_t
|
2012-04-17 05:20:26 +08:00
|
|
|
H5D__compact_construct(H5F_t *f, H5D_t *dset)
|
[svn-r15131] Description:
Finish omnibus chunked dataset I/O refactoring, to separate general
actions on chunked datasets from actions that are specific to using the v1
B-tree index.
Cleaned up a few bugs and added some additional tests also.
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.5.2 (amazon) in debug mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
2008-06-04 03:44:12 +08:00
|
|
|
{
|
2020-09-30 22:27:10 +08:00
|
|
|
hssize_t stmp_size; /* Temporary holder for raw data size */
|
|
|
|
hsize_t tmp_size; /* Temporary holder for raw data size */
|
|
|
|
hsize_t max_comp_data_size; /* Max. allowed size of compact data */
|
|
|
|
unsigned u; /* Local index variable */
|
|
|
|
herr_t ret_value = SUCCEED; /* Return value */
|
[svn-r15131] Description:
Finish omnibus chunked dataset I/O refactoring, to separate general
actions on chunked datasets from actions that are specific to using the v1
B-tree index.
Cleaned up a few bugs and added some additional tests also.
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.5.2 (amazon) in debug mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
2008-06-04 03:44:12 +08:00
|
|
|
|
2012-04-17 05:20:26 +08:00
|
|
|
FUNC_ENTER_STATIC
|
[svn-r15131] Description:
Finish omnibus chunked dataset I/O refactoring, to separate general
actions on chunked datasets from actions that are specific to using the v1
B-tree index.
Cleaned up a few bugs and added some additional tests also.
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.5.2 (amazon) in debug mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
2008-06-04 03:44:12 +08:00
|
|
|
|
|
|
|
/* Sanity checks */
|
|
|
|
HDassert(f);
|
|
|
|
HDassert(dset);
|
|
|
|
|
2010-08-27 01:16:50 +08:00
|
|
|
/* Check for invalid dataset dimensions */
|
2020-09-30 22:27:10 +08:00
|
|
|
for (u = 0; u < dset->shared->ndims; u++)
|
|
|
|
if (dset->shared->max_dims[u] > dset->shared->curr_dims[u])
|
2015-04-18 14:39:34 +08:00
|
|
|
HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "extendible compact dataset not allowed")
|
2010-08-27 01:16:50 +08:00
|
|
|
|
[svn-r15131] Description:
Finish omnibus chunked dataset I/O refactoring, to separate general
actions on chunked datasets from actions that are specific to using the v1
B-tree index.
Cleaned up a few bugs and added some additional tests also.
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.5.2 (amazon) in debug mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
2008-06-04 03:44:12 +08:00
|
|
|
/*
|
|
|
|
* Compact dataset is stored in dataset object header message of
|
|
|
|
* layout.
|
|
|
|
*/
|
[svn-r18634] Description:
Clean up compiler warnings.
Tested on:
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x,
w/C++ & FORTRAN, w/threadsafe, in debug mode
Linux/64-amd64 2.6 (amani) w/Intel compilers, w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in debug mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
Mac OS X/32 10.6.3 (amazon) in debug mode
Mac OS X/32 10.6.3 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
2010-04-28 02:25:31 +08:00
|
|
|
stmp_size = H5S_GET_EXTENT_NPOINTS(dset->shared->space);
|
|
|
|
HDassert(stmp_size >= 0);
|
|
|
|
tmp_size = H5T_get_size(dset->shared->type);
|
|
|
|
HDassert(tmp_size > 0);
|
|
|
|
tmp_size = tmp_size * (hsize_t)stmp_size;
|
2015-05-11 06:38:04 +08:00
|
|
|
H5_CHECKED_ASSIGN(dset->shared->layout.storage.u.compact.size, size_t, tmp_size, hssize_t);
|
[svn-r15131] Description:
Finish omnibus chunked dataset I/O refactoring, to separate general
actions on chunked datasets from actions that are specific to using the v1
B-tree index.
Cleaned up a few bugs and added some additional tests also.
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.5.2 (amazon) in debug mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
2008-06-04 03:44:12 +08:00
|
|
|
|
|
|
|
/* Verify data size is smaller than maximum header message size
|
|
|
|
* (64KB) minus other layout message fields.
|
|
|
|
*/
|
2012-04-17 05:20:26 +08:00
|
|
|
max_comp_data_size = H5O_MESG_MAX_SIZE - H5D__layout_meta_size(f, &(dset->shared->layout), FALSE);
|
2020-09-30 22:27:10 +08:00
|
|
|
if (dset->shared->layout.storage.u.compact.size > max_comp_data_size)
|
|
|
|
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL,
|
|
|
|
"compact dataset size is bigger than header message maximum size")
|
[svn-r15131] Description:
Finish omnibus chunked dataset I/O refactoring, to separate general
actions on chunked datasets from actions that are specific to using the v1
B-tree index.
Cleaned up a few bugs and added some additional tests also.
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.5.2 (amazon) in debug mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
2008-06-04 03:44:12 +08:00
|
|
|
|
|
|
|
done:
|
|
|
|
FUNC_LEAVE_NOAPI(ret_value)
|
2012-04-17 05:20:26 +08:00
|
|
|
} /* end H5D__compact_construct() */
|
[svn-r15131] Description:
Finish omnibus chunked dataset I/O refactoring, to separate general
actions on chunked datasets from actions that are specific to using the v1
B-tree index.
Cleaned up a few bugs and added some additional tests also.
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.5.2 (amazon) in debug mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
2008-06-04 03:44:12 +08:00
|
|
|
|
2009-01-27 22:00:07 +08:00
|
|
|
/*-------------------------------------------------------------------------
|
2012-04-17 05:20:26 +08:00
|
|
|
* Function: H5D__compact_is_space_alloc
|
2009-01-27 22:00:07 +08:00
|
|
|
*
|
|
|
|
* Purpose: Query if space is allocated for layout
|
|
|
|
*
|
|
|
|
* Return: Non-negative on success/Negative on failure
|
|
|
|
*
|
|
|
|
* Programmer: Quincey Koziol
|
|
|
|
* Thursday, January 15, 2009
|
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
static hbool_t
|
2015-06-02 03:38:09 +08:00
|
|
|
H5D__compact_is_space_alloc(const H5O_storage_t H5_ATTR_UNUSED *storage)
|
2009-01-27 22:00:07 +08:00
|
|
|
{
|
2012-04-17 05:20:26 +08:00
|
|
|
FUNC_ENTER_STATIC_NOERR
|
2009-01-27 22:00:07 +08:00
|
|
|
|
|
|
|
/* Sanity checks */
|
[svn-r17281] Description:
Further refactoring of the dataset layout information, to separate the
storage information from the layout info.
Tested on:
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (jam) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/Intel compilers w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in debug mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
Mac OS X/32 10.5.7 (amazon) in debug mode
Mac OS X/32 10.5.7 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
2009-07-31 11:08:12 +08:00
|
|
|
HDassert(storage);
|
2009-01-27 22:00:07 +08:00
|
|
|
|
|
|
|
/* Compact storage is currently always allocated */
|
|
|
|
FUNC_LEAVE_NOAPI(TRUE)
|
2012-04-17 05:20:26 +08:00
|
|
|
} /* end H5D__compact_is_space_alloc() */
|
2009-01-27 22:00:07 +08:00
|
|
|
|
2008-05-01 03:51:13 +08:00
|
|
|
/*-------------------------------------------------------------------------
|
2012-04-17 05:20:26 +08:00
|
|
|
* Function: H5D__compact_io_init
|
2008-05-01 03:51:13 +08:00
|
|
|
*
|
|
|
|
* Purpose: Performs initialization before any sort of I/O on the raw data
|
|
|
|
*
|
|
|
|
* Return: Non-negative on success/Negative on failure
|
|
|
|
*
|
|
|
|
* Programmer: Quincey Koziol
|
|
|
|
* Thursday, March 20, 2008
|
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
static herr_t
|
2015-06-02 03:38:09 +08:00
|
|
|
H5D__compact_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t H5_ATTR_UNUSED *type_info,
|
2021-11-20 22:34:50 +08:00
|
|
|
hsize_t H5_ATTR_UNUSED nelmts, H5S_t H5_ATTR_UNUSED *file_space,
|
|
|
|
H5S_t H5_ATTR_UNUSED *mem_space, H5D_chunk_map_t H5_ATTR_UNUSED *cm)
|
2008-05-01 03:51:13 +08:00
|
|
|
{
|
2012-04-17 05:20:26 +08:00
|
|
|
FUNC_ENTER_STATIC_NOERR
|
2008-05-01 03:51:13 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
io_info->store->compact.buf = io_info->dset->shared->layout.storage.u.compact.buf;
|
[svn-r17275] Description:
Refactor dataet storage information further, moving the chunk operations
into the storage struct and also fine-tune the chunk index structure for index
callbacks.
Tested on:
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (jam) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/Intel compilers w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in debug mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
Mac OS X/32 10.5.7 (amazon) in debug mode
Mac OS X/32 10.5.7 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
2009-07-31 01:51:49 +08:00
|
|
|
io_info->store->compact.dirty = &io_info->dset->shared->layout.storage.u.compact.dirty;
|
2008-05-01 03:51:13 +08:00
|
|
|
|
|
|
|
FUNC_LEAVE_NOAPI(SUCCEED)
|
2012-04-17 05:20:26 +08:00
|
|
|
} /* end H5D__compact_io_init() */
|
2008-05-01 03:51:13 +08:00
|
|
|
|
2021-09-30 12:00:24 +08:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
* Function: H5D__compact_iovv_memmanage_cb
|
|
|
|
*
|
|
|
|
* Purpose: Callback operator for H5D__compact_readvv()/_writevv() to
|
|
|
|
* send a memory copy request to the underlying file driver.
|
|
|
|
*
|
|
|
|
* Return: Non-negative on success/Negative on failure
|
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
static herr_t
|
|
|
|
H5D__compact_iovv_memmanage_cb(hsize_t dst_off, hsize_t src_off, size_t len, void *_udata)
|
|
|
|
{
|
|
|
|
H5D_compact_iovv_memmanage_ud_t *udata = (H5D_compact_iovv_memmanage_ud_t *)_udata;
|
|
|
|
H5FD_ctl_memcpy_args_t op_args;
|
|
|
|
uint64_t op_flags;
|
|
|
|
H5FD_t * file_handle = NULL;
|
|
|
|
herr_t ret_value = SUCCEED;
|
|
|
|
|
|
|
|
FUNC_ENTER_STATIC
|
|
|
|
|
|
|
|
/* Retrieve pointer to file driver structure for ctl call */
|
|
|
|
if (H5F_shared_get_file_driver(udata->f_sh, &file_handle) < 0)
|
|
|
|
HGOTO_ERROR(H5E_IO, H5E_CANTGET, FAIL, "can't get file handle")
|
|
|
|
|
|
|
|
/* Setup operation flags and arguments */
|
|
|
|
op_flags = H5FD_CTL__ROUTE_TO_TERMINAL_VFD_FLAG | H5FD_CTL__FAIL_IF_UNKNOWN_FLAG;
|
|
|
|
|
|
|
|
op_args.dstbuf = udata->dstbuf;
|
|
|
|
op_args.dst_off = dst_off;
|
|
|
|
op_args.srcbuf = udata->srcbuf;
|
|
|
|
op_args.src_off = src_off;
|
|
|
|
op_args.len = len;
|
|
|
|
|
|
|
|
/* Make request to file driver */
|
|
|
|
if (H5FD_ctl(file_handle, H5FD_CTL__MEM_COPY, op_flags, &op_args, NULL) < 0)
|
|
|
|
HGOTO_ERROR(H5E_IO, H5E_FCNTL, FAIL, "VFD memcpy request failed")
|
|
|
|
|
|
|
|
done:
|
|
|
|
FUNC_LEAVE_NOAPI(ret_value)
|
|
|
|
} /* end H5D__compact_iovv_memmanage_cb() */
|
|
|
|
|
2002-08-21 00:18:02 +08:00
|
|
|
/*-------------------------------------------------------------------------
|
2012-04-17 05:20:26 +08:00
|
|
|
* Function: H5D__compact_readvv
|
2005-08-14 04:53:35 +08:00
|
|
|
*
|
2002-08-21 00:18:02 +08:00
|
|
|
* Purpose: Reads some data vectors from a dataset into a buffer.
|
2005-08-14 04:53:35 +08:00
|
|
|
* The data is in compact dataset. The address is relative
|
2002-08-21 00:18:02 +08:00
|
|
|
* to the beginning address of the dataset. The offsets and
|
|
|
|
* sequence lengths are in bytes.
|
2005-08-14 04:53:35 +08:00
|
|
|
*
|
2002-08-21 00:18:02 +08:00
|
|
|
* Return: Non-negative on success/Negative on failure
|
2005-08-14 04:53:35 +08:00
|
|
|
*
|
2003-05-08 05:52:24 +08:00
|
|
|
* Programmer: Quincey Koziol
|
|
|
|
* May 7, 2003
|
2005-08-14 04:53:35 +08:00
|
|
|
*
|
|
|
|
* Notes:
|
2003-05-08 05:52:24 +08:00
|
|
|
* Offsets in the sequences must be monotonically increasing
|
2005-08-14 04:53:35 +08:00
|
|
|
*
|
2002-08-21 00:18:02 +08:00
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
2008-05-01 03:51:13 +08:00
|
|
|
static ssize_t
|
2020-09-30 22:27:10 +08:00
|
|
|
H5D__compact_readvv(const H5D_io_info_t *io_info, size_t dset_max_nseq, size_t *dset_curr_seq,
|
|
|
|
size_t dset_size_arr[], hsize_t dset_offset_arr[], size_t mem_max_nseq,
|
|
|
|
size_t *mem_curr_seq, size_t mem_size_arr[], hsize_t mem_offset_arr[])
|
2002-08-21 00:18:02 +08:00
|
|
|
{
|
2020-09-30 22:27:10 +08:00
|
|
|
ssize_t ret_value = -1; /* Return value */
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2012-04-17 05:20:26 +08:00
|
|
|
FUNC_ENTER_STATIC
|
2004-06-06 03:04:49 +08:00
|
|
|
|
2008-05-01 03:51:13 +08:00
|
|
|
HDassert(io_info);
|
2002-08-21 00:18:02 +08:00
|
|
|
|
2021-09-30 12:00:24 +08:00
|
|
|
/* Check if file driver wishes to do its own memory management */
|
|
|
|
if (H5F_SHARED_HAS_FEATURE(io_info->f_sh, H5FD_FEAT_MEMMANAGE)) {
|
|
|
|
H5D_compact_iovv_memmanage_ud_t udata;
|
|
|
|
|
|
|
|
/* Set up udata for memory copy operation */
|
|
|
|
udata.f_sh = io_info->f_sh;
|
|
|
|
udata.dstbuf = io_info->u.rbuf;
|
|
|
|
udata.srcbuf = io_info->store->compact.buf;
|
|
|
|
|
|
|
|
/* Request that file driver does the memory copy */
|
|
|
|
if ((ret_value = H5VM_opvv(mem_max_nseq, mem_curr_seq, mem_size_arr, mem_offset_arr, dset_max_nseq,
|
|
|
|
dset_curr_seq, dset_size_arr, dset_offset_arr,
|
|
|
|
H5D__compact_iovv_memmanage_cb, &udata)) < 0)
|
|
|
|
HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "vectorized memcpy failed")
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* Use the vectorized memory copy routine to do actual work */
|
|
|
|
if ((ret_value = H5VM_memcpyvv(io_info->u.rbuf, mem_max_nseq, mem_curr_seq, mem_size_arr,
|
|
|
|
mem_offset_arr, io_info->store->compact.buf, dset_max_nseq,
|
|
|
|
dset_curr_seq, dset_size_arr, dset_offset_arr)) < 0)
|
|
|
|
HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "vectorized memcpy failed")
|
|
|
|
}
|
2002-08-21 00:18:02 +08:00
|
|
|
|
2005-08-14 04:53:35 +08:00
|
|
|
done:
|
2004-12-29 22:26:20 +08:00
|
|
|
FUNC_LEAVE_NOAPI(ret_value)
|
2020-09-30 22:27:10 +08:00
|
|
|
} /* end H5D__compact_readvv() */
|
2002-08-21 00:18:02 +08:00
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
2012-04-17 05:20:26 +08:00
|
|
|
* Function: H5D__compact_writevv
|
2005-08-14 04:53:35 +08:00
|
|
|
*
|
2002-08-21 00:18:02 +08:00
|
|
|
* Purpose: Writes some data vectors from a dataset into a buffer.
|
2005-08-14 04:53:35 +08:00
|
|
|
* The data is in compact dataset. The address is relative
|
2002-08-21 00:18:02 +08:00
|
|
|
* to the beginning address for the file. The offsets and
|
|
|
|
* sequence lengths are in bytes. This function only copies
|
2005-08-14 04:53:35 +08:00
|
|
|
* data into the buffer in the LAYOUT struct and mark it
|
|
|
|
* as DIRTY. Later in H5D_close, the data is copied into
|
|
|
|
* header message in memory.
|
|
|
|
*
|
2002-08-21 00:18:02 +08:00
|
|
|
* Return: Non-negative on success/Negative on failure
|
2005-08-14 04:53:35 +08:00
|
|
|
*
|
2003-05-08 05:52:24 +08:00
|
|
|
* Programmer: Quincey Koziol
|
|
|
|
* May 2, 2003
|
2005-08-14 04:53:35 +08:00
|
|
|
*
|
|
|
|
* Notes:
|
2002-08-21 00:18:02 +08:00
|
|
|
* Offsets in the sequences must be monotonically increasing
|
2005-08-14 04:53:35 +08:00
|
|
|
*
|
2002-08-21 00:18:02 +08:00
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
2008-05-01 03:51:13 +08:00
|
|
|
static ssize_t
|
2020-09-30 22:27:10 +08:00
|
|
|
H5D__compact_writevv(const H5D_io_info_t *io_info, size_t dset_max_nseq, size_t *dset_curr_seq,
|
|
|
|
size_t dset_size_arr[], hsize_t dset_offset_arr[], size_t mem_max_nseq,
|
|
|
|
size_t *mem_curr_seq, size_t mem_size_arr[], hsize_t mem_offset_arr[])
|
2002-08-21 00:18:02 +08:00
|
|
|
{
|
2020-09-30 22:27:10 +08:00
|
|
|
ssize_t ret_value = -1; /* Return value */
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2012-04-17 05:20:26 +08:00
|
|
|
FUNC_ENTER_STATIC
|
2004-06-06 03:04:49 +08:00
|
|
|
|
2008-05-01 03:51:13 +08:00
|
|
|
HDassert(io_info);
|
2002-08-21 00:18:02 +08:00
|
|
|
|
2021-09-30 12:00:24 +08:00
|
|
|
/* Check if file driver wishes to do its own memory management */
|
|
|
|
if (H5F_SHARED_HAS_FEATURE(io_info->f_sh, H5FD_FEAT_MEMMANAGE)) {
|
|
|
|
H5D_compact_iovv_memmanage_ud_t udata;
|
|
|
|
|
|
|
|
/* Set up udata for memory copy operation */
|
|
|
|
udata.f_sh = io_info->f_sh;
|
|
|
|
udata.dstbuf = io_info->store->compact.buf;
|
|
|
|
udata.srcbuf = io_info->u.wbuf;
|
|
|
|
|
|
|
|
/* Request that file driver does the memory copy */
|
|
|
|
if ((ret_value = H5VM_opvv(dset_max_nseq, dset_curr_seq, dset_size_arr, dset_offset_arr, mem_max_nseq,
|
|
|
|
mem_curr_seq, mem_size_arr, mem_offset_arr, H5D__compact_iovv_memmanage_cb,
|
|
|
|
&udata)) < 0)
|
|
|
|
HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "vectorized memcpy failed")
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* Use the vectorized memory copy routine to do actual work */
|
|
|
|
if ((ret_value = H5VM_memcpyvv(io_info->store->compact.buf, dset_max_nseq, dset_curr_seq,
|
|
|
|
dset_size_arr, dset_offset_arr, io_info->u.wbuf, mem_max_nseq,
|
|
|
|
mem_curr_seq, mem_size_arr, mem_offset_arr)) < 0)
|
|
|
|
HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "vectorized memcpy failed")
|
|
|
|
}
|
2002-08-21 00:18:02 +08:00
|
|
|
|
2006-09-26 06:22:14 +08:00
|
|
|
/* Mark the compact dataset's buffer as dirty */
|
2008-05-01 03:51:13 +08:00
|
|
|
*io_info->store->compact.dirty = TRUE;
|
2002-08-21 00:18:02 +08:00
|
|
|
|
2005-08-14 04:53:35 +08:00
|
|
|
done:
|
2004-12-29 22:26:20 +08:00
|
|
|
FUNC_LEAVE_NOAPI(ret_value)
|
2020-09-30 22:27:10 +08:00
|
|
|
} /* end H5D__compact_writevv() */
|
2006-01-29 02:31:22 +08:00
|
|
|
|
[svn-r17243] Description:
Refactor how the layout message is created/written/read in the
dataset's object header.
Tested on:
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (jam) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/Intel compilers w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in debug mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
Mac OS X/32 10.5.7 (amazon) in debug mode
Mac OS X/32 10.5.7 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
2009-07-28 06:11:29 +08:00
|
|
|
/*-------------------------------------------------------------------------
|
2012-04-17 05:20:26 +08:00
|
|
|
* Function: H5D__compact_flush
|
[svn-r17243] Description:
Refactor how the layout message is created/written/read in the
dataset's object header.
Tested on:
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (jam) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/Intel compilers w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in debug mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
Mac OS X/32 10.5.7 (amazon) in debug mode
Mac OS X/32 10.5.7 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
2009-07-28 06:11:29 +08:00
|
|
|
*
|
|
|
|
* Purpose: Writes dirty compact data to object header
|
|
|
|
*
|
|
|
|
* Return: Non-negative on success/Negative on failure
|
|
|
|
*
|
|
|
|
* Programmer: Quincey Koziol
|
|
|
|
* Monday, July 27, 2009
|
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
static herr_t
|
2018-03-16 05:54:30 +08:00
|
|
|
H5D__compact_flush(H5D_t *dset)
|
[svn-r17243] Description:
Refactor how the layout message is created/written/read in the
dataset's object header.
Tested on:
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (jam) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/Intel compilers w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in debug mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
Mac OS X/32 10.5.7 (amazon) in debug mode
Mac OS X/32 10.5.7 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
2009-07-28 06:11:29 +08:00
|
|
|
{
|
2020-09-30 22:27:10 +08:00
|
|
|
herr_t ret_value = SUCCEED; /* Return value */
|
[svn-r17243] Description:
Refactor how the layout message is created/written/read in the
dataset's object header.
Tested on:
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (jam) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/Intel compilers w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in debug mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
Mac OS X/32 10.5.7 (amazon) in debug mode
Mac OS X/32 10.5.7 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
2009-07-28 06:11:29 +08:00
|
|
|
|
2012-04-17 05:20:26 +08:00
|
|
|
FUNC_ENTER_STATIC
|
[svn-r17243] Description:
Refactor how the layout message is created/written/read in the
dataset's object header.
Tested on:
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (jam) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/Intel compilers w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in debug mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
Mac OS X/32 10.5.7 (amazon) in debug mode
Mac OS X/32 10.5.7 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
2009-07-28 06:11:29 +08:00
|
|
|
|
|
|
|
/* Sanity check */
|
|
|
|
HDassert(dset);
|
|
|
|
|
|
|
|
/* Check if the buffered compact information is dirty */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (dset->shared->layout.storage.u.compact.dirty) {
|
2017-05-07 12:40:44 +08:00
|
|
|
dset->shared->layout.storage.u.compact.dirty = FALSE;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5O_msg_write(&(dset->oloc), H5O_LAYOUT_ID, 0, H5O_UPDATE_TIME, &(dset->shared->layout)) < 0) {
|
2017-05-09 11:14:20 +08:00
|
|
|
dset->shared->layout.storage.u.compact.dirty = TRUE;
|
[svn-r17243] Description:
Refactor how the layout message is created/written/read in the
dataset's object header.
Tested on:
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (jam) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/Intel compilers w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in debug mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
Mac OS X/32 10.5.7 (amazon) in debug mode
Mac OS X/32 10.5.7 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
2009-07-28 06:11:29 +08:00
|
|
|
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to update layout message")
|
2017-05-09 11:14:20 +08:00
|
|
|
}
|
[svn-r17243] Description:
Refactor how the layout message is created/written/read in the
dataset's object header.
Tested on:
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (jam) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/Intel compilers w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in debug mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
Mac OS X/32 10.5.7 (amazon) in debug mode
Mac OS X/32 10.5.7 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
2009-07-28 06:11:29 +08:00
|
|
|
} /* end if */
|
|
|
|
|
|
|
|
done:
|
|
|
|
FUNC_LEAVE_NOAPI(ret_value)
|
2012-04-17 05:20:26 +08:00
|
|
|
} /* end H5D__compact_flush() */
|
[svn-r17243] Description:
Refactor how the layout message is created/written/read in the
dataset's object header.
Tested on:
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (jam) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/Intel compilers w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in debug mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
Mac OS X/32 10.5.7 (amazon) in debug mode
Mac OS X/32 10.5.7 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
2009-07-28 06:11:29 +08:00
|
|
|
|
2015-09-17 06:27:49 +08:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
* Function: H5D__compact_dest
|
|
|
|
*
|
|
|
|
* Purpose: Free the compact buffer
|
|
|
|
*
|
|
|
|
* Return: Non-negative on success/Negative on failure
|
|
|
|
*
|
|
|
|
* Programmer: Quincey Koziol
|
|
|
|
* Thursday, Sept 3, 2015
|
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
static herr_t
|
2018-03-16 05:54:30 +08:00
|
|
|
H5D__compact_dest(H5D_t *dset)
|
2015-09-17 06:27:49 +08:00
|
|
|
{
|
|
|
|
FUNC_ENTER_STATIC_NOERR
|
|
|
|
|
|
|
|
/* Sanity check */
|
|
|
|
HDassert(dset);
|
|
|
|
|
|
|
|
/* Free the buffer for the raw data for compact datasets */
|
|
|
|
dset->shared->layout.storage.u.compact.buf = H5MM_xfree(dset->shared->layout.storage.u.compact.buf);
|
|
|
|
|
|
|
|
FUNC_LEAVE_NOAPI(SUCCEED)
|
|
|
|
} /* end H5D__compact_dest() */
|
|
|
|
|
2006-01-29 02:31:22 +08:00
|
|
|
/*-------------------------------------------------------------------------
|
2012-04-17 05:20:26 +08:00
|
|
|
* Function: H5D__compact_copy
|
2006-01-29 02:31:22 +08:00
|
|
|
*
|
|
|
|
* Purpose: Copy compact storage raw data from SRC file to DST file.
|
|
|
|
*
|
|
|
|
* Return: Non-negative on success, negative on failure.
|
|
|
|
*
|
|
|
|
* Programmer: Peter Cao
|
2006-06-27 22:45:06 +08:00
|
|
|
* December 11, 2005
|
2006-01-29 02:31:22 +08:00
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
herr_t
|
2017-06-11 08:40:19 +08:00
|
|
|
H5D__compact_copy(H5F_t *f_src, H5O_storage_compact_t *_storage_src, H5F_t *f_dst,
|
2020-09-30 22:27:10 +08:00
|
|
|
H5O_storage_compact_t *storage_dst, H5T_t *dt_src, H5O_copy_t *cpy_info)
|
2006-01-29 02:31:22 +08:00
|
|
|
{
|
2020-09-30 22:27:10 +08:00
|
|
|
hid_t tid_src = -1; /* Datatype ID for source datatype */
|
|
|
|
hid_t tid_dst = -1; /* Datatype ID for destination datatype */
|
|
|
|
hid_t tid_mem = -1; /* Datatype ID for memory datatype */
|
|
|
|
void * buf = NULL; /* Buffer for copying data */
|
|
|
|
void * bkg = NULL; /* Temporary buffer for copying data */
|
|
|
|
void * reclaim_buf = NULL; /* Buffer for reclaiming data */
|
|
|
|
hid_t buf_sid = -1; /* ID for buffer dataspace */
|
|
|
|
H5D_shared_t *shared_fo =
|
|
|
|
(H5D_shared_t *)cpy_info->shared_fo; /* Pointer to the shared struct for dataset object */
|
|
|
|
H5O_storage_compact_t *storage_src = _storage_src; /* Pointer to storage_src */
|
|
|
|
herr_t ret_value = SUCCEED; /* Return value */
|
2006-01-29 02:31:22 +08:00
|
|
|
|
2012-04-17 05:20:26 +08:00
|
|
|
FUNC_ENTER_PACKAGE
|
2006-01-29 02:31:22 +08:00
|
|
|
|
|
|
|
/* Check args */
|
2006-09-26 06:22:14 +08:00
|
|
|
HDassert(f_src);
|
[svn-r17281] Description:
Further refactoring of the dataset layout information, to separate the
storage information from the layout info.
Tested on:
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (jam) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/Intel compilers w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in debug mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
Mac OS X/32 10.5.7 (amazon) in debug mode
Mac OS X/32 10.5.7 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
2009-07-31 11:08:12 +08:00
|
|
|
HDassert(storage_src);
|
2006-07-16 03:49:04 +08:00
|
|
|
HDassert(f_dst);
|
[svn-r17281] Description:
Further refactoring of the dataset layout information, to separate the
storage information from the layout info.
Tested on:
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (jam) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/Intel compilers w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in debug mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
Mac OS X/32 10.5.7 (amazon) in debug mode
Mac OS X/32 10.5.7 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
2009-07-31 11:08:12 +08:00
|
|
|
HDassert(storage_dst);
|
2016-01-03 09:03:08 +08:00
|
|
|
HDassert(storage_dst->buf);
|
2006-12-01 05:38:30 +08:00
|
|
|
HDassert(dt_src);
|
2006-01-29 02:31:22 +08:00
|
|
|
|
2017-06-11 08:40:19 +08:00
|
|
|
/* If the dataset is open in the file, point to "layout" in the shared struct */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (shared_fo != NULL)
|
2017-06-11 08:40:19 +08:00
|
|
|
storage_src = &(shared_fo->layout.storage.u.compact);
|
|
|
|
|
2006-12-15 02:46:51 +08:00
|
|
|
/* Create datatype ID for src datatype, so it gets freed */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((tid_src = H5I_register(H5I_DATATYPE, dt_src, FALSE)) < 0)
|
[svn-r17281] Description:
Further refactoring of the dataset layout information, to separate the
storage information from the layout info.
Tested on:
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (jam) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/Intel compilers w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in debug mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
Mac OS X/32 10.5.7 (amazon) in debug mode
Mac OS X/32 10.5.7 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
2009-07-31 11:08:12 +08:00
|
|
|
HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register source file datatype")
|
2006-12-15 02:46:51 +08:00
|
|
|
|
2006-12-01 05:38:30 +08:00
|
|
|
/* If there's a VLEN source datatype, do type conversion information */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5T_detect_class(dt_src, H5T_VLEN, FALSE) > 0) {
|
|
|
|
H5T_path_t *tpath_src_mem, *tpath_mem_dst; /* Datatype conversion paths */
|
|
|
|
H5T_t * dt_dst; /* Destination datatype */
|
|
|
|
H5T_t * dt_mem; /* Memory datatype */
|
|
|
|
H5S_t * buf_space; /* Dataspace describing buffer */
|
|
|
|
size_t buf_size; /* Size of copy buffer */
|
|
|
|
size_t nelmts; /* Number of elements in buffer */
|
|
|
|
size_t src_dt_size; /* Source datatype size */
|
|
|
|
size_t tmp_dt_size; /* Temporary datatype size */
|
|
|
|
size_t max_dt_size; /* Max atatype size */
|
|
|
|
hsize_t buf_dim; /* Dimension for buffer */
|
2006-01-29 02:31:22 +08:00
|
|
|
|
|
|
|
/* create a memory copy of the variable-length datatype */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (NULL == (dt_mem = H5T_copy(dt_src, H5T_COPY_TRANSIENT)))
|
2006-01-29 02:31:22 +08:00
|
|
|
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy")
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((tid_mem = H5I_register(H5I_DATATYPE, dt_mem, FALSE)) < 0) {
|
2018-03-16 05:54:30 +08:00
|
|
|
(void)H5T_close_real(dt_mem);
|
2006-09-26 06:22:14 +08:00
|
|
|
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register memory datatype")
|
2009-12-13 13:28:30 +08:00
|
|
|
} /* end if */
|
2006-01-29 02:31:22 +08:00
|
|
|
|
|
|
|
/* create variable-length datatype at the destinaton file */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (NULL == (dt_dst = H5T_copy(dt_src, H5T_COPY_TRANSIENT)))
|
2006-01-29 02:31:22 +08:00
|
|
|
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy")
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5T_set_loc(dt_dst, H5F_VOL_OBJ(f_dst), H5T_LOC_DISK) < 0) {
|
2018-03-16 05:54:30 +08:00
|
|
|
(void)H5T_close_real(dt_dst);
|
2006-01-29 02:31:22 +08:00
|
|
|
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "cannot mark datatype on disk")
|
2009-12-13 13:28:30 +08:00
|
|
|
} /* end if */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((tid_dst = H5I_register(H5I_DATATYPE, dt_dst, FALSE)) < 0) {
|
2018-03-16 05:54:30 +08:00
|
|
|
(void)H5T_close_real(dt_dst);
|
2006-01-29 02:31:22 +08:00
|
|
|
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register destination file datatype")
|
2009-12-13 13:28:30 +08:00
|
|
|
} /* end if */
|
2006-01-29 02:31:22 +08:00
|
|
|
|
|
|
|
/* Set up the conversion functions */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (NULL == (tpath_src_mem = H5T_path_find(dt_src, dt_mem)))
|
2008-09-11 03:10:41 +08:00
|
|
|
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to convert between src and mem datatypes")
|
2020-09-30 22:27:10 +08:00
|
|
|
if (NULL == (tpath_mem_dst = H5T_path_find(dt_mem, dt_dst)))
|
2008-09-11 03:10:41 +08:00
|
|
|
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to convert between mem and dst datatypes")
|
2006-01-29 02:31:22 +08:00
|
|
|
|
|
|
|
/* Determine largest datatype size */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (0 == (src_dt_size = H5T_get_size(dt_src)))
|
2006-01-29 02:31:22 +08:00
|
|
|
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to determine datatype size")
|
2020-09-30 22:27:10 +08:00
|
|
|
if (0 == (tmp_dt_size = H5T_get_size(dt_mem)))
|
2006-01-29 02:31:22 +08:00
|
|
|
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to determine datatype size")
|
|
|
|
max_dt_size = MAX(src_dt_size, tmp_dt_size);
|
2020-09-30 22:27:10 +08:00
|
|
|
if (0 == (tmp_dt_size = H5T_get_size(dt_dst)))
|
2006-01-29 02:31:22 +08:00
|
|
|
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to determine datatype size")
|
|
|
|
max_dt_size = MAX(max_dt_size, tmp_dt_size);
|
|
|
|
|
|
|
|
/* Set number of whole elements that fit in buffer */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (0 == (nelmts = storage_src->size / src_dt_size))
|
2006-01-29 02:31:22 +08:00
|
|
|
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "element size too large")
|
|
|
|
|
|
|
|
/* Set up number of bytes to copy, and initial buffer size */
|
|
|
|
buf_size = nelmts * max_dt_size;
|
|
|
|
|
|
|
|
/* Create dataspace for number of elements in buffer */
|
|
|
|
buf_dim = nelmts;
|
|
|
|
|
|
|
|
/* Create the space and set the initial extent */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (NULL == (buf_space = H5S_create_simple((unsigned)1, &buf_dim, NULL)))
|
2006-01-29 02:31:22 +08:00
|
|
|
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create simple dataspace")
|
|
|
|
|
2020-11-30 20:50:39 +08:00
|
|
|
/* Register */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((buf_sid = H5I_register(H5I_DATASPACE, buf_space, FALSE)) < 0) {
|
2006-01-29 02:31:22 +08:00
|
|
|
H5S_close(buf_space);
|
2020-11-30 20:50:39 +08:00
|
|
|
HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, FAIL, "unable to register dataspace ID")
|
2006-01-29 02:31:22 +08:00
|
|
|
} /* end if */
|
|
|
|
|
|
|
|
/* Allocate memory for recclaim buf */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (NULL == (reclaim_buf = H5FL_BLK_MALLOC(type_conv, buf_size)))
|
2006-04-02 04:14:11 +08:00
|
|
|
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
|
2006-01-29 02:31:22 +08:00
|
|
|
|
|
|
|
/* Allocate memory for copying the chunk */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (NULL == (buf = H5FL_BLK_MALLOC(type_conv, buf_size)))
|
2006-04-02 04:14:11 +08:00
|
|
|
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
|
2006-01-29 02:31:22 +08:00
|
|
|
|
2019-03-16 23:06:52 +08:00
|
|
|
H5MM_memcpy(buf, storage_src->buf, storage_src->size);
|
2006-01-29 02:31:22 +08:00
|
|
|
|
2009-10-03 04:40:01 +08:00
|
|
|
/* allocate temporary bkg buff for data conversion */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (NULL == (bkg = H5FL_BLK_MALLOC(type_conv, buf_size)))
|
2009-10-03 04:40:01 +08:00
|
|
|
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
|
|
|
|
|
2006-01-29 02:31:22 +08:00
|
|
|
/* Convert from source file to memory */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5T_convert(tpath_src_mem, tid_src, tid_mem, nelmts, (size_t)0, (size_t)0, buf, bkg) < 0)
|
2006-01-29 02:31:22 +08:00
|
|
|
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "datatype conversion failed")
|
|
|
|
|
2009-10-03 04:40:01 +08:00
|
|
|
/* Copy into another buffer, to reclaim memory later */
|
2019-03-16 23:06:52 +08:00
|
|
|
H5MM_memcpy(reclaim_buf, buf, buf_size);
|
2006-01-29 02:31:22 +08:00
|
|
|
|
2009-10-03 04:40:01 +08:00
|
|
|
/* Set background buffer to all zeros */
|
|
|
|
HDmemset(bkg, 0, buf_size);
|
2006-04-02 04:14:11 +08:00
|
|
|
|
2006-01-29 02:31:22 +08:00
|
|
|
/* Convert from memory to destination file */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5T_convert(tpath_mem_dst, tid_mem, tid_dst, nelmts, (size_t)0, (size_t)0, buf, bkg) < 0)
|
2006-01-29 02:31:22 +08:00
|
|
|
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "datatype conversion failed")
|
|
|
|
|
2019-03-16 23:06:52 +08:00
|
|
|
H5MM_memcpy(storage_dst->buf, buf, storage_dst->size);
|
2006-01-29 02:31:22 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5T_reclaim(tid_mem, buf_space, reclaim_buf) < 0)
|
2006-01-29 02:31:22 +08:00
|
|
|
HGOTO_ERROR(H5E_DATASET, H5E_BADITER, FAIL, "unable to reclaim variable-length data")
|
|
|
|
} /* end if */
|
2020-09-30 22:27:10 +08:00
|
|
|
else if (H5T_get_class(dt_src, FALSE) == H5T_REFERENCE) {
|
|
|
|
if (f_src != f_dst) {
|
2006-12-01 05:38:30 +08:00
|
|
|
/* Check for expanding references */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (cpy_info->expand_ref) {
|
|
|
|
/* Copy objects referenced in source buffer to destination file and set destination elements
|
|
|
|
*/
|
|
|
|
if (H5O_copy_expand_ref(f_src, tid_src, dt_src, storage_src->buf, storage_src->size, f_dst,
|
|
|
|
storage_dst->buf, cpy_info) < 0)
|
2006-12-01 05:38:30 +08:00
|
|
|
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "unable to copy reference attribute")
|
|
|
|
} /* end if */
|
|
|
|
else
|
|
|
|
/* Reset value to zero */
|
[svn-r17281] Description:
Further refactoring of the dataset layout information, to separate the
storage information from the layout info.
Tested on:
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (jam) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/Intel compilers w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in debug mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
Mac OS X/32 10.5.7 (amazon) in debug mode
Mac OS X/32 10.5.7 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
2009-07-31 11:08:12 +08:00
|
|
|
HDmemset(storage_dst->buf, 0, storage_src->size);
|
2006-12-01 05:38:30 +08:00
|
|
|
} /* end if */
|
|
|
|
else
|
|
|
|
/* Type conversion not necessary */
|
2019-03-16 23:06:52 +08:00
|
|
|
H5MM_memcpy(storage_dst->buf, storage_src->buf, storage_src->size);
|
2006-12-01 05:38:30 +08:00
|
|
|
} /* end if */
|
2008-09-16 23:52:51 +08:00
|
|
|
else
|
2006-12-01 05:38:30 +08:00
|
|
|
/* Type conversion not necessary */
|
2019-03-16 23:06:52 +08:00
|
|
|
H5MM_memcpy(storage_dst->buf, storage_src->buf, storage_src->size);
|
[svn-r17281] Description:
Further refactoring of the dataset layout information, to separate the
storage information from the layout info.
Tested on:
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (jam) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/Intel compilers w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in debug mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
Mac OS X/32 10.5.7 (amazon) in debug mode
Mac OS X/32 10.5.7 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
2009-07-31 11:08:12 +08:00
|
|
|
|
|
|
|
/* Mark destination buffer as dirty */
|
|
|
|
storage_dst->dirty = TRUE;
|
2006-01-29 02:31:22 +08:00
|
|
|
|
|
|
|
done:
|
2020-09-30 22:27:10 +08:00
|
|
|
if (buf_sid > 0 && H5I_dec_ref(buf_sid) < 0)
|
2008-09-11 03:10:41 +08:00
|
|
|
HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "can't decrement temporary dataspace ID")
|
2020-09-30 22:27:10 +08:00
|
|
|
if (tid_src > 0 && H5I_dec_ref(tid_src) < 0)
|
[svn-r19398] Descriptino:
Clean up the internal usage H5I_dec_ref() to eliminate the sequence of
flags that has been creeping in.
Tested on:
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x,
w/C++ & FORTRAN, w/threadsafe, in debug mode
Linux/64-amd64 2.6 (amani) w/Intel compilers, w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, w/threadsafe, in production mode
Linux/PPC 2.6 (heiwa) w/C++ & FORTRAN, w/threadsafe, in debug mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in debug mode
Mac OS X/32 10.6.4 (amazon) in debug mode
Mac OS X/32 10.6.4 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
Mac OS X/32 10.6.4 (amazon) w/parallel, in debug mode
2010-09-16 22:02:19 +08:00
|
|
|
HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't decrement temporary datatype ID")
|
2020-09-30 22:27:10 +08:00
|
|
|
if (tid_dst > 0 && H5I_dec_ref(tid_dst) < 0)
|
[svn-r19398] Descriptino:
Clean up the internal usage H5I_dec_ref() to eliminate the sequence of
flags that has been creeping in.
Tested on:
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x,
w/C++ & FORTRAN, w/threadsafe, in debug mode
Linux/64-amd64 2.6 (amani) w/Intel compilers, w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, w/threadsafe, in production mode
Linux/PPC 2.6 (heiwa) w/C++ & FORTRAN, w/threadsafe, in debug mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in debug mode
Mac OS X/32 10.6.4 (amazon) in debug mode
Mac OS X/32 10.6.4 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
Mac OS X/32 10.6.4 (amazon) w/parallel, in debug mode
2010-09-16 22:02:19 +08:00
|
|
|
HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't decrement temporary datatype ID")
|
2020-09-30 22:27:10 +08:00
|
|
|
if (tid_mem > 0 && H5I_dec_ref(tid_mem) < 0)
|
[svn-r19398] Descriptino:
Clean up the internal usage H5I_dec_ref() to eliminate the sequence of
flags that has been creeping in.
Tested on:
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x,
w/C++ & FORTRAN, w/threadsafe, in debug mode
Linux/64-amd64 2.6 (amani) w/Intel compilers, w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, w/threadsafe, in production mode
Linux/PPC 2.6 (heiwa) w/C++ & FORTRAN, w/threadsafe, in debug mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in debug mode
Mac OS X/32 10.6.4 (amazon) in debug mode
Mac OS X/32 10.6.4 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
Mac OS X/32 10.6.4 (amazon) w/parallel, in debug mode
2010-09-16 22:02:19 +08:00
|
|
|
HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't decrement temporary datatype ID")
|
2020-09-30 22:27:10 +08:00
|
|
|
if (buf)
|
2010-04-21 02:26:41 +08:00
|
|
|
buf = H5FL_BLK_FREE(type_conv, buf);
|
2020-09-30 22:27:10 +08:00
|
|
|
if (reclaim_buf)
|
2010-04-21 02:26:41 +08:00
|
|
|
reclaim_buf = H5FL_BLK_FREE(type_conv, reclaim_buf);
|
2020-09-30 22:27:10 +08:00
|
|
|
if (bkg)
|
2010-04-21 02:26:41 +08:00
|
|
|
bkg = H5FL_BLK_FREE(type_conv, bkg);
|
2006-01-29 02:31:22 +08:00
|
|
|
|
|
|
|
FUNC_LEAVE_NOAPI(ret_value)
|
2012-04-17 05:20:26 +08:00
|
|
|
} /* end H5D__compact_copy() */
|