summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2016-11-12 22:01:30 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2016-11-12 22:01:30 (GMT)
commitd4591ff54d9319346f49a3bc67431f0fa26a8d65 (patch)
treec73146c1bd6bdd942c462b4cf09e02768b687a78 /src
parentd183e9a1a2eadf768996f5cc41d67aa2685a2363 (diff)
downloadhdf5-d4591ff54d9319346f49a3bc67431f0fa26a8d65.zip
hdf5-d4591ff54d9319346f49a3bc67431f0fa26a8d65.tar.gz
hdf5-d4591ff54d9319346f49a3bc67431f0fa26a8d65.tar.bz2
Bring over new 'notify' metadata cache client callback actions for when an
entry is cleaned / dirtied or its [flush dependency] child entry is cleaned / dirtied.
Diffstat (limited to 'src')
-rw-r--r--src/H5ACprivate.h4
-rw-r--r--src/H5C.c81
-rw-r--r--src/H5Cprivate.h6
-rw-r--r--src/H5EAcache.c45
-rw-r--r--src/H5HFcache.c28
5 files changed, 134 insertions, 30 deletions
diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h
index cfb9028..01b7125 100644
--- a/src/H5ACprivate.h
+++ b/src/H5ACprivate.h
@@ -164,6 +164,10 @@ typedef H5C_notify_action_t H5AC_notify_action_t;
#define H5AC_NOTIFY_ACTION_AFTER_LOAD H5C_NOTIFY_ACTION_AFTER_LOAD
#define H5AC_NOTIFY_ACTION_AFTER_FLUSH H5C_NOTIFY_ACTION_AFTER_FLUSH
#define H5AC_NOTIFY_ACTION_BEFORE_EVICT H5C_NOTIFY_ACTION_BEFORE_EVICT
+#define H5AC_NOTIFY_ACTION_ENTRY_DIRTIED H5C_NOTIFY_ACTION_ENTRY_DIRTIED
+#define H5AC_NOTIFY_ACTION_ENTRY_CLEANED H5C_NOTIFY_ACTION_ENTRY_CLEANED
+#define H5AC_NOTIFY_ACTION_CHILD_DIRTIED H5C_NOTIFY_ACTION_CHILD_DIRTIED
+#define H5AC_NOTIFY_ACTION_CHILD_CLEANED H5C_NOTIFY_ACTION_CHILD_CLEANED
#define H5AC__CLASS_NO_FLAGS_SET H5C__CLASS_NO_FLAGS_SET
#define H5AC__CLASS_SPECULATIVE_LOAD_FLAG H5C__CLASS_SPECULATIVE_LOAD_FLAG
diff --git a/src/H5C.c b/src/H5C.c
index 9248f4f..d2812b3 100644
--- a/src/H5C.c
+++ b/src/H5C.c
@@ -1535,6 +1535,13 @@ H5C_mark_entry_dirty(void *thing)
/* Check for entry changing status and do notifications, etc. */
if(was_clean) {
+ /* If the entry's type has a 'notify' callback send a 'entry dirtied'
+ * notice now that the entry is fully integrated into the cache.
+ */
+ if(entry_ptr->type->notify &&
+ (entry_ptr->type->notify)(H5C_NOTIFY_ACTION_ENTRY_DIRTIED, entry_ptr) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, "can't notify client about entry dirty flag set")
+
/* Propagate the dirty flag up the flush dependency chain if appropriate */
if(entry_ptr->flush_dep_nparents > 0)
if(H5C__mark_flush_dep_dirty(entry_ptr) < 0)
@@ -1660,6 +1667,13 @@ H5C_move_entry(H5C_t * cache_ptr,
/* Check for entry changing status and do notifications, etc. */
if(!was_dirty) {
+ /* If the entry's type has a 'notify' callback send a 'entry dirtied'
+ * notice now that the entry is fully integrated into the cache.
+ */
+ if(entry_ptr->type->notify &&
+ (entry_ptr->type->notify)(H5C_NOTIFY_ACTION_ENTRY_DIRTIED, entry_ptr) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, "can't notify client about entry dirty flag set")
+
/* Propagate the dirty flag up the flush dependency chain if appropriate */
if(entry_ptr->flush_dep_nparents > 0)
if(H5C__mark_flush_dep_dirty(entry_ptr) < 0)
@@ -1801,6 +1815,13 @@ H5C_resize_entry(void *thing, size_t new_size)
/* Check for entry changing status and do notifications, etc. */
if(was_clean) {
+ /* If the entry's type has a 'notify' callback send a 'entry dirtied'
+ * notice now that the entry is fully integrated into the cache.
+ */
+ if(entry_ptr->type->notify &&
+ (entry_ptr->type->notify)(H5C_NOTIFY_ACTION_ENTRY_DIRTIED, entry_ptr) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, "can't notify client about entry dirty flag set")
+
/* Propagate the dirty flag up the flush dependency chain if appropriate */
if(entry_ptr->flush_dep_nparents > 0)
if(H5C__mark_flush_dep_dirty(entry_ptr) < 0)
@@ -3026,6 +3047,13 @@ H5C_unprotect(H5F_t * f,
/* Update index for newly dirtied entry */
H5C__UPDATE_INDEX_FOR_ENTRY_DIRTY(cache_ptr, entry_ptr)
+ /* If the entry's type has a 'notify' callback send a 'entry dirtied'
+ * notice now that the entry is fully integrated into the cache.
+ */
+ if(entry_ptr->type->notify &&
+ (entry_ptr->type->notify)(H5C_NOTIFY_ACTION_ENTRY_DIRTIED, entry_ptr) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, "can't notify client about entry dirty flag set")
+
/* Propagate the flush dep dirty flag up the flush dependency chain
* if appropriate */
if(entry_ptr->flush_dep_nparents > 0)
@@ -3034,6 +3062,13 @@ H5C_unprotect(H5F_t * f,
} /* end if */
/* Check for newly clean entry */
else if(!was_clean && !entry_ptr->is_dirty) {
+ /* If the entry's type has a 'notify' callback send a 'entry cleaned'
+ * notice now that the entry is fully integrated into the cache.
+ */
+ if(entry_ptr->type->notify &&
+ (entry_ptr->type->notify)(H5C_NOTIFY_ACTION_ENTRY_CLEANED, entry_ptr) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, "can't notify client about entry dirty flag cleared")
+
/* Propagate the flush dep clean flag up the flush dependency chain
* if appropriate */
if(entry_ptr->flush_dep_nparents > 0)
@@ -3464,6 +3499,11 @@ H5C_create_flush_dependency(void * parent_thing, void * child_thing)
HDassert(parent_entry->flush_dep_ndirty_children < parent_entry->flush_dep_nchildren);
parent_entry->flush_dep_ndirty_children++;
+
+ /* If the parent has a 'notify' callback, send a 'child entry dirtied' notice */
+ if(parent_entry->type->notify &&
+ (parent_entry->type->notify)(H5C_NOTIFY_ACTION_CHILD_DIRTIED, parent_entry) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, "can't notify parent about child entry dirty flag set")
} /* end if */
/* Post-conditions, for successful operation */
@@ -3570,6 +3610,11 @@ H5C_destroy_flush_dependency(void *parent_thing, void * child_thing)
HDassert(parent_entry->flush_dep_ndirty_children > 0);
parent_entry->flush_dep_ndirty_children--;
+
+ /* If the parent has a 'notify' callback, send a 'child entry cleaned' notice */
+ if(parent_entry->type->notify &&
+ (parent_entry->type->notify)(H5C_NOTIFY_ACTION_CHILD_CLEANED, parent_entry) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, "can't notify parent about child entry dirty flag reset")
} /* end if */
/* Shrink or free the parent array if apporpriate */
@@ -5991,6 +6036,13 @@ H5C__flush_single_entry(const H5F_t *f, hid_t dxpl_id, H5C_cache_entry_t *entry_
/* Check for entry changing status and do notifications, etc. */
if(was_dirty) {
+ /* If the entry's type has a 'notify' callback send a 'entry cleaned'
+ * notice now that the entry is fully integrated into the cache.
+ */
+ if(entry_ptr->type->notify &&
+ (entry_ptr->type->notify)(H5C_NOTIFY_ACTION_ENTRY_CLEANED, entry_ptr) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, "can't notify client about entry dirty flag cleared")
+
/* Propagate the clean flag up the flush dependency chain if appropriate */
HDassert(entry_ptr->flush_dep_ndirty_children == 0);
if(entry_ptr->flush_dep_nparents > 0)
@@ -6100,6 +6152,13 @@ H5C__flush_single_entry(const H5F_t *f, hid_t dxpl_id, H5C_cache_entry_t *entry_
if(entry_ptr->type->clear && (entry_ptr->type->clear)(f, (void *)entry_ptr, TRUE) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to clear entry")
+
+ /* If the entry's type has a 'notify' callback send a 'entry cleaned'
+ * notice now that the entry is fully integrated into the cache.
+ */
+ if(entry_ptr->type->notify &&
+ (entry_ptr->type->notify)(H5C_NOTIFY_ACTION_ENTRY_CLEANED, entry_ptr) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, "can't notify client about entry dirty flag cleared")
} /* end if */
/* we are about to discard the in core representation --
@@ -7521,8 +7580,9 @@ static herr_t
H5C__mark_flush_dep_dirty(H5C_cache_entry_t * entry)
{
unsigned u; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_STATIC_NOERR
+ FUNC_ENTER_STATIC
/* Sanity checks */
HDassert(entry);
@@ -7534,9 +7594,15 @@ H5C__mark_flush_dep_dirty(H5C_cache_entry_t * entry)
/* Adjust the parent's number of dirty children */
entry->flush_dep_parent[u]->flush_dep_ndirty_children++;
+
+ /* If the parent has a 'notify' callback, send a 'child entry dirtied' notice */
+ if(entry->flush_dep_parent[u]->type->notify &&
+ (entry->flush_dep_parent[u]->type->notify)(H5C_NOTIFY_ACTION_CHILD_DIRTIED, entry->flush_dep_parent[u]) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, "can't notify parent about child entry dirty flag set")
} /* end for */
- FUNC_LEAVE_NOAPI(SUCCEED)
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__mark_flush_dep_dirty() */
@@ -7559,8 +7625,9 @@ static herr_t
H5C__mark_flush_dep_clean(H5C_cache_entry_t * entry)
{
unsigned u; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_STATIC_NOERR
+ FUNC_ENTER_STATIC
/* Sanity checks */
HDassert(entry);
@@ -7572,9 +7639,15 @@ H5C__mark_flush_dep_clean(H5C_cache_entry_t * entry)
/* Adjust the parent's number of dirty children */
entry->flush_dep_parent[u]->flush_dep_ndirty_children--;
+
+ /* If the parent has a 'notify' callback, send a 'child entry cleaned' notice */
+ if(entry->flush_dep_parent[u]->type->notify &&
+ (entry->flush_dep_parent[u]->type->notify)(H5C_NOTIFY_ACTION_CHILD_CLEANED, entry->flush_dep_parent[u]) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, "can't notify parent about child entry dirty flag reset")
} /* end for */
- FUNC_LEAVE_NOAPI(SUCCEED)
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__mark_flush_dep_clean() */
#ifndef NDEBUG
diff --git a/src/H5Cprivate.h b/src/H5Cprivate.h
index 9db33d2..e98bc07 100644
--- a/src/H5Cprivate.h
+++ b/src/H5Cprivate.h
@@ -1058,9 +1058,13 @@ typedef enum H5C_notify_action_t {
H5C_NOTIFY_ACTION_AFTER_FLUSH, /* Entry has just been flushed to
* file.
*/
- H5C_NOTIFY_ACTION_BEFORE_EVICT /* Entry is about to be evicted
+ H5C_NOTIFY_ACTION_BEFORE_EVICT, /* Entry is about to be evicted
* from cache.
*/
+ H5C_NOTIFY_ACTION_ENTRY_DIRTIED, /* Entry has been marked dirty. */
+ H5C_NOTIFY_ACTION_ENTRY_CLEANED, /* Entry has been marked clean. */
+ H5C_NOTIFY_ACTION_CHILD_DIRTIED, /* Dependent child has been marked dirty. */
+ H5C_NOTIFY_ACTION_CHILD_CLEANED /* Dependent child has been marked clean. */
} H5C_notify_action_t;
/* Cache client callback function pointers */
diff --git a/src/H5EAcache.c b/src/H5EAcache.c
index 9224916..ea8bd0e 100644
--- a/src/H5EAcache.c
+++ b/src/H5EAcache.c
@@ -824,9 +824,13 @@ H5EA__cache_iblock_notify(H5AC_notify_action_t action, void *_thing))
H5E_THROW(H5E_CANTDEPEND, "unable to create flush dependency between index block and header, address = %llu", (unsigned long long)iblock->addr)
break;
- case H5AC_NOTIFY_ACTION_AFTER_FLUSH:
- /* do nothing */
- break;
+ case H5AC_NOTIFY_ACTION_AFTER_FLUSH:
+ case H5AC_NOTIFY_ACTION_ENTRY_DIRTIED:
+ case H5AC_NOTIFY_ACTION_ENTRY_CLEANED:
+ case H5AC_NOTIFY_ACTION_CHILD_DIRTIED:
+ case H5AC_NOTIFY_ACTION_CHILD_CLEANED:
+ /* do nothing */
+ break;
case H5AC_NOTIFY_ACTION_BEFORE_EVICT:
/* Destroy flush dependency on extensible array header */
@@ -1178,14 +1182,14 @@ H5EA__cache_sblock_notify(H5AC_notify_action_t action, void *_thing))
H5E_THROW(H5E_CANTDEPEND, "unable to create flush dependency between super block and index block, address = %llu", (unsigned long long)sblock->addr)
break;
- case H5AC_NOTIFY_ACTION_AFTER_FLUSH:
+ case H5AC_NOTIFY_ACTION_AFTER_FLUSH:
/* Destroy flush dependency on extensible array header, if set */
if(sblock->has_hdr_depend) {
if(H5EA__destroy_flush_depend((H5AC_info_t *)sblock->hdr, (H5AC_info_t *)sblock) < 0)
H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency between super block and header, address = %llu", (unsigned long long)sblock->addr)
sblock->has_hdr_depend = FALSE;
} /* end if */
- break;
+ break;
case H5AC_NOTIFY_ACTION_BEFORE_EVICT:
/* Destroy flush dependency on index block */
@@ -1200,6 +1204,13 @@ H5EA__cache_sblock_notify(H5AC_notify_action_t action, void *_thing))
} /* end if */
break;
+ case H5AC_NOTIFY_ACTION_ENTRY_DIRTIED:
+ case H5AC_NOTIFY_ACTION_ENTRY_CLEANED:
+ case H5AC_NOTIFY_ACTION_CHILD_DIRTIED:
+ case H5AC_NOTIFY_ACTION_CHILD_CLEANED:
+ /* do nothing */
+ break;
+
default:
H5E_THROW(H5E_BADVALUE, "unknown action from metadata cache")
} /* end switch */
@@ -1545,14 +1556,14 @@ H5EA__cache_dblock_notify(H5AC_notify_action_t action, void *_thing))
H5E_THROW(H5E_CANTDEPEND, "unable to create flush dependency between data block and parent, address = %llu", (unsigned long long)dblock->addr)
break;
- case H5AC_NOTIFY_ACTION_AFTER_FLUSH:
+ case H5AC_NOTIFY_ACTION_AFTER_FLUSH:
/* Destroy flush dependency on extensible array header, if set */
if(dblock->has_hdr_depend) {
if(H5EA__destroy_flush_depend((H5AC_info_t *)dblock->hdr, (H5AC_info_t *)dblock) < 0)
H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency between direct block and header, address = %llu", (unsigned long long)dblock->addr)
dblock->has_hdr_depend = FALSE;
} /* end if */
- break;
+ break;
case H5AC_NOTIFY_ACTION_BEFORE_EVICT:
/* Destroy flush dependency on parent */
@@ -1562,11 +1573,18 @@ H5EA__cache_dblock_notify(H5AC_notify_action_t action, void *_thing))
/* Destroy flush dependency on extensible array header, if set */
if(dblock->has_hdr_depend) {
if(H5EA__destroy_flush_depend((H5AC_info_t *)dblock->hdr, (H5AC_info_t *)dblock) < 0)
- H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency between direct block and header, address = %llu", (unsigned long long)dblock->addr)
+ H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency between data block and header, address = %llu", (unsigned long long)dblock->addr)
dblock->has_hdr_depend = FALSE;
} /* end if */
break;
+ case H5AC_NOTIFY_ACTION_ENTRY_DIRTIED:
+ case H5AC_NOTIFY_ACTION_ENTRY_CLEANED:
+ case H5AC_NOTIFY_ACTION_CHILD_DIRTIED:
+ case H5AC_NOTIFY_ACTION_CHILD_CLEANED:
+ /* do nothing */
+ break;
+
default:
H5E_THROW(H5E_BADVALUE, "unknown action from metadata cache")
} /* end switch */
@@ -1879,14 +1897,14 @@ H5EA__cache_dblk_page_notify(H5AC_notify_action_t action, void *_thing))
H5E_THROW(H5E_CANTDEPEND, "unable to create flush dependency between data block page and parent, address = %llu", (unsigned long long)dblk_page->addr)
break;
- case H5AC_NOTIFY_ACTION_AFTER_FLUSH:
+ case H5AC_NOTIFY_ACTION_AFTER_FLUSH:
/* Destroy flush dependency on extensible array header, if set */
if(dblk_page->has_hdr_depend) {
if(H5EA__destroy_flush_depend((H5AC_info_t *)dblk_page->hdr, (H5AC_info_t *)dblk_page) < 0)
H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency between data block page and header, address = %llu", (unsigned long long)dblk_page->addr)
dblk_page->has_hdr_depend = FALSE;
} /* end if */
- break;
+ break;
case H5AC_NOTIFY_ACTION_BEFORE_EVICT:
/* Destroy flush dependency on parent */
@@ -1901,6 +1919,13 @@ H5EA__cache_dblk_page_notify(H5AC_notify_action_t action, void *_thing))
} /* end if */
break;
+ case H5AC_NOTIFY_ACTION_ENTRY_DIRTIED:
+ case H5AC_NOTIFY_ACTION_ENTRY_CLEANED:
+ case H5AC_NOTIFY_ACTION_CHILD_DIRTIED:
+ case H5AC_NOTIFY_ACTION_CHILD_CLEANED:
+ /* do nothing */
+ break;
+
default:
H5E_THROW(H5E_BADVALUE, "unknown action from metadata cache")
} /* end switch */
diff --git a/src/H5HFcache.c b/src/H5HFcache.c
index 31ecc62..3308f25 100644
--- a/src/H5HFcache.c
+++ b/src/H5HFcache.c
@@ -1379,19 +1379,9 @@ H5HF__cache_iblock_notify(H5C_notify_action_t action, void *_thing)
if(action == H5AC_NOTIFY_ACTION_BEFORE_EVICT)
HDassert((iblock->parent == iblock->fd_parent) || ((NULL == iblock->parent) && (iblock->fd_parent)));
- else
- HDassert(iblock->parent == iblock->fd_parent);
/* further sanity checks */
if(iblock->parent == NULL) {
- /* Either this is the root iblock, or the parent pointer is */
- /* invalid. Since we save a copy of the parent pointer on */
- /* the insertion event, it doesn't matter if the parent pointer */
- /* is invalid just before eviction. However, we will not be */
- /* able to function if it is invalid on the insertion event. */
- /* Scream and die if this is the case. */
- HDassert((action == H5C_NOTIFY_ACTION_BEFORE_EVICT) || (iblock->block_off == 0));
-
/* pointer from hdr to root iblock will not be set up unless */
/* the fractal heap has already pinned the hdr. Do what */
/* sanity checking we can. */
@@ -1433,6 +1423,10 @@ H5HF__cache_iblock_notify(H5C_notify_action_t action, void *_thing)
break;
case H5AC_NOTIFY_ACTION_AFTER_FLUSH:
+ case H5AC_NOTIFY_ACTION_ENTRY_DIRTIED:
+ case H5AC_NOTIFY_ACTION_ENTRY_CLEANED:
+ case H5AC_NOTIFY_ACTION_CHILD_DIRTIED:
+ case H5AC_NOTIFY_ACTION_CHILD_CLEANED:
/* do nothing */
break;
@@ -1633,11 +1627,11 @@ H5HF__cache_dblock_deserialize(const void *_image, size_t len, void *_udata,
/* Check for I/O filters on this heap */
if(hdr->filter_len > 0) {
- H5Z_cb_t filter_cb = {NULL, NULL}; /* Filter callback structure */
- size_t nbytes; /* Number of bytes used in buffer, after applying reverse filters */
- void *read_buf; /* Pointer to buffer to read in */
- size_t read_size; /* Size of filtered direct block to read */
- unsigned filter_mask; /* Excluded filters for direct block */
+ H5Z_cb_t filter_cb = {NULL, NULL}; /* Filter callback structure */
+ size_t nbytes; /* Number of bytes used in buffer, after applying reverse filters */
+ void *read_buf; /* Pointer to buffer to read in */
+ size_t read_size; /* Size of filtered direct block to read */
+ unsigned filter_mask; /* Excluded filters for direct block */
/* Check for root direct block */
if(par_info->iblock == NULL)
@@ -2394,6 +2388,10 @@ H5HF__cache_dblock_notify(H5C_notify_action_t action, void *_thing)
break;
case H5AC_NOTIFY_ACTION_AFTER_FLUSH:
+ case H5AC_NOTIFY_ACTION_ENTRY_DIRTIED:
+ case H5AC_NOTIFY_ACTION_ENTRY_CLEANED:
+ case H5AC_NOTIFY_ACTION_CHILD_DIRTIED:
+ case H5AC_NOTIFY_ACTION_CHILD_CLEANED:
/* do nothing */
break;