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 | |
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')
-rw-r--r-- | src/H5F.c | 9 | ||||
-rw-r--r-- | src/H5FD.c | 182 | ||||
-rw-r--r-- | src/H5FDfamily.c | 1 | ||||
-rw-r--r-- | src/H5FDgass.c | 1 | ||||
-rw-r--r-- | src/H5FDlog.c | 1 | ||||
-rw-r--r-- | src/H5FDmpio.c | 1 | ||||
-rw-r--r-- | src/H5FDmulti.c | 1 | ||||
-rw-r--r-- | src/H5FDpublic.h | 11 | ||||
-rw-r--r-- | src/H5FDsec2.c | 1 | ||||
-rw-r--r-- | src/H5FDsrb.c | 1 | ||||
-rw-r--r-- | src/H5FDstdio.c | 1 | ||||
-rw-r--r-- | src/H5FDstream.c | 1 | ||||
-rw-r--r-- | src/H5Fprivate.h | 80 | ||||
-rw-r--r-- | src/H5P.c | 212 | ||||
-rw-r--r-- | src/H5Ppublic.h | 9 |
15 files changed, 304 insertions, 208 deletions
@@ -193,8 +193,9 @@ H5F_init_interface(void) double rdcc_w0 = H5F_ACS_PREEMPT_READ_CHUNKS_DEF; hsize_t threshold = H5F_ACS_ALIGN_THRHD_DEF; hsize_t alignment = H5F_ACS_ALIGN_DEF; - size_t meta_block_size = H5F_ACS_META_BLOCK_SIZE_DEF; + hsize_t meta_block_size = H5F_ACS_META_BLOCK_SIZE_DEF; size_t sieve_buf_size = H5F_ACS_SIEVE_BUF_SIZE_DEF; + hsize_t sdata_block_size = H5F_ACS_SDATA_BLOCK_SIZE_DEF; unsigned gc_ref = H5F_ACS_GARBG_COLCT_REF_DEF; hid_t driver_id = H5F_ACS_FILE_DRV_ID_DEF; void *driver_info = H5F_ACS_FILE_DRV_INFO_DEF; @@ -358,6 +359,10 @@ H5F_init_interface(void) if(H5P_register(acs_pclass,H5F_ACS_SIEVE_BUF_SIZE_NAME,H5F_ACS_SIEVE_BUF_SIZE_SIZE, &sieve_buf_size,NULL,NULL,NULL,NULL,NULL,NULL)<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); + /* Register the minimum "small data" allocation block size */ + if(H5P_register(acs_pclass,H5F_ACS_SDATA_BLOCK_SIZE_NAME,H5F_ACS_SDATA_BLOCK_SIZE_SIZE, &sdata_block_size,NULL,NULL,NULL,NULL,NULL,NULL)<0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); + /* Register the garbage collection reference */ if(H5P_register(acs_pclass,H5F_ACS_GARBG_COLCT_REF_NAME,H5F_ACS_GARBG_COLCT_REF_SIZE, &gc_ref,NULL,NULL,NULL,NULL,NULL,NULL)<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); @@ -850,6 +855,8 @@ H5Fget_access_plist(hid_t file_id) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set meta data cache size"); if(H5P_set(new_plist, H5F_ACS_SIEVE_BUF_SIZE_NAME, &(f->shared->sieve_buf_size)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't sieve buffer size"); + if(H5P_set(new_plist, H5F_ACS_SDATA_BLOCK_SIZE_NAME, &(f->shared->lf->def_sdata_block_size)) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set 'small data' cache size"); if(H5P_set(new_plist, H5F_ACS_FILE_DRV_ID_NAME, &(f->shared->lf->driver_id)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set file driver ID"); @@ -775,6 +775,7 @@ H5FD_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) H5FD_t *file=NULL; hid_t driver_id = -1; size_t meta_block_size=0; + size_t sdata_block_size=0; H5P_genplist_t *plist; /* Property list pointer */ FUNC_ENTER_NOAPI(H5FD_open, NULL); @@ -815,6 +816,9 @@ H5FD_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) if(H5P_get(plist, H5F_ACS_META_BLOCK_SIZE_NAME, &(meta_block_size)) < 0) HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get meta data block size"); file->def_meta_block_size = meta_block_size; + if(H5P_get(plist, H5F_ACS_SDATA_BLOCK_SIZE_NAME, &(sdata_block_size)) < 0) + HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get 'small data' block size"); + file->def_sdata_block_size = sdata_block_size; file->accum_loc = HADDR_UNDEF; if(H5P_get(plist, H5F_ACS_ALIGN_THRHD_NAME, &(file->threshold)) < 0) HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get alignment threshold"); @@ -1420,72 +1424,144 @@ H5FD_alloc(H5FD_t *file, H5FD_mem_t type, hsize_t size) } #endif - /* - * If the metadata aggregation feature is enabled for this VFL driver, - * allocate "generic" metadata space and sub-allocate out of that, if - * possible. Otherwise just allocate through H5FD_real_alloc() - */ - /* Allocate all types of metadata out of the metadata block */ - if((file->feature_flags&H5FD_FEAT_AGGREGATE_METADATA) && type!=H5FD_MEM_DRAW) { - /* Check if the space requested is larger than the space left in the block */ - if(size>file->cur_meta_block_size) { - haddr_t new_meta; /* Address for new metadata */ - - /* Check if the block asked for is too large for a metadata block */ - if(size>=file->def_meta_block_size) { - /* Allocate more room for this new block the regular way */ - new_meta=H5FD_real_alloc(file,type,size); - - /* Check if the new metadata is at the end of the current metadata block */ - if(file->eoma+file->cur_meta_block_size==new_meta) { - /* Treat the allocation request as if the current metadata block - * grew by the amount allocated and just update the eoma - * address. Don't bother updating the cur_meta_block_size - * since it will just grow and shrink by the same amount. - */ - ret_value=file->eoma; - file->eoma+=size; + /* Handle metadata differently from "raw" data */ + if(type!=H5FD_MEM_DRAW) { + /* + * If the metadata aggregation feature is enabled for this VFL driver, + * allocate "generic" metadata space and sub-allocate out of that, if + * possible. Otherwise just allocate through H5FD_real_alloc() + */ + /* Allocate all types of metadata out of the metadata block */ + if(file->feature_flags&H5FD_FEAT_AGGREGATE_METADATA) { + /* Check if the space requested is larger than the space left in the block */ + if(size>file->cur_meta_block_size) { + haddr_t new_meta; /* Address for new metadata */ + + /* Check if the block asked for is too large for a metadata block */ + if(size>=file->def_meta_block_size) { + /* Allocate more room for this new block the regular way */ + new_meta=H5FD_real_alloc(file,type,size); + + /* Check if the new metadata is at the end of the current metadata block */ + if(file->eoma+file->cur_meta_block_size==new_meta) { + /* Treat the allocation request as if the current metadata block + * grew by the amount allocated and just update the eoma + * address. Don't bother updating the cur_meta_block_size + * since it will just grow and shrink by the same amount. + */ + ret_value=file->eoma; + file->eoma+=size; + } /* end if */ + else { + /* Use the new metadata block for the space allocated */ + ret_value=new_meta; + } /* end else */ } /* end if */ else { - /* Use the new metadata block for the space allocated */ - ret_value=new_meta; - } /* end else */ - } /* end if */ - else { - /* Allocate another metadata block */ - new_meta=H5FD_real_alloc(file,H5FD_MEM_DEFAULT,file->def_meta_block_size); + /* Allocate another metadata block */ + new_meta=H5FD_real_alloc(file,H5FD_MEM_DEFAULT,file->def_meta_block_size); - /* Check if the new metadata is at the end of the current metadata block */ - if(file->eoma+file->cur_meta_block_size==new_meta) { - file->cur_meta_block_size+=file->def_meta_block_size; - } /* end if */ - else { - /* - * Instead of just dropping the remainder of the block on the - * floor and leaving the space in the file unused, we should - * return this small piece of unused space to the free list - * management. - QAK - */ - file->eoma=new_meta; - file->cur_meta_block_size=file->def_meta_block_size; - } /* end else */ + /* Check if the new metadata is at the end of the current metadata block */ + if(file->eoma+file->cur_meta_block_size==new_meta) { + file->cur_meta_block_size+=file->def_meta_block_size; + } /* end if */ + else { + /* + * Instead of just dropping the remainder of the block on the + * floor and leaving the space in the file unused, we should + * return this small piece of unused space to the free list + * management. - QAK + */ + file->eoma=new_meta; + file->cur_meta_block_size=file->def_meta_block_size; + } /* end else */ + /* Allocate space out of the metadata block */ + ret_value=file->eoma; + file->cur_meta_block_size-=size; + file->eoma+=size; + } /* end else */ + } /* end if */ + else { /* Allocate space out of the metadata block */ ret_value=file->eoma; file->cur_meta_block_size-=size; file->eoma+=size; } /* end else */ } /* end if */ - else { - /* Allocate space out of the metadata block */ - ret_value=file->eoma; - file->cur_meta_block_size-=size; - file->eoma+=size; + else { /* Allocate data the regular way */ + ret_value=H5FD_real_alloc(file,type,size); } /* end else */ } /* end if */ - else { /* Allocate data the regular way */ - ret_value=H5FD_real_alloc(file,type,size); + else { /* Allocate "raw" data */ + /* + * If the "small data" aggregation feature is enabled for this VFL driver, + * allocate "small data" space and sub-allocate out of that, if + * possible. Otherwise just allocate through H5FD_real_alloc() + */ + if(file->feature_flags&H5FD_FEAT_AGGREGATE_SMALLDATA) { + /* Check if the space requested is larger than the space left in the block */ + if(size>file->cur_sdata_block_size) { + haddr_t new_data; /* Address for new raw data block */ + + /* Check if the block asked for is too large for the "small data" block */ + if(size>=file->def_sdata_block_size) { + /* Allocate more room for this new block the regular way */ + new_data=H5FD_real_alloc(file,type,size); + + /* Check if the new raw data is at the end of the current "small data" block */ + if(file->eosda+file->cur_sdata_block_size==new_data) { + /* Treat the allocation request as if the current "small data" + * block grew by the amount allocated and just update the + * eosda address. Don't bother updating the + * cur_sdata_block_size since it will just grow and shrink by + * the same amount. + */ + ret_value=file->eosda; + file->eosda+=size; + } /* end if */ + else { + /* Use the new "small data" block for the space allocated */ + ret_value=new_data; + } /* end else */ + } /* end if */ + else { + /* Allocate another "small data" block */ + new_data=H5FD_real_alloc(file,type,file->def_sdata_block_size); + + /* Check if the new raw data is at the end of the current "small data" block */ + if(file->eosda+file->cur_sdata_block_size==new_data) { + file->cur_sdata_block_size+=file->def_sdata_block_size; + } /* end if */ + else { + /* + * Instead of just dropping the remainder of the block on the + * floor and leaving the space in the file unused, we should + * return this small piece of unused space to the free list + * management. - QAK + */ + file->eosda=new_data; + file->cur_sdata_block_size=file->def_sdata_block_size; + } /* end else */ + + + /* Allocate space out of the "small data" block */ + ret_value=file->eosda; + file->cur_sdata_block_size-=size; + file->eosda+=size; + } /* end else */ + } /* end if */ + else { + /* Allocate space out of the "small data" block */ + ret_value=file->eosda; + file->cur_sdata_block_size-=size; + file->eosda+=size; + } /* end else */ + } /* end if */ + else { /* Allocate data the regular way */ + ret_value=H5FD_real_alloc(file,type,size); + } /* end else */ } /* end else */ done: diff --git a/src/H5FDfamily.c b/src/H5FDfamily.c index 4828d47..24a244d 100644 --- a/src/H5FDfamily.c +++ b/src/H5FDfamily.c @@ -682,6 +682,7 @@ H5FD_family_query(const H5FD_t UNUSED * _f, unsigned long *flags /* out */) *flags|=H5FD_FEAT_AGGREGATE_METADATA; /* OK to aggregate metadata allocations */ *flags|=H5FD_FEAT_ACCUMULATE_METADATA; /* OK to accumulate metadata for faster writes */ *flags|=H5FD_FEAT_DATA_SIEVE; /* OK to perform data sieving for faster raw data reads & writes */ + *flags|=H5FD_FEAT_AGGREGATE_SMALLDATA; /* OK to aggregate "small" raw data allocations */ } FUNC_LEAVE(ret_value); diff --git a/src/H5FDgass.c b/src/H5FDgass.c index f5c3f2d..42b46b2 100644 --- a/src/H5FDgass.c +++ b/src/H5FDgass.c @@ -489,6 +489,7 @@ H5FD_gass_query(const UNUSED H5FD_t *_f, unsigned long *flags /* out */) if(flags) { *flags = 0; *flags|=H5FD_FEAT_DATA_SIEVE; /* OK to perform data sieving for faster raw data reads & writes */ + *flags|=H5FD_FEAT_AGGREGATE_SMALLDATA; /* OK to aggregate "small" raw data allocations */ } FUNC_LEAVE(ret_value); diff --git a/src/H5FDlog.c b/src/H5FDlog.c index 563f4f0..4036f9b 100644 --- a/src/H5FDlog.c +++ b/src/H5FDlog.c @@ -766,6 +766,7 @@ H5FD_log_query(const H5FD_t UNUSED * _f, unsigned long *flags /* out */) *flags|=H5FD_FEAT_AGGREGATE_METADATA; /* OK to aggregate metadata allocations */ *flags|=H5FD_FEAT_ACCUMULATE_METADATA; /* OK to accumulate metadata for faster writes */ *flags|=H5FD_FEAT_DATA_SIEVE; /* OK to perform data sieving for faster raw data reads & writes */ + *flags|=H5FD_FEAT_AGGREGATE_SMALLDATA; /* OK to aggregate "small" raw data allocations */ } FUNC_LEAVE(ret_value); diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c index 69e2b49..0ec8db3 100644 --- a/src/H5FDmpio.c +++ b/src/H5FDmpio.c @@ -944,6 +944,7 @@ H5FD_mpio_query(const H5FD_t *_file, unsigned long *flags /* out */) if(flags) { *flags=0; *flags|=H5FD_FEAT_AGGREGATE_METADATA; /* OK to aggregate metadata allocations */ + *flags|=H5FD_FEAT_AGGREGATE_SMALLDATA; /* OK to aggregate "small" raw data allocations */ } /* end if */ FUNC_LEAVE(ret_value); diff --git a/src/H5FDmulti.c b/src/H5FDmulti.c index 2e7045b..3d56cc9 100644 --- a/src/H5FDmulti.c +++ b/src/H5FDmulti.c @@ -1364,6 +1364,7 @@ H5FD_multi_query(const H5FD_t *_f, unsigned long *flags /* out */) if(flags) { *flags=0; *flags|=H5FD_FEAT_DATA_SIEVE; /* OK to perform data sieving for faster raw data reads & writes */ + *flags|=H5FD_FEAT_AGGREGATE_SMALLDATA; /* OK to aggregate "small" raw data allocations */ } return(0); diff --git a/src/H5FDpublic.h b/src/H5FDpublic.h index 67256b5..49c89bc 100644 --- a/src/H5FDpublic.h +++ b/src/H5FDpublic.h @@ -100,6 +100,12 @@ typedef enum H5FD_mem_t { * http://www.mcs.anl.gov/~thakur/papers/mpio-high-perf.ps.gz */ #define H5FD_FEAT_DATA_SIEVE 0x00000004 + /* + * Defining the H5FD_FEAT_AGGREGATE_SMALLDATA for a VFL driver means that + * the library will attempt to allocate a larger block for "small" raw data + * and then sub-allocate "small" raw data requests from that larger block. + */ +#define H5FD_FEAT_AGGREGATE_SMALLDATA 0x00000008 /* Forward declaration */ @@ -164,6 +170,11 @@ struct H5FD_t { hsize_t cur_meta_block_size; /* Current size of metadata allocation region left */ haddr_t eoma; /*End of metadata allocated region*/ + /* "Small data" aggregation fields */ + hsize_t def_sdata_block_size; /* "Small data" allocation block size (if aggregating "small data") */ + hsize_t cur_sdata_block_size; /* Current size of "small data" allocation region left */ + haddr_t eosda; /* End of "small data" allocated region */ + /* Metadata accumulator fields */ unsigned char *meta_accum; /*Buffer to hold the accumulated metadata */ haddr_t accum_loc; /* File location (offset) of the accumulated metadata */ diff --git a/src/H5FDsec2.c b/src/H5FDsec2.c index 03c4e29..25e5938 100644 --- a/src/H5FDsec2.c +++ b/src/H5FDsec2.c @@ -442,6 +442,7 @@ H5FD_sec2_query(const H5FD_t UNUSED * _f, unsigned long *flags /* out */) *flags|=H5FD_FEAT_AGGREGATE_METADATA; /* OK to aggregate metadata allocations */ *flags|=H5FD_FEAT_ACCUMULATE_METADATA; /* OK to accumulate metadata for faster writes */ *flags|=H5FD_FEAT_DATA_SIEVE; /* OK to perform data sieving for faster raw data reads & writes */ + *flags|=H5FD_FEAT_AGGREGATE_SMALLDATA; /* OK to aggregate "small" raw data allocations */ } FUNC_LEAVE(ret_value); diff --git a/src/H5FDsrb.c b/src/H5FDsrb.c index f2a97de..1579af0 100644 --- a/src/H5FDsrb.c +++ b/src/H5FDsrb.c @@ -436,6 +436,7 @@ H5FD_srb_query(const UNUSED H5FD_t *_f, unsigned long *flags /* out */) if(flags) { *flags = 0; *flags|=H5FD_FEAT_DATA_SIEVE; /* OK to perform data sieving for faster raw data reads & writes */ + *flags|=H5FD_FEAT_AGGREGATE_SMALLDATA; /* OK to aggregate "small" raw data allocations */ } FUNC_LEAVE(ret_value); diff --git a/src/H5FDstdio.c b/src/H5FDstdio.c index 387d736..2ae8398 100644 --- a/src/H5FDstdio.c +++ b/src/H5FDstdio.c @@ -471,6 +471,7 @@ H5FD_stdio_query(const H5FD_t *_f, unsigned long *flags /* out */) *flags|=H5FD_FEAT_AGGREGATE_METADATA; /* OK to aggregate metadata allocations */ *flags|=H5FD_FEAT_ACCUMULATE_METADATA; /* OK to accumulate metadata for faster writes */ *flags|=H5FD_FEAT_DATA_SIEVE; /* OK to perform data sieving for faster raw data reads & writes */ + *flags|=H5FD_FEAT_AGGREGATE_SMALLDATA; /* OK to aggregate "small" raw data allocations */ } return(0); diff --git a/src/H5FDstream.c b/src/H5FDstream.c index ac6e8dc..72cb7b8 100644 --- a/src/H5FDstream.c +++ b/src/H5FDstream.c @@ -907,6 +907,7 @@ H5FD_stream_query(const H5FD_t * UNUSED _f, *flags = 0; /* OK to perform data sieving for faster raw data reads & writes */ *flags |= H5FD_FEAT_DATA_SIEVE; + *flags|=H5FD_FEAT_AGGREGATE_SMALLDATA; /* OK to aggregate "small" raw data allocations */ } FUNC_LEAVE (SUCCEED); diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index 42af604..c18c331 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -253,66 +253,72 @@ __DLL__ size_t H5F_sizeof_size(const H5F_t *f); /* ========= File Access properties ============ */ /* Definitions for size of meta data cache(elements) */ -#define H5F_ACS_META_CACHE_SIZE_NAME "mdc_nelmts" -#define H5F_ACS_META_CACHE_SIZE_SIZE sizeof(int) -#define H5F_ACS_META_CACHE_SIZE_DEF H5AC_NSLOTS +#define H5F_ACS_META_CACHE_SIZE_NAME "mdc_nelmts" +#define H5F_ACS_META_CACHE_SIZE_SIZE sizeof(int) +#define H5F_ACS_META_CACHE_SIZE_DEF H5AC_NSLOTS /* Definitions for size of raw data chunk cache(elements) */ -#define H5F_ACS_DATA_CACHE_ELMT_SIZE_NAME "rdcc_nelmts" -#define H5F_ACS_DATA_CACHE_ELMT_SIZE_SIZE sizeof(size_t) -#define H5F_ACS_DATA_CACHE_ELMT_SIZE_DEF 521 +#define H5F_ACS_DATA_CACHE_ELMT_SIZE_NAME "rdcc_nelmts" +#define H5F_ACS_DATA_CACHE_ELMT_SIZE_SIZE sizeof(size_t) +#define H5F_ACS_DATA_CACHE_ELMT_SIZE_DEF 521 /* Definition for size of raw data chunk cache(bytes) */ -#define H5F_ACS_DATA_CACHE_BYTE_SIZE_NAME "rdcc_nbytes" -#define H5F_ACS_DATA_CACHE_BYTE_SIZE_SIZE sizeof(size_t) -#define H5F_ACS_DATA_CACHE_BYTE_SIZE_DEF 1024*1024 +#define H5F_ACS_DATA_CACHE_BYTE_SIZE_NAME "rdcc_nbytes" +#define H5F_ACS_DATA_CACHE_BYTE_SIZE_SIZE sizeof(size_t) +#define H5F_ACS_DATA_CACHE_BYTE_SIZE_DEF 1024*1024 /* Definition for preemption read chunks first */ -#define H5F_ACS_PREEMPT_READ_CHUNKS_NAME "rdcc_w0" -#define H5F_ACS_PREEMPT_READ_CHUNKS_SIZE sizeof(double) -#define H5F_ACS_PREEMPT_READ_CHUNKS_DEF 0.75 +#define H5F_ACS_PREEMPT_READ_CHUNKS_NAME "rdcc_w0" +#define H5F_ACS_PREEMPT_READ_CHUNKS_SIZE sizeof(double) +#define H5F_ACS_PREEMPT_READ_CHUNKS_DEF 0.75 /* Definition for threshold for alignment */ -#define H5F_ACS_ALIGN_THRHD_NAME "threshold" -#define H5F_ACS_ALIGN_THRHD_SIZE sizeof(hsize_t) -#define H5F_ACS_ALIGN_THRHD_DEF 1 +#define H5F_ACS_ALIGN_THRHD_NAME "threshold" +#define H5F_ACS_ALIGN_THRHD_SIZE sizeof(hsize_t) +#define H5F_ACS_ALIGN_THRHD_DEF 1 /* Definition for alignment */ -#define H5F_ACS_ALIGN_NAME "align" -#define H5F_ACS_ALIGN_SIZE sizeof(hsize_t) -#define H5F_ACS_ALIGN_DEF 1 +#define H5F_ACS_ALIGN_NAME "align" +#define H5F_ACS_ALIGN_SIZE sizeof(hsize_t) +#define H5F_ACS_ALIGN_DEF 1 -/* Definition for minimum metadata allocation block size(when +/* Definition for minimum metadata allocation block size (when aggregating metadata allocations. */ -#define H5F_ACS_META_BLOCK_SIZE_NAME "meta_block_size" -#define H5F_ACS_META_BLOCK_SIZE_SIZE sizeof(size_t) -#define H5F_ACS_META_BLOCK_SIZE_DEF 2048 +#define H5F_ACS_META_BLOCK_SIZE_NAME "meta_block_size" +#define H5F_ACS_META_BLOCK_SIZE_SIZE sizeof(hsize_t) +#define H5F_ACS_META_BLOCK_SIZE_DEF 2048 /* Definition for maximum sieve buffer size (when data sieving is allowed by file driver */ -#define H5F_ACS_SIEVE_BUF_SIZE_NAME "sieve_buf_size" -#define H5F_ACS_SIEVE_BUF_SIZE_SIZE sizeof(size_t) -#define H5F_ACS_SIEVE_BUF_SIZE_DEF 64*1024 +#define H5F_ACS_SIEVE_BUF_SIZE_NAME "sieve_buf_size" +#define H5F_ACS_SIEVE_BUF_SIZE_SIZE sizeof(size_t) +#define H5F_ACS_SIEVE_BUF_SIZE_DEF 64*1024 + +/* Definition for minimum "small data" allocation block size (when + aggregating "small" raw data allocations. */ +#define H5F_ACS_SDATA_BLOCK_SIZE_NAME "sdata_block_size" +#define H5F_ACS_SDATA_BLOCK_SIZE_SIZE sizeof(hsize_t) +#define H5F_ACS_SDATA_BLOCK_SIZE_DEF 2048 /* Definition for garbage-collect references */ -#define H5F_ACS_GARBG_COLCT_REF_NAME "gc_ref" -#define H5F_ACS_GARBG_COLCT_REF_SIZE sizeof(unsigned) -#define H5F_ACS_GARBG_COLCT_REF_DEF 0 +#define H5F_ACS_GARBG_COLCT_REF_NAME "gc_ref" +#define H5F_ACS_GARBG_COLCT_REF_SIZE sizeof(unsigned) +#define H5F_ACS_GARBG_COLCT_REF_DEF 0 /* Definition for file driver ID */ -#define H5F_ACS_FILE_DRV_ID_NAME "driver_id" -#define H5F_ACS_FILE_DRV_ID_SIZE sizeof(hid_t) -#define H5F_ACS_FILE_DRV_ID_DEF H5FD_SEC2 +#define H5F_ACS_FILE_DRV_ID_NAME "driver_id" +#define H5F_ACS_FILE_DRV_ID_SIZE sizeof(hid_t) +#define H5F_ACS_FILE_DRV_ID_DEF H5FD_SEC2 /* Definition for file driver info */ -#define H5F_ACS_FILE_DRV_INFO_NAME "driver_info" -#define H5F_ACS_FILE_DRV_INFO_SIZE sizeof(void*) -#define H5F_ACS_FILE_DRV_INFO_DEF NULL +#define H5F_ACS_FILE_DRV_INFO_NAME "driver_info" +#define H5F_ACS_FILE_DRV_INFO_SIZE sizeof(void*) +#define H5F_ACS_FILE_DRV_INFO_DEF NULL /* Definition for file close degree */ -#define H5F_CLOSE_DEGREE_NAME "close_degree" -#define H5F_CLOSE_DEGREE_SIZE sizeof(H5F_close_degree_t) -#define H5F_CLOSE_DEGREE_DEF H5F_CLOSE_DEFAULT +#define H5F_CLOSE_DEGREE_NAME "close_degree" +#define H5F_CLOSE_DEGREE_SIZE sizeof(H5F_close_degree_t) +#define H5F_CLOSE_DEGREE_DEF H5F_CLOSE_DEFAULT /* ======================== File Mount properties ====================*/ /* Definition for whether absolute symlinks local to file. */ @@ -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 diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h index d50f268..ab15cbd 100644 --- a/src/H5Ppublic.h +++ b/src/H5Ppublic.h @@ -251,13 +251,8 @@ __DLL__ herr_t H5Pget_vlen_mem_manager(hid_t plist_id, void **alloc_info, H5MM_free_t *free_func, void **free_info); -#ifdef H5_WANT_H5_V1_4_COMPAT __DLL__ herr_t H5Pset_meta_block_size(hid_t fapl_id, hsize_t size); __DLL__ herr_t H5Pget_meta_block_size(hid_t fapl_id, hsize_t *size/*out*/); -#else /* H5_WANT_H5_V1_4_COMPAT */ -__DLL__ herr_t H5Pset_meta_block_size(hid_t fapl_id, size_t size); -__DLL__ herr_t H5Pget_meta_block_size(hid_t fapl_id, size_t *size/*out*/); -#endif /* H5_WANT_H5_V1_4_COMPAT */ #ifdef H5_WANT_H5_V1_4_COMPAT __DLL__ herr_t H5Pset_sieve_buf_size(hid_t fapl_id, hsize_t size); __DLL__ herr_t H5Pget_sieve_buf_size(hid_t fapl_id, hsize_t *size/*out*/); @@ -267,6 +262,10 @@ __DLL__ herr_t H5Pget_sieve_buf_size(hid_t fapl_id, size_t *size/*out*/); #endif /* H5_WANT_H5_V1_4_COMPAT */ __DLL__ herr_t H5Pset_hyper_vector_size(hid_t fapl_id, size_t size); __DLL__ herr_t H5Pget_hyper_vector_size(hid_t fapl_id, size_t *size/*out*/); +#ifdef LATER +__DLL__ herr_t H5Pset_small_data_block_size(hid_t fapl_id, hsize_t size); +__DLL__ herr_t H5Pget_small_data_block_size(hid_t fapl_id, hsize_t *size/*out*/); +#endif /* LATER */ #ifdef __cplusplus } |