summaryrefslogtreecommitdiffstats
path: root/src/H5BT.c
diff options
context:
space:
mode:
authorJohn Mainzer <mainzer@hdfgroup.org>2005-06-24 06:30:29 (GMT)
committerJohn Mainzer <mainzer@hdfgroup.org>2005-06-24 06:30:29 (GMT)
commit7f8e3460261851cdad1e344d8929d2817e3149ad (patch)
tree760d0e8dd581c4d4245a7e8acf51254f0c29d1ad /src/H5BT.c
parent2ab6b12b552e9260e2e76640a788b5a3744c6a9f (diff)
downloadhdf5-7f8e3460261851cdad1e344d8929d2817e3149ad.zip
hdf5-7f8e3460261851cdad1e344d8929d2817e3149ad.tar.gz
hdf5-7f8e3460261851cdad1e344d8929d2817e3149ad.tar.bz2
[svn-r10978] Purpose:
Interim checkin of code changes moving management of the is_dirty flag into the cache code. Description: Prior to this checkin, management of the is_dirty flag was handled above the level of the metadata cache. This can no longer be allowed, as it introduces a race condition in the proposed fix for a cache coherency bug in PHDF5. Solution: Move management fo the is_dirty flag to the cache code proper. Entries are now marked as dirty via a flag on the unprotect call. Platforms tested: h5committested Misc. update:
Diffstat (limited to 'src/H5BT.c')
-rw-r--r--src/H5BT.c81
1 files changed, 73 insertions, 8 deletions
diff --git a/src/H5BT.c b/src/H5BT.c
index 20c35a7..5ee8a00 100644
--- a/src/H5BT.c
+++ b/src/H5BT.c
@@ -69,6 +69,16 @@ H5FL_DEFINE(H5BT_t);
* koziol@ncsa.uiuc.edu
* Mar 10 2005
*
+ * Modifications:
+ *
+ *
+ * John Mainzer 6/8/05
+ * Removed code setting the is_dirty field of the cache info.
+ * This is no longer pemitted, as the cache code is now
+ * manageing this field. Since this function uses a call to
+ * H5AC_set() (which marks the entry dirty automaticly), no
+ * other change is required.
+ *
*-------------------------------------------------------------------------
*/
herr_t
@@ -91,7 +101,6 @@ H5BT_create(H5F_t *f, hid_t dxpl_id, haddr_t *addr_p)
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for block tracker info")
/* Assign internal information */
- bt->cache_info.is_dirty = TRUE;
bt->max_block_size = 0; /* Indicate that the value is invalid */
bt->min_block_size = HSIZET_MAX; /* Indicate that the value is invalid */
@@ -190,11 +199,19 @@ H5BT_insert_modify_cb(void *_record, void *_op_data, hbool_t *changed)
* koziol@ncsa.uiuc.edu
* Mar 10 2005
*
+ * Modifications:
+ *
+ * John Mainzer, 6/8/05
+ * Modified the function to use the new dirtied parameter of
+ * of H5AC_unprotect() instead of modifying the is_dirty
+ * field of the cache info.
+ *
*-------------------------------------------------------------------------
*/
herr_t
H5BT_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, haddr_t offset, hsize_t length)
{
+ hbool_t bt_dirtied = FALSE;
H5BT_t *bt = NULL; /* The new B-tree header information */
H5BT_blk_info_t lower, upper; /* Info for blocks less than & greater than new block */
hbool_t lower_valid = FALSE, upper_valid = FALSE; /* Lower & upper blocks valid? */
@@ -405,7 +422,7 @@ H5BT_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, haddr_t offset, hsize_t lengt
done:
/* Release the block tracker info */
- if (bt && H5AC_unprotect(f, dxpl_id, H5AC_BLTR, addr, bt, H5AC__NO_FLAGS_SET) < 0)
+ if (bt && H5AC_unprotect(f, dxpl_id, H5AC_BLTR, addr, bt, bt_dirtied, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_BLKTRK, H5E_CANTUNPROTECT, FAIL, "unable to release block tracker info")
FUNC_LEAVE_NOAPI(ret_value)
@@ -423,11 +440,19 @@ done:
* koziol@ncsa.uiuc.edu
* Mar 10 2005
*
+ * Modifications:
+ *
+ * John Mainzer, 6/17/05
+ * Modified the function to use the new dirtied parameter of
+ * of H5AC_unprotect() instead of modifying the is_dirty
+ * field of the cache info.
+ *
*-------------------------------------------------------------------------
*/
herr_t
H5BT_get_total_size(H5F_t *f, hid_t dxpl_id, haddr_t addr, hsize_t *tot_size)
{
+ hbool_t bt_dirtied = FALSE;
H5BT_t *bt = NULL; /* The new B-tree header information */
herr_t ret_value=SUCCEED;
@@ -449,7 +474,7 @@ H5BT_get_total_size(H5F_t *f, hid_t dxpl_id, haddr_t addr, hsize_t *tot_size)
done:
/* Release the block tracker info */
- if (bt && H5AC_unprotect(f, dxpl_id, H5AC_BLTR, addr, bt, H5AC__NO_FLAGS_SET) < 0)
+ if (bt && H5AC_unprotect(f, dxpl_id, H5AC_BLTR, addr, bt, bt_dirtied, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_BLKTRK, H5E_CANTUNPROTECT, FAIL, "unable to release block tracker info")
FUNC_LEAVE_NOAPI(ret_value)
@@ -498,11 +523,19 @@ H5BT_remove_find_cb(const void *_record, void *_op_data)
* koziol@ncsa.uiuc.edu
* Mar 11 2005
*
+ * Modifications:
+ *
+ * John Mainzer, 6/8/05
+ * Modified the function to use the new dirtied parameter of
+ * of H5AC_unprotect() instead of modifying the is_dirty
+ * field of the cache info.
+ *
*-------------------------------------------------------------------------
*/
herr_t
H5BT_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, haddr_t offset, hsize_t length)
{
+ hbool_t bt_dirtied = FALSE;
H5BT_t *bt = NULL; /* The new B-tree header information */
H5BT_blk_info_t found; /* Block info found */
hsize_t nblks; /* Number of blocks tracked */
@@ -645,7 +678,7 @@ HGOTO_ERROR(H5E_BLKTRK, H5E_UNSUPPORTED, FAIL, "Couldn't find block to remove")
done:
/* Release the block tracker info */
- if (bt && H5AC_unprotect(f, dxpl_id, H5AC_BLTR, addr, bt, H5AC__NO_FLAGS_SET) < 0)
+ if (bt && H5AC_unprotect(f, dxpl_id, H5AC_BLTR, addr, bt, bt_dirtied, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_BLKTRK, H5E_CANTUNPROTECT, FAIL, "unable to release block tracker info")
FUNC_LEAVE_NOAPI(ret_value)
@@ -700,11 +733,19 @@ H5BT_locate_cb(const void *_record, void *_op_data)
* koziol@ncsa.uiuc.edu
* Mar 24 2005
*
+ * Modifications:
+ *
+ * John Mainzer, 6/8/05
+ * Modified the function to use the new dirtied parameter of
+ * of H5AC_unprotect() instead of modifying the is_dirty
+ * field of the cache info.
+ *
*-------------------------------------------------------------------------
*/
htri_t
H5BT_locate(H5F_t *f, hid_t dxpl_id, haddr_t addr, hsize_t size, haddr_t *locate_addr, hsize_t *locate_size)
{
+ hbool_t bt_dirtied = FALSE;
H5BT_t *bt = NULL; /* The new B-tree header information */
H5BT_locate_t found; /* Block info found */
htri_t ret_value=TRUE;
@@ -739,7 +780,7 @@ H5BT_locate(H5F_t *f, hid_t dxpl_id, haddr_t addr, hsize_t size, haddr_t *locate
done:
/* Release the block tracker info */
- if (bt && H5AC_unprotect(f, dxpl_id, H5AC_BLTR, addr, bt, H5AC__NO_FLAGS_SET) < 0)
+ if (bt && H5AC_unprotect(f, dxpl_id, H5AC_BLTR, addr, bt, bt_dirtied, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_BLKTRK, H5E_CANTUNPROTECT, FAIL, "unable to release block tracker info")
FUNC_LEAVE_NOAPI(ret_value)
@@ -760,11 +801,19 @@ done:
* koziol@ncsa.uiuc.edu
* Mar 25 2005
*
+ * Modifications:
+ *
+ * John Mainzer, 6/8/05
+ * Modified the function to use the new dirtied parameter of
+ * of H5AC_unprotect() instead of modifying the is_dirty
+ * field of the cache info.
+ *
*-------------------------------------------------------------------------
*/
herr_t
H5BT_iterate(H5F_t *f, hid_t dxpl_id, haddr_t addr, H5BT_operator_t op, void *op_data)
{
+ hbool_t bt_dirtied = FALSE;
H5BT_t *bt = NULL; /* The new B-tree header information */
herr_t ret_value;
@@ -787,7 +836,7 @@ H5BT_iterate(H5F_t *f, hid_t dxpl_id, haddr_t addr, H5BT_operator_t op, void *op
done:
/* Release the block tracker info */
- if (bt && H5AC_unprotect(f, dxpl_id, H5AC_BLTR, addr, bt, H5AC__NO_FLAGS_SET) < 0)
+ if (bt && H5AC_unprotect(f, dxpl_id, H5AC_BLTR, addr, bt, bt_dirtied, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_BLKTRK, H5E_CANTUNPROTECT, FAIL, "unable to release block tracker info")
FUNC_LEAVE_NOAPI(ret_value)
@@ -836,12 +885,20 @@ H5BT_neighbor_cb(const void *_record, void *_op_data)
* koziol@ncsa.uiuc.edu
* Mar 28 2005
*
+ * Modifications:
+ *
+ * John Mainzer, 6/8/05
+ * Modified the function to use the new dirtied parameter of
+ * of H5AC_unprotect() instead of modifying the is_dirty
+ * field of the cache info.
+ *
*-------------------------------------------------------------------------
*/
herr_t
H5BT_neighbor(H5F_t *f, hid_t dxpl_id, haddr_t addr, H5BT_compare_t range,
haddr_t range_addr, H5BT_blk_info_t *found_block)
{
+ hbool_t bt_dirtied = FALSE;
H5BT_t *bt = NULL; /* The new B-tree header information */
H5BT_blk_info_t find; /* Information for locating block */
H5BT_blk_info_t found; /* Block info found */
@@ -873,7 +930,7 @@ H5BT_neighbor(H5F_t *f, hid_t dxpl_id, haddr_t addr, H5BT_compare_t range,
done:
/* Release the block tracker info */
- if (bt && H5AC_unprotect(f, dxpl_id, H5AC_BLTR, addr, bt, H5AC__NO_FLAGS_SET) < 0)
+ if (bt && H5AC_unprotect(f, dxpl_id, H5AC_BLTR, addr, bt, bt_dirtied, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_BLKTRK, H5E_CANTUNPROTECT, FAIL, "unable to release block tracker info")
FUNC_LEAVE_NOAPI(ret_value)
@@ -891,11 +948,19 @@ done:
* koziol@ncsa.uiuc.edu
* Mar 14 2005
*
+ * Modifications:
+ *
+ * John Mainzer, 6/8/05
+ * Modified the function to use the new dirtied parameter of
+ * of H5AC_unprotect() instead of modifying the is_dirty
+ * field of the cache info.
+ *
*-------------------------------------------------------------------------
*/
herr_t
H5BT_delete(H5F_t *f, hid_t dxpl_id, haddr_t addr)
{
+ hbool_t bt_dirtied = FALSE;
H5BT_t *bt = NULL; /* The new B-tree header information */
herr_t ret_value=SUCCEED;
@@ -921,7 +986,7 @@ H5BT_delete(H5F_t *f, hid_t dxpl_id, haddr_t addr)
done:
/* Release the block tracker info */
- if (bt && H5AC_unprotect(f, dxpl_id, H5AC_BLTR, addr, bt, H5AC__DELETED_FLAG) < 0)
+ if (bt && H5AC_unprotect(f, dxpl_id, H5AC_BLTR, addr, bt, bt_dirtied, H5AC__DELETED_FLAG) < 0)
HDONE_ERROR(H5E_BLKTRK, H5E_CANTUNPROTECT, FAIL, "unable to release block tracker info")
FUNC_LEAVE_NOAPI(ret_value)