diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2002-06-05 15:23:20 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2002-06-05 15:23:20 (GMT) |
commit | 6b1208407f5886c917f1ebb38bac058eeb980e30 (patch) | |
tree | 6b29e7da66abf76d1ed3e1b7ea52b7a7638f3534 /src/H5P.c | |
parent | c72c322f6265f121cfd2542f081875f42c9d6fed (diff) | |
download | hdf5-6b1208407f5886c917f1ebb38bac058eeb980e30.zip hdf5-6b1208407f5886c917f1ebb38bac058eeb980e30.tar.gz hdf5-6b1208407f5886c917f1ebb38bac058eeb980e30.tar.bz2 |
[svn-r5536] Purpose:
New feature.
Description:
Added a "small data" block allocation mechanism to the library, similar to
the mechanism used for allocating metadata currently.
See the RFC for more details:
http://hdf.ncsa.uiuc.edu/RFC/SmallData/SmallData.html
This reduces the number of I/O operations which hit the disk for my test
program from 19 to 15 (i.e. from 393 to 15, overall).
Platforms tested:
Solaris 2.7 (arabica) w/FORTRAN and FreeBSD 4.5 (sleipnir) w/C++
Diffstat (limited to 'src/H5P.c')
-rw-r--r-- | src/H5P.c | 212 |
1 files changed, 100 insertions, 112 deletions
@@ -3987,113 +3987,6 @@ done: FUNC_LEAVE(ret_value); } -#ifdef H5_WANT_H5_V1_4_COMPAT - -/*------------------------------------------------------------------------- - * Function: H5Pset_meta_block_size - * - * Purpose: Sets the minimum size of metadata block allocations when - * the H5FD_FEAT_AGGREGATE_METADATA is set by a VFL driver. - * Each "raw" metadata block is allocated to be this size and then - * specific pieces of metadata (object headers, local heaps, B-trees, etc) - * are sub-allocated from this block. - * - * The default value is set to 2048 (bytes), indicating that metadata - * will be attempted to be bunched together in (at least) 2K blocks in - * the file. Setting the value to 0 with this API function will - * turn off the metadata aggregation, even if the VFL driver attempts to - * use that strategy. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * Friday, August 25, 2000 - * - * Modifications: - * - * Raymond Lu - * Tuesday, Oct 23, 2001 - * Changed the file access list to the new generic property - * list. - * - *------------------------------------------------------------------------- - */ -herr_t -H5Pset_meta_block_size(hid_t plist_id, hsize_t _size) -{ - H5P_genplist_t *plist; /* Property list pointer */ - size_t size=(size_t)_size; /* Work around parameter size difference */ - herr_t ret_value=SUCCEED; /* return value */ - - FUNC_ENTER_API(H5Pset_meta_block_size, FAIL); - H5TRACE2("e","ih",plist_id,_size); - - /* Check args */ - if(TRUE != H5P_isa_class(plist_id, H5P_FILE_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list"); - - /* Get the plist structure */ - if(NULL == (plist = H5I_object(plist_id))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); - - /* Set values */ - if(H5P_set(plist, H5F_ACS_META_BLOCK_SIZE_NAME, &size) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set meta data block size"); - -done: - FUNC_LEAVE(ret_value); -} - - -/*------------------------------------------------------------------------- - * Function: H5Pget_meta_block_size - * - * Purpose: Returns the current settings for the metadata block allocation - * property from a file access property list. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * Friday, August 29, 2000 - * - * Modifications: - * - * Raymond Lu - * Tuesday, Oct 23, 2001 - * Changed the file access list to the new generic property - * list. - * - *------------------------------------------------------------------------- - */ -herr_t -H5Pget_meta_block_size(hid_t plist_id, hsize_t *_size/*out*/) -{ - H5P_genplist_t *plist; /* Property list pointer */ - size_t size; /* Work around parameter size difference */ - herr_t ret_value=SUCCEED; /* return value */ - - FUNC_ENTER_API(H5Pget_meta_block_size, FAIL); - H5TRACE2("e","ix",plist_id,_size); - - /* Check args */ - if(TRUE != H5P_isa_class(plist_id, H5P_FILE_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list"); - - /* Get the plist structure */ - if(NULL == (plist = H5I_object(plist_id))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); - - /* Get values */ - if (_size) { - if(H5P_get(plist, H5F_ACS_META_BLOCK_SIZE_NAME, &size) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get meta data block size"); - *_size=size; - } /* end if */ - -done: - FUNC_LEAVE(ret_value); -} -#else /* H5_WANT_H5_V1_4_COMPAT */ /*------------------------------------------------------------------------- * Function: H5Pset_meta_block_size @@ -4125,13 +4018,13 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Pset_meta_block_size(hid_t plist_id, size_t size) +H5Pset_meta_block_size(hid_t plist_id, hsize_t size) { H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value=SUCCEED; /* return value */ FUNC_ENTER_API(H5Pset_meta_block_size, FAIL); - H5TRACE2("e","iz",plist_id,size); + H5TRACE2("e","ih",plist_id,size); /* Check args */ if(TRUE != H5P_isa_class(plist_id, H5P_FILE_ACCESS)) @@ -4171,7 +4064,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Pget_meta_block_size(hid_t plist_id, size_t *size/*out*/) +H5Pget_meta_block_size(hid_t plist_id, hsize_t *size/*out*/) { H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value=SUCCEED; /* return value */ @@ -4188,14 +4081,14 @@ H5Pget_meta_block_size(hid_t plist_id, size_t *size/*out*/) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); /* Get values */ - if (size) + if (size) { if(H5P_get(plist, H5F_ACS_META_BLOCK_SIZE_NAME, size) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get meta data block size"); + } /* end if */ done: FUNC_LEAVE(ret_value); } -#endif /* H5_WANT_H5_V1_4_COMPAT */ #ifdef H5_WANT_H5_V1_4_COMPAT @@ -4499,6 +4392,101 @@ done: FUNC_LEAVE(ret_value); } /* end H5Pget_hyper_vector_size() */ +#ifdef LATER + +/*------------------------------------------------------------------------- + * Function: H5Pset_small_data_block_size + * + * Purpose: Sets the minimum size of "small" raw data block allocations + * when the H5FD_FEAT_AGGREGATE_SMALLDATA is set by a VFL driver. + * Each "small" raw data block is allocated to be this size and then + * pieces of raw data which are small enough to fit are sub-allocated from + * this block. + * + * The default value is set to 2048 (bytes), indicating that raw data + * smaller than this value will be attempted to be bunched together in (at + * least) 2K blocks in the file. Setting the value to 0 with this API + * function will turn off the "small" raw data aggregation, even if the + * VFL driver attempts to use that strategy. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * Wednesday, June 5, 2002 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +herr_t +H5Pset_small_data_block_size(hid_t plist_id, hsize_t size) +{ + H5P_genplist_t *plist; /* Property list pointer */ + herr_t ret_value=SUCCEED; /* return value */ + + FUNC_ENTER_API(H5Pset_small_data_block_size, FAIL); + H5TRACE2("e","ih",plist_id,size); + + /* Check args */ + if(TRUE != H5P_isa_class(plist_id, H5P_FILE_ACCESS)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list"); + + /* Get the plist structure */ + if(NULL == (plist = H5I_object(plist_id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); + + /* Set values */ + if(H5P_set(plist, H5F_ACS_SDATA_BLOCK_SIZE_NAME, &size) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set 'small data' block size"); + +done: + FUNC_LEAVE(ret_value); +} /* end H5Pset_small_data_block_size() */ + + +/*------------------------------------------------------------------------- + * Function: H5Pget_small_data_block_size + * + * Purpose: Returns the current settings for the "small" raw data block + * allocation property from a file access property list. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * Wednesday, June 5, 2002 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +herr_t +H5Pget_small_data_block_size(hid_t plist_id, hsize_t *size/*out*/) +{ + H5P_genplist_t *plist; /* Property list pointer */ + herr_t ret_value=SUCCEED; /* return value */ + + FUNC_ENTER_API(H5Pget_small_data_block_size, FAIL); + H5TRACE2("e","ix",plist_id,size); + + /* Check args */ + if(TRUE != H5P_isa_class(plist_id, H5P_FILE_ACCESS)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list"); + + /* Get the plist structure */ + if(NULL == (plist = H5I_object(plist_id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); + + /* Get values */ + if (size) { + if(H5P_get(plist, H5F_ACS_META_BLOCK_SIZE_NAME, size) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get 'small data' block size"); + } /* end if */ + +done: + FUNC_LEAVE(ret_value); +} /* end H5Pget_small_data_block_size() */ +#endif /* LATER */ + /*-------------------------------------------------------------------------- NAME |