diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2004-02-06 15:34:01 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2004-02-06 15:34:01 (GMT) |
commit | d8cfeadd906c13421c4fe9abe1a5318a956236f6 (patch) | |
tree | 1c0c4c1f988ebd2ec44de73411bd8dcc136c6464 /src/H5Distore.c | |
parent | aaeecad6564fe93bb8de567220eed453f890acf4 (diff) | |
download | hdf5-d8cfeadd906c13421c4fe9abe1a5318a956236f6.zip hdf5-d8cfeadd906c13421c4fe9abe1a5318a956236f6.tar.gz hdf5-d8cfeadd906c13421c4fe9abe1a5318a956236f6.tar.bz2 |
[svn-r8158] Purpose:
Code cleanup/optimization
Description:
Query property list values once, at the beginning of the I/O routines,
instead of querying the property list values multiple (lots!) of times in
lower level routines.
Solution:
Create "property list caches" for internal library queries of the property
list values.
Platforms tested:
IBM p690 (copper) w/parallel & fphdf5
h5committest
Diffstat (limited to 'src/H5Distore.c')
-rw-r--r-- | src/H5Distore.c | 156 |
1 files changed, 63 insertions, 93 deletions
diff --git a/src/H5Distore.c b/src/H5Distore.c index b726c68..f8ae032 100644 --- a/src/H5Distore.c +++ b/src/H5Distore.c @@ -910,7 +910,8 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5F_istore_flush_entry(H5F_t *f, hid_t dxpl_id, H5F_rdcc_ent_t *ent, hbool_t reset) +H5F_istore_flush_entry(H5F_t *f, const H5D_dxpl_cache_t *dxpl_cache, + hid_t dxpl_id, H5F_rdcc_ent_t *ent, hbool_t reset) { herr_t ret_value=SUCCEED; /*return value */ H5F_istore_ud1_t udata; /*pass through B-tree */ @@ -939,10 +940,6 @@ H5F_istore_flush_entry(H5F_t *f, hid_t dxpl_id, H5F_rdcc_ent_t *ent, hbool_t res /* Should the chunk be filtered before writing it to disk? */ if (ent->pline && ent->pline->nused) { - H5P_genplist_t *plist; /* Data xfer property list */ - H5Z_cb_t cb_struct; - H5Z_EDC_t edc; - if (!reset) { /* * Copy the chunk to a new buffer before running it through @@ -966,17 +963,8 @@ H5F_istore_flush_entry(H5F_t *f, hid_t dxpl_id, H5F_rdcc_ent_t *ent, hbool_t res point_of_no_return = TRUE; ent->chunk = NULL; } - /* Don't know whether we should involve transfer property list. So - * just pass in H5Z_ENABLE_EDC and default callback setting for data - * read. */ - if (NULL == (plist = H5P_object_verify(dxpl_id,H5P_DATASET_XFER))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset transfer property list"); - if(H5P_get(plist,H5D_XFER_EDC_NAME,&edc)<0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get edc information"); - if(H5P_get(plist,H5D_XFER_FILTER_CB_NAME,&cb_struct)<0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get filter callback struct"); - if (H5Z_pipeline(ent->pline, 0, &(udata.key.filter_mask), edc, - cb_struct, &(udata.key.nbytes), &alloc, &buf)<0) { + if (H5Z_pipeline(ent->pline, 0, &(udata.key.filter_mask), dxpl_cache->err_detect, + dxpl_cache->filter_cb, &(udata.key.nbytes), &alloc, &buf)<0) { HGOTO_ERROR(H5E_PLINE, H5E_WRITEERROR, FAIL, "output pipeline failed"); } @@ -1046,7 +1034,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5F_istore_preempt(H5F_t *f, hid_t dxpl_id, H5F_rdcc_ent_t * ent, hbool_t flush) +H5F_istore_preempt(H5F_t *f, const H5D_dxpl_cache_t *dxpl_cache, hid_t dxpl_id, H5F_rdcc_ent_t * ent, hbool_t flush) { H5F_rdcc_t *rdcc = &(f->shared->rdcc); herr_t ret_value=SUCCEED; /* Return value */ @@ -1060,7 +1048,7 @@ H5F_istore_preempt(H5F_t *f, hid_t dxpl_id, H5F_rdcc_ent_t * ent, hbool_t flush) if(flush) { /* Flush */ - if(H5F_istore_flush_entry(f, dxpl_id, ent, TRUE) < 0) + if(H5F_istore_flush_entry(f, dxpl_cache, dxpl_id, ent, TRUE) < 0) HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "cannot flush indexed storage buffer"); } else { @@ -1116,6 +1104,7 @@ done: herr_t H5F_istore_flush (H5F_t *f, hid_t dxpl_id, unsigned flags) { + H5D_dxpl_cache_t dxpl_cache; /* Cached data transfer properties */ H5F_rdcc_t *rdcc = &(f->shared->rdcc); int nerrors=0; H5F_rdcc_ent_t *ent=NULL, *next=NULL; @@ -1123,6 +1112,10 @@ H5F_istore_flush (H5F_t *f, hid_t dxpl_id, unsigned flags) FUNC_ENTER_NOAPI(H5F_istore_flush, FAIL); + /* Fill the DXPL cache values for later use */ + if (H5D_get_dxpl_cache(dxpl_id,&dxpl_cache)<0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't fill dxpl cache") + for (ent=rdcc->head; ent; ent=next) { next = ent->next; if ((flags&H5F_FLUSH_CLEAR_ONLY)) { @@ -1130,10 +1123,10 @@ H5F_istore_flush (H5F_t *f, hid_t dxpl_id, unsigned flags) ent->dirty = FALSE; } /* end if */ else if ((flags&H5F_FLUSH_INVALIDATE)) { - if (H5F_istore_preempt(f, dxpl_id, ent, TRUE )<0) + if (H5F_istore_preempt(f, &dxpl_cache, dxpl_id, ent, TRUE )<0) nerrors++; } else { - if (H5F_istore_flush_entry(f, dxpl_id, ent, FALSE)<0) + if (H5F_istore_flush_entry(f, &dxpl_cache, dxpl_id, ent, FALSE)<0) nerrors++; } } @@ -1166,6 +1159,7 @@ done: herr_t H5F_istore_dest (H5F_t *f, hid_t dxpl_id) { + H5D_dxpl_cache_t dxpl_cache; /* Cached data transfer properties */ H5F_rdcc_t *rdcc = &(f->shared->rdcc); int nerrors=0; H5F_rdcc_ent_t *ent=NULL, *next=NULL; @@ -1173,13 +1167,17 @@ H5F_istore_dest (H5F_t *f, hid_t dxpl_id) FUNC_ENTER_NOAPI(H5F_istore_dest, FAIL); + /* Fill the DXPL cache values for later use */ + if (H5D_get_dxpl_cache(dxpl_id,&dxpl_cache)<0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't fill dxpl cache") + for (ent=rdcc->head; ent; ent=next) { #ifdef H5F_ISTORE_DEBUG HDfputc('c', stderr); HDfflush(stderr); #endif next = ent->next; - if (H5F_istore_preempt(f, dxpl_id, ent, TRUE )<0) + if (H5F_istore_preempt(f, &dxpl_cache, dxpl_id, ent, TRUE )<0) nerrors++; } if (nerrors) @@ -1212,7 +1210,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5F_istore_prune (H5F_t *f, hid_t dxpl_id, size_t size) +H5F_istore_prune (H5F_t *f, const H5D_dxpl_cache_t *dxpl_cache, hid_t dxpl_id, size_t size) { int i, j, nerrors=0; H5F_rdcc_t *rdcc = &(f->shared->rdcc); @@ -1291,7 +1289,7 @@ H5F_istore_prune (H5F_t *f, hid_t dxpl_id, size_t size) if (n[j]==cur) n[j] = cur->next; } - if (H5F_istore_preempt(f, dxpl_id, cur, TRUE)<0) + if (H5F_istore_preempt(f, dxpl_cache, dxpl_id, cur, TRUE)<0) nerrors++; } } @@ -1346,7 +1344,7 @@ done: *------------------------------------------------------------------------- */ static void * -H5F_istore_lock(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, +H5F_istore_lock(H5F_t *f, const H5D_dxpl_cache_t *dxpl_cache, hid_t dxpl_id, const H5O_layout_t *layout, const H5O_pline_t *pline, const H5O_fill_t *fill, H5D_fill_time_t fill_time, const hssize_t offset[], hbool_t relax, unsigned *idx_hint/*in,out*/) @@ -1363,15 +1361,10 @@ H5F_istore_lock(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, herr_t status; /*func return status */ void *chunk=NULL; /*the file chunk */ void *ret_value; /*return value */ - H5P_genplist_t *plist; /* Property list */ - H5Z_EDC_t edc; - H5Z_cb_t cb_struct; FUNC_ENTER_NOAPI_NOINIT(H5F_istore_lock); assert(TRUE==H5P_isa_class(dxpl_id,H5P_DATASET_XFER)); - plist=H5I_object(dxpl_id); - assert(plist!=NULL); HDmemset(&udata, 0, sizeof(H5F_istore_ud1_t)); if (rdcc->nslots>0) { @@ -1447,12 +1440,8 @@ H5F_istore_lock(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for raw data chunk"); if (H5F_block_read(f, H5FD_MEM_DRAW, udata.addr, udata.key.nbytes, dxpl_id, chunk)<0) HGOTO_ERROR (H5E_IO, H5E_READERROR, NULL, "unable to read raw data chunk"); - if(H5P_get(plist,H5D_XFER_EDC_NAME,&edc)<0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "can't get edc information"); - if(H5P_get(plist,H5D_XFER_FILTER_CB_NAME,&cb_struct)<0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "can't get filter callback struct"); - if (H5Z_pipeline(pline, H5Z_FLAG_REVERSE, &(udata.key.filter_mask), edc, - cb_struct, &(udata.key.nbytes), &chunk_alloc, &chunk)<0) { + if (H5Z_pipeline(pline, H5Z_FLAG_REVERSE, &(udata.key.filter_mask), dxpl_cache->err_detect, + dxpl_cache->filter_cb, &(udata.key.nbytes), &chunk_alloc, &chunk)<0) { HGOTO_ERROR(H5E_PLINE, H5E_READERROR, NULL, "data pipeline read failed"); } rdcc->nmisses++; @@ -1500,10 +1489,10 @@ H5F_istore_lock(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, HDputc('#', stderr); HDfflush(stderr); #endif - if (H5F_istore_preempt(f, dxpl_id, ent, TRUE)<0) + if (H5F_istore_preempt(f, dxpl_cache, dxpl_id, ent, TRUE)<0) HGOTO_ERROR(H5E_IO, H5E_CANTINIT, NULL, "unable to preempt chunk from cache"); } - if (H5F_istore_prune(f, dxpl_id, chunk_size)<0) + if (H5F_istore_prune(f, dxpl_cache, dxpl_id, chunk_size)<0) HGOTO_ERROR(H5E_IO, H5E_CANTINIT, NULL, "unable to preempt chunk(s) from cache"); /* Create a new entry */ @@ -1520,7 +1509,7 @@ H5F_istore_lock(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, ent->wr_count = chunk_size; ent->chunk = chunk; - H5P_get(plist,H5D_XFER_BTREE_SPLIT_RATIO_NAME,&(ent->split_ratios)); + HDmemcpy(&(ent->split_ratios),&dxpl_cache->btree_split_ratio,H5D_XFER_BTREE_SPLIT_RATIO_SIZE); /* Add it to the cache */ assert(NULL==rdcc->slot[idx]); @@ -1619,16 +1608,14 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5F_istore_unlock(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, - const H5O_pline_t *pline, hbool_t dirty, - const hssize_t offset[], unsigned *idx_hint, - uint8_t *chunk, size_t naccessed) +H5F_istore_unlock(H5F_t *f, const H5D_dxpl_cache_t *dxpl_cache, hid_t dxpl_id, + const H5O_layout_t *layout, const H5O_pline_t *pline, hbool_t dirty, + const hssize_t offset[], unsigned *idx_hint, uint8_t *chunk, size_t naccessed) { H5F_rdcc_t *rdcc = &(f->shared->rdcc); H5F_rdcc_ent_t *ent = NULL; int found = -1; unsigned u; - H5P_genplist_t *plist; /* Property list */ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5F_istore_unlock); @@ -1664,12 +1651,9 @@ H5F_istore_unlock(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, x.alloc_size = x.chunk_size; x.chunk = chunk; - assert(TRUE==H5P_isa_class(dxpl_id,H5P_DATASET_XFER)); - plist=H5I_object(dxpl_id); - assert(plist!=NULL); - H5P_get(plist,H5D_XFER_BTREE_SPLIT_RATIO_NAME,&(x.split_ratios)); + HDmemcpy(&(x.split_ratios),&dxpl_cache->btree_split_ratio,H5D_XFER_BTREE_SPLIT_RATIO_SIZE); - H5F_istore_flush_entry (f, dxpl_id, &x, TRUE); + H5F_istore_flush_entry (f, dxpl_cache, dxpl_id, &x, TRUE); } else { if(chunk) H5MM_xfree (chunk); @@ -1709,8 +1693,8 @@ H5F_istore_unlock(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, *------------------------------------------------------------------------- */ ssize_t -H5F_istore_readvv(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, - H5P_genplist_t *dc_plist, hssize_t chunk_coords[], +H5F_istore_readvv(H5F_t *f, const struct H5D_dxpl_cache_t *dxpl_cache, hid_t dxpl_id, + const H5O_layout_t *layout, const struct H5D_dcpl_cache_t *dcpl_cache, hssize_t chunk_coords[], size_t chunk_max_nseq, size_t *chunk_curr_seq, size_t chunk_len_arr[], hsize_t chunk_offset_arr[], size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_offset_arr[], void *buf) @@ -1718,7 +1702,6 @@ H5F_istore_readvv(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, hsize_t chunk_size; /* Chunk size, in bytes */ haddr_t chunk_addr; /* Chunk address on disk */ hssize_t chunk_coords_in_elmts[H5O_LAYOUT_NDIMS]; - H5O_pline_t pline; /* I/O pipeline information */ size_t u; /* Local index variables */ ssize_t ret_value; /* Return value */ @@ -1726,18 +1709,16 @@ H5F_istore_readvv(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, /* Check args */ assert(f); + assert(dxpl_cache); assert(layout && H5D_CHUNKED==layout->type); assert(layout->ndims>0 && layout->ndims<=H5O_LAYOUT_NDIMS); + assert(dcpl_cache); assert(chunk_len_arr); assert(chunk_offset_arr); assert(mem_len_arr); assert(mem_offset_arr); assert(buf); - /* Get necessary properties from property list */ - if(H5P_get(dc_plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get data pipeline"); - /* Compute chunk size */ for (u=0, chunk_size=1; u<layout->ndims; u++) chunk_size *= layout->dim[u]; @@ -1771,29 +1752,21 @@ HDfprintf(stderr,"%s: mem_offset_arr[%Zu]=%Hu\n",FUNC,*mem_curr_seq,mem_offset_a * for the chunk has been defined, then don't load the chunk into the * cache, just write the data to it directly. */ - if (chunk_size>f->shared->rdcc_nbytes && pline.nused==0 && + if (chunk_size>f->shared->rdcc_nbytes && dcpl_cache->pline.nused==0 && chunk_addr!=HADDR_UNDEF) { if ((ret_value=H5F_contig_readvv(f, chunk_size, chunk_addr, chunk_max_nseq, chunk_curr_seq, chunk_len_arr, chunk_offset_arr, mem_max_nseq, mem_curr_seq, mem_len_arr, mem_offset_arr, dxpl_id, buf))<0) HGOTO_ERROR (H5E_IO, H5E_READERROR, FAIL, "unable to read raw data to file"); } /* end if */ else { uint8_t *chunk; /* Pointer to cached chunk in memory */ - H5O_fill_t fill; /* Fill value information */ - H5D_fill_time_t fill_time; /* Fill time information */ unsigned idx_hint=0; /* Cache index hint */ ssize_t naccessed; /* Number of bytes accessed in chunk */ - /* Get necessary properties from property list */ - if(H5P_get(dc_plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get fill value"); - if(H5P_get(dc_plist, H5D_CRT_FILL_TIME_NAME, &fill_time) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get fill time"); - /* * Lock the chunk, copy from application to chunk, then unlock the * chunk. */ - if (NULL==(chunk=H5F_istore_lock(f, dxpl_id, layout, &pline, &fill, fill_time, + if (NULL==(chunk=H5F_istore_lock(f, dxpl_cache, dxpl_id, layout, &dcpl_cache->pline, &dcpl_cache->fill, dcpl_cache->fill_time, chunk_coords_in_elmts, FALSE, &idx_hint))) HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "unable to read raw data chunk"); @@ -1802,7 +1775,7 @@ HDfprintf(stderr,"%s: mem_offset_arr[%Zu]=%Hu\n",FUNC,*mem_curr_seq,mem_offset_a HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "vectorized memcpy failed"); H5_CHECK_OVERFLOW(naccessed,ssize_t,size_t); - if (H5F_istore_unlock(f, dxpl_id, layout, &pline, FALSE, + if (H5F_istore_unlock(f, dxpl_cache, dxpl_id, layout, &dcpl_cache->pline, FALSE, chunk_coords_in_elmts, &idx_hint, chunk, (size_t)naccessed)<0) HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "unable to unlock raw data chunk"); @@ -1831,8 +1804,9 @@ done: *------------------------------------------------------------------------- */ ssize_t -H5F_istore_writevv(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, - H5P_genplist_t *dc_plist, hssize_t chunk_coords[], +H5F_istore_writevv(H5F_t *f, const struct H5D_dxpl_cache_t *dxpl_cache, + hid_t dxpl_id, const H5O_layout_t *layout, + const struct H5D_dcpl_cache_t *dcpl_cache, hssize_t chunk_coords[], size_t chunk_max_nseq, size_t *chunk_curr_seq, size_t chunk_len_arr[], hsize_t chunk_offset_arr[], size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_offset_arr[], const void *buf) @@ -1840,7 +1814,6 @@ H5F_istore_writevv(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, hsize_t chunk_size; /* Chunk size, in bytes */ haddr_t chunk_addr; /* Chunk address on disk */ hssize_t chunk_coords_in_elmts[H5O_LAYOUT_NDIMS]; - H5O_pline_t pline; /* I/O pipeline information */ size_t u; /* Local index variables */ ssize_t ret_value; /* Return value */ @@ -1848,18 +1821,16 @@ H5F_istore_writevv(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, /* Check args */ assert(f); + assert(dxpl_cache); assert(layout && H5D_CHUNKED==layout->type); assert(layout->ndims>0 && layout->ndims<=H5O_LAYOUT_NDIMS); + assert(dcpl_cache); assert(chunk_len_arr); assert(chunk_offset_arr); assert(mem_len_arr); assert(mem_offset_arr); assert(buf); - /* Get necessary properties from property list */ - if(H5P_get(dc_plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get data pipeline"); - /* Compute chunk size */ for (u=0, chunk_size=1; u<layout->ndims; u++) chunk_size *= layout->dim[u]; @@ -1898,11 +1869,11 @@ HDfprintf(stderr,"%s: mem_offset_arr[%Zu]=%Hu\n",FUNC,*mem_curr_seq,mem_offset_a * writing to other elements in the same chunk. Do a direct * write-through of only the elements requested. */ - if ((chunk_size>f->shared->rdcc_nbytes && pline.nused==0 && chunk_addr!=HADDR_UNDEF) + if ((chunk_size>f->shared->rdcc_nbytes && dcpl_cache->pline.nused==0 && chunk_addr!=HADDR_UNDEF) || (IS_H5FD_MPI(f) && (H5F_ACC_RDWR & f->shared->flags))) { #ifdef H5_HAVE_PARALLEL /* Additional sanity check when operating in parallel */ - if (chunk_addr==HADDR_UNDEF || pline.nused>0) + if (chunk_addr==HADDR_UNDEF || dcpl_cache->pline.nused>0) HGOTO_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, "unable to locate raw data chunk"); #endif /* H5_HAVE_PARALLEL */ if ((ret_value=H5F_contig_writevv(f, chunk_size, chunk_addr, chunk_max_nseq, chunk_curr_seq, chunk_len_arr, chunk_offset_arr, mem_max_nseq, mem_curr_seq, mem_len_arr, mem_offset_arr, dxpl_id, buf))<0) @@ -1910,18 +1881,10 @@ HDfprintf(stderr,"%s: mem_offset_arr[%Zu]=%Hu\n",FUNC,*mem_curr_seq,mem_offset_a } /* end if */ else { uint8_t *chunk; /* Pointer to cached chunk in memory */ - H5O_fill_t fill; /* Fill value information */ - H5D_fill_time_t fill_time; /* Fill time information */ unsigned idx_hint=0; /* Cache index hint */ ssize_t naccessed; /* Number of bytes accessed in chunk */ hbool_t relax; /* Whether whole chunk is selected */ - /* Get necessary properties from property list */ - if(H5P_get(dc_plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get fill value"); - if(H5P_get(dc_plist, H5D_CRT_FILL_TIME_NAME, &fill_time) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get fill time"); - /* * Lock the chunk, copy from application to chunk, then unlock the * chunk. @@ -1931,7 +1894,7 @@ HDfprintf(stderr,"%s: mem_offset_arr[%Zu]=%Hu\n",FUNC,*mem_curr_seq,mem_offset_a else relax = FALSE; - if (NULL==(chunk=H5F_istore_lock(f, dxpl_id, layout, &pline, &fill, fill_time, + if (NULL==(chunk=H5F_istore_lock(f, dxpl_cache, dxpl_id, layout, &dcpl_cache->pline, &dcpl_cache->fill, dcpl_cache->fill_time, chunk_coords_in_elmts, relax, &idx_hint))) HGOTO_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, "unable to read raw data chunk"); @@ -1940,7 +1903,7 @@ HDfprintf(stderr,"%s: mem_offset_arr[%Zu]=%Hu\n",FUNC,*mem_curr_seq,mem_offset_a HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "vectorized memcpy failed"); H5_CHECK_OVERFLOW(naccessed,ssize_t,size_t); - if (H5F_istore_unlock(f, dxpl_id, layout, &pline, TRUE, + if (H5F_istore_unlock(f, dxpl_cache, dxpl_id, layout, &dcpl_cache->pline, TRUE, chunk_coords_in_elmts, &idx_hint, chunk, (size_t)naccessed)<0) HGOTO_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, "uanble to unlock raw data chunk"); @@ -2174,7 +2137,7 @@ H5F_istore_allocate(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, assert(layout->ndims>0 && layout->ndims<=H5O_LAYOUT_NDIMS); assert(H5F_addr_defined(layout->addr)); assert(TRUE==H5P_isa_class(dxpl_id,H5P_DATASET_XFER)); - assert(dc_plist!=NULL); + assert(dc_plist); /* Get necessary properties from dataset creation property list */ if(H5P_get(dc_plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0) @@ -2467,7 +2430,8 @@ done: *------------------------------------------------------------------------- */ herr_t -H5F_istore_prune_by_extent(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, const H5S_t * space) +H5F_istore_prune_by_extent(H5F_t *f, const struct H5D_dxpl_cache_t *dxpl_cache, + hid_t dxpl_id, const H5O_layout_t *layout, const H5S_t * space) { H5F_rdcc_t *rdcc = &(f->shared->rdcc); /*raw data chunk cache */ H5F_rdcc_ent_t *ent = NULL, *next = NULL; /*cache entry */ @@ -2520,7 +2484,7 @@ H5F_istore_prune_by_extent(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, #endif /* Preempt the entry from the cache, but do not flush it to disk */ - if(H5F_istore_preempt(f, dxpl_id, ent, FALSE) < 0) + if(H5F_istore_preempt(f, dxpl_cache, dxpl_id, ent, FALSE) < 0) HGOTO_ERROR(H5E_IO, H5E_CANTINIT, 0, "unable to preempt chunk"); } } @@ -2677,8 +2641,9 @@ done: *------------------------------------------------------------------------- */ herr_t -H5F_istore_initialize_by_extent(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, - H5P_genplist_t *dc_plist, const H5S_t * space) +H5F_istore_initialize_by_extent(H5F_t *f, const struct H5D_dxpl_cache_t *dxpl_cache, + hid_t dxpl_id, const H5O_layout_t *layout, + H5P_genplist_t *dc_plist, const H5S_t * space) { uint8_t *chunk = NULL; /*the file chunk */ unsigned idx_hint = 0; /*input value for H5F_istore_lock */ @@ -2775,7 +2740,7 @@ H5F_istore_initialize_by_extent(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *lay if(found) { - if(NULL == (chunk = H5F_istore_lock(f, dxpl_id, layout, &pline, &fill, fill_time, + if(NULL == (chunk = H5F_istore_lock(f, dxpl_cache, dxpl_id, layout, &pline, &fill, fill_time, chunk_offset, FALSE, &idx_hint))) HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to read raw data chunk"); @@ -2808,7 +2773,7 @@ H5F_istore_initialize_by_extent(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *lay if(H5S_select_fill(fill.buf, (size_t)size[rank], space_chunk, chunk) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTENCODE, FAIL, "filling selection failed"); - if(H5F_istore_unlock(f, dxpl_id, layout, &pline, TRUE, + if(H5F_istore_unlock(f, dxpl_cache, dxpl_id, layout, &pline, TRUE, chunk_offset, &idx_hint, chunk, (size_t)naccessed) < 0) HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to unlock raw data chunk"); } /*found */ @@ -2848,6 +2813,7 @@ done: herr_t H5F_istore_delete(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout) { + H5D_dxpl_cache_t dxpl_cache; /* Cached data transfer properties */ H5F_istore_ud1_t udata; /* User data for B-tree iterator call */ H5F_rdcc_t *rdcc = &(f->shared->rdcc); /* File's raw data chunk cache */ H5F_rdcc_ent_t *ent, *next; /* Pointers to cache entries */ @@ -2855,6 +2821,10 @@ H5F_istore_delete(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout) FUNC_ENTER_NOAPI(H5F_istore_delete, FAIL); + /* Fill the DXPL cache values for later use */ + if (H5D_get_dxpl_cache(dxpl_id,&dxpl_cache)<0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't fill dxpl cache") + /* Check if the B-tree has been created in the file */ if(H5F_addr_defined(layout->addr)) { /* Iterate through the entries in the cache, checking for the chunks to be deleted */ @@ -2865,7 +2835,7 @@ H5F_istore_delete(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout) /* Is the chunk to be deleted this cache entry? */ if(layout->addr==ent->layout->addr) /* Remove entry without flushing */ - if (H5F_istore_preempt(f, dxpl_id, ent, FALSE )<0) + if (H5F_istore_preempt(f, &dxpl_cache, dxpl_id, ent, FALSE )<0) HGOTO_ERROR (H5E_IO, H5E_CANTFLUSH, FAIL, "unable to flush one or more raw data chunks"); } /* end for */ |