summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Mainzer <mainzer@hdfgroup.org>2004-12-22 22:58:00 (GMT)
committerJohn Mainzer <mainzer@hdfgroup.org>2004-12-22 22:58:00 (GMT)
commit2c58126fdd9c91aa3be076fbb9971f0f1df968e9 (patch)
treee5e11f634bfbd911e488330db442ad1ec2a0bb7d
parentc2188b9781e440824181aa85884fa24f95bfcef0 (diff)
downloadhdf5-2c58126fdd9c91aa3be076fbb9971f0f1df968e9.zip
hdf5-2c58126fdd9c91aa3be076fbb9971f0f1df968e9.tar.gz
hdf5-2c58126fdd9c91aa3be076fbb9971f0f1df968e9.tar.bz2
[svn-r9700] Purpose:
Fix a bug in the cache caused by a slightly over active sanity check. Description: When the #define H5C_DO_SANITY_CHECKS is TRUE, the macro H5C__DLL_PRE_INSERT_SC is executed prior to inserting an entry in the LRU list. The macro performs a variety of sanity checks, and flags an error if any of the checks fail. Prior to this update, the macro used to check to see if the target list had length 1 and size <= 0. The new epoch marker entries used in the age out cache size reduction algorithm have size zero -- making it possible for this sanity check to fail incorrectly. Note that cache sanity checks are disabled in the CVS version of the code, so this bug and bug fix should be invisible unless you are working with the cache, and turn the sanity checks on. Solution: Removed the offending clause in H5C__DLL_PRE_INSERT_SC. Since the size used in the macro is typically a size_t and thus cannot have negative value, there was no point in changing it to "size < 0". Platforms tested: Ran a serial test on heping. Under the circumstances, I didn't feel the need for further testing. Misc. update:
-rw-r--r--src/H5C.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/src/H5C.c b/src/H5C.c
index 1e2f92a..2b60248 100644
--- a/src/H5C.c
+++ b/src/H5C.c
@@ -144,6 +144,30 @@
* good enough.
* JRM - 12/9/04
*
+ *
+ * In the H5C__DLL_PRE_INSERT_SC macro, replaced the lines:
+ *
+ * ( ( (len) == 1 ) &&
+ * ( ( (head_ptr) != (tail_ptr) ) || ( (Size) <= 0 ) ||
+ * ( (head_ptr) == NULL ) || ( (head_ptr)->size != (Size) )
+ * )
+ * ) ||
+ *
+ * with:
+ *
+ * ( ( (len) == 1 ) &&
+ * ( ( (head_ptr) != (tail_ptr) ) ||
+ * ( (head_ptr) == NULL ) || ( (head_ptr)->size != (Size) )
+ * )
+ * ) ||
+ *
+ * Epoch markers have size 0, so we can now have a non-empty list with
+ * zero size. Hence the "( (Size) <= 0 )" clause cause false failures
+ * in the sanity check. Since "Size" is typically a size_t, it can't
+ * take on negative values, and thus the revised clause "( (Size) < 0 )"
+ * caused compiler warnings.
+ * JRM - 12/22/04
+ *
****************************************************************************/
#if H5C_DO_SANITY_CHECKS
@@ -198,7 +222,7 @@ if ( ( (entry_ptr) == NULL ) || \
) || \
( (len) < 0 ) || \
( ( (len) == 1 ) && \
- ( ( (head_ptr) != (tail_ptr) ) || ( (Size) <= 0 ) || \
+ ( ( (head_ptr) != (tail_ptr) ) || \
( (head_ptr) == NULL ) || ( (head_ptr)->size != (Size) ) \
) \
) || \