30 #error "Do not include this file outside the H5C package!" 38 #include "H5Cprivate.h" 42 #include "H5SLprivate.h" 55 #define H5C__MAX_PASSES_ON_FLUSH 4 839 #define H5C__HASH_TABLE_LEN (64 * 1024) 841 #define H5C__H5C_T_MAGIC 0x005CAC0E 842 #define H5C__MAX_NUM_TYPE_IDS 19 843 #define H5C__PREFIX_LEN 32 856 const char * (* type_name_table_ptr);
878 #if H5C_DO_SANITY_CHECKS 879 int64_t slist_len_increase;
880 int64_t slist_size_increase;
928 #if H5C_COLLECT_CACHE_STATS 954 int64_t total_ht_insertions;
955 int64_t total_ht_deletions;
956 int64_t successful_ht_searches;
957 int64_t total_successful_ht_search_depth;
958 int64_t failed_ht_searches;
959 int64_t total_failed_ht_search_depth;
961 int32_t max_index_len;
962 size_t max_index_size;
963 size_t max_clean_index_size;
964 size_t max_dirty_index_size;
966 int32_t max_slist_len;
967 size_t max_slist_size;
975 int64_t calls_to_msic;
976 int64_t total_entries_skipped_in_msic;
977 int64_t total_entries_scanned_in_msic;
978 int32_t max_entries_skipped_in_msic;
979 int32_t max_entries_scanned_in_msic;
980 int64_t entries_scanned_to_make_space;
982 #if H5C_COLLECT_CACHE_ENTRY_STATS 1100 #if H5C_DO_SANITY_CHECKS 1102 #define H5C__DLL_PRE_REMOVE_SC(entry_ptr, head_ptr, tail_ptr, len, Size, fv) \ 1103 if ( ( (head_ptr) == NULL ) || \ 1104 ( (tail_ptr) == NULL ) || \ 1105 ( (entry_ptr) == NULL ) || \ 1107 ( (Size) < (entry_ptr)->size ) || \ 1108 ( ( (entry_ptr)->prev == NULL ) && ( (head_ptr) != (entry_ptr) ) ) || \ 1109 ( ( (entry_ptr)->next == NULL ) && ( (tail_ptr) != (entry_ptr) ) ) || \ 1110 ( ( (len) == 1 ) && \ 1111 ( ! ( ( (head_ptr) == (entry_ptr) ) && \ 1112 ( (tail_ptr) == (entry_ptr) ) && \ 1113 ( (entry_ptr)->next == NULL ) && \ 1114 ( (entry_ptr)->prev == NULL ) && \ 1115 ( (Size) == (entry_ptr)->size ) \ 1120 HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, (fv), "DLL pre remove SC failed") \ 1123 #define H5C__DLL_SC(head_ptr, tail_ptr, len, Size, fv) \ 1124 if ( ( ( ( (head_ptr) == NULL ) || ( (tail_ptr) == NULL ) ) && \ 1125 ( (head_ptr) != (tail_ptr) ) \ 1129 ( ( (len) == 1 ) && \ 1130 ( ( (head_ptr) != (tail_ptr) ) || \ 1131 ( (head_ptr) == NULL ) || ( (head_ptr)->size != (Size) ) \ 1134 ( ( (len) >= 1 ) && \ 1135 ( ( (head_ptr) == NULL ) || ( (head_ptr)->prev != NULL ) || \ 1136 ( (tail_ptr) == NULL ) || ( (tail_ptr)->next != NULL ) \ 1140 HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, (fv), "DLL sanity check failed") \ 1143 #define H5C__DLL_PRE_INSERT_SC(entry_ptr, head_ptr, tail_ptr, len, Size, fv) \ 1144 if ( ( (entry_ptr) == NULL ) || \ 1145 ( (entry_ptr)->next != NULL ) || \ 1146 ( (entry_ptr)->prev != NULL ) || \ 1147 ( ( ( (head_ptr) == NULL ) || ( (tail_ptr) == NULL ) ) && \ 1148 ( (head_ptr) != (tail_ptr) ) \ 1151 ( ( (len) == 1 ) && \ 1152 ( ( (head_ptr) != (tail_ptr) ) || \ 1153 ( (head_ptr) == NULL ) || ( (head_ptr)->size != (Size) ) \ 1156 ( ( (len) >= 1 ) && \ 1157 ( ( (head_ptr) == NULL ) || ( (head_ptr)->prev != NULL ) || \ 1158 ( (tail_ptr) == NULL ) || ( (tail_ptr)->next != NULL ) \ 1162 HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, (fv), "DLL pre insert SC failed") \ 1165 #define H5C__DLL_PRE_SIZE_UPDATE_SC(dll_len, dll_size, old_size, new_size) \ 1166 if ( ( (dll_len) <= 0 ) || \ 1167 ( (dll_size) <= 0 ) || \ 1168 ( (old_size) <= 0 ) || \ 1169 ( (old_size) > (dll_size) ) || \ 1170 ( (new_size) <= 0 ) || \ 1171 ( ( (dll_len) == 1 ) && ( (old_size) != (dll_size) ) ) ) { \ 1172 HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "DLL pre size update SC failed") \ 1175 #define H5C__DLL_POST_SIZE_UPDATE_SC(dll_len, dll_size, old_size, new_size) \ 1176 if ( ( (new_size) > (dll_size) ) || \ 1177 ( ( (dll_len) == 1 ) && ( (new_size) != (dll_size) ) ) ) { \ 1178 HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "DLL post size update SC failed") \ 1183 #define H5C__DLL_PRE_REMOVE_SC(entry_ptr, head_ptr, tail_ptr, len, Size, fv) 1184 #define H5C__DLL_SC(head_ptr, tail_ptr, len, Size, fv) 1185 #define H5C__DLL_PRE_INSERT_SC(entry_ptr, head_ptr, tail_ptr, len, Size, fv) 1186 #define H5C__DLL_PRE_SIZE_UPDATE_SC(dll_len, dll_size, old_size, new_size) 1187 #define H5C__DLL_POST_SIZE_UPDATE_SC(dll_len, dll_size, old_size, new_size) 1192 #define H5C__DLL_APPEND(entry_ptr, head_ptr, tail_ptr, len, Size, fail_val) \ 1193 H5C__DLL_PRE_INSERT_SC(entry_ptr, head_ptr, tail_ptr, len, Size, \ 1195 if ( (head_ptr) == NULL ) \ 1197 (head_ptr) = (entry_ptr); \ 1198 (tail_ptr) = (entry_ptr); \ 1202 (tail_ptr)->next = (entry_ptr); \ 1203 (entry_ptr)->prev = (tail_ptr); \ 1204 (tail_ptr) = (entry_ptr); \ 1207 (Size) += (entry_ptr)->size; 1209 #define H5C__DLL_PREPEND(entry_ptr, head_ptr, tail_ptr, len, Size, fail_val) \ 1210 H5C__DLL_PRE_INSERT_SC(entry_ptr, head_ptr, tail_ptr, len, Size, \ 1212 if ( (head_ptr) == NULL ) \ 1214 (head_ptr) = (entry_ptr); \ 1215 (tail_ptr) = (entry_ptr); \ 1219 (head_ptr)->prev = (entry_ptr); \ 1220 (entry_ptr)->next = (head_ptr); \ 1221 (head_ptr) = (entry_ptr); \ 1224 (Size) += entry_ptr->size; 1226 #define H5C__DLL_REMOVE(entry_ptr, head_ptr, tail_ptr, len, Size, fail_val) \ 1227 H5C__DLL_PRE_REMOVE_SC(entry_ptr, head_ptr, tail_ptr, len, Size, \ 1230 if ( (head_ptr) == (entry_ptr) ) \ 1232 (head_ptr) = (entry_ptr)->next; \ 1233 if ( (head_ptr) != NULL ) \ 1235 (head_ptr)->prev = NULL; \ 1240 (entry_ptr)->prev->next = (entry_ptr)->next; \ 1242 if ( (tail_ptr) == (entry_ptr) ) \ 1244 (tail_ptr) = (entry_ptr)->prev; \ 1245 if ( (tail_ptr) != NULL ) \ 1247 (tail_ptr)->next = NULL; \ 1252 (entry_ptr)->next->prev = (entry_ptr)->prev; \ 1254 entry_ptr->next = NULL; \ 1255 entry_ptr->prev = NULL; \ 1257 (Size) -= entry_ptr->size; \ 1260 #define H5C__DLL_UPDATE_FOR_SIZE_CHANGE(dll_len, dll_size, old_size, new_size) \ 1261 H5C__DLL_PRE_SIZE_UPDATE_SC(dll_len, dll_size, old_size, new_size) \ 1262 (dll_size) -= (old_size); \ 1263 (dll_size) += (new_size); \ 1264 H5C__DLL_POST_SIZE_UPDATE_SC(dll_len, dll_size, old_size, new_size) 1266 #if H5C_DO_SANITY_CHECKS 1268 #define H5C__AUX_DLL_PRE_REMOVE_SC(entry_ptr, hd_ptr, tail_ptr, len, Size, fv) \ 1269 if ( ( (hd_ptr) == NULL ) || \ 1270 ( (tail_ptr) == NULL ) || \ 1271 ( (entry_ptr) == NULL ) || \ 1273 ( (Size) < (entry_ptr)->size ) || \ 1274 ( ( (Size) == (entry_ptr)->size ) && ( ! ( (len) == 1 ) ) ) || \ 1275 ( ( (entry_ptr)->aux_prev == NULL ) && ( (hd_ptr) != (entry_ptr) ) ) || \ 1276 ( ( (entry_ptr)->aux_next == NULL ) && ( (tail_ptr) != (entry_ptr) ) ) || \ 1277 ( ( (len) == 1 ) && \ 1278 ( ! ( ( (hd_ptr) == (entry_ptr) ) && ( (tail_ptr) == (entry_ptr) ) && \ 1279 ( (entry_ptr)->aux_next == NULL ) && \ 1280 ( (entry_ptr)->aux_prev == NULL ) && \ 1281 ( (Size) == (entry_ptr)->size ) \ 1286 HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, (fv), "aux DLL pre remove SC failed") \ 1289 #define H5C__AUX_DLL_SC(head_ptr, tail_ptr, len, Size, fv) \ 1290 if ( ( ( ( (head_ptr) == NULL ) || ( (tail_ptr) == NULL ) ) && \ 1291 ( (head_ptr) != (tail_ptr) ) \ 1295 ( ( (len) == 1 ) && \ 1296 ( ( (head_ptr) != (tail_ptr) ) || ( (Size) <= 0 ) || \ 1297 ( (head_ptr) == NULL ) || ( (head_ptr)->size != (Size) ) \ 1300 ( ( (len) >= 1 ) && \ 1301 ( ( (head_ptr) == NULL ) || ( (head_ptr)->aux_prev != NULL ) || \ 1302 ( (tail_ptr) == NULL ) || ( (tail_ptr)->aux_next != NULL ) \ 1306 HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, (fv), "AUX DLL sanity check failed") \ 1309 #define H5C__AUX_DLL_PRE_INSERT_SC(entry_ptr, hd_ptr, tail_ptr, len, Size, fv) \ 1310 if ( ( (entry_ptr) == NULL ) || \ 1311 ( (entry_ptr)->aux_next != NULL ) || \ 1312 ( (entry_ptr)->aux_prev != NULL ) || \ 1313 ( ( ( (hd_ptr) == NULL ) || ( (tail_ptr) == NULL ) ) && \ 1314 ( (hd_ptr) != (tail_ptr) ) \ 1317 ( ( (len) == 1 ) && \ 1318 ( ( (hd_ptr) != (tail_ptr) ) || ( (Size) <= 0 ) || \ 1319 ( (hd_ptr) == NULL ) || ( (hd_ptr)->size != (Size) ) \ 1322 ( ( (len) >= 1 ) && \ 1323 ( ( (hd_ptr) == NULL ) || ( (hd_ptr)->aux_prev != NULL ) || \ 1324 ( (tail_ptr) == NULL ) || ( (tail_ptr)->aux_next != NULL ) \ 1328 HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, (fv), "AUX DLL pre insert SC failed") \ 1333 #define H5C__AUX_DLL_PRE_REMOVE_SC(entry_ptr, hd_ptr, tail_ptr, len, Size, fv) 1334 #define H5C__AUX_DLL_SC(head_ptr, tail_ptr, len, Size, fv) 1335 #define H5C__AUX_DLL_PRE_INSERT_SC(entry_ptr, hd_ptr, tail_ptr, len, Size, fv) 1340 #define H5C__AUX_DLL_APPEND(entry_ptr, head_ptr, tail_ptr, len, Size, fail_val)\ 1341 H5C__AUX_DLL_PRE_INSERT_SC(entry_ptr, head_ptr, tail_ptr, len, Size, \ 1343 if ( (head_ptr) == NULL ) \ 1345 (head_ptr) = (entry_ptr); \ 1346 (tail_ptr) = (entry_ptr); \ 1350 (tail_ptr)->aux_next = (entry_ptr); \ 1351 (entry_ptr)->aux_prev = (tail_ptr); \ 1352 (tail_ptr) = (entry_ptr); \ 1355 (Size) += entry_ptr->size; 1357 #define H5C__AUX_DLL_PREPEND(entry_ptr, head_ptr, tail_ptr, len, Size, fv) \ 1358 H5C__AUX_DLL_PRE_INSERT_SC(entry_ptr, head_ptr, tail_ptr, len, Size, \ 1360 if ( (head_ptr) == NULL ) \ 1362 (head_ptr) = (entry_ptr); \ 1363 (tail_ptr) = (entry_ptr); \ 1367 (head_ptr)->aux_prev = (entry_ptr); \ 1368 (entry_ptr)->aux_next = (head_ptr); \ 1369 (head_ptr) = (entry_ptr); \ 1372 (Size) += entry_ptr->size; 1374 #define H5C__AUX_DLL_REMOVE(entry_ptr, head_ptr, tail_ptr, len, Size, fv) \ 1375 H5C__AUX_DLL_PRE_REMOVE_SC(entry_ptr, head_ptr, tail_ptr, len, Size, \ 1378 if ( (head_ptr) == (entry_ptr) ) \ 1380 (head_ptr) = (entry_ptr)->aux_next; \ 1381 if ( (head_ptr) != NULL ) \ 1383 (head_ptr)->aux_prev = NULL; \ 1388 (entry_ptr)->aux_prev->aux_next = (entry_ptr)->aux_next; \ 1390 if ( (tail_ptr) == (entry_ptr) ) \ 1392 (tail_ptr) = (entry_ptr)->aux_prev; \ 1393 if ( (tail_ptr) != NULL ) \ 1395 (tail_ptr)->aux_next = NULL; \ 1400 (entry_ptr)->aux_next->aux_prev = (entry_ptr)->aux_prev; \ 1402 entry_ptr->aux_next = NULL; \ 1403 entry_ptr->aux_prev = NULL; \ 1405 (Size) -= entry_ptr->size; \ 1439 #define H5C__UPDATE_CACHE_HIT_RATE_STATS(cache_ptr, hit) \ 1440 (cache_ptr->cache_accesses)++; \ 1442 (cache_ptr->cache_hits)++; \ 1445 #if H5C_COLLECT_CACHE_STATS 1447 #define H5C__UPDATE_MAX_INDEX_SIZE_STATS(cache_ptr) \ 1448 if ( (cache_ptr)->index_size > (cache_ptr)->max_index_size ) \ 1449 (cache_ptr)->max_index_size = (cache_ptr)->index_size; \ 1450 if ( (cache_ptr)->clean_index_size > \ 1451 (cache_ptr)->max_clean_index_size ) \ 1452 (cache_ptr)->max_clean_index_size = \ 1453 (cache_ptr)->clean_index_size; \ 1454 if ( (cache_ptr)->dirty_index_size > \ 1455 (cache_ptr)->max_dirty_index_size ) \ 1456 (cache_ptr)->max_dirty_index_size = \ 1457 (cache_ptr)->dirty_index_size; 1459 #define H5C__UPDATE_STATS_FOR_DIRTY_PIN(cache_ptr, entry_ptr) \ 1460 (((cache_ptr)->dirty_pins)[(entry_ptr)->type->id])++; 1462 #define H5C__UPDATE_STATS_FOR_UNPROTECT(cache_ptr) \ 1463 if ( (cache_ptr)->slist_len > (cache_ptr)->max_slist_len ) \ 1464 (cache_ptr)->max_slist_len = (cache_ptr)->slist_len; \ 1465 if ( (cache_ptr)->slist_size > (cache_ptr)->max_slist_size ) \ 1466 (cache_ptr)->max_slist_size = (cache_ptr)->slist_size; \ 1467 if ( (cache_ptr)->pel_len > (cache_ptr)->max_pel_len ) \ 1468 (cache_ptr)->max_pel_len = (cache_ptr)->pel_len; \ 1469 if ( (cache_ptr)->pel_size > (cache_ptr)->max_pel_size ) \ 1470 (cache_ptr)->max_pel_size = (cache_ptr)->pel_size; 1472 #define H5C__UPDATE_STATS_FOR_MOVE(cache_ptr, entry_ptr) \ 1473 if ( cache_ptr->flush_in_progress ) { \ 1474 ((cache_ptr)->cache_flush_moves[(entry_ptr)->type->id])++; \ 1476 if ( entry_ptr->flush_in_progress ) { \ 1477 ((cache_ptr)->entry_flush_moves[(entry_ptr)->type->id])++; \ 1479 (((cache_ptr)->moves)[(entry_ptr)->type->id])++; 1481 #define H5C__UPDATE_STATS_FOR_ENTRY_SIZE_CHANGE(cache_ptr, entry_ptr, new_size)\ 1482 if ( cache_ptr->flush_in_progress ) { \ 1483 ((cache_ptr)->cache_flush_size_changes[(entry_ptr)->type->id])++; \ 1485 if ( entry_ptr->flush_in_progress ) { \ 1486 ((cache_ptr)->entry_flush_size_changes[(entry_ptr)->type->id])++; \ 1488 if ( (entry_ptr)->size < (new_size) ) { \ 1489 ((cache_ptr)->size_increases[(entry_ptr)->type->id])++; \ 1490 H5C__UPDATE_MAX_INDEX_SIZE_STATS(cache_ptr) \ 1491 if ( (cache_ptr)->slist_size > (cache_ptr)->max_slist_size ) \ 1492 (cache_ptr)->max_slist_size = (cache_ptr)->slist_size; \ 1493 if ( (cache_ptr)->pl_size > (cache_ptr)->max_pl_size ) \ 1494 (cache_ptr)->max_pl_size = (cache_ptr)->pl_size; \ 1495 } else if ( (entry_ptr)->size > (new_size) ) { \ 1496 ((cache_ptr)->size_decreases[(entry_ptr)->type->id])++; \ 1499 #define H5C__UPDATE_STATS_FOR_HT_INSERTION(cache_ptr) \ 1500 (cache_ptr)->total_ht_insertions++; 1502 #define H5C__UPDATE_STATS_FOR_HT_DELETION(cache_ptr) \ 1503 (cache_ptr)->total_ht_deletions++; 1505 #define H5C__UPDATE_STATS_FOR_HT_SEARCH(cache_ptr, success, depth) \ 1507 (cache_ptr)->successful_ht_searches++; \ 1508 (cache_ptr)->total_successful_ht_search_depth += depth; \ 1510 (cache_ptr)->failed_ht_searches++; \ 1511 (cache_ptr)->total_failed_ht_search_depth += depth; \ 1514 #define H5C__UPDATE_STATS_FOR_UNPIN(cache_ptr, entry_ptr) \ 1515 ((cache_ptr)->unpins)[(entry_ptr)->type->id]++; 1517 #if H5C_COLLECT_CACHE_ENTRY_STATS 1519 #define H5C__RESET_CACHE_ENTRY_STATS(entry_ptr) \ 1520 (entry_ptr)->accesses = 0; \ 1521 (entry_ptr)->clears = 0; \ 1522 (entry_ptr)->flushes = 0; \ 1523 (entry_ptr)->pins = 0; 1525 #define H5C__UPDATE_STATS_FOR_CLEAR(cache_ptr, entry_ptr) \ 1526 (((cache_ptr)->clears)[(entry_ptr)->type->id])++; \ 1527 if ( (entry_ptr)->is_pinned ) { \ 1528 (((cache_ptr)->pinned_clears)[(entry_ptr)->type->id])++; \ 1530 ((entry_ptr)->clears)++; 1532 #define H5C__UPDATE_STATS_FOR_FLUSH(cache_ptr, entry_ptr) \ 1533 (((cache_ptr)->flushes)[(entry_ptr)->type->id])++; \ 1534 if ( (entry_ptr)->is_pinned ) { \ 1535 (((cache_ptr)->pinned_flushes)[(entry_ptr)->type->id])++; \ 1537 ((entry_ptr)->flushes)++; 1539 #define H5C__UPDATE_STATS_FOR_EVICTION(cache_ptr, entry_ptr) \ 1540 (((cache_ptr)->evictions)[(entry_ptr)->type->id])++; \ 1541 if ( (entry_ptr)->accesses > \ 1542 ((cache_ptr)->max_accesses)[(entry_ptr)->type->id] ) { \ 1543 ((cache_ptr)->max_accesses)[(entry_ptr)->type->id] \ 1544 = (entry_ptr)->accesses; \ 1546 if ( (entry_ptr)->accesses < \ 1547 ((cache_ptr)->min_accesses)[(entry_ptr)->type->id] ) { \ 1548 ((cache_ptr)->min_accesses)[(entry_ptr)->type->id] \ 1549 = (entry_ptr)->accesses; \ 1551 if ( (entry_ptr)->clears > \ 1552 ((cache_ptr)->max_clears)[(entry_ptr)->type->id] ) { \ 1553 ((cache_ptr)->max_clears)[(entry_ptr)->type->id] \ 1554 = (entry_ptr)->clears; \ 1556 if ( (entry_ptr)->flushes > \ 1557 ((cache_ptr)->max_flushes)[(entry_ptr)->type->id] ) { \ 1558 ((cache_ptr)->max_flushes)[(entry_ptr)->type->id] \ 1559 = (entry_ptr)->flushes; \ 1561 if ( (entry_ptr)->size > \ 1562 ((cache_ptr)->max_size)[(entry_ptr)->type->id] ) { \ 1563 ((cache_ptr)->max_size)[(entry_ptr)->type->id] \ 1564 = (entry_ptr)->size; \ 1566 if ( (entry_ptr)->pins > \ 1567 ((cache_ptr)->max_pins)[(entry_ptr)->type->id] ) { \ 1568 ((cache_ptr)->max_pins)[(entry_ptr)->type->id] \ 1569 = (entry_ptr)->pins; \ 1572 #define H5C__UPDATE_STATS_FOR_INSERTION(cache_ptr, entry_ptr) \ 1573 (((cache_ptr)->insertions)[(entry_ptr)->type->id])++; \ 1574 if ( (entry_ptr)->is_pinned ) { \ 1575 (((cache_ptr)->pinned_insertions)[(entry_ptr)->type->id])++; \ 1576 ((cache_ptr)->pins)[(entry_ptr)->type->id]++; \ 1577 (entry_ptr)->pins++; \ 1578 if ( (cache_ptr)->pel_len > (cache_ptr)->max_pel_len ) \ 1579 (cache_ptr)->max_pel_len = (cache_ptr)->pel_len; \ 1580 if ( (cache_ptr)->pel_size > (cache_ptr)->max_pel_size ) \ 1581 (cache_ptr)->max_pel_size = (cache_ptr)->pel_size; \ 1583 if ( (cache_ptr)->index_len > (cache_ptr)->max_index_len ) \ 1584 (cache_ptr)->max_index_len = (cache_ptr)->index_len; \ 1585 H5C__UPDATE_MAX_INDEX_SIZE_STATS(cache_ptr) \ 1586 if ( (cache_ptr)->slist_len > (cache_ptr)->max_slist_len ) \ 1587 (cache_ptr)->max_slist_len = (cache_ptr)->slist_len; \ 1588 if ( (cache_ptr)->slist_size > (cache_ptr)->max_slist_size ) \ 1589 (cache_ptr)->max_slist_size = (cache_ptr)->slist_size; \ 1590 if ( (entry_ptr)->size > \ 1591 ((cache_ptr)->max_size)[(entry_ptr)->type->id] ) { \ 1592 ((cache_ptr)->max_size)[(entry_ptr)->type->id] \ 1593 = (entry_ptr)->size; \ 1596 #define H5C__UPDATE_STATS_FOR_PROTECT(cache_ptr, entry_ptr, hit) \ 1598 ((cache_ptr)->hits)[(entry_ptr)->type->id]++; \ 1600 ((cache_ptr)->misses)[(entry_ptr)->type->id]++; \ 1601 if ( ! ((entry_ptr)->is_read_only) ) { \ 1602 ((cache_ptr)->write_protects)[(entry_ptr)->type->id]++; \ 1604 ((cache_ptr)->read_protects)[(entry_ptr)->type->id]++; \ 1605 if ( ((entry_ptr)->ro_ref_count) > \ 1606 ((cache_ptr)->max_read_protects)[(entry_ptr)->type->id] ) { \ 1607 ((cache_ptr)->max_read_protects)[(entry_ptr)->type->id] = \ 1608 ((entry_ptr)->ro_ref_count); \ 1611 if ( (cache_ptr)->index_len > (cache_ptr)->max_index_len ) \ 1612 (cache_ptr)->max_index_len = (cache_ptr)->index_len; \ 1613 H5C__UPDATE_MAX_INDEX_SIZE_STATS(cache_ptr) \ 1614 if ( (cache_ptr)->pl_len > (cache_ptr)->max_pl_len ) \ 1615 (cache_ptr)->max_pl_len = (cache_ptr)->pl_len; \ 1616 if ( (cache_ptr)->pl_size > (cache_ptr)->max_pl_size ) \ 1617 (cache_ptr)->max_pl_size = (cache_ptr)->pl_size; \ 1618 if ( (entry_ptr)->size > \ 1619 ((cache_ptr)->max_size)[(entry_ptr)->type->id] ) { \ 1620 ((cache_ptr)->max_size)[(entry_ptr)->type->id] \ 1621 = (entry_ptr)->size; \ 1623 ((entry_ptr)->accesses)++; 1625 #define H5C__UPDATE_STATS_FOR_PIN(cache_ptr, entry_ptr) \ 1626 ((cache_ptr)->pins)[(entry_ptr)->type->id]++; \ 1627 (entry_ptr)->pins++; \ 1628 if ( (cache_ptr)->pel_len > (cache_ptr)->max_pel_len ) \ 1629 (cache_ptr)->max_pel_len = (cache_ptr)->pel_len; \ 1630 if ( (cache_ptr)->pel_size > (cache_ptr)->max_pel_size ) \ 1631 (cache_ptr)->max_pel_size = (cache_ptr)->pel_size; 1635 #define H5C__RESET_CACHE_ENTRY_STATS(entry_ptr) 1637 #define H5C__UPDATE_STATS_FOR_CLEAR(cache_ptr, entry_ptr) \ 1638 if ( (entry_ptr)->is_pinned ) { \ 1639 (((cache_ptr)->pinned_clears)[(entry_ptr)->type->id])++; \ 1641 (((cache_ptr)->clears)[(entry_ptr)->type->id])++; 1643 #define H5C__UPDATE_STATS_FOR_FLUSH(cache_ptr, entry_ptr) \ 1644 (((cache_ptr)->flushes)[(entry_ptr)->type->id])++; \ 1645 if ( (entry_ptr)->is_pinned ) { \ 1646 (((cache_ptr)->pinned_flushes)[(entry_ptr)->type->id])++; \ 1649 #define H5C__UPDATE_STATS_FOR_EVICTION(cache_ptr, entry_ptr) \ 1650 (((cache_ptr)->evictions)[(entry_ptr)->type->id])++; 1652 #define H5C__UPDATE_STATS_FOR_INSERTION(cache_ptr, entry_ptr) \ 1653 (((cache_ptr)->insertions)[(entry_ptr)->type->id])++; \ 1654 if ( (entry_ptr)->is_pinned ) { \ 1655 (((cache_ptr)->pinned_insertions)[(entry_ptr)->type->id])++; \ 1656 ((cache_ptr)->pins)[(entry_ptr)->type->id]++; \ 1657 if ( (cache_ptr)->pel_len > (cache_ptr)->max_pel_len ) \ 1658 (cache_ptr)->max_pel_len = (cache_ptr)->pel_len; \ 1659 if ( (cache_ptr)->pel_size > (cache_ptr)->max_pel_size ) \ 1660 (cache_ptr)->max_pel_size = (cache_ptr)->pel_size; \ 1662 if ( (cache_ptr)->index_len > (cache_ptr)->max_index_len ) \ 1663 (cache_ptr)->max_index_len = (cache_ptr)->index_len; \ 1664 H5C__UPDATE_MAX_INDEX_SIZE_STATS(cache_ptr) \ 1665 if ( (cache_ptr)->slist_len > (cache_ptr)->max_slist_len ) \ 1666 (cache_ptr)->max_slist_len = (cache_ptr)->slist_len; \ 1667 if ( (cache_ptr)->slist_size > (cache_ptr)->max_slist_size ) \ 1668 (cache_ptr)->max_slist_size = (cache_ptr)->slist_size; 1670 #define H5C__UPDATE_STATS_FOR_PROTECT(cache_ptr, entry_ptr, hit) \ 1672 ((cache_ptr)->hits)[(entry_ptr)->type->id]++; \ 1674 ((cache_ptr)->misses)[(entry_ptr)->type->id]++; \ 1675 if ( ! ((entry_ptr)->is_read_only) ) { \ 1676 ((cache_ptr)->write_protects)[(entry_ptr)->type->id]++; \ 1678 ((cache_ptr)->read_protects)[(entry_ptr)->type->id]++; \ 1679 if ( ((entry_ptr)->ro_ref_count) > \ 1680 ((cache_ptr)->max_read_protects)[(entry_ptr)->type->id] ) { \ 1681 ((cache_ptr)->max_read_protects)[(entry_ptr)->type->id] = \ 1682 ((entry_ptr)->ro_ref_count); \ 1685 if ( (cache_ptr)->index_len > (cache_ptr)->max_index_len ) \ 1686 (cache_ptr)->max_index_len = (cache_ptr)->index_len; \ 1687 H5C__UPDATE_MAX_INDEX_SIZE_STATS(cache_ptr) \ 1688 if ( (cache_ptr)->pl_len > (cache_ptr)->max_pl_len ) \ 1689 (cache_ptr)->max_pl_len = (cache_ptr)->pl_len; \ 1690 if ( (cache_ptr)->pl_size > (cache_ptr)->max_pl_size ) \ 1691 (cache_ptr)->max_pl_size = (cache_ptr)->pl_size; 1693 #define H5C__UPDATE_STATS_FOR_PIN(cache_ptr, entry_ptr) \ 1694 ((cache_ptr)->pins)[(entry_ptr)->type->id]++; \ 1695 if ( (cache_ptr)->pel_len > (cache_ptr)->max_pel_len ) \ 1696 (cache_ptr)->max_pel_len = (cache_ptr)->pel_len; \ 1697 if ( (cache_ptr)->pel_size > (cache_ptr)->max_pel_size ) \ 1698 (cache_ptr)->max_pel_size = (cache_ptr)->pel_size; 1704 #define H5C__RESET_CACHE_ENTRY_STATS(entry_ptr) 1705 #define H5C__UPDATE_STATS_FOR_DIRTY_PIN(cache_ptr, entry_ptr) 1706 #define H5C__UPDATE_STATS_FOR_UNPROTECT(cache_ptr) 1707 #define H5C__UPDATE_STATS_FOR_MOVE(cache_ptr, entry_ptr) 1708 #define H5C__UPDATE_STATS_FOR_ENTRY_SIZE_CHANGE(cache_ptr, entry_ptr, new_size) 1709 #define H5C__UPDATE_STATS_FOR_HT_INSERTION(cache_ptr) 1710 #define H5C__UPDATE_STATS_FOR_HT_DELETION(cache_ptr) 1711 #define H5C__UPDATE_STATS_FOR_HT_SEARCH(cache_ptr, success, depth) 1712 #define H5C__UPDATE_STATS_FOR_INSERTION(cache_ptr, entry_ptr) 1713 #define H5C__UPDATE_STATS_FOR_CLEAR(cache_ptr, entry_ptr) 1714 #define H5C__UPDATE_STATS_FOR_FLUSH(cache_ptr, entry_ptr) 1715 #define H5C__UPDATE_STATS_FOR_EVICTION(cache_ptr, entry_ptr) 1716 #define H5C__UPDATE_STATS_FOR_PROTECT(cache_ptr, entry_ptr, hit) 1717 #define H5C__UPDATE_STATS_FOR_PIN(cache_ptr, entry_ptr) 1718 #define H5C__UPDATE_STATS_FOR_UNPIN(cache_ptr, entry_ptr) 1745 #define H5C__HASH_MASK ((size_t)(H5C__HASH_TABLE_LEN - 1) << 3) 1747 #define H5C__HASH_FCN(x) (int)(((x) & H5C__HASH_MASK) >> 3) 1749 #if H5C_DO_SANITY_CHECKS 1751 #define H5C__PRE_HT_INSERT_SC(cache_ptr, entry_ptr, fail_val) \ 1752 if ( ( (cache_ptr) == NULL ) || \ 1753 ( (cache_ptr)->magic != H5C__H5C_T_MAGIC ) || \ 1754 ( (entry_ptr) == NULL ) || \ 1755 ( ! H5F_addr_defined((entry_ptr)->addr) ) || \ 1756 ( (entry_ptr)->ht_next != NULL ) || \ 1757 ( (entry_ptr)->ht_prev != NULL ) || \ 1758 ( (entry_ptr)->size <= 0 ) || \ 1759 ( (k = H5C__HASH_FCN((entry_ptr)->addr)) < 0 ) || \ 1760 ( k >= H5C__HASH_TABLE_LEN ) || \ 1761 ( (cache_ptr)->index_size != \ 1762 ((cache_ptr)->clean_index_size + \ 1763 (cache_ptr)->dirty_index_size) ) ) { \ 1764 HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, fail_val, \ 1765 "Pre HT insert SC failed") \ 1768 #define H5C__PRE_HT_REMOVE_SC(cache_ptr, entry_ptr) \ 1769 if ( ( (cache_ptr) == NULL ) || \ 1770 ( (cache_ptr)->magic != H5C__H5C_T_MAGIC ) || \ 1771 ( (cache_ptr)->index_len < 1 ) || \ 1772 ( (entry_ptr) == NULL ) || \ 1773 ( (cache_ptr)->index_size < (entry_ptr)->size ) || \ 1774 ( ! H5F_addr_defined((entry_ptr)->addr) ) || \ 1775 ( (entry_ptr)->size <= 0 ) || \ 1776 ( H5C__HASH_FCN((entry_ptr)->addr) < 0 ) || \ 1777 ( H5C__HASH_FCN((entry_ptr)->addr) >= H5C__HASH_TABLE_LEN ) || \ 1778 ( ((cache_ptr)->index)[(H5C__HASH_FCN((entry_ptr)->addr))] \ 1780 ( ( ((cache_ptr)->index)[(H5C__HASH_FCN((entry_ptr)->addr))] \ 1781 != (entry_ptr) ) && \ 1782 ( (entry_ptr)->ht_prev == NULL ) ) || \ 1783 ( ( ((cache_ptr)->index)[(H5C__HASH_FCN((entry_ptr)->addr))] == \ 1785 ( (entry_ptr)->ht_prev != NULL ) ) || \ 1786 ( (cache_ptr)->index_size != \ 1787 ((cache_ptr)->clean_index_size + \ 1788 (cache_ptr)->dirty_index_size) ) ) { \ 1789 HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Pre HT remove SC failed") \ 1793 #define H5C__PRE_HT_SEARCH_SC(cache_ptr, Addr, fail_val) \ 1794 if ( ( (cache_ptr) == NULL ) || \ 1795 ( (cache_ptr)->magic != H5C__H5C_T_MAGIC ) || \ 1796 ( (cache_ptr)->index_size != \ 1797 ((cache_ptr)->clean_index_size + (cache_ptr)->dirty_index_size) ) || \ 1798 ( ! H5F_addr_defined(Addr) ) || \ 1799 ( H5C__HASH_FCN(Addr) < 0 ) || \ 1800 ( H5C__HASH_FCN(Addr) >= H5C__HASH_TABLE_LEN ) ) { \ 1801 HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, fail_val, "Pre HT search SC failed") \ 1805 #define H5C__POST_SUC_HT_SEARCH_SC(cache_ptr, entry_ptr, Addr, k, fail_val) \ 1806 if ( ( (cache_ptr) == NULL ) || \ 1807 ( (cache_ptr)->magic != H5C__H5C_T_MAGIC ) || \ 1808 ( (cache_ptr)->index_len < 1 ) || \ 1809 ( (entry_ptr) == NULL ) || \ 1810 ( (cache_ptr)->index_size < (entry_ptr)->size ) || \ 1811 ( (cache_ptr)->index_size != \ 1812 ((cache_ptr)->clean_index_size + (cache_ptr)->dirty_index_size) ) || \ 1813 ( H5F_addr_ne((entry_ptr)->addr, (Addr)) ) || \ 1814 ( (entry_ptr)->size <= 0 ) || \ 1815 ( ((cache_ptr)->index)[k] == NULL ) || \ 1816 ( ( ((cache_ptr)->index)[k] != (entry_ptr) ) && \ 1817 ( (entry_ptr)->ht_prev == NULL ) ) || \ 1818 ( ( ((cache_ptr)->index)[k] == (entry_ptr) ) && \ 1819 ( (entry_ptr)->ht_prev != NULL ) ) || \ 1820 ( ( (entry_ptr)->ht_prev != NULL ) && \ 1821 ( (entry_ptr)->ht_prev->ht_next != (entry_ptr) ) ) || \ 1822 ( ( (entry_ptr)->ht_next != NULL ) && \ 1823 ( (entry_ptr)->ht_next->ht_prev != (entry_ptr) ) ) ) { \ 1824 HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, fail_val, \ 1825 "Post successful HT search SC failed") \ 1829 #define H5C__POST_HT_SHIFT_TO_FRONT(cache_ptr, entry_ptr, k, fail_val) \ 1830 if ( ( (cache_ptr) == NULL ) || \ 1831 ( ((cache_ptr)->index)[k] != (entry_ptr) ) || \ 1832 ( (entry_ptr)->ht_prev != NULL ) ) { \ 1833 HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, fail_val, \ 1834 "Post HT shift to front SC failed") \ 1837 #define H5C__PRE_HT_ENTRY_SIZE_CHANGE_SC(cache_ptr, old_size, new_size, \ 1838 entry_ptr, was_clean) \ 1839 if ( ( (cache_ptr) == NULL ) || \ 1840 ( (cache_ptr)->index_len <= 0 ) || \ 1841 ( (cache_ptr)->index_size <= 0 ) || \ 1842 ( (new_size) <= 0 ) || \ 1843 ( (old_size) > (cache_ptr)->index_size ) || \ 1844 ( (new_size) <= 0 ) || \ 1845 ( ( (cache_ptr)->index_len == 1 ) && \ 1846 ( (cache_ptr)->index_size != (old_size) ) ) || \ 1847 ( (cache_ptr)->index_size != \ 1848 ((cache_ptr)->clean_index_size + \ 1849 (cache_ptr)->dirty_index_size) ) || \ 1850 ( (entry_ptr == NULL) ) || \ 1851 ( ( !( was_clean ) || \ 1852 ( (cache_ptr)->clean_index_size < (old_size) ) ) && \ 1853 ( ( (was_clean) ) || \ 1854 ( (cache_ptr)->dirty_index_size < (old_size) ) ) ) || \ 1855 ( (entry_ptr) == NULL ) ) { \ 1856 HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ 1857 "Pre HT entry size change SC failed") \ 1860 #define H5C__POST_HT_ENTRY_SIZE_CHANGE_SC(cache_ptr, old_size, new_size, \ 1862 if ( ( (cache_ptr) == NULL ) || \ 1863 ( (cache_ptr)->index_len <= 0 ) || \ 1864 ( (cache_ptr)->index_size <= 0 ) || \ 1865 ( (new_size) > (cache_ptr)->index_size ) || \ 1866 ( (cache_ptr)->index_size != \ 1867 ((cache_ptr)->clean_index_size + \ 1868 (cache_ptr)->dirty_index_size) ) || \ 1869 ( ( !((entry_ptr)->is_dirty ) || \ 1870 ( (cache_ptr)->dirty_index_size < (new_size) ) ) && \ 1871 ( ( ((entry_ptr)->is_dirty) ) || \ 1872 ( (cache_ptr)->clean_index_size < (new_size) ) ) ) || \ 1873 ( ( (cache_ptr)->index_len == 1 ) && \ 1874 ( (cache_ptr)->index_size != (new_size) ) ) ) { \ 1875 HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ 1876 "Post HT entry size change SC failed") \ 1879 #define H5C__PRE_HT_UPDATE_FOR_ENTRY_CLEAN_SC(cache_ptr, entry_ptr) \ 1881 ( (cache_ptr) == NULL ) || \ 1882 ( (cache_ptr)->magic != H5C__H5C_T_MAGIC ) || \ 1883 ( (cache_ptr)->index_len <= 0 ) || \ 1884 ( (entry_ptr) == NULL ) || \ 1885 ( (entry_ptr)->is_dirty != FALSE ) || \ 1886 ( (cache_ptr)->index_size < (entry_ptr)->size ) || \ 1887 ( (cache_ptr)->dirty_index_size < (entry_ptr)->size ) || \ 1888 ( (cache_ptr)->index_size != \ 1889 ((cache_ptr)->clean_index_size + (cache_ptr)->dirty_index_size) ) ) { \ 1890 HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ 1891 "Pre HT update for entry clean SC failed") \ 1894 #define H5C__PRE_HT_UPDATE_FOR_ENTRY_DIRTY_SC(cache_ptr, entry_ptr) \ 1896 ( (cache_ptr) == NULL ) || \ 1897 ( (cache_ptr)->magic != H5C__H5C_T_MAGIC ) || \ 1898 ( (cache_ptr)->index_len <= 0 ) || \ 1899 ( (entry_ptr) == NULL ) || \ 1900 ( (entry_ptr)->is_dirty != TRUE ) || \ 1901 ( (cache_ptr)->index_size < (entry_ptr)->size ) || \ 1902 ( (cache_ptr)->clean_index_size < (entry_ptr)->size ) || \ 1903 ( (cache_ptr)->index_size != \ 1904 ((cache_ptr)->clean_index_size + (cache_ptr)->dirty_index_size) ) ) { \ 1905 HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ 1906 "Pre HT update for entry dirty SC failed") \ 1909 #define H5C__POST_HT_UPDATE_FOR_ENTRY_CLEAN_SC(cache_ptr, entry_ptr) \ 1910 if ( (cache_ptr)->index_size != \ 1911 ((cache_ptr)->clean_index_size + (cache_ptr)->dirty_index_size) ) { \ 1912 HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ 1913 "Post HT update for entry clean SC failed") \ 1916 #define H5C__POST_HT_UPDATE_FOR_ENTRY_DIRTY_SC(cache_ptr, entry_ptr) \ 1917 if ( (cache_ptr)->index_size != \ 1918 ((cache_ptr)->clean_index_size + (cache_ptr)->dirty_index_size) ) { \ 1919 HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ 1920 "Post HT update for entry dirty SC failed") \ 1925 #define H5C__PRE_HT_INSERT_SC(cache_ptr, entry_ptr, fail_val) 1926 #define H5C__PRE_HT_REMOVE_SC(cache_ptr, entry_ptr) 1927 #define H5C__PRE_HT_SEARCH_SC(cache_ptr, Addr, fail_val) 1928 #define H5C__POST_SUC_HT_SEARCH_SC(cache_ptr, entry_ptr, Addr, k, fail_val) 1929 #define H5C__POST_HT_SHIFT_TO_FRONT(cache_ptr, entry_ptr, k, fail_val) 1930 #define H5C__PRE_HT_UPDATE_FOR_ENTRY_CLEAN_SC(cache_ptr, entry_ptr) 1931 #define H5C__PRE_HT_UPDATE_FOR_ENTRY_DIRTY_SC(cache_ptr, entry_ptr) 1932 #define H5C__PRE_HT_ENTRY_SIZE_CHANGE_SC(cache_ptr, old_size, new_size, \ 1933 entry_ptr, was_clean) 1934 #define H5C__POST_HT_ENTRY_SIZE_CHANGE_SC(cache_ptr, old_size, new_size, \ 1936 #define H5C__POST_HT_UPDATE_FOR_ENTRY_CLEAN_SC(cache_ptr, entry_ptr) 1937 #define H5C__POST_HT_UPDATE_FOR_ENTRY_DIRTY_SC(cache_ptr, entry_ptr) 1942 #define H5C__INSERT_IN_INDEX(cache_ptr, entry_ptr, fail_val) \ 1945 H5C__PRE_HT_INSERT_SC(cache_ptr, entry_ptr, fail_val) \ 1946 k = H5C__HASH_FCN((entry_ptr)->addr); \ 1947 if ( ((cache_ptr)->index)[k] == NULL ) \ 1949 ((cache_ptr)->index)[k] = (entry_ptr); \ 1953 (entry_ptr)->ht_next = ((cache_ptr)->index)[k]; \ 1954 (entry_ptr)->ht_next->ht_prev = (entry_ptr); \ 1955 ((cache_ptr)->index)[k] = (entry_ptr); \ 1957 (cache_ptr)->index_len++; \ 1958 (cache_ptr)->index_size += (entry_ptr)->size; \ 1959 if ( (entry_ptr)->is_dirty ) { \ 1960 (cache_ptr)->dirty_index_size += (entry_ptr)->size; \ 1962 (cache_ptr)->clean_index_size += (entry_ptr)->size; \ 1964 H5C__UPDATE_STATS_FOR_HT_INSERTION(cache_ptr) \ 1967 #define H5C__DELETE_FROM_INDEX(cache_ptr, entry_ptr) \ 1970 H5C__PRE_HT_REMOVE_SC(cache_ptr, entry_ptr) \ 1971 k = H5C__HASH_FCN((entry_ptr)->addr); \ 1972 if ( (entry_ptr)->ht_next ) \ 1974 (entry_ptr)->ht_next->ht_prev = (entry_ptr)->ht_prev; \ 1976 if ( (entry_ptr)->ht_prev ) \ 1978 (entry_ptr)->ht_prev->ht_next = (entry_ptr)->ht_next; \ 1980 if ( ((cache_ptr)->index)[k] == (entry_ptr) ) \ 1982 ((cache_ptr)->index)[k] = (entry_ptr)->ht_next; \ 1984 (entry_ptr)->ht_next = NULL; \ 1985 (entry_ptr)->ht_prev = NULL; \ 1986 (cache_ptr)->index_len--; \ 1987 (cache_ptr)->index_size -= (entry_ptr)->size; \ 1988 if ( (entry_ptr)->is_dirty ) { \ 1989 (cache_ptr)->dirty_index_size -= (entry_ptr)->size; \ 1991 (cache_ptr)->clean_index_size -= (entry_ptr)->size; \ 1993 H5C__UPDATE_STATS_FOR_HT_DELETION(cache_ptr) \ 1996 #define H5C__SEARCH_INDEX(cache_ptr, Addr, entry_ptr, fail_val) \ 2000 H5C__PRE_HT_SEARCH_SC(cache_ptr, Addr, fail_val) \ 2001 k = H5C__HASH_FCN(Addr); \ 2002 entry_ptr = ((cache_ptr)->index)[k]; \ 2003 while ( ( entry_ptr ) && ( H5F_addr_ne(Addr, (entry_ptr)->addr) ) ) \ 2005 (entry_ptr) = (entry_ptr)->ht_next; \ 2010 H5C__POST_SUC_HT_SEARCH_SC(cache_ptr, entry_ptr, Addr, k, fail_val) \ 2011 if ( entry_ptr != ((cache_ptr)->index)[k] ) \ 2013 if ( (entry_ptr)->ht_next ) \ 2015 (entry_ptr)->ht_next->ht_prev = (entry_ptr)->ht_prev; \ 2017 HDassert( (entry_ptr)->ht_prev != NULL ); \ 2018 (entry_ptr)->ht_prev->ht_next = (entry_ptr)->ht_next; \ 2019 ((cache_ptr)->index)[k]->ht_prev = (entry_ptr); \ 2020 (entry_ptr)->ht_next = ((cache_ptr)->index)[k]; \ 2021 (entry_ptr)->ht_prev = NULL; \ 2022 ((cache_ptr)->index)[k] = (entry_ptr); \ 2023 H5C__POST_HT_SHIFT_TO_FRONT(cache_ptr, entry_ptr, k, fail_val) \ 2026 H5C__UPDATE_STATS_FOR_HT_SEARCH(cache_ptr, (entry_ptr != NULL), depth) \ 2029 #define H5C__SEARCH_INDEX_NO_STATS(cache_ptr, Addr, entry_ptr, fail_val) \ 2033 H5C__PRE_HT_SEARCH_SC(cache_ptr, Addr, fail_val) \ 2034 k = H5C__HASH_FCN(Addr); \ 2035 entry_ptr = ((cache_ptr)->index)[k]; \ 2036 while ( ( entry_ptr ) && ( H5F_addr_ne(Addr, (entry_ptr)->addr) ) ) \ 2038 (entry_ptr) = (entry_ptr)->ht_next; \ 2043 H5C__POST_SUC_HT_SEARCH_SC(cache_ptr, entry_ptr, Addr, k, fail_val) \ 2044 if ( entry_ptr != ((cache_ptr)->index)[k] ) \ 2046 if ( (entry_ptr)->ht_next ) \ 2048 (entry_ptr)->ht_next->ht_prev = (entry_ptr)->ht_prev; \ 2050 HDassert( (entry_ptr)->ht_prev != NULL ); \ 2051 (entry_ptr)->ht_prev->ht_next = (entry_ptr)->ht_next; \ 2052 ((cache_ptr)->index)[k]->ht_prev = (entry_ptr); \ 2053 (entry_ptr)->ht_next = ((cache_ptr)->index)[k]; \ 2054 (entry_ptr)->ht_prev = NULL; \ 2055 ((cache_ptr)->index)[k] = (entry_ptr); \ 2056 H5C__POST_HT_SHIFT_TO_FRONT(cache_ptr, entry_ptr, k, fail_val) \ 2061 #define H5C__UPDATE_INDEX_FOR_ENTRY_CLEAN(cache_ptr, entry_ptr) \ 2063 H5C__PRE_HT_UPDATE_FOR_ENTRY_CLEAN_SC(cache_ptr, entry_ptr); \ 2064 (cache_ptr)->dirty_index_size -= (entry_ptr)->size; \ 2065 (cache_ptr)->clean_index_size += (entry_ptr)->size; \ 2066 H5C__POST_HT_UPDATE_FOR_ENTRY_CLEAN_SC(cache_ptr, entry_ptr); \ 2069 #define H5C__UPDATE_INDEX_FOR_ENTRY_DIRTY(cache_ptr, entry_ptr) \ 2071 H5C__PRE_HT_UPDATE_FOR_ENTRY_DIRTY_SC(cache_ptr, entry_ptr); \ 2072 (cache_ptr)->clean_index_size -= (entry_ptr)->size; \ 2073 (cache_ptr)->dirty_index_size += (entry_ptr)->size; \ 2074 H5C__POST_HT_UPDATE_FOR_ENTRY_DIRTY_SC(cache_ptr, entry_ptr); \ 2077 #define H5C__UPDATE_INDEX_FOR_SIZE_CHANGE(cache_ptr, old_size, new_size, \ 2078 entry_ptr, was_clean) \ 2080 H5C__PRE_HT_ENTRY_SIZE_CHANGE_SC(cache_ptr, old_size, new_size, \ 2081 entry_ptr, was_clean) \ 2082 (cache_ptr)->index_size -= (old_size); \ 2083 (cache_ptr)->index_size += (new_size); \ 2084 if ( was_clean ) { \ 2085 (cache_ptr)->clean_index_size -= (old_size); \ 2087 (cache_ptr)->dirty_index_size -= (old_size); \ 2089 if ( (entry_ptr)->is_dirty ) { \ 2090 (cache_ptr)->dirty_index_size += (new_size); \ 2092 (cache_ptr)->clean_index_size += (new_size); \ 2094 H5C__POST_HT_ENTRY_SIZE_CHANGE_SC(cache_ptr, old_size, new_size, \ 2159 #if H5C_DO_SANITY_CHECKS 2161 #define H5C__INSERT_ENTRY_IN_SLIST(cache_ptr, entry_ptr, fail_val) \ 2163 HDassert( (cache_ptr) ); \ 2164 HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \ 2165 HDassert( (entry_ptr) ); \ 2166 HDassert( (entry_ptr)->size > 0 ); \ 2167 HDassert( H5F_addr_defined((entry_ptr)->addr) ); \ 2168 HDassert( !((entry_ptr)->in_slist) ); \ 2170 if ( H5SL_insert((cache_ptr)->slist_ptr, entry_ptr, &(entry_ptr)->addr) \ 2172 HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, (fail_val), \ 2173 "Can't insert entry in skip list") \ 2175 (entry_ptr)->in_slist = TRUE; \ 2176 (cache_ptr)->slist_len++; \ 2177 (cache_ptr)->slist_size += (entry_ptr)->size; \ 2178 (cache_ptr)->slist_len_increase++; \ 2179 (cache_ptr)->slist_size_increase += (entry_ptr)->size; \ 2181 HDassert( (cache_ptr)->slist_len > 0 ); \ 2182 HDassert( (cache_ptr)->slist_size > 0 ); \ 2188 #define H5C__INSERT_ENTRY_IN_SLIST(cache_ptr, entry_ptr, fail_val) \ 2190 HDassert( (cache_ptr) ); \ 2191 HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \ 2192 HDassert( (entry_ptr) ); \ 2193 HDassert( (entry_ptr)->size > 0 ); \ 2194 HDassert( H5F_addr_defined((entry_ptr)->addr) ); \ 2195 HDassert( !((entry_ptr)->in_slist) ); \ 2197 if ( H5SL_insert((cache_ptr)->slist_ptr, entry_ptr, &(entry_ptr)->addr) \ 2199 HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, (fail_val), \ 2200 "Can't insert entry in skip list") \ 2202 (entry_ptr)->in_slist = TRUE; \ 2203 (cache_ptr)->slist_len++; \ 2204 (cache_ptr)->slist_size += (entry_ptr)->size; \ 2206 HDassert( (cache_ptr)->slist_len > 0 ); \ 2207 HDassert( (cache_ptr)->slist_size > 0 ); \ 2246 #define H5C__REMOVE_ENTRY_FROM_SLIST(cache_ptr, entry_ptr) \ 2248 HDassert( (cache_ptr) ); \ 2249 HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \ 2250 HDassert( (entry_ptr) ); \ 2251 HDassert( !((entry_ptr)->is_protected) ); \ 2252 HDassert( !((entry_ptr)->is_read_only) ); \ 2253 HDassert( ((entry_ptr)->ro_ref_count) == 0 ); \ 2254 HDassert( (entry_ptr)->size > 0 ); \ 2255 HDassert( (entry_ptr)->in_slist ); \ 2256 HDassert( (cache_ptr)->slist_ptr ); \ 2258 if ( H5SL_remove((cache_ptr)->slist_ptr, &(entry_ptr)->addr) \ 2261 HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, \ 2262 "Can't delete entry from skip list.") \ 2264 HDassert( (cache_ptr)->slist_len > 0 ); \ 2265 (cache_ptr)->slist_len--; \ 2266 HDassert( (cache_ptr)->slist_size >= (entry_ptr)->size ); \ 2267 (cache_ptr)->slist_size -= (entry_ptr)->size; \ 2268 (entry_ptr)->in_slist = FALSE; \ 2298 #if H5C_DO_SANITY_CHECKS 2300 #define H5C__UPDATE_SLIST_FOR_SIZE_CHANGE(cache_ptr, old_size, new_size) \ 2302 HDassert( (cache_ptr) ); \ 2303 HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \ 2304 HDassert( (old_size) > 0 ); \ 2305 HDassert( (new_size) > 0 ); \ 2306 HDassert( (old_size) <= (cache_ptr)->slist_size ); \ 2307 HDassert( (cache_ptr)->slist_len > 0 ); \ 2308 HDassert( ((cache_ptr)->slist_len > 1) || \ 2309 ( (cache_ptr)->slist_size == (old_size) ) ); \ 2311 (cache_ptr)->slist_size -= (old_size); \ 2312 (cache_ptr)->slist_size += (new_size); \ 2314 (cache_ptr)->slist_size_increase -= (int64_t)(old_size); \ 2315 (cache_ptr)->slist_size_increase += (int64_t)(new_size); \ 2317 HDassert( (new_size) <= (cache_ptr)->slist_size ); \ 2318 HDassert( ( (cache_ptr)->slist_len > 1 ) || \ 2319 ( (cache_ptr)->slist_size == (new_size) ) ); \ 2324 #define H5C__UPDATE_SLIST_FOR_SIZE_CHANGE(cache_ptr, old_size, new_size) \ 2326 HDassert( (cache_ptr) ); \ 2327 HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \ 2328 HDassert( (old_size) > 0 ); \ 2329 HDassert( (new_size) > 0 ); \ 2330 HDassert( (old_size) <= (cache_ptr)->slist_size ); \ 2331 HDassert( (cache_ptr)->slist_len > 0 ); \ 2332 HDassert( ((cache_ptr)->slist_len > 1) || \ 2333 ( (cache_ptr)->slist_size == (old_size) ) ); \ 2335 (cache_ptr)->slist_size -= (old_size); \ 2336 (cache_ptr)->slist_size += (new_size); \ 2338 HDassert( (new_size) <= (cache_ptr)->slist_size ); \ 2339 HDassert( ( (cache_ptr)->slist_len > 1 ) || \ 2340 ( (cache_ptr)->slist_size == (new_size) ) ); \ 2389 #if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS 2391 #define H5C__FAKE_RP_FOR_MOST_RECENT_ACCESS(cache_ptr, entry_ptr, fail_val) \ 2393 HDassert( (cache_ptr) ); \ 2394 HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \ 2395 HDassert( (entry_ptr) ); \ 2396 HDassert( !((entry_ptr)->is_protected) ); \ 2397 HDassert( !((entry_ptr)->is_read_only) ); \ 2398 HDassert( ((entry_ptr)->ro_ref_count) == 0 ); \ 2399 HDassert( (entry_ptr)->size > 0 ); \ 2401 if ( ! ((entry_ptr)->is_pinned) ) { \ 2408 H5C__DLL_REMOVE((entry_ptr), (cache_ptr)->LRU_head_ptr, \ 2409 (cache_ptr)->LRU_tail_ptr, \ 2410 (cache_ptr)->LRU_list_len, \ 2411 (cache_ptr)->LRU_list_size, (fail_val)) \ 2413 H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->LRU_head_ptr, \ 2414 (cache_ptr)->LRU_tail_ptr, \ 2415 (cache_ptr)->LRU_list_len, \ 2416 (cache_ptr)->LRU_list_size, (fail_val)) \ 2426 if ( (entry_ptr)->is_dirty ) { \ 2427 H5C__AUX_DLL_REMOVE((entry_ptr), (cache_ptr)->dLRU_head_ptr, \ 2428 (cache_ptr)->dLRU_tail_ptr, \ 2429 (cache_ptr)->dLRU_list_len, \ 2430 (cache_ptr)->dLRU_list_size, (fail_val)) \ 2432 H5C__AUX_DLL_PREPEND((entry_ptr), (cache_ptr)->dLRU_head_ptr, \ 2433 (cache_ptr)->dLRU_tail_ptr, \ 2434 (cache_ptr)->dLRU_list_len, \ 2435 (cache_ptr)->dLRU_list_size, (fail_val)) \ 2437 H5C__AUX_DLL_REMOVE((entry_ptr), (cache_ptr)->cLRU_head_ptr, \ 2438 (cache_ptr)->cLRU_tail_ptr, \ 2439 (cache_ptr)->cLRU_list_len, \ 2440 (cache_ptr)->cLRU_list_size, (fail_val)) \ 2442 H5C__AUX_DLL_PREPEND((entry_ptr), (cache_ptr)->cLRU_head_ptr, \ 2443 (cache_ptr)->cLRU_tail_ptr, \ 2444 (cache_ptr)->cLRU_list_len, \ 2445 (cache_ptr)->cLRU_list_size, (fail_val)) \ 2454 #define H5C__FAKE_RP_FOR_MOST_RECENT_ACCESS(cache_ptr, entry_ptr, fail_val) \ 2456 HDassert( (cache_ptr) ); \ 2457 HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \ 2458 HDassert( (entry_ptr) ); \ 2459 HDassert( !((entry_ptr)->is_protected) ); \ 2460 HDassert( !((entry_ptr)->is_read_only) ); \ 2461 HDassert( ((entry_ptr)->ro_ref_count) == 0 ); \ 2462 HDassert( (entry_ptr)->size > 0 ); \ 2464 if ( ! ((entry_ptr)->is_pinned) ) { \ 2471 H5C__DLL_REMOVE((entry_ptr), (cache_ptr)->LRU_head_ptr, \ 2472 (cache_ptr)->LRU_tail_ptr, \ 2473 (cache_ptr)->LRU_list_len, \ 2474 (cache_ptr)->LRU_list_size, (fail_val)) \ 2476 H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->LRU_head_ptr, \ 2477 (cache_ptr)->LRU_tail_ptr, \ 2478 (cache_ptr)->LRU_list_len, \ 2479 (cache_ptr)->LRU_list_size, (fail_val)) \ 2531 #if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS 2533 #define H5C__UPDATE_RP_FOR_EVICTION(cache_ptr, entry_ptr, fail_val) \ 2535 HDassert( (cache_ptr) ); \ 2536 HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \ 2537 HDassert( (entry_ptr) ); \ 2538 HDassert( !((entry_ptr)->is_protected) ); \ 2539 HDassert( !((entry_ptr)->is_read_only) ); \ 2540 HDassert( ((entry_ptr)->ro_ref_count) == 0 ); \ 2541 HDassert( !((entry_ptr)->is_pinned) ); \ 2542 HDassert( (entry_ptr)->size > 0 ); \ 2548 H5C__DLL_REMOVE((entry_ptr), (cache_ptr)->LRU_head_ptr, \ 2549 (cache_ptr)->LRU_tail_ptr, (cache_ptr)->LRU_list_len, \ 2550 (cache_ptr)->LRU_list_size, (fail_val)) \ 2558 if ( (entry_ptr)->is_dirty ) { \ 2560 H5C__AUX_DLL_REMOVE((entry_ptr), (cache_ptr)->dLRU_head_ptr, \ 2561 (cache_ptr)->dLRU_tail_ptr, \ 2562 (cache_ptr)->dLRU_list_len, \ 2563 (cache_ptr)->dLRU_list_size, (fail_val)) \ 2565 H5C__AUX_DLL_REMOVE((entry_ptr), (cache_ptr)->cLRU_head_ptr, \ 2566 (cache_ptr)->cLRU_tail_ptr, \ 2567 (cache_ptr)->cLRU_list_len, \ 2568 (cache_ptr)->cLRU_list_size, (fail_val)) \ 2575 #define H5C__UPDATE_RP_FOR_EVICTION(cache_ptr, entry_ptr, fail_val) \ 2577 HDassert( (cache_ptr) ); \ 2578 HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \ 2579 HDassert( (entry_ptr) ); \ 2580 HDassert( !((entry_ptr)->is_protected) ); \ 2581 HDassert( !((entry_ptr)->is_read_only) ); \ 2582 HDassert( ((entry_ptr)->ro_ref_count) == 0 ); \ 2583 HDassert( !((entry_ptr)->is_pinned) ); \ 2584 HDassert( (entry_ptr)->size > 0 ); \ 2590 H5C__DLL_REMOVE((entry_ptr), (cache_ptr)->LRU_head_ptr, \ 2591 (cache_ptr)->LRU_tail_ptr, (cache_ptr)->LRU_list_len, \ 2592 (cache_ptr)->LRU_list_size, (fail_val)) \ 2644 #if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS 2646 #define H5C__UPDATE_RP_FOR_FLUSH(cache_ptr, entry_ptr, fail_val) \ 2648 HDassert( (cache_ptr) ); \ 2649 HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \ 2650 HDassert( (entry_ptr) ); \ 2651 HDassert( !((entry_ptr)->is_protected) ); \ 2652 HDassert( !((entry_ptr)->is_read_only) ); \ 2653 HDassert( ((entry_ptr)->ro_ref_count) == 0 ); \ 2654 HDassert( (entry_ptr)->size > 0 ); \ 2656 if ( ! ((entry_ptr)->is_pinned) ) { \ 2664 H5C__DLL_REMOVE((entry_ptr), (cache_ptr)->LRU_head_ptr, \ 2665 (cache_ptr)->LRU_tail_ptr, \ 2666 (cache_ptr)->LRU_list_len, \ 2667 (cache_ptr)->LRU_list_size, (fail_val)) \ 2669 H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->LRU_head_ptr, \ 2670 (cache_ptr)->LRU_tail_ptr, \ 2671 (cache_ptr)->LRU_list_len, \ 2672 (cache_ptr)->LRU_list_size, (fail_val)) \ 2685 if ( (entry_ptr)->is_dirty ) { \ 2686 H5C__AUX_DLL_REMOVE((entry_ptr), (cache_ptr)->dLRU_head_ptr, \ 2687 (cache_ptr)->dLRU_tail_ptr, \ 2688 (cache_ptr)->dLRU_list_len, \ 2689 (cache_ptr)->dLRU_list_size, (fail_val)) \ 2691 H5C__AUX_DLL_REMOVE((entry_ptr), (cache_ptr)->cLRU_head_ptr, \ 2692 (cache_ptr)->cLRU_tail_ptr, \ 2693 (cache_ptr)->cLRU_list_len, \ 2694 (cache_ptr)->cLRU_list_size, (fail_val)) \ 2697 H5C__AUX_DLL_PREPEND((entry_ptr), (cache_ptr)->cLRU_head_ptr, \ 2698 (cache_ptr)->cLRU_tail_ptr, \ 2699 (cache_ptr)->cLRU_list_len, \ 2700 (cache_ptr)->cLRU_list_size, (fail_val)) \ 2708 #define H5C__UPDATE_RP_FOR_FLUSH(cache_ptr, entry_ptr, fail_val) \ 2710 HDassert( (cache_ptr) ); \ 2711 HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \ 2712 HDassert( (entry_ptr) ); \ 2713 HDassert( !((entry_ptr)->is_protected) ); \ 2714 HDassert( !((entry_ptr)->is_read_only) ); \ 2715 HDassert( ((entry_ptr)->ro_ref_count) == 0 ); \ 2716 HDassert( (entry_ptr)->size > 0 ); \ 2718 if ( ! ((entry_ptr)->is_pinned) ) { \ 2726 H5C__DLL_REMOVE((entry_ptr), (cache_ptr)->LRU_head_ptr, \ 2727 (cache_ptr)->LRU_tail_ptr, \ 2728 (cache_ptr)->LRU_list_len, \ 2729 (cache_ptr)->LRU_list_size, (fail_val)) \ 2731 H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->LRU_head_ptr, \ 2732 (cache_ptr)->LRU_tail_ptr, \ 2733 (cache_ptr)->LRU_list_len, \ 2734 (cache_ptr)->LRU_list_size, (fail_val)) \ 2790 #if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS 2792 #define H5C__UPDATE_RP_FOR_INSERTION(cache_ptr, entry_ptr, fail_val) \ 2794 HDassert( (cache_ptr) ); \ 2795 HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \ 2796 HDassert( (entry_ptr) ); \ 2797 HDassert( !((entry_ptr)->is_protected) ); \ 2798 HDassert( !((entry_ptr)->is_read_only) ); \ 2799 HDassert( ((entry_ptr)->ro_ref_count) == 0 ); \ 2800 HDassert( (entry_ptr)->size > 0 ); \ 2802 if ( (entry_ptr)->is_pinned ) { \ 2804 H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->pel_head_ptr, \ 2805 (cache_ptr)->pel_tail_ptr, \ 2806 (cache_ptr)->pel_len, \ 2807 (cache_ptr)->pel_size, (fail_val)) \ 2815 H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->LRU_head_ptr, \ 2816 (cache_ptr)->LRU_tail_ptr, \ 2817 (cache_ptr)->LRU_list_len, \ 2818 (cache_ptr)->LRU_list_size, (fail_val)) \ 2824 if ( entry_ptr->is_dirty ) { \ 2825 H5C__AUX_DLL_PREPEND((entry_ptr), (cache_ptr)->dLRU_head_ptr, \ 2826 (cache_ptr)->dLRU_tail_ptr, \ 2827 (cache_ptr)->dLRU_list_len, \ 2828 (cache_ptr)->dLRU_list_size, (fail_val)) \ 2830 H5C__AUX_DLL_PREPEND((entry_ptr), (cache_ptr)->cLRU_head_ptr, \ 2831 (cache_ptr)->cLRU_tail_ptr, \ 2832 (cache_ptr)->cLRU_list_len, \ 2833 (cache_ptr)->cLRU_list_size, (fail_val)) \ 2842 #define H5C__UPDATE_RP_FOR_INSERTION(cache_ptr, entry_ptr, fail_val) \ 2844 HDassert( (cache_ptr) ); \ 2845 HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \ 2846 HDassert( (entry_ptr) ); \ 2847 HDassert( !((entry_ptr)->is_protected) ); \ 2848 HDassert( !((entry_ptr)->is_read_only) ); \ 2849 HDassert( ((entry_ptr)->ro_ref_count) == 0 ); \ 2850 HDassert( (entry_ptr)->size > 0 ); \ 2852 if ( (entry_ptr)->is_pinned ) { \ 2854 H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->pel_head_ptr, \ 2855 (cache_ptr)->pel_tail_ptr, \ 2856 (cache_ptr)->pel_len, \ 2857 (cache_ptr)->pel_size, (fail_val)) \ 2865 H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->LRU_head_ptr, \ 2866 (cache_ptr)->LRU_tail_ptr, \ 2867 (cache_ptr)->LRU_list_len, \ 2868 (cache_ptr)->LRU_list_size, (fail_val)) \ 2925 #if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS 2927 #define H5C__UPDATE_RP_FOR_PROTECT(cache_ptr, entry_ptr, fail_val) \ 2929 HDassert( (cache_ptr) ); \ 2930 HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \ 2931 HDassert( (entry_ptr) ); \ 2932 HDassert( !((entry_ptr)->is_protected) ); \ 2933 HDassert( !((entry_ptr)->is_read_only) ); \ 2934 HDassert( ((entry_ptr)->ro_ref_count) == 0 ); \ 2935 HDassert( (entry_ptr)->size > 0 ); \ 2937 if ( (entry_ptr)->is_pinned ) { \ 2939 H5C__DLL_REMOVE((entry_ptr), (cache_ptr)->pel_head_ptr, \ 2940 (cache_ptr)->pel_tail_ptr, \ 2941 (cache_ptr)->pel_len, \ 2942 (cache_ptr)->pel_size, (fail_val)) \ 2943 HDassert( (cache_ptr)->pel_len >= 0 ); \ 2951 H5C__DLL_REMOVE((entry_ptr), (cache_ptr)->LRU_head_ptr, \ 2952 (cache_ptr)->LRU_tail_ptr, \ 2953 (cache_ptr)->LRU_list_len, \ 2954 (cache_ptr)->LRU_list_size, (fail_val)) \ 2960 if ( (entry_ptr)->is_dirty ) { \ 2962 H5C__AUX_DLL_REMOVE((entry_ptr), (cache_ptr)->dLRU_head_ptr, \ 2963 (cache_ptr)->dLRU_tail_ptr, \ 2964 (cache_ptr)->dLRU_list_len, \ 2965 (cache_ptr)->dLRU_list_size, (fail_val)) \ 2969 H5C__AUX_DLL_REMOVE((entry_ptr), (cache_ptr)->cLRU_head_ptr, \ 2970 (cache_ptr)->cLRU_tail_ptr, \ 2971 (cache_ptr)->cLRU_list_len, \ 2972 (cache_ptr)->cLRU_list_size, (fail_val)) \ 2982 H5C__DLL_APPEND((entry_ptr), (cache_ptr)->pl_head_ptr, \ 2983 (cache_ptr)->pl_tail_ptr, \ 2984 (cache_ptr)->pl_len, \ 2985 (cache_ptr)->pl_size, (fail_val)) \ 2990 #define H5C__UPDATE_RP_FOR_PROTECT(cache_ptr, entry_ptr, fail_val) \ 2992 HDassert( (cache_ptr) ); \ 2993 HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \ 2994 HDassert( (entry_ptr) ); \ 2995 HDassert( !((entry_ptr)->is_protected) ); \ 2996 HDassert( !((entry_ptr)->is_read_only) ); \ 2997 HDassert( ((entry_ptr)->ro_ref_count) == 0 ); \ 2998 HDassert( (entry_ptr)->size > 0 ); \ 3000 if ( (entry_ptr)->is_pinned ) { \ 3002 H5C__DLL_REMOVE((entry_ptr), (cache_ptr)->pel_head_ptr, \ 3003 (cache_ptr)->pel_tail_ptr, \ 3004 (cache_ptr)->pel_len, \ 3005 (cache_ptr)->pel_size, (fail_val)) \ 3006 HDassert( (cache_ptr)->pel_len >= 0 ); \ 3014 H5C__DLL_REMOVE((entry_ptr), (cache_ptr)->LRU_head_ptr, \ 3015 (cache_ptr)->LRU_tail_ptr, \ 3016 (cache_ptr)->LRU_list_len, \ 3017 (cache_ptr)->LRU_list_size, (fail_val)) \ 3026 H5C__DLL_APPEND((entry_ptr), (cache_ptr)->pl_head_ptr, \ 3027 (cache_ptr)->pl_tail_ptr, \ 3028 (cache_ptr)->pl_len, \ 3029 (cache_ptr)->pl_size, (fail_val)) \ 3054 #if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS 3056 #define H5C__UPDATE_RP_FOR_MOVE(cache_ptr, entry_ptr, was_dirty, fail_val) \ 3058 HDassert( (cache_ptr) ); \ 3059 HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \ 3060 HDassert( (entry_ptr) ); \ 3061 HDassert( !((entry_ptr)->is_protected) ); \ 3062 HDassert( !((entry_ptr)->is_read_only) ); \ 3063 HDassert( ((entry_ptr)->ro_ref_count) == 0 ); \ 3064 HDassert( (entry_ptr)->size > 0 ); \ 3066 if ( ! ( (entry_ptr)->is_pinned ) ) { \ 3073 H5C__DLL_REMOVE((entry_ptr), (cache_ptr)->LRU_head_ptr, \ 3074 (cache_ptr)->LRU_tail_ptr, \ 3075 (cache_ptr)->LRU_list_len, \ 3076 (cache_ptr)->LRU_list_size, (fail_val)) \ 3078 H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->LRU_head_ptr, \ 3079 (cache_ptr)->LRU_tail_ptr, \ 3080 (cache_ptr)->LRU_list_len, \ 3081 (cache_ptr)->LRU_list_size, (fail_val)) \ 3086 if ( was_dirty ) { \ 3088 H5C__AUX_DLL_REMOVE((entry_ptr), \ 3089 (cache_ptr)->dLRU_head_ptr, \ 3090 (cache_ptr)->dLRU_tail_ptr, \ 3091 (cache_ptr)->dLRU_list_len, \ 3092 (cache_ptr)->dLRU_list_size, \ 3097 H5C__AUX_DLL_REMOVE((entry_ptr), \ 3098 (cache_ptr)->cLRU_head_ptr, \ 3099 (cache_ptr)->cLRU_tail_ptr, \ 3100 (cache_ptr)->cLRU_list_len, \ 3101 (cache_ptr)->cLRU_list_size, \ 3109 if ( (entry_ptr)->is_dirty ) { \ 3111 H5C__AUX_DLL_PREPEND((entry_ptr), \ 3112 (cache_ptr)->dLRU_head_ptr, \ 3113 (cache_ptr)->dLRU_tail_ptr, \ 3114 (cache_ptr)->dLRU_list_len, \ 3115 (cache_ptr)->dLRU_list_size, \ 3120 H5C__AUX_DLL_PREPEND((entry_ptr), \ 3121 (cache_ptr)->cLRU_head_ptr, \ 3122 (cache_ptr)->cLRU_tail_ptr, \ 3123 (cache_ptr)->cLRU_list_len, \ 3124 (cache_ptr)->cLRU_list_size, \ 3134 #define H5C__UPDATE_RP_FOR_MOVE(cache_ptr, entry_ptr, was_dirty, fail_val) \ 3136 HDassert( (cache_ptr) ); \ 3137 HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \ 3138 HDassert( (entry_ptr) ); \ 3139 HDassert( !((entry_ptr)->is_protected) ); \ 3140 HDassert( !((entry_ptr)->is_read_only) ); \ 3141 HDassert( ((entry_ptr)->ro_ref_count) == 0 ); \ 3142 HDassert( (entry_ptr)->size > 0 ); \ 3144 if ( ! ( (entry_ptr)->is_pinned ) ) { \ 3151 H5C__DLL_REMOVE((entry_ptr), (cache_ptr)->LRU_head_ptr, \ 3152 (cache_ptr)->LRU_tail_ptr, \ 3153 (cache_ptr)->LRU_list_len, \ 3154 (cache_ptr)->LRU_list_size, (fail_val)) \ 3156 H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->LRU_head_ptr, \ 3157 (cache_ptr)->LRU_tail_ptr, \ 3158 (cache_ptr)->LRU_list_len, \ 3159 (cache_ptr)->LRU_list_size, (fail_val)) \ 3200 #if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS 3202 #define H5C__UPDATE_RP_FOR_SIZE_CHANGE(cache_ptr, entry_ptr, new_size) \ 3204 HDassert( (cache_ptr) ); \ 3205 HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \ 3206 HDassert( (entry_ptr) ); \ 3207 HDassert( !((entry_ptr)->is_protected) ); \ 3208 HDassert( !((entry_ptr)->is_read_only) ); \ 3209 HDassert( ((entry_ptr)->ro_ref_count) == 0 ); \ 3210 HDassert( (entry_ptr)->size > 0 ); \ 3211 HDassert( new_size > 0 ); \ 3213 if ( (entry_ptr)->is_pinned ) { \ 3215 H5C__DLL_UPDATE_FOR_SIZE_CHANGE((cache_ptr)->pel_len, \ 3216 (cache_ptr)->pel_size, \ 3217 (entry_ptr)->size, \ 3226 H5C__DLL_UPDATE_FOR_SIZE_CHANGE((cache_ptr)->LRU_list_len, \ 3227 (cache_ptr)->LRU_list_size, \ 3228 (entry_ptr)->size, \ 3236 if ( (entry_ptr)->is_dirty ) { \ 3238 H5C__DLL_UPDATE_FOR_SIZE_CHANGE((cache_ptr)->dLRU_list_len, \ 3239 (cache_ptr)->dLRU_list_size, \ 3240 (entry_ptr)->size, \ 3245 H5C__DLL_UPDATE_FOR_SIZE_CHANGE((cache_ptr)->cLRU_list_len, \ 3246 (cache_ptr)->cLRU_list_size, \ 3247 (entry_ptr)->size, \ 3258 #define H5C__UPDATE_RP_FOR_SIZE_CHANGE(cache_ptr, entry_ptr, new_size) \ 3260 HDassert( (cache_ptr) ); \ 3261 HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \ 3262 HDassert( (entry_ptr) ); \ 3263 HDassert( !((entry_ptr)->is_protected) ); \ 3264 HDassert( !((entry_ptr)->is_read_only) ); \ 3265 HDassert( ((entry_ptr)->ro_ref_count) == 0 ); \ 3266 HDassert( (entry_ptr)->size > 0 ); \ 3267 HDassert( new_size > 0 ); \ 3269 if ( (entry_ptr)->is_pinned ) { \ 3271 H5C__DLL_UPDATE_FOR_SIZE_CHANGE((cache_ptr)->pel_len, \ 3272 (cache_ptr)->pel_size, \ 3273 (entry_ptr)->size, \ 3282 H5C__DLL_UPDATE_FOR_SIZE_CHANGE((cache_ptr)->LRU_list_len, \ 3283 (cache_ptr)->LRU_list_size, \ 3284 (entry_ptr)->size, \ 3324 #if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS 3326 #define H5C__UPDATE_RP_FOR_UNPIN(cache_ptr, entry_ptr, fail_val) \ 3328 HDassert( (cache_ptr) ); \ 3329 HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \ 3330 HDassert( (entry_ptr) ); \ 3331 HDassert( !((entry_ptr)->is_protected) ); \ 3332 HDassert( !((entry_ptr)->is_read_only) ); \ 3333 HDassert( ((entry_ptr)->ro_ref_count) == 0 ); \ 3334 HDassert( (entry_ptr)->is_pinned); \ 3335 HDassert( (entry_ptr)->size > 0 ); \ 3340 H5C__DLL_REMOVE((entry_ptr), (cache_ptr)->pel_head_ptr, \ 3341 (cache_ptr)->pel_tail_ptr, (cache_ptr)->pel_len, \ 3342 (cache_ptr)->pel_size, (fail_val)) \ 3343 HDassert( (cache_ptr)->pel_len >= 0 ); \ 3349 H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->LRU_head_ptr, \ 3350 (cache_ptr)->LRU_tail_ptr, \ 3351 (cache_ptr)->LRU_list_len, \ 3352 (cache_ptr)->LRU_list_size, (fail_val)) \ 3358 if ( (entry_ptr)->is_dirty ) { \ 3360 H5C__AUX_DLL_PREPEND((entry_ptr), \ 3361 (cache_ptr)->dLRU_head_ptr, \ 3362 (cache_ptr)->dLRU_tail_ptr, \ 3363 (cache_ptr)->dLRU_list_len, \ 3364 (cache_ptr)->dLRU_list_size, \ 3369 H5C__AUX_DLL_PREPEND((entry_ptr), \ 3370 (cache_ptr)->cLRU_head_ptr, \ 3371 (cache_ptr)->cLRU_tail_ptr, \ 3372 (cache_ptr)->cLRU_list_len, \ 3373 (cache_ptr)->cLRU_list_size, \ 3383 #define H5C__UPDATE_RP_FOR_UNPIN(cache_ptr, entry_ptr, fail_val) \ 3385 HDassert( (cache_ptr) ); \ 3386 HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \ 3387 HDassert( (entry_ptr) ); \ 3388 HDassert( !((entry_ptr)->is_protected) ); \ 3389 HDassert( !((entry_ptr)->is_read_only) ); \ 3390 HDassert( ((entry_ptr)->ro_ref_count) == 0 ); \ 3391 HDassert( (entry_ptr)->is_pinned); \ 3392 HDassert( (entry_ptr)->size > 0 ); \ 3397 H5C__DLL_REMOVE((entry_ptr), (cache_ptr)->pel_head_ptr, \ 3398 (cache_ptr)->pel_tail_ptr, (cache_ptr)->pel_len, \ 3399 (cache_ptr)->pel_size, (fail_val)) \ 3400 HDassert( (cache_ptr)->pel_len >= 0 ); \ 3406 H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->LRU_head_ptr, \ 3407 (cache_ptr)->LRU_tail_ptr, \ 3408 (cache_ptr)->LRU_list_len, \ 3409 (cache_ptr)->LRU_list_size, (fail_val)) \ 3462 #if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS 3464 #define H5C__UPDATE_RP_FOR_UNPROTECT(cache_ptr, entry_ptr, fail_val) \ 3466 HDassert( (cache_ptr) ); \ 3467 HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \ 3468 HDassert( (entry_ptr) ); \ 3469 HDassert( (entry_ptr)->is_protected); \ 3470 HDassert( (entry_ptr)->size > 0 ); \ 3475 H5C__DLL_REMOVE((entry_ptr), (cache_ptr)->pl_head_ptr, \ 3476 (cache_ptr)->pl_tail_ptr, (cache_ptr)->pl_len, \ 3477 (cache_ptr)->pl_size, (fail_val)) \ 3479 if ( (entry_ptr)->is_pinned ) { \ 3481 H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->pel_head_ptr, \ 3482 (cache_ptr)->pel_tail_ptr, \ 3483 (cache_ptr)->pel_len, \ 3484 (cache_ptr)->pel_size, (fail_val)) \ 3492 H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->LRU_head_ptr, \ 3493 (cache_ptr)->LRU_tail_ptr, \ 3494 (cache_ptr)->LRU_list_len, \ 3495 (cache_ptr)->LRU_list_size, (fail_val)) \ 3501 if ( (entry_ptr)->is_dirty ) { \ 3503 H5C__AUX_DLL_PREPEND((entry_ptr), (cache_ptr)->dLRU_head_ptr, \ 3504 (cache_ptr)->dLRU_tail_ptr, \ 3505 (cache_ptr)->dLRU_list_len, \ 3506 (cache_ptr)->dLRU_list_size, (fail_val)) \ 3510 H5C__AUX_DLL_PREPEND((entry_ptr), (cache_ptr)->cLRU_head_ptr, \ 3511 (cache_ptr)->cLRU_tail_ptr, \ 3512 (cache_ptr)->cLRU_list_len, \ 3513 (cache_ptr)->cLRU_list_size, (fail_val)) \ 3523 #define H5C__UPDATE_RP_FOR_UNPROTECT(cache_ptr, entry_ptr, fail_val) \ 3525 HDassert( (cache_ptr) ); \ 3526 HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \ 3527 HDassert( (entry_ptr) ); \ 3528 HDassert( (entry_ptr)->is_protected); \ 3529 HDassert( (entry_ptr)->size > 0 ); \ 3534 H5C__DLL_REMOVE((entry_ptr), (cache_ptr)->pl_head_ptr, \ 3535 (cache_ptr)->pl_tail_ptr, (cache_ptr)->pl_len, \ 3536 (cache_ptr)->pl_size, (fail_val)) \ 3538 if ( (entry_ptr)->is_pinned ) { \ 3540 H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->pel_head_ptr, \ 3541 (cache_ptr)->pel_tail_ptr, \ 3542 (cache_ptr)->pel_len, \ 3543 (cache_ptr)->pel_size, (fail_val)) \ 3551 H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->LRU_head_ptr, \ 3552 (cache_ptr)->LRU_tail_ptr, \ 3553 (cache_ptr)->LRU_list_len, \ 3554 (cache_ptr)->LRU_list_size, (fail_val)) \ H5C_cache_entry_t * pl_tail_ptr
#define H5C__HASH_TABLE_LEN
hbool_t evictions_enabled
int32_t epoch_markers_active
H5C_cache_entry_t * cLRU_tail_ptr
H5C_cache_entry_t * pel_head_ptr
H5C_cache_entry_t * dLRU_tail_ptr
H5C_cache_entry_t * cLRU_head_ptr
H5C_auto_size_ctl_t resize_ctl
hbool_t size_increase_possible
int32_t epoch_marker_ringbuf_first
H5C_cache_entry_t * pl_head_ptr
H5C_cache_entry_t epoch_markers[H5C__MAX_EPOCH_MARKERS]
H5C_cache_entry_t * index[H5C__HASH_TABLE_LEN]
hbool_t flush_in_progress
hbool_t flash_size_increase_possible
hbool_t size_decrease_possible
H5C_cache_entry_t * pel_tail_ptr
int32_t epoch_marker_ringbuf_last
hbool_t epoch_marker_active[H5C__MAX_EPOCH_MARKERS]
int32_t epoch_marker_ringbuf_size
H5C_write_permitted_func_t check_write_permitted
H5C_cache_entry_t * LRU_tail_ptr
H5C_log_flush_func_t log_flush
size_t flash_size_increase_threshold
int32_t epoch_marker_ringbuf[H5C__MAX_EPOCH_MARKERS+1]
char prefix[H5C__PREFIX_LEN]
#define H5C__MAX_NUM_TYPE_IDS
H5C_cache_entry_t * LRU_head_ptr
H5C_cache_entry_t * dLRU_head_ptr