diff options
Diffstat (limited to 'src/H5AC.c')
-rw-r--r-- | src/H5AC.c | 98 |
1 files changed, 43 insertions, 55 deletions
@@ -128,8 +128,7 @@ static herr_t H5AC__receive_haddr_list(MPI_Comm mpi_comm, int *num_entries_ptr, haddr_t **haddr_buf_ptr_ptr); static herr_t H5AC__receive_candidate_list(const H5AC_t *cache_ptr, int *num_entries_ptr, haddr_t **haddr_buf_ptr_ptr); -static herr_t H5AC__receive_and_apply_clean_list(H5F_t *f, hid_t primary_dxpl_id, - hid_t secondary_dxpl_id); +static herr_t H5AC__receive_and_apply_clean_list(H5F_t *f, hid_t dxpl_id); static herr_t H5AC__tidy_cache_0_lists(H5AC_t *cache_ptr, int num_candidates, haddr_t *candidates_list_ptr); static herr_t H5AC__rsp__dist_md_write__flush(H5F_t *f, hid_t dxpl_id); @@ -201,6 +200,7 @@ static const char *H5AC_entry_type_names[H5AC_NTYPES] = "fixed array data block", "fixed array data block pages", "superblock", + "driver info", "test entry" /* for testing only -- not used for actual files */ }; @@ -575,7 +575,7 @@ H5AC_dest(H5F_t *f, hid_t dxpl_id) #endif /* H5_HAVE_PARALLEL */ /* Destroy the cache */ - if(H5C_dest(f, dxpl_id, H5AC_dxpl_id) < 0) + if(H5C_dest(f, dxpl_id) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFREE, FAIL, "can't destroy cache") f->shared->cache = NULL; @@ -628,8 +628,7 @@ H5AC_expunge_entry(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, HDassert(f->shared); HDassert(f->shared->cache); HDassert(type); - HDassert(type->clear); - HDassert(type->dest); + HDassert(type->serialize); HDassert(H5F_addr_defined(addr)); #if H5AC__TRACE_FILE_ENABLED @@ -645,7 +644,7 @@ H5AC_expunge_entry(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, } #endif /* H5AC__TRACE_FILE_ENABLED */ - if(H5C_expunge_entry(f, dxpl_id, H5AC_dxpl_id, type, addr, flags) < 0) + if(H5C_expunge_entry(f, dxpl_id, type, addr, flags) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTEXPUNGE, FAIL, "H5C_expunge_entry() failed.") done: @@ -710,7 +709,7 @@ H5AC_flush(H5F_t *f, hid_t dxpl_id) /* Flush the cache */ /* (Again, in parallel - writes out the superblock) */ - if(H5C_flush_cache(f, dxpl_id, H5AC_dxpl_id, H5AC__NO_FLAGS_SET) < 0) + if(H5C_flush_cache(f, dxpl_id, H5AC__NO_FLAGS_SET) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush cache.") done: @@ -818,8 +817,7 @@ H5AC_insert_entry(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t add HDassert(f->shared); HDassert(f->shared->cache); HDassert(type); - HDassert(type->flush); - HDassert(type->size); + HDassert(type->serialize); HDassert(H5F_addr_defined(addr)); HDassert(thing); @@ -841,7 +839,7 @@ H5AC_insert_entry(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t add #endif /* H5AC__TRACE_FILE_ENABLED */ /* Insert entry into metadata cache */ - if(H5C_insert_entry(f, dxpl_id, H5AC_dxpl_id, type, addr, thing, flags) < 0) + if(H5C_insert_entry(f, dxpl_id, type, addr, thing, flags) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, "H5C_insert_entry() failed") #if H5AC__TRACE_FILE_ENABLED @@ -1138,9 +1136,8 @@ done: */ void * H5AC_protect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, - void *udata, H5AC_protect_t rw) + void *udata, unsigned flags) { - unsigned protect_flags = H5C__NO_FLAGS_SET; void * thing; /* Pointer to native data structure for entry */ #if H5AC__TRACE_FILE_ENABLED char trace[128] = ""; @@ -1156,47 +1153,36 @@ H5AC_protect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, HDassert(f->shared); HDassert(f->shared->cache); HDassert(type); - HDassert(type->flush); - HDassert(type->load); + HDassert(type->serialize); HDassert(H5F_addr_defined(addr)); + /* Check for unexpected flags -- H5C__FLUSH_COLLECTIVELY_FLAG + * only permitted in the parallel case. + */ +#ifdef H5_HAVE_PARALLEL + HDassert(0 == (flags & (unsigned)(~(H5C__READ_ONLY_FLAG | \ + H5C__FLUSH_LAST_FLAG | \ + H5C__FLUSH_COLLECTIVELY_FLAG)))); +#else /* H5_HAVE_PARALLEL */ + HDassert(0 == (flags & (unsigned)(~(H5C__READ_ONLY_FLAG | \ + H5C__FLUSH_LAST_FLAG)))); +#endif /* H5_HAVE_PARALLEL */ + /* Check for invalid access request */ - if(0 == (H5F_INTENT(f) & H5F_ACC_RDWR) && rw == H5AC_WRITE) + if((0 == (H5F_INTENT(f) & H5F_ACC_RDWR)) && (0 == (flags & H5C__READ_ONLY_FLAG))) HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, NULL, "no write intent on file") #if H5AC__TRACE_FILE_ENABLED - /* For the protect call, only the addr and type id is really necessary - * in the trace file. Include the size of the entry protected as a - * sanity check. Also indicate whether the call was successful to - * catch occult errors. + /* For the protect call, only the addr, size, type id, and flags are + * necessary in the trace file. Also indicate whether the call was + * successful to catch occult errors. */ - if(NULL != (trace_file_ptr = H5C_get_trace_file_ptr(cache_ptr))) { - - const char * rw_string; - - if ( rw == H5AC_WRITE ) { - - rw_string = "H5AC_WRITE"; - - } else if ( rw == H5AC_READ ) { - - rw_string = "H5AC_READ"; - - } else { - - rw_string = "???"; - } - - sprintf(trace, "%s 0x%lx %d %s", FUNC, (unsigned long)addr, - (int)(type->id), rw_string); - } + if(NULL != (trace_file_ptr = H5C_get_trace_file_ptr(cache_ptr))) + sprintf(trace, "%s 0x%lx %d 0x%x", FUNC, (unsigned long)addr, + (int)(type->id), flags); #endif /* H5AC__TRACE_FILE_ENABLED */ - if ( rw == H5AC_READ ) - protect_flags |= H5C__READ_ONLY_FLAG; - - if(NULL == (thing = H5C_protect(f, dxpl_id, H5AC_dxpl_id, type, addr, udata, protect_flags))) - + if(NULL == (thing = H5C_protect(f, dxpl_id, type, addr, udata, flags))) HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, NULL, "H5C_protect() failed.") #if H5AC__TRACE_FILE_ENABLED @@ -1438,8 +1424,8 @@ H5AC_unprotect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, HDassert(f->shared); HDassert(f->shared->cache); HDassert(type); - HDassert(type->clear); - HDassert(type->flush); + HDassert(type->deserialize); + HDassert(type->image_len); HDassert(H5F_addr_defined(addr)); HDassert(thing); HDassert( ((H5AC_info_t *)thing)->addr == addr ); @@ -1462,9 +1448,11 @@ H5AC_unprotect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, * the entry. */ if(dirtied && !deleted) { + hbool_t curr_compressed = FALSE; /* dummy for call */ size_t curr_size = 0; + size_t curr_compressed_size = 0; /* dummy for call */ - if((type->size)(f, thing, &curr_size) < 0) + if((type->image_len)(thing, &curr_size, &curr_compressed, &curr_compressed_size) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTGETSIZE, FAIL, "Can't get size of thing") if(((H5AC_info_t *)thing)->size != curr_size) @@ -1483,7 +1471,7 @@ H5AC_unprotect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, } /* end if */ #endif /* H5_HAVE_PARALLEL */ - if(H5C_unprotect(f, dxpl_id, H5AC_dxpl_id, type, addr, thing, flags) < 0) + if(H5C_unprotect(f, dxpl_id, type, addr, thing, flags) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "H5C_unprotect() failed.") #ifdef H5_HAVE_PARALLEL @@ -3419,7 +3407,7 @@ H5AC__propagate_and_apply_candidate_list(H5F_t *f, hid_t dxpl_id) aux_ptr->write_permitted = TRUE; /* Apply the candidate list */ - result = H5C_apply_candidate_list(f, dxpl_id, dxpl_id, cache_ptr, num_candidates, + result = H5C_apply_candidate_list(f, dxpl_id, cache_ptr, num_candidates, candidates_list_ptr, aux_ptr->mpi_rank, aux_ptr->mpi_size); /* Disable writes again */ @@ -3563,7 +3551,7 @@ H5AC__propagate_flushed_and_still_clean_entries_list(H5F_t *f, hid_t dxpl_id) HDassert(H5SL_count(aux_ptr->c_slist_ptr) == 0); } /* end if */ else { - if(H5AC__receive_and_apply_clean_list(f, dxpl_id, H5AC_dxpl_id) < 0) + if(H5AC__receive_and_apply_clean_list(f, dxpl_id) < 0) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't receive and/or process clean slist broadcast.") } /* end else */ @@ -3667,7 +3655,7 @@ done: */ #ifdef H5_HAVE_PARALLEL static herr_t -H5AC__receive_and_apply_clean_list(H5F_t *f, hid_t primary_dxpl_id, hid_t secondary_dxpl_id) +H5AC__receive_and_apply_clean_list(H5F_t *f, hid_t dxpl_id) { H5AC_t * cache_ptr; H5AC_aux_t * aux_ptr; @@ -3693,7 +3681,7 @@ H5AC__receive_and_apply_clean_list(H5F_t *f, hid_t primary_dxpl_id, hid_t second if(num_entries > 0) /* mark the indicated entries as clean */ - if(H5C_mark_entries_as_clean(f, primary_dxpl_id, secondary_dxpl_id, (int32_t)num_entries, haddr_buf_ptr) < 0) + if(H5C_mark_entries_as_clean(f, dxpl_id, (int32_t)num_entries, haddr_buf_ptr) < 0) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't mark entries clean.") /* if it is defined, call the sync point done callback. Note @@ -3860,7 +3848,7 @@ H5AC__rsp__dist_md_write__flush(H5F_t *f, hid_t dxpl_id) aux_ptr->write_permitted = TRUE; /* Apply the candidate list */ - result = H5C_apply_candidate_list(f, dxpl_id, dxpl_id, cache_ptr, num_entries, + result = H5C_apply_candidate_list(f, dxpl_id, cache_ptr, num_entries, haddr_buf_ptr, aux_ptr->mpi_rank, aux_ptr->mpi_size); /* Disable writes again */ @@ -4073,7 +4061,7 @@ H5AC__rsp__p0_only__flush(H5F_t *f, hid_t dxpl_id) aux_ptr->write_permitted = TRUE; /* Flush the cache */ - result = H5C_flush_cache(f, dxpl_id, dxpl_id, H5AC__NO_FLAGS_SET); + result = H5C_flush_cache(f, dxpl_id, H5AC__NO_FLAGS_SET); /* Disable writes again */ aux_ptr->write_permitted = FALSE; @@ -4197,7 +4185,7 @@ H5AC__rsp__p0_only__flush_to_min_clean(H5F_t *f, hid_t dxpl_id) aux_ptr->write_permitted = TRUE; /* Flush the cache */ - result = H5C_flush_to_min_clean(f, dxpl_id, H5AC_dxpl_id); + result = H5C_flush_to_min_clean(f, dxpl_id); /* Disable writes again */ aux_ptr->write_permitted = FALSE; |