mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-01-18 15:15:56 +08:00
Merge pull request #313 in HDFFV/hdf5 from merge_page_buffering_04 to develop
* commit '321adc3a6f35e3e8f3b3c7be8680fcdff6660db6': Align w/incoming page buffering changes.
This commit is contained in:
commit
fd268dca96
12
src/H5AC.c
12
src/H5AC.c
@ -616,12 +616,18 @@ H5AC_dest(H5F_t *f, hid_t dxpl_id)
|
||||
|
||||
#ifdef H5_HAVE_PARALLEL
|
||||
if(aux_ptr != NULL) {
|
||||
if(aux_ptr->d_slist_ptr != NULL)
|
||||
if(aux_ptr->d_slist_ptr != NULL) {
|
||||
HDassert(H5SL_count(aux_ptr->d_slist_ptr) == 0);
|
||||
H5SL_close(aux_ptr->d_slist_ptr);
|
||||
if(aux_ptr->c_slist_ptr != NULL)
|
||||
} /* end if */
|
||||
if(aux_ptr->c_slist_ptr != NULL) {
|
||||
HDassert(H5SL_count(aux_ptr->c_slist_ptr) == 0);
|
||||
H5SL_close(aux_ptr->c_slist_ptr);
|
||||
if(aux_ptr->candidate_slist_ptr != NULL)
|
||||
} /* end if */
|
||||
if(aux_ptr->candidate_slist_ptr != NULL) {
|
||||
HDassert(H5SL_count(aux_ptr->candidate_slist_ptr) == 0);
|
||||
H5SL_close(aux_ptr->candidate_slist_ptr);
|
||||
} /* end if */
|
||||
aux_ptr->magic = 0;
|
||||
aux_ptr = H5FL_FREE(H5AC_aux_t, aux_ptr);
|
||||
} /* end if */
|
||||
|
118
src/H5C.c
118
src/H5C.c
@ -1086,9 +1086,9 @@ H5C_flush_cache(H5F_t *f, hid_t dxpl_id, unsigned flags)
|
||||
*/
|
||||
ring = H5C_RING_USER;
|
||||
while(ring < H5C_RING_NTYPES) {
|
||||
/* only call the free space manager settle routines when close
|
||||
* warning has been received, and then only when the index is
|
||||
* non-empty for that ring.
|
||||
|
||||
/* Only call the free space manager settle routines when close
|
||||
* warning has been received.
|
||||
*/
|
||||
if(cache_ptr->close_warning_received) {
|
||||
switch(ring) {
|
||||
@ -1556,7 +1556,7 @@ H5C_insert_entry(H5F_t * f,
|
||||
|
||||
if(H5C__make_space_in_cache(f, dxpl_id, space_needed, write_permitted) < 0)
|
||||
HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, "H5C__make_space_in_cache failed")
|
||||
}
|
||||
} /* end if */
|
||||
|
||||
H5C__INSERT_IN_INDEX(cache_ptr, entry_ptr, FAIL)
|
||||
|
||||
@ -2542,6 +2542,8 @@ H5C_protect(H5F_t * f,
|
||||
HGOTO_ERROR(H5E_CACHE, H5E_CANTLOAD, NULL, "can't load entry")
|
||||
|
||||
entry_ptr = (H5C_cache_entry_t *)thing;
|
||||
cache_ptr->entries_loaded_counter++;
|
||||
|
||||
entry_ptr->ring = ring;
|
||||
#ifdef H5_HAVE_PARALLEL
|
||||
if(H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI) && entry_ptr->coll_access)
|
||||
@ -2632,7 +2634,7 @@ H5C_protect(H5F_t * f,
|
||||
|
||||
if(H5C__make_space_in_cache(f, dxpl_id, space_needed, write_permitted) < 0 )
|
||||
HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, NULL, "H5C__make_space_in_cache failed")
|
||||
}
|
||||
} /* end if */
|
||||
|
||||
/* Insert the entry in the hash table. It can't be dirty yet, so
|
||||
* we don't even check to see if it should go in the skip list.
|
||||
@ -2667,13 +2669,10 @@ H5C_protect(H5F_t * f,
|
||||
*/
|
||||
H5C__UPDATE_RP_FOR_INSERTION(cache_ptr, entry_ptr, NULL)
|
||||
|
||||
/* Update entries loaded in cache counter */
|
||||
cache_ptr->entries_loaded_counter++;
|
||||
|
||||
/* Record that the entry was loaded, to trigger a notify callback later */
|
||||
/* (After the entry is fully added to the cache) */
|
||||
was_loaded = TRUE;
|
||||
}
|
||||
} /* end else */
|
||||
|
||||
HDassert(entry_ptr->addr == addr);
|
||||
HDassert(entry_ptr->type == type);
|
||||
@ -3490,23 +3489,20 @@ done:
|
||||
*
|
||||
* Function: H5C_unsettle_entry_ring
|
||||
*
|
||||
* Purpose: Advise the metadata cache that the specified entry's metadata
|
||||
* cache manager ring is no longer settled (if it was on entry).
|
||||
* Purpose: Advise the metadata cache that the specified entry's free space
|
||||
* manager ring is no longer settled (if it was on entry).
|
||||
*
|
||||
* If the target metadata cache manager ring is already
|
||||
* If the target free space manager ring is already
|
||||
* unsettled, do nothing, and return SUCCEED.
|
||||
*
|
||||
* If the target metadata cache manager ring is settled, and
|
||||
* If the target free space manager ring is settled, and
|
||||
* we are not in the process of a file shutdown, mark
|
||||
* the ring as unsettled, and return SUCCEED.
|
||||
*
|
||||
* If the target metadata cache manager is settled, and we
|
||||
* If the target free space manager is settled, and we
|
||||
* are in the process of a file shutdown, post an error
|
||||
* message, and return FAIL.
|
||||
*
|
||||
* Note that this function simply passes the call on to
|
||||
* the metadata cache proper, and returns the result.
|
||||
*
|
||||
* Return: Non-negative on success/Negative on failure
|
||||
*
|
||||
* Programmer: Quincey Koziol
|
||||
@ -4565,19 +4561,6 @@ done:
|
||||
*
|
||||
* Programmer: John Mainzer, 11/22/04
|
||||
*
|
||||
* Changes: Modified function to detect deletions of entries
|
||||
* during a scan of the LRU, and where appropriate,
|
||||
* restart the scan to avoid proceeding with a next
|
||||
* entry that is no longer in the cache.
|
||||
*
|
||||
* Note the absence of checks after flushes of clean
|
||||
* entries. As a second entry can only be removed by
|
||||
* by a call to the pre_serialize or serialize callback
|
||||
* of the first, and as these callbacks will not be called
|
||||
* on clean entries, no checks are needed.
|
||||
*
|
||||
* JRM -- 4/6/15
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static herr_t
|
||||
@ -4669,39 +4652,26 @@ H5C__autoadjust__ageout__evict_aged_out_entries(H5F_t * f,
|
||||
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush entry")
|
||||
}
|
||||
|
||||
if ( prev_ptr != NULL ) {
|
||||
|
||||
if(prev_ptr != NULL) {
|
||||
if(corked) /* dirty corked entry is skipped */
|
||||
entry_ptr = prev_ptr;
|
||||
|
||||
else if ( ( restart_scan )
|
||||
||
|
||||
( prev_ptr->is_dirty != prev_is_dirty )
|
||||
||
|
||||
( prev_ptr->next != next_ptr )
|
||||
||
|
||||
( prev_ptr->is_protected )
|
||||
||
|
||||
( prev_ptr->is_pinned ) ) {
|
||||
|
||||
/* something has happened to the LRU -- start over
|
||||
else if(restart_scan || (prev_ptr->is_dirty != prev_is_dirty)
|
||||
|| (prev_ptr->next != next_ptr)
|
||||
|| (prev_ptr->is_protected)
|
||||
|| (prev_ptr->is_pinned)) {
|
||||
/* Something has happened to the LRU -- start over
|
||||
* from the tail.
|
||||
*/
|
||||
restart_scan = FALSE;
|
||||
entry_ptr = cache_ptr->LRU_tail_ptr;
|
||||
|
||||
H5C__UPDATE_STATS_FOR_LRU_SCAN_RESTART(cache_ptr)
|
||||
|
||||
} else {
|
||||
|
||||
} /* end else-if */
|
||||
else
|
||||
entry_ptr = prev_ptr;
|
||||
|
||||
}
|
||||
} else {
|
||||
|
||||
} /* end if */
|
||||
else
|
||||
entry_ptr = NULL;
|
||||
|
||||
}
|
||||
} /* end while */
|
||||
|
||||
/* for now at least, don't bother to maintain the minimum clean size,
|
||||
@ -6929,38 +6899,6 @@ done:
|
||||
*
|
||||
* Programmer: John Mainzer, 5/14/04
|
||||
*
|
||||
* Changes: Modified function to skip over entries with the
|
||||
* flush_in_progress flag set. If this is not done,
|
||||
* an infinite recursion is possible if the cache is
|
||||
* full, and the pre-serialize or serialize routine
|
||||
* attempts to load another entry.
|
||||
*
|
||||
* This error was exposed by a re-factor of the
|
||||
* H5C__flush_single_entry() routine. However, it was
|
||||
* a potential bug from the moment that entries were
|
||||
* allowed to load other entries on flush.
|
||||
*
|
||||
* In passing, note that the primary and secondary dxpls
|
||||
* mentioned in the comment above have been replaced by
|
||||
* a single dxpl at some point, and thus the discussion
|
||||
* above is somewhat obsolete. Date of this change is
|
||||
* unkown.
|
||||
*
|
||||
* JRM -- 12/26/14
|
||||
*
|
||||
* Modified function to detect deletions of entries
|
||||
* during a scan of the LRU, and where appropriate,
|
||||
* restart the scan to avoid proceeding with a next
|
||||
* entry that is no longer in the cache.
|
||||
*
|
||||
* Note the absence of checks after flushes of clean
|
||||
* entries. As a second entry can only be removed by
|
||||
* by a call to the pre_serialize or serialize callback
|
||||
* of the first, and as these callbacks will not be called
|
||||
* on clean entries, no checks are needed.
|
||||
*
|
||||
* JRM -- 4/6/15
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
herr_t
|
||||
@ -6993,21 +6931,15 @@ H5C__make_space_in_cache(H5F_t *f, hid_t dxpl_id, size_t space_needed,
|
||||
HDassert(cache_ptr->index_size == (cache_ptr->clean_index_size + cache_ptr->dirty_index_size));
|
||||
|
||||
if ( write_permitted ) {
|
||||
|
||||
restart_scan = FALSE;
|
||||
initial_list_len = cache_ptr->LRU_list_len;
|
||||
entry_ptr = cache_ptr->LRU_tail_ptr;
|
||||
|
||||
if ( cache_ptr->index_size >= cache_ptr->max_cache_size ) {
|
||||
|
||||
if(cache_ptr->index_size >= cache_ptr->max_cache_size)
|
||||
empty_space = 0;
|
||||
|
||||
} else {
|
||||
|
||||
else
|
||||
empty_space = cache_ptr->max_cache_size - cache_ptr->index_size;
|
||||
|
||||
}
|
||||
|
||||
while ( ( ( (cache_ptr->index_size + space_needed)
|
||||
>
|
||||
cache_ptr->max_cache_size
|
||||
|
@ -83,7 +83,7 @@
|
||||
#define H5C_IMAGE_ENTRY_T_BAD_MAGIC 0xBeefDead
|
||||
|
||||
/* Maximum ring allowed in image */
|
||||
#define H5C_MAX_RING_IN_IMAGE 3
|
||||
#define H5C_MAX_RING_IN_IMAGE H5C_RING_MDFSM
|
||||
|
||||
|
||||
/******************/
|
||||
@ -3115,6 +3115,7 @@ done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* H5C__reconstruct_cache_contents() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5C__reconstruct_cache_entry()
|
||||
*
|
||||
@ -3903,7 +3904,7 @@ H5C__write_cache_image(H5F_t *f, hid_t dxpl_id, const H5C_t *cache_ptr)
|
||||
|
||||
/* Write the buffer (if serial access, or rank 0 for parallel access) */
|
||||
if(H5F_block_write(f, H5FD_MEM_SUPER, cache_ptr->image_addr, cache_ptr->image_len, dxpl_id, cache_ptr->image_buffer) < 0)
|
||||
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't write metadata cache image block to file.")
|
||||
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "can't write metadata cache image block to file")
|
||||
#ifdef H5_HAVE_PARALLEL
|
||||
} /* end if */
|
||||
} /* end block */
|
||||
|
@ -4294,8 +4294,8 @@ typedef struct H5C_tag_info_t {
|
||||
* page buffering, this is no longer viable, as we must finalize the on
|
||||
* disk image of all metadata much sooner.
|
||||
*
|
||||
* This is handled by the H5FS_settle_raw_data_fsm() and
|
||||
* H5FS_settle_meta_data_fsm() routines. As these calls are expensive,
|
||||
* This is handled by the H5MF_settle_raw_data_fsm() and
|
||||
* H5MF_settle_meta_data_FSM() routines. As these calls are expensive,
|
||||
* the following fields are used to track whether the target free space
|
||||
* managers are clean.
|
||||
*
|
||||
@ -4887,7 +4887,7 @@ H5_DLL herr_t H5C__generate_cache_image(H5F_t *f, hid_t dxpl_id, H5C_t *cache_pt
|
||||
H5_DLL herr_t H5C__load_cache_image(H5F_t *f, hid_t dxpl_id);
|
||||
H5_DLL herr_t H5C__mark_flush_dep_serialized(H5C_cache_entry_t * entry_ptr);
|
||||
H5_DLL herr_t H5C__mark_flush_dep_unserialized(H5C_cache_entry_t * entry_ptr);
|
||||
H5_DLL herr_t H5C__make_space_in_cache(H5F_t * f, hid_t dxpl_id,
|
||||
H5_DLL herr_t H5C__make_space_in_cache(H5F_t * f, hid_t dxpl_id,
|
||||
size_t space_needed, hbool_t write_permitted);
|
||||
H5_DLL herr_t H5C__flush_marked_entries(H5F_t * f, hid_t dxpl_id);
|
||||
H5_DLL herr_t H5C__generate_image(H5F_t *f, H5C_t *cache_ptr,
|
||||
|
@ -444,7 +444,8 @@ H5C_get_entry_ring(const H5F_t *f, haddr_t addr, H5C_ring_t *ring)
|
||||
|
||||
/* Locate the entry at the address */
|
||||
H5C__SEARCH_INDEX(cache_ptr, addr, entry_ptr, FAIL)
|
||||
HDassert(entry_ptr);
|
||||
if(entry_ptr == NULL)
|
||||
HGOTO_ERROR(H5E_CACHE, H5E_NOTFOUND, FAIL, "can't find entry in index")
|
||||
|
||||
/* Return the ring value */
|
||||
*ring = entry_ptr->ring;
|
||||
|
16
src/H5Fint.c
16
src/H5Fint.c
@ -833,7 +833,7 @@ H5F_dest(H5F_t *f, hid_t dxpl_id, hbool_t flush)
|
||||
if((H5F_ACC_RDWR & H5F_INTENT(f)) && flush)
|
||||
if(H5F__flush_phase1(f, dxpl_id) < 0)
|
||||
/* Push error, but keep going*/
|
||||
HDONE_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush cache")
|
||||
HDONE_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush cached data (phase 1)")
|
||||
|
||||
/* Notify the metadata cache that the file is about to be closed.
|
||||
* This allows the cache to set up for creating a metadata cache
|
||||
@ -849,8 +849,8 @@ H5F_dest(H5F_t *f, hid_t dxpl_id, hbool_t flush)
|
||||
*/
|
||||
if((H5F_ACC_RDWR & H5F_INTENT(f)) && flush)
|
||||
if(H5F__flush_phase2(f, dxpl_id, TRUE) < 0)
|
||||
/* Push error, but keep going*/
|
||||
HDONE_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush cache")
|
||||
/* Push error, but keep going */
|
||||
HDONE_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush cached data (phase 2)")
|
||||
|
||||
/* With the shutdown modifications, the contents of the metadata cache
|
||||
* should be clean at this point, with the possible exception of the
|
||||
@ -1285,6 +1285,10 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id,
|
||||
shared = file->shared;
|
||||
lf = shared->lf;
|
||||
|
||||
/* Get the file access property list, for future queries */
|
||||
if(NULL == (a_plist = (H5P_genplist_t *)H5I_object(fapl_id)))
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not file access property list")
|
||||
|
||||
/*
|
||||
* Read or write the file superblock, depending on whether the file is
|
||||
* empty or not.
|
||||
@ -1318,10 +1322,6 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id,
|
||||
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to read root group")
|
||||
} /* end if */
|
||||
|
||||
/* Get the file access property list, for future queries */
|
||||
if(NULL == (a_plist = (H5P_genplist_t *)H5I_object(fapl_id)))
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not file access property list")
|
||||
|
||||
/*
|
||||
* Decide the file close degree. If it's the first time to open the
|
||||
* file, set the degree to access property list value; if it's the
|
||||
@ -1529,7 +1529,7 @@ H5F__flush_phase2(H5F_t *f, hid_t dxpl_id, hbool_t closing)
|
||||
/* Flush file buffers to disk. */
|
||||
if(H5FD_flush(f->shared->lf, dxpl_id, closing) < 0)
|
||||
/* Push error, but keep going*/
|
||||
HDONE_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "low level flush failed")
|
||||
HDONE_ERROR(H5E_IO, H5E_CANTFLUSH, FAIL, "low level flush failed")
|
||||
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5F__flush_phase2() */
|
||||
|
@ -240,7 +240,7 @@ done:
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
herr_t
|
||||
static herr_t
|
||||
H5F__update_super_ext_driver_msg(H5F_t *f, hid_t dxpl_id)
|
||||
{
|
||||
H5F_super_t *sblock; /* Pointer to the super block */
|
||||
|
133
src/H5MF.c
133
src/H5MF.c
@ -1251,18 +1251,18 @@ done:
|
||||
* Purpose: Handle any tasks required before the metadata cache
|
||||
* can serialize or flush the raw data free space manager
|
||||
* and any metadata free space managers that reside in the
|
||||
* raw data free space manager ring.
|
||||
* raw data free space manager ring.
|
||||
*
|
||||
* Specifically, any metadata managers that DON'T handle
|
||||
* space allocation for free space manager header or section
|
||||
* info will reside in the raw data free space manager ring.
|
||||
* As of this writing, the plan is to move to only two free space
|
||||
* space allocation for free space manager header or section
|
||||
* info will reside in the raw data free space manager ring.
|
||||
* As of this writing, the plan is to move to only two free space
|
||||
* managers, one for raw data and one for metadata -- which
|
||||
* means that only the raw data free space manager will reside
|
||||
* in the free space manager ring. However, this has not been
|
||||
* fully implemented yet, so this code must support the
|
||||
* possibilty of multiple metadata free space managers, at most
|
||||
* two of which handle free space manager header or section info,
|
||||
* two of which handle free space manager header or section info,
|
||||
* and thus reside in the metadata free space manager ring.
|
||||
*
|
||||
* At present, the task list is:
|
||||
@ -1271,20 +1271,20 @@ done:
|
||||
*
|
||||
* a) Free both aggregators. Space not at EOA will be
|
||||
* added to the appropriate free space manager.
|
||||
*
|
||||
*
|
||||
* The raw data aggregator should not be restarted
|
||||
* after this point. It is possible that the metadata
|
||||
* aggregator will be.
|
||||
*
|
||||
*
|
||||
* b) Free all file space currently allocated to free
|
||||
* space managers.
|
||||
* space managers.
|
||||
*
|
||||
* c) Delete the free space manager superblock
|
||||
* extension message if allocated.
|
||||
*
|
||||
* This done, reduce the EOA by moving it to just before
|
||||
* the last piece of free memory in the file.
|
||||
*
|
||||
*
|
||||
* 2) Ensure that space is allocated for the free space
|
||||
* manager superblock extension message. Must do this
|
||||
* now, before reallocating file space for free space
|
||||
@ -1309,6 +1309,7 @@ done:
|
||||
* We will allocate space for free space managers involved
|
||||
* in the allocation of file space for free space managers
|
||||
* in H5MF_settle_meta_data_fsm()
|
||||
*
|
||||
* Return: SUCCEED/FAIL
|
||||
*
|
||||
* Programmer: John Mainzer
|
||||
@ -1348,9 +1349,9 @@ H5MF_settle_raw_data_fsm(H5F_t *f, hid_t dxpl_id, hbool_t *fsm_settled)
|
||||
|
||||
/* a) Free the space in aggregators:
|
||||
*
|
||||
* (for space not at EOF, it may be put into free space managers)
|
||||
* (for space not at EOF, it may be put into free space managers)
|
||||
*
|
||||
* Do this now so that the raw data FSM (and any other FSM that isn't
|
||||
* Do this now so that the raw data FSM (and any other FSM that isn't
|
||||
* involved in space allocation for FSMs) will have no further activity.
|
||||
*
|
||||
* Note that while the raw data aggregator should not be restarted during
|
||||
@ -1371,23 +1372,23 @@ H5MF_settle_raw_data_fsm(H5F_t *f, hid_t dxpl_id, hbool_t *fsm_settled)
|
||||
|
||||
/* b) Free the file space (if any) allocated to each free space manager.
|
||||
*
|
||||
* Do this to facilitate reduction of the size of the file to the
|
||||
* extent possible. We will re-allocate space to free space managers
|
||||
* Do this to facilitate reduction of the size of the file to the
|
||||
* extent possible. We will re-allocate space to free space managers
|
||||
* that have free space to save after this reduction.
|
||||
*
|
||||
* In the case of the raw data free space manager, and any other free
|
||||
* space manager that does not allocate space for free space managers,
|
||||
* allocations should be complete at this point, as all raw data should
|
||||
* have space allocated and be flushed to file at this point. Thus we
|
||||
* can examine such free space managers and only re-allocate space for
|
||||
* can examine such free space managers and only re-allocate space for
|
||||
* them if they contain free space. Do this later in this function after
|
||||
* the EOA has been reduced to the extent possible.
|
||||
*
|
||||
* For free space managers that allocate file space for free space
|
||||
* managers (usually just a single metadata free space manager, but for
|
||||
* now at least, free space managers for different types of metadata
|
||||
* For free space managers that allocate file space for free space
|
||||
* managers (usually just a single metadata free space manager, but for
|
||||
* now at least, free space managers for different types of metadata
|
||||
* are possible), the matter is more ticklish due to the self-
|
||||
* referential nature of the problem. These FSMs are dealt with in
|
||||
* referential nature of the problem. These FSMs are dealt with in
|
||||
* H5MF_settle_meta_data_fsm().
|
||||
*/
|
||||
for(type = H5FD_MEM_SUPER; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type)) {
|
||||
@ -1403,8 +1404,8 @@ H5MF_settle_raw_data_fsm(H5F_t *f, hid_t dxpl_id, hbool_t *fsm_settled)
|
||||
if(!fsm_visited[fsm_type]) {
|
||||
fsm_visited[fsm_type] = TRUE;
|
||||
|
||||
/* If there is no active FSM for this type, but such a FSM has
|
||||
* space allocated in file, open it so that we can free its file
|
||||
/* If there is no active FSM for this type, but such a FSM has
|
||||
* space allocated in file, open it so that we can free its file
|
||||
* space.
|
||||
*/
|
||||
if(NULL == f->shared->fs_man[fsm_type]) {
|
||||
@ -1429,8 +1430,8 @@ H5MF_settle_raw_data_fsm(H5F_t *f, hid_t dxpl_id, hbool_t *fsm_settled)
|
||||
else
|
||||
needed_ring = H5AC_RING_RDFSM;
|
||||
if(needed_ring != curr_ring) {
|
||||
if(H5AC_set_ring(dxpl_id, needed_ring, &dxpl, &curr_ring)< 0)
|
||||
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSET, FAIL, "unable to set ring value.")
|
||||
if(H5AC_set_ring(dxpl_id, needed_ring, &dxpl, &curr_ring) < 0)
|
||||
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSET, FAIL, "unable to set ring value")
|
||||
curr_ring = needed_ring;
|
||||
} /* end if */
|
||||
|
||||
@ -1456,11 +1457,11 @@ H5MF_settle_raw_data_fsm(H5F_t *f, hid_t dxpl_id, hbool_t *fsm_settled)
|
||||
} /* end if */
|
||||
} /* end for */
|
||||
|
||||
/* c) Delete the free space manager superblock extension message
|
||||
/* c) Delete the free space manager superblock extension message
|
||||
* if allocated.
|
||||
*
|
||||
* Must do this since the routine that writes / creates superblock
|
||||
* extension messages will choke if the target message is
|
||||
* extension messages will choke if the target message is
|
||||
* unexpectedly either absent or present.
|
||||
*/
|
||||
if(H5F_addr_defined(f->shared->sblock->ext_addr))
|
||||
@ -1471,39 +1472,39 @@ H5MF_settle_raw_data_fsm(H5F_t *f, hid_t dxpl_id, hbool_t *fsm_settled)
|
||||
if(H5MF__close_shrink_eoa(f, dxpl_id) < 0)
|
||||
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSHRINK, FAIL, "can't shrink eoa")
|
||||
|
||||
|
||||
/* 2) Ensure that space is allocated for the free space manager superblock
|
||||
* extension message. Must do this now, before reallocating file space
|
||||
|
||||
/* 2) Ensure that space is allocated for the free space manager superblock
|
||||
* extension message. Must do this now, before reallocating file space
|
||||
* for free space managers, as it is possible that this allocation may
|
||||
* grab the last section in a FSM -- making it unnecessary to
|
||||
* grab the last section in a FSM -- making it unnecessary to
|
||||
* re-allocate file space for it.
|
||||
*
|
||||
* Do this by writing a free space manager superblock extension message.
|
||||
*
|
||||
* Since no free space manager has file space allocated for it, this
|
||||
*
|
||||
* Since no free space manager has file space allocated for it, this
|
||||
* message must be invalid since we can't save addresses of FSMs when
|
||||
* those addresses are unknown. This is OK -- we will write the correct
|
||||
* values to the message at free space manager shutdown.
|
||||
*/
|
||||
for(type = H5FD_MEM_SUPER; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type))
|
||||
fsinfo.fs_addr[type-1] = HADDR_UNDEF;
|
||||
for(type = H5FD_MEM_SUPER; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type))
|
||||
fsinfo.fs_addr[type - 1] = HADDR_UNDEF;
|
||||
fsinfo.strategy = f->shared->fs_strategy;
|
||||
fsinfo.threshold = f->shared->fs_threshold;
|
||||
if(H5F_super_ext_write_msg(f, dxpl_id, H5O_FSINFO_ID, &fsinfo, TRUE, H5O_MSG_NO_FLAGS_SET) < 0)
|
||||
HGOTO_ERROR(H5E_RESOURCE, H5E_WRITEERROR, FAIL, "error in writing message to superblock extension")
|
||||
HGOTO_ERROR(H5E_RESOURCE, H5E_WRITEERROR, FAIL, "error in writing fsinfo message to superblock extension")
|
||||
|
||||
|
||||
/* 3) Scan all free space managers not involved in allocating
|
||||
* space for free space managers. For each such free space
|
||||
* manager, test to see if it contains free space. If
|
||||
* manager, test to see if it contains free space. If
|
||||
* it does, allocate file space for its header and section
|
||||
* data. If it contains no free space, leave it without
|
||||
* allocated file space as there is no need to save it to
|
||||
* data. If it contains no free space, leave it without
|
||||
* allocated file space as there is no need to save it to
|
||||
* file.
|
||||
*
|
||||
* Note that all free space managers in this class should
|
||||
* see no further space allocations / deallocations as
|
||||
* at this point, all raw data allocations should be
|
||||
* see no further space allocations / deallocations as
|
||||
* at this point, all raw data allocations should be
|
||||
* finalized, as should all metadata allocations not involving
|
||||
* free space managers.
|
||||
*
|
||||
@ -1529,11 +1530,11 @@ H5MF_settle_raw_data_fsm(H5F_t *f, hid_t dxpl_id, hbool_t *fsm_settled)
|
||||
|
||||
if(needed_ring != curr_ring) {
|
||||
if(H5AC_set_ring(dxpl_id, needed_ring, &dxpl, &curr_ring)< 0)
|
||||
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSET, FAIL, "unable to set ring value.")
|
||||
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSET, FAIL, "unable to set ring value")
|
||||
curr_ring = needed_ring;
|
||||
} /* end if */
|
||||
|
||||
/* Since there can be a many-to-one mapping from memory types
|
||||
/* Since there can be a many-to-one mapping from memory types
|
||||
* to free space managers, ensure that we don't visit any FSM
|
||||
* more than once.
|
||||
*/
|
||||
@ -1555,10 +1556,10 @@ H5MF_settle_raw_data_fsm(H5F_t *f, hid_t dxpl_id, hbool_t *fsm_settled)
|
||||
|
||||
/* Query free space manager info for this type */
|
||||
if(H5FS_stat_info(f, f->shared->fs_man[fsm_type], &fs_stat) < 0 )
|
||||
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't get free-space info")
|
||||
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't get free-space info")
|
||||
|
||||
/* If the free space manager contains section info,
|
||||
* allocate space for the header and sinfo (note that
|
||||
/* If the free space manager contains section info,
|
||||
* allocate space for the header and sinfo (note that
|
||||
* space must not be allocated at present -- verify
|
||||
* verify this with assertions).
|
||||
*/
|
||||
@ -1600,7 +1601,7 @@ H5MF_settle_raw_data_fsm(H5F_t *f, hid_t dxpl_id, hbool_t *fsm_settled)
|
||||
/* Close any opened FSMs */
|
||||
if(fsm_opened[fsm_type]) {
|
||||
if(H5MF__alloc_close(f, dxpl_id, fsm_type) < 0)
|
||||
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't close file free space manager")
|
||||
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't close file free space manager")
|
||||
fsm_opened[fsm_type] = FALSE;
|
||||
} /* end if */
|
||||
} /* end if */
|
||||
@ -1788,7 +1789,7 @@ H5MF_settle_meta_data_fsm(H5F_t *f, hid_t dxpl_id, hbool_t *fsm_settled)
|
||||
} /* end if */
|
||||
#endif /* NDEBUG */
|
||||
|
||||
/* Free the space in the metadata aggregator. Do this via the
|
||||
/* Free the space in the metadata aggregator. Do this via the
|
||||
* H5MF_free_aggrs() call. Note that the raw data aggregator must
|
||||
* have already been freed. Sanity checks for this?
|
||||
*/
|
||||
@ -1802,18 +1803,18 @@ H5MF_settle_meta_data_fsm(H5F_t *f, hid_t dxpl_id, hbool_t *fsm_settled)
|
||||
|
||||
/* ******************* PROBLEM: ********************
|
||||
*
|
||||
* If the file has an alignement other than 1, and if
|
||||
* the EOA is not a multiple of this alignment, allocating sapce
|
||||
* for the section via the VFD info has the potential of generating
|
||||
* a fragment that will be added to the free space manager. This
|
||||
* If the file has an alignement other than 1, and if
|
||||
* the EOA is not a multiple of this alignment, allocating sapce
|
||||
* for the section via the VFD info has the potential of generating
|
||||
* a fragment that will be added to the free space manager. This
|
||||
* of course undoes everything we have been doing here.
|
||||
*
|
||||
* Need a way around this. Obvious solution is to force the EOA to
|
||||
* be a multiple of the alignment.
|
||||
* Need a way around this. Obvious solution is to force the EOA to
|
||||
* be a multiple of the alignment.
|
||||
*
|
||||
* Fortunately, alignment is typically 1, so this is a non-issue in
|
||||
* most cases. In cases where the alignment is not 1, for now we
|
||||
* have decided to drop the fragment on the floor.
|
||||
* most cases. In cases where the alignment is not 1, for now we
|
||||
* have decided to drop the fragment on the floor.
|
||||
*
|
||||
* Eventually, we should fix this by modifying the on disk representations
|
||||
* of free space managers to allow for empty space, so as to bypass the
|
||||
@ -1823,30 +1824,30 @@ H5MF_settle_meta_data_fsm(H5F_t *f, hid_t dxpl_id, hbool_t *fsm_settled)
|
||||
/* HDassert(f->shared->alignment == 1); */
|
||||
|
||||
|
||||
/* The free space manager(s) that handle space allocations for free
|
||||
* space managers should be settled now, albeit without file space
|
||||
/* The free space manager(s) that handle space allocations for free
|
||||
* space managers should be settled now, albeit without file space
|
||||
* allocated to them. To avoid the possibility of changing the sizes
|
||||
* of their section info blocks, allocate space for them now at the
|
||||
* of their section info blocks, allocate space for them now at the
|
||||
* end of file via H5FD_alloc().
|
||||
*
|
||||
* In the past, this issue of allocating space without touching the
|
||||
* free space managers has been deal with by calling
|
||||
* H5MF_aggr_vfd_alloc(), which in turn calls H5MF_aggr_alloc().
|
||||
* This is problematic since (if I read the code correctly) it will
|
||||
* re-constitute the metadata aggregator, which will add any left
|
||||
* over space to one of the free space managers when freed.
|
||||
* In the past, this issue of allocating space without touching the
|
||||
* free space managers has been deal with by calling
|
||||
* H5MF_aggr_vfd_alloc(), which in turn calls H5MF_aggr_alloc().
|
||||
* This is problematic since (if I read the code correctly) it will
|
||||
* re-constitute the metadata aggregator, which will add any leftover
|
||||
* space to one of the free space managers when freed.
|
||||
*
|
||||
* This is a non-starter, since the entire objective is to settle the
|
||||
* free space managers.
|
||||
*
|
||||
* Hence the decision to call H5FD_alloc() directly.
|
||||
*
|
||||
* As discussed in PROBLEM above, if f->shared->alignment is not 1,
|
||||
* Hence the decision to call H5FD_alloc() directly.
|
||||
*
|
||||
* As discussed in PROBLEM above, if f->shared->alignment is not 1,
|
||||
* this has the possibility of generating a fragment of file space
|
||||
* that would typically be inserted into one of the free space managers.
|
||||
*
|
||||
* This is isn't good, but due to schedule pressure, we will just drop
|
||||
* the fragement on the floor for now.
|
||||
* the fragment on the floor for now.
|
||||
*/
|
||||
if(hdr_fspace)
|
||||
if(H5FS_alloc_vfd_alloc_hdr_and_section_info(f, dxpl_id, hdr_fspace,
|
||||
|
@ -51,15 +51,13 @@
|
||||
|
||||
/* File space manager routines */
|
||||
H5_DLL herr_t H5MF_init_merge_flags(H5F_t *f);
|
||||
H5_DLL herr_t H5MF_get_freespace(H5F_t *f, hid_t dxpl_id, hsize_t *tot_space,
|
||||
hsize_t *meta_size);
|
||||
H5_DLL herr_t H5MF_get_freespace(H5F_t *f, hid_t dxpl_id, hsize_t *tot_space, hsize_t *meta_size);
|
||||
H5_DLL herr_t H5MF_close(H5F_t *f, hid_t dxpl_id);
|
||||
H5_DLL herr_t H5MF_try_close(H5F_t *f, hid_t dxpl_id);
|
||||
|
||||
/* File space allocation routines */
|
||||
H5_DLL haddr_t H5MF_alloc(H5F_t *f, H5FD_mem_t type, hid_t dxpl_id, hsize_t size);
|
||||
H5_DLL haddr_t H5MF_aggr_vfd_alloc(H5F_t *f, H5FD_mem_t type, hid_t dxpl_id,
|
||||
hsize_t size);
|
||||
H5_DLL haddr_t H5MF_aggr_vfd_alloc(H5F_t *f, H5FD_mem_t type, hid_t dxpl_id, hsize_t size);
|
||||
H5_DLL haddr_t H5MF_vfd_alloc(H5F_t *f, hid_t dxpl_id, H5FD_mem_t alloc_type,
|
||||
hsize_t size, hbool_t keep_fragment);
|
||||
H5_DLL herr_t H5MF_xfree(H5F_t *f, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr,
|
||||
@ -78,7 +76,7 @@ H5_DLL haddr_t H5MF_alloc_tmp(H5F_t *f, hsize_t size);
|
||||
H5_DLL herr_t H5MF_free_aggrs(H5F_t *f, hid_t dxpl_id);
|
||||
H5_DLL htri_t H5MF_aggrs_try_shrink_eoa(H5F_t *f, hid_t dxpl_id);
|
||||
|
||||
/* Settling routines */
|
||||
/* Free space manager settling routines */
|
||||
H5_DLL herr_t H5MF_settle_raw_data_fsm(H5F_t *f, hid_t dxpl_id, hbool_t *fsm_settled);
|
||||
H5_DLL herr_t H5MF_settle_meta_data_fsm(H5F_t *f, hid_t dxpl_id, hbool_t *fsm_settled);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user