00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #ifndef H5C_PACKAGE
00032 #error "Do not include this file outside the H5C package!"
00033 #endif
00034
00035 #ifndef _H5Cpkg_H
00036 #define _H5Cpkg_H
00037
00038
00039
00040 #include "H5Cprivate.h"
00041
00042
00043
00044 #include "H5SLprivate.h"
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055 #define H5C__MAX_PASSES_ON_FLUSH 4
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243
00244
00245
00246
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256
00257
00258
00259
00260
00261
00262
00263
00264
00265
00266
00267
00268
00269
00270
00271
00272
00273
00274
00275
00276
00277
00278
00279
00280
00281
00282
00283
00284
00285
00286
00287
00288
00289
00290
00291
00292
00293
00294
00295
00296
00297
00298
00299
00300
00301
00302
00303
00304
00305
00306
00307
00308
00309
00310
00311
00312
00313
00314
00315
00316
00317
00318
00319
00320
00321
00322
00323
00324
00325
00326
00327
00328
00329
00330
00331
00332
00333
00334
00335
00336
00337
00338
00339
00340
00341
00342
00343
00344
00345
00346
00347
00348
00349
00350
00351
00352
00353
00354
00355
00356
00357
00358
00359
00360
00361
00362
00363
00364
00365
00366
00367
00368
00369
00370
00371
00372
00373
00374
00375
00376
00377
00378
00379
00380
00381
00382
00383
00384
00385
00386
00387
00388
00389
00390
00391
00392
00393
00394
00395
00396
00397
00398
00399
00400
00401
00402
00403
00404
00405
00406
00407
00408
00409
00410
00411
00412
00413
00414
00415
00416
00417
00418
00419
00420
00421
00422
00423
00424
00425
00426
00427
00428
00429
00430
00431
00432
00433
00434
00435
00436
00437
00438
00439
00440
00441
00442
00443
00444
00445
00446
00447
00448
00449
00450
00451
00452
00453
00454
00455
00456
00457
00458
00459
00460
00461
00462
00463
00464
00465
00466
00467
00468
00469
00470
00471
00472
00473
00474
00475
00476
00477
00478
00479
00480
00481
00482
00483
00484
00485
00486
00487
00488
00489
00490
00491
00492
00493
00494
00495
00496
00497
00498
00499
00500
00501
00502
00503
00504
00505
00506
00507
00508
00509
00510
00511
00512
00513
00514
00515
00516
00517
00518
00519
00520
00521
00522
00523
00524
00525
00526
00527
00528
00529
00530
00531
00532
00533
00534
00535
00536
00537
00538
00539
00540
00541
00542
00543
00544
00545
00546
00547
00548
00549
00550
00551
00552
00553
00554
00555
00556
00557
00558
00559
00560
00561
00562
00563
00564
00565
00566
00567
00568
00569
00570
00571
00572
00573
00574
00575
00576
00577
00578
00579
00580
00581
00582
00583
00584
00585
00586
00587
00588
00589
00590
00591
00592
00593
00594
00595
00596
00597
00598
00599
00600
00601
00602
00603
00604
00605
00606
00607
00608
00609
00610
00611
00612
00613
00614
00615
00616
00617
00618
00619
00620
00621
00622
00623
00624
00625
00626
00627
00628
00629
00630
00631
00632
00633
00634
00635
00636
00637
00638
00639
00640
00641
00642
00643
00644
00645
00646
00647
00648
00649
00650
00651
00652
00653
00654
00655
00656
00657
00658
00659
00660
00661
00662
00663
00664
00665
00666
00667
00668
00669
00670
00671
00672
00673
00674
00675
00676
00677
00678
00679
00680
00681
00682
00683
00684
00685
00686
00687
00688
00689
00690
00691
00692
00693
00694
00695
00696
00697
00698
00699
00700
00701
00702
00703
00704
00705
00706
00707
00708
00709
00710
00711
00712
00713
00714
00715
00716
00717
00718
00719
00720
00721
00722
00723
00724
00725
00726
00727
00728
00729
00730
00731
00732
00733
00734
00735
00736
00737
00738
00739
00740
00741
00742
00743
00744
00745
00746
00747
00748
00749
00750
00751
00752
00753
00754
00755
00756
00757
00758
00759
00760
00761
00762
00763
00764
00765
00766
00767
00768
00769
00770
00771
00772
00773
00774
00775
00776
00777
00778
00779
00780
00781
00782
00783
00784
00785
00786
00787
00788
00789
00790
00791
00792
00793
00794
00795
00796
00797
00798
00799
00800
00801
00802
00803
00804
00805
00806
00807
00808
00809
00810
00811
00812
00813
00814
00815
00816
00817
00818
00819
00820
00821
00822
00823
00824
00825
00826
00827
00828
00829
00830
00831
00832
00833
00834
00835
00836
00837
00838
00839
00840
00841
00842
00843
00844
00845
00846
00847
00848
00849
00850
00851
00852
00853
00854
00855
00856
00857 #define H5C__HASH_TABLE_LEN (64 * 1024)
00858
00859 #define H5C__H5C_T_MAGIC 0x005CAC0E
00860 #define H5C__MAX_NUM_TYPE_IDS 18
00861 #define H5C__PREFIX_LEN 32
00862
00863 struct H5C_t
00864 {
00865 uint32_t magic;
00866
00867 hbool_t flush_in_progress;
00868
00869 FILE * trace_file_ptr;
00870
00871 void * aux_ptr;
00872
00873 int32_t max_type_id;
00874 const char * (* type_name_table_ptr);
00875
00876 size_t max_cache_size;
00877 size_t min_clean_size;
00878
00879 H5C_write_permitted_func_t check_write_permitted;
00880 hbool_t write_permitted;
00881
00882 H5C_log_flush_func_t log_flush;
00883
00884 hbool_t evictions_enabled;
00885
00886 int32_t index_len;
00887 size_t index_size;
00888 size_t clean_index_size;
00889 size_t dirty_index_size;
00890 H5C_cache_entry_t * (index[H5C__HASH_TABLE_LEN]);
00891
00892
00893 int32_t slist_len;
00894 size_t slist_size;
00895 H5SL_t * slist_ptr;
00896 #if H5C_DO_SANITY_CHECKS
00897 int64_t slist_len_increase;
00898 int64_t slist_size_increase;
00899 #endif
00900
00901 int32_t pl_len;
00902 size_t pl_size;
00903 H5C_cache_entry_t * pl_head_ptr;
00904 H5C_cache_entry_t * pl_tail_ptr;
00905
00906 int32_t pel_len;
00907 size_t pel_size;
00908 H5C_cache_entry_t * pel_head_ptr;
00909 H5C_cache_entry_t * pel_tail_ptr;
00910
00911 int32_t LRU_list_len;
00912 size_t LRU_list_size;
00913 H5C_cache_entry_t * LRU_head_ptr;
00914 H5C_cache_entry_t * LRU_tail_ptr;
00915
00916 int32_t cLRU_list_len;
00917 size_t cLRU_list_size;
00918 H5C_cache_entry_t * cLRU_head_ptr;
00919 H5C_cache_entry_t * cLRU_tail_ptr;
00920
00921 int32_t dLRU_list_len;
00922 size_t dLRU_list_size;
00923 H5C_cache_entry_t * dLRU_head_ptr;
00924 H5C_cache_entry_t * dLRU_tail_ptr;
00925
00926 hbool_t size_increase_possible;
00927 hbool_t flash_size_increase_possible;
00928 size_t flash_size_increase_threshold;
00929 hbool_t size_decrease_possible;
00930 hbool_t resize_enabled;
00931 hbool_t cache_full;
00932 hbool_t size_decreased;
00933 H5C_auto_size_ctl_t resize_ctl;
00934
00935 int32_t epoch_markers_active;
00936 hbool_t epoch_marker_active[H5C__MAX_EPOCH_MARKERS];
00937 int32_t epoch_marker_ringbuf[H5C__MAX_EPOCH_MARKERS+1];
00938 int32_t epoch_marker_ringbuf_first;
00939 int32_t epoch_marker_ringbuf_last;
00940 int32_t epoch_marker_ringbuf_size;
00941 H5C_cache_entry_t epoch_markers[H5C__MAX_EPOCH_MARKERS];
00942
00943 int64_t cache_hits;
00944 int64_t cache_accesses;
00945
00946 #if H5C_COLLECT_CACHE_STATS
00947
00948
00949 int64_t hits[H5C__MAX_NUM_TYPE_IDS + 1];
00950 int64_t misses[H5C__MAX_NUM_TYPE_IDS + 1];
00951 int64_t write_protects[H5C__MAX_NUM_TYPE_IDS + 1];
00952 int64_t read_protects[H5C__MAX_NUM_TYPE_IDS + 1];
00953 int32_t max_read_protects[H5C__MAX_NUM_TYPE_IDS + 1];
00954 int64_t insertions[H5C__MAX_NUM_TYPE_IDS + 1];
00955 int64_t pinned_insertions[H5C__MAX_NUM_TYPE_IDS + 1];
00956 int64_t clears[H5C__MAX_NUM_TYPE_IDS + 1];
00957 int64_t flushes[H5C__MAX_NUM_TYPE_IDS + 1];
00958 int64_t evictions[H5C__MAX_NUM_TYPE_IDS + 1];
00959 int64_t renames[H5C__MAX_NUM_TYPE_IDS + 1];
00960 int64_t entry_flush_renames[H5C__MAX_NUM_TYPE_IDS + 1];
00961 int64_t cache_flush_renames[H5C__MAX_NUM_TYPE_IDS + 1];
00962 int64_t pins[H5C__MAX_NUM_TYPE_IDS + 1];
00963 int64_t unpins[H5C__MAX_NUM_TYPE_IDS + 1];
00964 int64_t dirty_pins[H5C__MAX_NUM_TYPE_IDS + 1];
00965 int64_t pinned_flushes[H5C__MAX_NUM_TYPE_IDS + 1];
00966 int64_t pinned_clears[H5C__MAX_NUM_TYPE_IDS + 1];
00967 int64_t size_increases[H5C__MAX_NUM_TYPE_IDS + 1];
00968 int64_t size_decreases[H5C__MAX_NUM_TYPE_IDS + 1];
00969 int64_t entry_flush_size_changes
00970 [H5C__MAX_NUM_TYPE_IDS + 1];
00971 int64_t cache_flush_size_changes
00972 [H5C__MAX_NUM_TYPE_IDS + 1];
00973
00974 int64_t total_ht_insertions;
00975 int64_t total_ht_deletions;
00976 int64_t successful_ht_searches;
00977 int64_t total_successful_ht_search_depth;
00978 int64_t failed_ht_searches;
00979 int64_t total_failed_ht_search_depth;
00980
00981 int32_t max_index_len;
00982 size_t max_index_size;
00983 size_t max_clean_index_size;
00984 size_t max_dirty_index_size;
00985
00986 int32_t max_slist_len;
00987 size_t max_slist_size;
00988
00989 int32_t max_pl_len;
00990 size_t max_pl_size;
00991
00992 int32_t max_pel_len;
00993 size_t max_pel_size;
00994
00995 int64_t calls_to_msic;
00996 int64_t total_entries_skipped_in_msic;
00997 int64_t total_entries_scanned_in_msic;
00998 int32_t max_entries_skipped_in_msic;
00999 int32_t max_entries_scanned_in_msic;
01000 int64_t entries_scanned_to_make_space;
01001
01002 #if H5C_COLLECT_CACHE_ENTRY_STATS
01003
01004 int32_t max_accesses[H5C__MAX_NUM_TYPE_IDS + 1];
01005 int32_t min_accesses[H5C__MAX_NUM_TYPE_IDS + 1];
01006 int32_t max_clears[H5C__MAX_NUM_TYPE_IDS + 1];
01007 int32_t max_flushes[H5C__MAX_NUM_TYPE_IDS + 1];
01008 size_t max_size[H5C__MAX_NUM_TYPE_IDS + 1];
01009 int32_t max_pins[H5C__MAX_NUM_TYPE_IDS + 1];
01010
01011 #endif
01012
01013 #endif
01014
01015 hbool_t skip_file_checks;
01016 hbool_t skip_dxpl_id_checks;
01017 char prefix[H5C__PREFIX_LEN];
01018 };
01019
01020
01021
01022
01023
01024
01025
01026
01027
01028
01029
01030
01031
01032
01033
01034
01035
01036
01037
01038
01039
01040
01041
01042
01043
01044
01045
01046
01047
01048
01049
01050
01051
01052
01053
01054
01055
01056
01057
01058
01059
01060
01061
01062
01063
01064
01065
01066
01067
01068
01069
01070
01071
01072
01073
01074
01075
01076
01077
01078
01079
01080
01081
01082
01083
01084
01085
01086
01087
01088
01089
01090
01091
01092
01093
01094
01095
01096
01097
01098
01099
01100
01101
01102
01103
01104
01105
01106
01107
01108
01109
01110
01111
01112
01113
01114
01115
01116
01117
01118
01119
01120
01121
01122
01123 #if H5C_DO_SANITY_CHECKS
01124
01125 #define H5C__DLL_PRE_REMOVE_SC(entry_ptr, head_ptr, tail_ptr, len, Size, fv) \
01126 if ( ( (head_ptr) == NULL ) || \
01127 ( (tail_ptr) == NULL ) || \
01128 ( (entry_ptr) == NULL ) || \
01129 ( (len) <= 0 ) || \
01130 ( (Size) < (entry_ptr)->size ) || \
01131 ( ( (entry_ptr)->prev == NULL ) && ( (head_ptr) != (entry_ptr) ) ) || \
01132 ( ( (entry_ptr)->next == NULL ) && ( (tail_ptr) != (entry_ptr) ) ) || \
01133 ( ( (len) == 1 ) && \
01134 ( ! ( ( (head_ptr) == (entry_ptr) ) && \
01135 ( (tail_ptr) == (entry_ptr) ) && \
01136 ( (entry_ptr)->next == NULL ) && \
01137 ( (entry_ptr)->prev == NULL ) && \
01138 ( (Size) == (entry_ptr)->size ) \
01139 ) \
01140 ) \
01141 ) \
01142 ) { \
01143 HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, (fv), "DLL pre remove SC failed") \
01144 }
01145
01146 #define H5C__DLL_SC(head_ptr, tail_ptr, len, Size, fv) \
01147 if ( ( ( ( (head_ptr) == NULL ) || ( (tail_ptr) == NULL ) ) && \
01148 ( (head_ptr) != (tail_ptr) ) \
01149 ) || \
01150 ( (len) < 0 ) || \
01151 ( (Size) < 0 ) || \
01152 ( ( (len) == 1 ) && \
01153 ( ( (head_ptr) != (tail_ptr) ) || \
01154 ( (head_ptr) == NULL ) || ( (head_ptr)->size != (Size) ) \
01155 ) \
01156 ) || \
01157 ( ( (len) >= 1 ) && \
01158 ( ( (head_ptr) == NULL ) || ( (head_ptr)->prev != NULL ) || \
01159 ( (tail_ptr) == NULL ) || ( (tail_ptr)->next != NULL ) \
01160 ) \
01161 ) \
01162 ) { \
01163 HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, (fv), "DLL sanity check failed") \
01164 }
01165
01166 #define H5C__DLL_PRE_INSERT_SC(entry_ptr, head_ptr, tail_ptr, len, Size, fv) \
01167 if ( ( (entry_ptr) == NULL ) || \
01168 ( (entry_ptr)->next != NULL ) || \
01169 ( (entry_ptr)->prev != NULL ) || \
01170 ( ( ( (head_ptr) == NULL ) || ( (tail_ptr) == NULL ) ) && \
01171 ( (head_ptr) != (tail_ptr) ) \
01172 ) || \
01173 ( (len) < 0 ) || \
01174 ( ( (len) == 1 ) && \
01175 ( ( (head_ptr) != (tail_ptr) ) || \
01176 ( (head_ptr) == NULL ) || ( (head_ptr)->size != (Size) ) \
01177 ) \
01178 ) || \
01179 ( ( (len) >= 1 ) && \
01180 ( ( (head_ptr) == NULL ) || ( (head_ptr)->prev != NULL ) || \
01181 ( (tail_ptr) == NULL ) || ( (tail_ptr)->next != NULL ) \
01182 ) \
01183 ) \
01184 ) { \
01185 HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, (fv), "DLL pre insert SC failed") \
01186 }
01187
01188 #define H5C__DLL_PRE_SIZE_UPDATE_SC(dll_len, dll_size, old_size, new_size) \
01189 if ( ( (dll_len) <= 0 ) || \
01190 ( (dll_size) <= 0 ) || \
01191 ( (old_size) <= 0 ) || \
01192 ( (old_size) > (dll_size) ) || \
01193 ( (new_size) <= 0 ) || \
01194 ( ( (dll_len) == 1 ) && ( (old_size) != (dll_size) ) ) ) { \
01195 HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "DLL pre size update SC failed") \
01196 }
01197
01198 #define H5C__DLL_POST_SIZE_UPDATE_SC(dll_len, dll_size, old_size, new_size) \
01199 if ( ( (new_size) > (dll_size) ) || \
01200 ( ( (dll_len) == 1 ) && ( (new_size) != (dll_size) ) ) ) { \
01201 HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "DLL post size update SC failed") \
01202 }
01203
01204 #else
01205
01206 #define H5C__DLL_PRE_REMOVE_SC(entry_ptr, head_ptr, tail_ptr, len, Size, fv)
01207 #define H5C__DLL_SC(head_ptr, tail_ptr, len, Size, fv)
01208 #define H5C__DLL_PRE_INSERT_SC(entry_ptr, head_ptr, tail_ptr, len, Size, fv)
01209 #define H5C__DLL_PRE_SIZE_UPDATE_SC(dll_len, dll_size, old_size, new_size)
01210 #define H5C__DLL_POST_SIZE_UPDATE_SC(dll_len, dll_size, old_size, new_size)
01211
01212 #endif
01213
01214
01215 #define H5C__DLL_APPEND(entry_ptr, head_ptr, tail_ptr, len, Size, fail_val) \
01216 H5C__DLL_PRE_INSERT_SC(entry_ptr, head_ptr, tail_ptr, len, Size, \
01217 fail_val) \
01218 if ( (head_ptr) == NULL ) \
01219 { \
01220 (head_ptr) = (entry_ptr); \
01221 (tail_ptr) = (entry_ptr); \
01222 } \
01223 else \
01224 { \
01225 (tail_ptr)->next = (entry_ptr); \
01226 (entry_ptr)->prev = (tail_ptr); \
01227 (tail_ptr) = (entry_ptr); \
01228 } \
01229 (len)++; \
01230 (Size) += (entry_ptr)->size;
01231
01232 #define H5C__DLL_PREPEND(entry_ptr, head_ptr, tail_ptr, len, Size, fail_val) \
01233 H5C__DLL_PRE_INSERT_SC(entry_ptr, head_ptr, tail_ptr, len, Size, \
01234 fail_val) \
01235 if ( (head_ptr) == NULL ) \
01236 { \
01237 (head_ptr) = (entry_ptr); \
01238 (tail_ptr) = (entry_ptr); \
01239 } \
01240 else \
01241 { \
01242 (head_ptr)->prev = (entry_ptr); \
01243 (entry_ptr)->next = (head_ptr); \
01244 (head_ptr) = (entry_ptr); \
01245 } \
01246 (len)++; \
01247 (Size) += entry_ptr->size;
01248
01249 #define H5C__DLL_REMOVE(entry_ptr, head_ptr, tail_ptr, len, Size, fail_val) \
01250 H5C__DLL_PRE_REMOVE_SC(entry_ptr, head_ptr, tail_ptr, len, Size, \
01251 fail_val) \
01252 { \
01253 if ( (head_ptr) == (entry_ptr) ) \
01254 { \
01255 (head_ptr) = (entry_ptr)->next; \
01256 if ( (head_ptr) != NULL ) \
01257 { \
01258 (head_ptr)->prev = NULL; \
01259 } \
01260 } \
01261 else \
01262 { \
01263 (entry_ptr)->prev->next = (entry_ptr)->next; \
01264 } \
01265 if ( (tail_ptr) == (entry_ptr) ) \
01266 { \
01267 (tail_ptr) = (entry_ptr)->prev; \
01268 if ( (tail_ptr) != NULL ) \
01269 { \
01270 (tail_ptr)->next = NULL; \
01271 } \
01272 } \
01273 else \
01274 { \
01275 (entry_ptr)->next->prev = (entry_ptr)->prev; \
01276 } \
01277 entry_ptr->next = NULL; \
01278 entry_ptr->prev = NULL; \
01279 (len)--; \
01280 (Size) -= entry_ptr->size; \
01281 }
01282
01283 #define H5C__DLL_UPDATE_FOR_SIZE_CHANGE(dll_len, dll_size, old_size, new_size) \
01284 H5C__DLL_PRE_SIZE_UPDATE_SC(dll_len, dll_size, old_size, new_size) \
01285 (dll_size) -= (old_size); \
01286 (dll_size) += (new_size); \
01287 H5C__DLL_POST_SIZE_UPDATE_SC(dll_len, dll_size, old_size, new_size)
01288
01289 #if H5C_DO_SANITY_CHECKS
01290
01291 #define H5C__AUX_DLL_PRE_REMOVE_SC(entry_ptr, hd_ptr, tail_ptr, len, Size, fv) \
01292 if ( ( (hd_ptr) == NULL ) || \
01293 ( (tail_ptr) == NULL ) || \
01294 ( (entry_ptr) == NULL ) || \
01295 ( (len) <= 0 ) || \
01296 ( (Size) < (entry_ptr)->size ) || \
01297 ( ( (Size) == (entry_ptr)->size ) && ( ! ( (len) == 1 ) ) ) || \
01298 ( ( (entry_ptr)->aux_prev == NULL ) && ( (hd_ptr) != (entry_ptr) ) ) || \
01299 ( ( (entry_ptr)->aux_next == NULL ) && ( (tail_ptr) != (entry_ptr) ) ) || \
01300 ( ( (len) == 1 ) && \
01301 ( ! ( ( (hd_ptr) == (entry_ptr) ) && ( (tail_ptr) == (entry_ptr) ) && \
01302 ( (entry_ptr)->aux_next == NULL ) && \
01303 ( (entry_ptr)->aux_prev == NULL ) && \
01304 ( (Size) == (entry_ptr)->size ) \
01305 ) \
01306 ) \
01307 ) \
01308 ) { \
01309 HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, (fv), "aux DLL pre remove SC failed") \
01310 }
01311
01312 #define H5C__AUX_DLL_SC(head_ptr, tail_ptr, len, Size, fv) \
01313 if ( ( ( ( (head_ptr) == NULL ) || ( (tail_ptr) == NULL ) ) && \
01314 ( (head_ptr) != (tail_ptr) ) \
01315 ) || \
01316 ( (len) < 0 ) || \
01317 ( (Size) < 0 ) || \
01318 ( ( (len) == 1 ) && \
01319 ( ( (head_ptr) != (tail_ptr) ) || ( (Size) <= 0 ) || \
01320 ( (head_ptr) == NULL ) || ( (head_ptr)->size != (Size) ) \
01321 ) \
01322 ) || \
01323 ( ( (len) >= 1 ) && \
01324 ( ( (head_ptr) == NULL ) || ( (head_ptr)->aux_prev != NULL ) || \
01325 ( (tail_ptr) == NULL ) || ( (tail_ptr)->aux_next != NULL ) \
01326 ) \
01327 ) \
01328 ) { \
01329 HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, (fv), "AUX DLL sanity check failed") \
01330 }
01331
01332 #define H5C__AUX_DLL_PRE_INSERT_SC(entry_ptr, hd_ptr, tail_ptr, len, Size, fv) \
01333 if ( ( (entry_ptr) == NULL ) || \
01334 ( (entry_ptr)->aux_next != NULL ) || \
01335 ( (entry_ptr)->aux_prev != NULL ) || \
01336 ( ( ( (hd_ptr) == NULL ) || ( (tail_ptr) == NULL ) ) && \
01337 ( (hd_ptr) != (tail_ptr) ) \
01338 ) || \
01339 ( (len) < 0 ) || \
01340 ( ( (len) == 1 ) && \
01341 ( ( (hd_ptr) != (tail_ptr) ) || ( (Size) <= 0 ) || \
01342 ( (hd_ptr) == NULL ) || ( (hd_ptr)->size != (Size) ) \
01343 ) \
01344 ) || \
01345 ( ( (len) >= 1 ) && \
01346 ( ( (hd_ptr) == NULL ) || ( (hd_ptr)->aux_prev != NULL ) || \
01347 ( (tail_ptr) == NULL ) || ( (tail_ptr)->aux_next != NULL ) \
01348 ) \
01349 ) \
01350 ) { \
01351 HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, (fv), "AUX DLL pre insert SC failed") \
01352 }
01353
01354 #else
01355
01356 #define H5C__AUX_DLL_PRE_REMOVE_SC(entry_ptr, hd_ptr, tail_ptr, len, Size, fv)
01357 #define H5C__AUX_DLL_SC(head_ptr, tail_ptr, len, Size, fv)
01358 #define H5C__AUX_DLL_PRE_INSERT_SC(entry_ptr, hd_ptr, tail_ptr, len, Size, fv)
01359
01360 #endif
01361
01362
01363 #define H5C__AUX_DLL_APPEND(entry_ptr, head_ptr, tail_ptr, len, Size, fail_val)\
01364 H5C__AUX_DLL_PRE_INSERT_SC(entry_ptr, head_ptr, tail_ptr, len, Size, \
01365 fail_val) \
01366 if ( (head_ptr) == NULL ) \
01367 { \
01368 (head_ptr) = (entry_ptr); \
01369 (tail_ptr) = (entry_ptr); \
01370 } \
01371 else \
01372 { \
01373 (tail_ptr)->aux_next = (entry_ptr); \
01374 (entry_ptr)->aux_prev = (tail_ptr); \
01375 (tail_ptr) = (entry_ptr); \
01376 } \
01377 (len)++; \
01378 (Size) += entry_ptr->size;
01379
01380 #define H5C__AUX_DLL_PREPEND(entry_ptr, head_ptr, tail_ptr, len, Size, fv) \
01381 H5C__AUX_DLL_PRE_INSERT_SC(entry_ptr, head_ptr, tail_ptr, len, Size, \
01382 fv) \
01383 if ( (head_ptr) == NULL ) \
01384 { \
01385 (head_ptr) = (entry_ptr); \
01386 (tail_ptr) = (entry_ptr); \
01387 } \
01388 else \
01389 { \
01390 (head_ptr)->aux_prev = (entry_ptr); \
01391 (entry_ptr)->aux_next = (head_ptr); \
01392 (head_ptr) = (entry_ptr); \
01393 } \
01394 (len)++; \
01395 (Size) += entry_ptr->size;
01396
01397 #define H5C__AUX_DLL_REMOVE(entry_ptr, head_ptr, tail_ptr, len, Size, fv) \
01398 H5C__AUX_DLL_PRE_REMOVE_SC(entry_ptr, head_ptr, tail_ptr, len, Size, \
01399 fv) \
01400 { \
01401 if ( (head_ptr) == (entry_ptr) ) \
01402 { \
01403 (head_ptr) = (entry_ptr)->aux_next; \
01404 if ( (head_ptr) != NULL ) \
01405 { \
01406 (head_ptr)->aux_prev = NULL; \
01407 } \
01408 } \
01409 else \
01410 { \
01411 (entry_ptr)->aux_prev->aux_next = (entry_ptr)->aux_next; \
01412 } \
01413 if ( (tail_ptr) == (entry_ptr) ) \
01414 { \
01415 (tail_ptr) = (entry_ptr)->aux_prev; \
01416 if ( (tail_ptr) != NULL ) \
01417 { \
01418 (tail_ptr)->aux_next = NULL; \
01419 } \
01420 } \
01421 else \
01422 { \
01423 (entry_ptr)->aux_next->aux_prev = (entry_ptr)->aux_prev; \
01424 } \
01425 entry_ptr->aux_next = NULL; \
01426 entry_ptr->aux_prev = NULL; \
01427 (len)--; \
01428 (Size) -= entry_ptr->size; \
01429 }
01430
01431
01432
01433
01434
01435
01436
01437
01438
01439
01440
01441
01442
01443
01444
01445
01446
01447
01448
01449
01450
01451
01452
01453
01454
01455
01456
01457
01458
01459
01460
01461
01462 #define H5C__UPDATE_CACHE_HIT_RATE_STATS(cache_ptr, hit) \
01463 (cache_ptr->cache_accesses)++; \
01464 if ( hit ) { \
01465 (cache_ptr->cache_hits)++; \
01466 } \
01467
01468 #if H5C_COLLECT_CACHE_STATS
01469
01470 #define H5C__UPDATE_MAX_INDEX_SIZE_STATS(cache_ptr) \
01471 if ( (cache_ptr)->index_size > (cache_ptr)->max_index_size ) \
01472 (cache_ptr)->max_index_size = (cache_ptr)->index_size; \
01473 if ( (cache_ptr)->clean_index_size > \
01474 (cache_ptr)->max_clean_index_size ) \
01475 (cache_ptr)->max_clean_index_size = \
01476 (cache_ptr)->clean_index_size; \
01477 if ( (cache_ptr)->dirty_index_size > \
01478 (cache_ptr)->max_dirty_index_size ) \
01479 (cache_ptr)->max_dirty_index_size = \
01480 (cache_ptr)->dirty_index_size;
01481
01482 #define H5C__UPDATE_STATS_FOR_DIRTY_PIN(cache_ptr, entry_ptr) \
01483 (((cache_ptr)->dirty_pins)[(entry_ptr)->type->id])++;
01484
01485 #define H5C__UPDATE_STATS_FOR_UNPROTECT(cache_ptr) \
01486 if ( (cache_ptr)->slist_len > (cache_ptr)->max_slist_len ) \
01487 (cache_ptr)->max_slist_len = (cache_ptr)->slist_len; \
01488 if ( (cache_ptr)->slist_size > (cache_ptr)->max_slist_size ) \
01489 (cache_ptr)->max_slist_size = (cache_ptr)->slist_size; \
01490 if ( (cache_ptr)->pel_len > (cache_ptr)->max_pel_len ) \
01491 (cache_ptr)->max_pel_len = (cache_ptr)->pel_len; \
01492 if ( (cache_ptr)->pel_size > (cache_ptr)->max_pel_size ) \
01493 (cache_ptr)->max_pel_size = (cache_ptr)->pel_size;
01494
01495 #define H5C__UPDATE_STATS_FOR_RENAME(cache_ptr, entry_ptr) \
01496 if ( cache_ptr->flush_in_progress ) { \
01497 ((cache_ptr)->cache_flush_renames[(entry_ptr)->type->id])++; \
01498 } \
01499 if ( entry_ptr->flush_in_progress ) { \
01500 ((cache_ptr)->entry_flush_renames[(entry_ptr)->type->id])++; \
01501 } \
01502 (((cache_ptr)->renames)[(entry_ptr)->type->id])++;
01503
01504 #define H5C__UPDATE_STATS_FOR_ENTRY_SIZE_CHANGE(cache_ptr, entry_ptr, new_size)\
01505 if ( cache_ptr->flush_in_progress ) { \
01506 ((cache_ptr)->cache_flush_size_changes[(entry_ptr)->type->id])++; \
01507 } \
01508 if ( entry_ptr->flush_in_progress ) { \
01509 ((cache_ptr)->entry_flush_size_changes[(entry_ptr)->type->id])++; \
01510 } \
01511 if ( (entry_ptr)->size < (new_size) ) { \
01512 ((cache_ptr)->size_increases[(entry_ptr)->type->id])++; \
01513 H5C__UPDATE_MAX_INDEX_SIZE_STATS(cache_ptr) \
01514 if ( (cache_ptr)->slist_size > (cache_ptr)->max_slist_size ) \
01515 (cache_ptr)->max_slist_size = (cache_ptr)->slist_size; \
01516 if ( (cache_ptr)->pl_size > (cache_ptr)->max_pl_size ) \
01517 (cache_ptr)->max_pl_size = (cache_ptr)->pl_size; \
01518 } else if ( (entry_ptr)->size > (new_size) ) { \
01519 ((cache_ptr)->size_decreases[(entry_ptr)->type->id])++; \
01520 }
01521
01522 #define H5C__UPDATE_STATS_FOR_HT_INSERTION(cache_ptr) \
01523 (cache_ptr)->total_ht_insertions++;
01524
01525 #define H5C__UPDATE_STATS_FOR_HT_DELETION(cache_ptr) \
01526 (cache_ptr)->total_ht_deletions++;
01527
01528 #define H5C__UPDATE_STATS_FOR_HT_SEARCH(cache_ptr, success, depth) \
01529 if ( success ) { \
01530 (cache_ptr)->successful_ht_searches++; \
01531 (cache_ptr)->total_successful_ht_search_depth += depth; \
01532 } else { \
01533 (cache_ptr)->failed_ht_searches++; \
01534 (cache_ptr)->total_failed_ht_search_depth += depth; \
01535 }
01536
01537 #define H5C__UPDATE_STATS_FOR_UNPIN(cache_ptr, entry_ptr) \
01538 ((cache_ptr)->unpins)[(entry_ptr)->type->id]++;
01539
01540 #if H5C_COLLECT_CACHE_ENTRY_STATS
01541
01542 #define H5C__RESET_CACHE_ENTRY_STATS(entry_ptr) \
01543 (entry_ptr)->accesses = 0; \
01544 (entry_ptr)->clears = 0; \
01545 (entry_ptr)->flushes = 0; \
01546 (entry_ptr)->pins = 0;
01547
01548 #define H5C__UPDATE_STATS_FOR_CLEAR(cache_ptr, entry_ptr) \
01549 (((cache_ptr)->clears)[(entry_ptr)->type->id])++; \
01550 if ( (entry_ptr)->is_pinned ) { \
01551 (((cache_ptr)->pinned_clears)[(entry_ptr)->type->id])++; \
01552 } \
01553 ((entry_ptr)->clears)++;
01554
01555 #define H5C__UPDATE_STATS_FOR_FLUSH(cache_ptr, entry_ptr) \
01556 (((cache_ptr)->flushes)[(entry_ptr)->type->id])++; \
01557 if ( (entry_ptr)->is_pinned ) { \
01558 (((cache_ptr)->pinned_flushes)[(entry_ptr)->type->id])++; \
01559 } \
01560 ((entry_ptr)->flushes)++;
01561
01562 #define H5C__UPDATE_STATS_FOR_EVICTION(cache_ptr, entry_ptr) \
01563 (((cache_ptr)->evictions)[(entry_ptr)->type->id])++; \
01564 if ( (entry_ptr)->accesses > \
01565 ((cache_ptr)->max_accesses)[(entry_ptr)->type->id] ) { \
01566 ((cache_ptr)->max_accesses)[(entry_ptr)->type->id] \
01567 = (entry_ptr)->accesses; \
01568 } \
01569 if ( (entry_ptr)->accesses < \
01570 ((cache_ptr)->min_accesses)[(entry_ptr)->type->id] ) { \
01571 ((cache_ptr)->min_accesses)[(entry_ptr)->type->id] \
01572 = (entry_ptr)->accesses; \
01573 } \
01574 if ( (entry_ptr)->clears > \
01575 ((cache_ptr)->max_clears)[(entry_ptr)->type->id] ) { \
01576 ((cache_ptr)->max_clears)[(entry_ptr)->type->id] \
01577 = (entry_ptr)->clears; \
01578 } \
01579 if ( (entry_ptr)->flushes > \
01580 ((cache_ptr)->max_flushes)[(entry_ptr)->type->id] ) { \
01581 ((cache_ptr)->max_flushes)[(entry_ptr)->type->id] \
01582 = (entry_ptr)->flushes; \
01583 } \
01584 if ( (entry_ptr)->size > \
01585 ((cache_ptr)->max_size)[(entry_ptr)->type->id] ) { \
01586 ((cache_ptr)->max_size)[(entry_ptr)->type->id] \
01587 = (entry_ptr)->size; \
01588 } \
01589 if ( (entry_ptr)->pins > \
01590 ((cache_ptr)->max_pins)[(entry_ptr)->type->id] ) { \
01591 ((cache_ptr)->max_pins)[(entry_ptr)->type->id] \
01592 = (entry_ptr)->pins; \
01593 }
01594
01595 #define H5C__UPDATE_STATS_FOR_INSERTION(cache_ptr, entry_ptr) \
01596 (((cache_ptr)->insertions)[(entry_ptr)->type->id])++; \
01597 if ( (entry_ptr)->is_pinned ) { \
01598 (((cache_ptr)->pinned_insertions)[(entry_ptr)->type->id])++; \
01599 ((cache_ptr)->pins)[(entry_ptr)->type->id]++; \
01600 (entry_ptr)->pins++; \
01601 if ( (cache_ptr)->pel_len > (cache_ptr)->max_pel_len ) \
01602 (cache_ptr)->max_pel_len = (cache_ptr)->pel_len; \
01603 if ( (cache_ptr)->pel_size > (cache_ptr)->max_pel_size ) \
01604 (cache_ptr)->max_pel_size = (cache_ptr)->pel_size; \
01605 } \
01606 if ( (cache_ptr)->index_len > (cache_ptr)->max_index_len ) \
01607 (cache_ptr)->max_index_len = (cache_ptr)->index_len; \
01608 H5C__UPDATE_MAX_INDEX_SIZE_STATS(cache_ptr) \
01609 if ( (cache_ptr)->slist_len > (cache_ptr)->max_slist_len ) \
01610 (cache_ptr)->max_slist_len = (cache_ptr)->slist_len; \
01611 if ( (cache_ptr)->slist_size > (cache_ptr)->max_slist_size ) \
01612 (cache_ptr)->max_slist_size = (cache_ptr)->slist_size; \
01613 if ( (entry_ptr)->size > \
01614 ((cache_ptr)->max_size)[(entry_ptr)->type->id] ) { \
01615 ((cache_ptr)->max_size)[(entry_ptr)->type->id] \
01616 = (entry_ptr)->size; \
01617 }
01618
01619 #define H5C__UPDATE_STATS_FOR_PROTECT(cache_ptr, entry_ptr, hit) \
01620 if ( hit ) \
01621 ((cache_ptr)->hits)[(entry_ptr)->type->id]++; \
01622 else \
01623 ((cache_ptr)->misses)[(entry_ptr)->type->id]++; \
01624 if ( ! ((entry_ptr)->is_read_only) ) { \
01625 ((cache_ptr)->write_protects)[(entry_ptr)->type->id]++; \
01626 } else { \
01627 ((cache_ptr)->read_protects)[(entry_ptr)->type->id]++; \
01628 if ( ((entry_ptr)->ro_ref_count) > \
01629 ((cache_ptr)->max_read_protects)[(entry_ptr)->type->id] ) { \
01630 ((cache_ptr)->max_read_protects)[(entry_ptr)->type->id] = \
01631 ((entry_ptr)->ro_ref_count); \
01632 } \
01633 } \
01634 if ( (cache_ptr)->index_len > (cache_ptr)->max_index_len ) \
01635 (cache_ptr)->max_index_len = (cache_ptr)->index_len; \
01636 H5C__UPDATE_MAX_INDEX_SIZE_STATS(cache_ptr) \
01637 if ( (cache_ptr)->pl_len > (cache_ptr)->max_pl_len ) \
01638 (cache_ptr)->max_pl_len = (cache_ptr)->pl_len; \
01639 if ( (cache_ptr)->pl_size > (cache_ptr)->max_pl_size ) \
01640 (cache_ptr)->max_pl_size = (cache_ptr)->pl_size; \
01641 if ( (entry_ptr)->size > \
01642 ((cache_ptr)->max_size)[(entry_ptr)->type->id] ) { \
01643 ((cache_ptr)->max_size)[(entry_ptr)->type->id] \
01644 = (entry_ptr)->size; \
01645 } \
01646 ((entry_ptr)->accesses)++;
01647
01648 #define H5C__UPDATE_STATS_FOR_PIN(cache_ptr, entry_ptr) \
01649 ((cache_ptr)->pins)[(entry_ptr)->type->id]++; \
01650 (entry_ptr)->pins++; \
01651 if ( (cache_ptr)->pel_len > (cache_ptr)->max_pel_len ) \
01652 (cache_ptr)->max_pel_len = (cache_ptr)->pel_len; \
01653 if ( (cache_ptr)->pel_size > (cache_ptr)->max_pel_size ) \
01654 (cache_ptr)->max_pel_size = (cache_ptr)->pel_size;
01655
01656 #else
01657
01658 #define H5C__RESET_CACHE_ENTRY_STATS(entry_ptr)
01659
01660 #define H5C__UPDATE_STATS_FOR_CLEAR(cache_ptr, entry_ptr) \
01661 if ( (entry_ptr)->is_pinned ) { \
01662 (((cache_ptr)->pinned_clears)[(entry_ptr)->type->id])++; \
01663 } \
01664 (((cache_ptr)->clears)[(entry_ptr)->type->id])++;
01665
01666 #define H5C__UPDATE_STATS_FOR_FLUSH(cache_ptr, entry_ptr) \
01667 (((cache_ptr)->flushes)[(entry_ptr)->type->id])++; \
01668 if ( (entry_ptr)->is_pinned ) { \
01669 (((cache_ptr)->pinned_flushes)[(entry_ptr)->type->id])++; \
01670 }
01671
01672 #define H5C__UPDATE_STATS_FOR_EVICTION(cache_ptr, entry_ptr) \
01673 (((cache_ptr)->evictions)[(entry_ptr)->type->id])++;
01674
01675 #define H5C__UPDATE_STATS_FOR_INSERTION(cache_ptr, entry_ptr) \
01676 (((cache_ptr)->insertions)[(entry_ptr)->type->id])++; \
01677 if ( (entry_ptr)->is_pinned ) { \
01678 (((cache_ptr)->pinned_insertions)[(entry_ptr)->type->id])++; \
01679 ((cache_ptr)->pins)[(entry_ptr)->type->id]++; \
01680 if ( (cache_ptr)->pel_len > (cache_ptr)->max_pel_len ) \
01681 (cache_ptr)->max_pel_len = (cache_ptr)->pel_len; \
01682 if ( (cache_ptr)->pel_size > (cache_ptr)->max_pel_size ) \
01683 (cache_ptr)->max_pel_size = (cache_ptr)->pel_size; \
01684 } \
01685 if ( (cache_ptr)->index_len > (cache_ptr)->max_index_len ) \
01686 (cache_ptr)->max_index_len = (cache_ptr)->index_len; \
01687 H5C__UPDATE_MAX_INDEX_SIZE_STATS(cache_ptr) \
01688 if ( (cache_ptr)->slist_len > (cache_ptr)->max_slist_len ) \
01689 (cache_ptr)->max_slist_len = (cache_ptr)->slist_len; \
01690 if ( (cache_ptr)->slist_size > (cache_ptr)->max_slist_size ) \
01691 (cache_ptr)->max_slist_size = (cache_ptr)->slist_size;
01692
01693 #define H5C__UPDATE_STATS_FOR_PROTECT(cache_ptr, entry_ptr, hit) \
01694 if ( hit ) \
01695 ((cache_ptr)->hits)[(entry_ptr)->type->id]++; \
01696 else \
01697 ((cache_ptr)->misses)[(entry_ptr)->type->id]++; \
01698 if ( ! ((entry_ptr)->is_read_only) ) { \
01699 ((cache_ptr)->write_protects)[(entry_ptr)->type->id]++; \
01700 } else { \
01701 ((cache_ptr)->read_protects)[(entry_ptr)->type->id]++; \
01702 if ( ((entry_ptr)->ro_ref_count) > \
01703 ((cache_ptr)->max_read_protects)[(entry_ptr)->type->id] ) { \
01704 ((cache_ptr)->max_read_protects)[(entry_ptr)->type->id] = \
01705 ((entry_ptr)->ro_ref_count); \
01706 } \
01707 } \
01708 if ( (cache_ptr)->index_len > (cache_ptr)->max_index_len ) \
01709 (cache_ptr)->max_index_len = (cache_ptr)->index_len; \
01710 H5C__UPDATE_MAX_INDEX_SIZE_STATS(cache_ptr) \
01711 if ( (cache_ptr)->pl_len > (cache_ptr)->max_pl_len ) \
01712 (cache_ptr)->max_pl_len = (cache_ptr)->pl_len; \
01713 if ( (cache_ptr)->pl_size > (cache_ptr)->max_pl_size ) \
01714 (cache_ptr)->max_pl_size = (cache_ptr)->pl_size;
01715
01716 #define H5C__UPDATE_STATS_FOR_PIN(cache_ptr, entry_ptr) \
01717 ((cache_ptr)->pins)[(entry_ptr)->type->id]++; \
01718 if ( (cache_ptr)->pel_len > (cache_ptr)->max_pel_len ) \
01719 (cache_ptr)->max_pel_len = (cache_ptr)->pel_len; \
01720 if ( (cache_ptr)->pel_size > (cache_ptr)->max_pel_size ) \
01721 (cache_ptr)->max_pel_size = (cache_ptr)->pel_size;
01722
01723 #endif
01724
01725 #else
01726
01727 #define H5C__RESET_CACHE_ENTRY_STATS(entry_ptr)
01728 #define H5C__UPDATE_STATS_FOR_DIRTY_PIN(cache_ptr, entry_ptr)
01729 #define H5C__UPDATE_STATS_FOR_UNPROTECT(cache_ptr)
01730 #define H5C__UPDATE_STATS_FOR_RENAME(cache_ptr, entry_ptr)
01731 #define H5C__UPDATE_STATS_FOR_ENTRY_SIZE_CHANGE(cache_ptr, entry_ptr, new_size)
01732 #define H5C__UPDATE_STATS_FOR_HT_INSERTION(cache_ptr)
01733 #define H5C__UPDATE_STATS_FOR_HT_DELETION(cache_ptr)
01734 #define H5C__UPDATE_STATS_FOR_HT_SEARCH(cache_ptr, success, depth)
01735 #define H5C__UPDATE_STATS_FOR_INSERTION(cache_ptr, entry_ptr)
01736 #define H5C__UPDATE_STATS_FOR_CLEAR(cache_ptr, entry_ptr)
01737 #define H5C__UPDATE_STATS_FOR_FLUSH(cache_ptr, entry_ptr)
01738 #define H5C__UPDATE_STATS_FOR_EVICTION(cache_ptr, entry_ptr)
01739 #define H5C__UPDATE_STATS_FOR_PROTECT(cache_ptr, entry_ptr, hit)
01740 #define H5C__UPDATE_STATS_FOR_PIN(cache_ptr, entry_ptr)
01741 #define H5C__UPDATE_STATS_FOR_UNPIN(cache_ptr, entry_ptr)
01742
01743 #endif
01744
01745
01746
01747
01748
01749
01750
01751
01752
01753
01754
01755
01756
01757
01758
01759
01760
01761
01762
01763
01764
01765
01766
01767
01768 #define H5C__HASH_MASK ((size_t)(H5C__HASH_TABLE_LEN - 1) << 3)
01769
01770 #define H5C__HASH_FCN(x) (int)(((x) & H5C__HASH_MASK) >> 3)
01771
01772 #if H5C_DO_SANITY_CHECKS
01773
01774 #define H5C__PRE_HT_INSERT_SC(cache_ptr, entry_ptr, fail_val) \
01775 if ( ( (cache_ptr) == NULL ) || \
01776 ( (cache_ptr)->magic != H5C__H5C_T_MAGIC ) || \
01777 ( (entry_ptr) == NULL ) || \
01778 ( ! H5F_addr_defined((entry_ptr)->addr) ) || \
01779 ( (entry_ptr)->ht_next != NULL ) || \
01780 ( (entry_ptr)->ht_prev != NULL ) || \
01781 ( (entry_ptr)->size <= 0 ) || \
01782 ( (k = H5C__HASH_FCN((entry_ptr)->addr)) < 0 ) || \
01783 ( k >= H5C__HASH_TABLE_LEN ) || \
01784 ( (cache_ptr)->index_size != \
01785 ((cache_ptr)->clean_index_size + \
01786 (cache_ptr)->dirty_index_size) ) ) { \
01787 HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, fail_val, \
01788 "Pre HT insert SC failed") \
01789 }
01790
01791 #define H5C__PRE_HT_REMOVE_SC(cache_ptr, entry_ptr) \
01792 if ( ( (cache_ptr) == NULL ) || \
01793 ( (cache_ptr)->magic != H5C__H5C_T_MAGIC ) || \
01794 ( (cache_ptr)->index_len < 1 ) || \
01795 ( (entry_ptr) == NULL ) || \
01796 ( (cache_ptr)->index_size < (entry_ptr)->size ) || \
01797 ( ! H5F_addr_defined((entry_ptr)->addr) ) || \
01798 ( (entry_ptr)->size <= 0 ) || \
01799 ( H5C__HASH_FCN((entry_ptr)->addr) < 0 ) || \
01800 ( H5C__HASH_FCN((entry_ptr)->addr) >= H5C__HASH_TABLE_LEN ) || \
01801 ( ((cache_ptr)->index)[(H5C__HASH_FCN((entry_ptr)->addr))] \
01802 == NULL ) || \
01803 ( ( ((cache_ptr)->index)[(H5C__HASH_FCN((entry_ptr)->addr))] \
01804 != (entry_ptr) ) && \
01805 ( (entry_ptr)->ht_prev == NULL ) ) || \
01806 ( ( ((cache_ptr)->index)[(H5C__HASH_FCN((entry_ptr)->addr))] == \
01807 (entry_ptr) ) && \
01808 ( (entry_ptr)->ht_prev != NULL ) ) || \
01809 ( (cache_ptr)->index_size != \
01810 ((cache_ptr)->clean_index_size + \
01811 (cache_ptr)->dirty_index_size) ) ) { \
01812 HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Pre HT remove SC failed") \
01813 }
01814
01815
01816 #define H5C__PRE_HT_SEARCH_SC(cache_ptr, Addr, fail_val) \
01817 if ( ( (cache_ptr) == NULL ) || \
01818 ( (cache_ptr)->magic != H5C__H5C_T_MAGIC ) || \
01819 ( (cache_ptr)->index_size != \
01820 ((cache_ptr)->clean_index_size + (cache_ptr)->dirty_index_size) ) || \
01821 ( ! H5F_addr_defined(Addr) ) || \
01822 ( H5C__HASH_FCN(Addr) < 0 ) || \
01823 ( H5C__HASH_FCN(Addr) >= H5C__HASH_TABLE_LEN ) ) { \
01824 HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, fail_val, "Pre HT search SC failed") \
01825 }
01826
01827
01828 #define H5C__POST_SUC_HT_SEARCH_SC(cache_ptr, entry_ptr, Addr, k, fail_val) \
01829 if ( ( (cache_ptr) == NULL ) || \
01830 ( (cache_ptr)->magic != H5C__H5C_T_MAGIC ) || \
01831 ( (cache_ptr)->index_len < 1 ) || \
01832 ( (entry_ptr) == NULL ) || \
01833 ( (cache_ptr)->index_size < (entry_ptr)->size ) || \
01834 ( (cache_ptr)->index_size != \
01835 ((cache_ptr)->clean_index_size + (cache_ptr)->dirty_index_size) ) || \
01836 ( H5F_addr_ne((entry_ptr)->addr, (Addr)) ) || \
01837 ( (entry_ptr)->size <= 0 ) || \
01838 ( ((cache_ptr)->index)[k] == NULL ) || \
01839 ( ( ((cache_ptr)->index)[k] != (entry_ptr) ) && \
01840 ( (entry_ptr)->ht_prev == NULL ) ) || \
01841 ( ( ((cache_ptr)->index)[k] == (entry_ptr) ) && \
01842 ( (entry_ptr)->ht_prev != NULL ) ) || \
01843 ( ( (entry_ptr)->ht_prev != NULL ) && \
01844 ( (entry_ptr)->ht_prev->ht_next != (entry_ptr) ) ) || \
01845 ( ( (entry_ptr)->ht_next != NULL ) && \
01846 ( (entry_ptr)->ht_next->ht_prev != (entry_ptr) ) ) ) { \
01847 HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, fail_val, \
01848 "Post successful HT search SC failed") \
01849 }
01850
01851
01852 #define H5C__POST_HT_SHIFT_TO_FRONT(cache_ptr, entry_ptr, k, fail_val) \
01853 if ( ( (cache_ptr) == NULL ) || \
01854 ( ((cache_ptr)->index)[k] != (entry_ptr) ) || \
01855 ( (entry_ptr)->ht_prev != NULL ) ) { \
01856 HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, fail_val, \
01857 "Post HT shift to front SC failed") \
01858 }
01859
01860 #define H5C__PRE_HT_ENTRY_SIZE_CHANGE_SC(cache_ptr, old_size, new_size, \
01861 entry_ptr, was_clean) \
01862 if ( ( (cache_ptr) == NULL ) || \
01863 ( (cache_ptr)->index_len <= 0 ) || \
01864 ( (cache_ptr)->index_size <= 0 ) || \
01865 ( (new_size) <= 0 ) || \
01866 ( (old_size) > (cache_ptr)->index_size ) || \
01867 ( (new_size) <= 0 ) || \
01868 ( ( (cache_ptr)->index_len == 1 ) && \
01869 ( (cache_ptr)->index_size != (old_size) ) ) || \
01870 ( (cache_ptr)->index_size != \
01871 ((cache_ptr)->clean_index_size + \
01872 (cache_ptr)->dirty_index_size) ) || \
01873 ( (entry_ptr == NULL) ) || \
01874 ( ( !( was_clean ) || \
01875 ( (cache_ptr)->clean_index_size < (old_size) ) ) && \
01876 ( ( (was_clean) ) || \
01877 ( (cache_ptr)->dirty_index_size < (old_size) ) ) ) \
01878 ( (entry_ptr) == NULL ) ) { \
01879 HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \
01880 "Pre HT entry size change SC failed") \
01881 }
01882
01883 #define H5C__POST_HT_ENTRY_SIZE_CHANGE_SC(cache_ptr, old_size, new_size, \
01884 entry_ptr) \
01885 if ( ( (cache_ptr) == NULL ) || \
01886 ( (cache_ptr)->index_len <= 0 ) || \
01887 ( (cache_ptr)->index_size <= 0 ) || \
01888 ( (new_size) > (cache_ptr)->index_size ) || \
01889 ( (cache_ptr)->index_size != \
01890 ((cache_ptr)->clean_index_size + \
01891 (cache_ptr)->dirty_index_size) ) || \
01892 ( ( !((entry_ptr)->is_dirty ) || \
01893 ( (cache_ptr)->dirty_index_size < (new_size) ) ) && \
01894 ( ( ((entry_ptr)->is_dirty) ) || \
01895 ( (cache_ptr)->clean_index_size < (new_size) ) ) ) \
01896 ( ( (cache_ptr)->index_len == 1 ) && \
01897 ( (cache_ptr)->index_size != (new_size) ) ) ) { \
01898 HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \
01899 "Post HT entry size change SC failed") \
01900 }
01901
01902 #define H5C__PRE_HT_UPDATE_FOR_ENTRY_CLEAN_SC(cache_ptr, entry_ptr) \
01903 if ( \
01904 ( (cache_ptr) == NULL ) || \
01905 ( (cache_ptr)->magic != H5C__H5C_T_MAGIC ) || \
01906 ( (cache_ptr)->index_len <= 0 ) || \
01907 ( (entry_ptr) == NULL ) || \
01908 ( (entry_ptr)->is_dirty != FALSE ) || \
01909 ( (cache_ptr)->index_size < (entry_ptr)->size ) || \
01910 ( (cache_ptr)->dirty_index_size < (entry_ptr)->size ) || \
01911 ( (cache_ptr)->index_size != \
01912 ((cache_ptr)->clean_index_size + (cache_ptr)->dirty_index_size) ) ) { \
01913 HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \
01914 "Pre HT update for entry clean SC failed") \
01915 }
01916
01917 #define H5C__PRE_HT_UPDATE_FOR_ENTRY_DIRTY_SC(cache_ptr, entry_ptr) \
01918 if ( \
01919 ( (cache_ptr) == NULL ) || \
01920 ( (cache_ptr)->magic != H5C__H5C_T_MAGIC ) || \
01921 ( (cache_ptr)->index_len <= 0 ) || \
01922 ( (entry_ptr) == NULL ) || \
01923 ( (entry_ptr)->is_dirty != TRUE ) || \
01924 ( (cache_ptr)->index_size < (entry_ptr)->size ) || \
01925 ( (cache_ptr)->clean_index_size < (entry_ptr)->size ) || \
01926 ( (cache_ptr)->index_size != \
01927 ((cache_ptr)->clean_index_size + (cache_ptr)->dirty_index_size) ) ) { \
01928 HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \
01929 "Pre HT update for entry dirty SC failed") \
01930 }
01931
01932 #define H5C__POST_HT_UPDATE_FOR_ENTRY_CLEAN_SC(cache_ptr, entry_ptr) \
01933 if ( (cache_ptr)->index_size != \
01934 ((cache_ptr)->clean_index_size + (cache_ptr)->dirty_index_size) ) { \
01935 HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \
01936 "Post HT update for entry clean SC failed") \
01937 }
01938
01939 #define H5C__POST_HT_UPDATE_FOR_ENTRY_DIRTY_SC(cache_ptr, entry_ptr) \
01940 if ( (cache_ptr)->index_size != \
01941 ((cache_ptr)->clean_index_size + (cache_ptr)->dirty_index_size) ) { \
01942 HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \
01943 "Post HT update for entry dirty SC failed") \
01944 }
01945
01946 #else
01947
01948 #define H5C__PRE_HT_INSERT_SC(cache_ptr, entry_ptr, fail_val)
01949 #define H5C__PRE_HT_REMOVE_SC(cache_ptr, entry_ptr)
01950 #define H5C__PRE_HT_SEARCH_SC(cache_ptr, Addr, fail_val)
01951 #define H5C__POST_SUC_HT_SEARCH_SC(cache_ptr, entry_ptr, Addr, k, fail_val)
01952 #define H5C__POST_HT_SHIFT_TO_FRONT(cache_ptr, entry_ptr, k, fail_val)
01953 #define H5C__PRE_HT_UPDATE_FOR_ENTRY_CLEAN_SC(cache_ptr, entry_ptr)
01954 #define H5C__PRE_HT_UPDATE_FOR_ENTRY_DIRTY_SC(cache_ptr, entry_ptr)
01955 #define H5C__PRE_HT_ENTRY_SIZE_CHANGE_SC(cache_ptr, old_size, new_size, \
01956 entry_ptr, was_clean)
01957 #define H5C__POST_HT_ENTRY_SIZE_CHANGE_SC(cache_ptr, old_size, new_size, \
01958 entry_ptr)
01959 #define H5C__POST_HT_UPDATE_FOR_ENTRY_CLEAN_SC(cache_ptr, entry_ptr)
01960 #define H5C__POST_HT_UPDATE_FOR_ENTRY_DIRTY_SC(cache_ptr, entry_ptr)
01961
01962 #endif
01963
01964
01965 #define H5C__INSERT_IN_INDEX(cache_ptr, entry_ptr, fail_val) \
01966 { \
01967 int k; \
01968 H5C__PRE_HT_INSERT_SC(cache_ptr, entry_ptr, fail_val) \
01969 k = H5C__HASH_FCN((entry_ptr)->addr); \
01970 if ( ((cache_ptr)->index)[k] == NULL ) \
01971 { \
01972 ((cache_ptr)->index)[k] = (entry_ptr); \
01973 } \
01974 else \
01975 { \
01976 (entry_ptr)->ht_next = ((cache_ptr)->index)[k]; \
01977 (entry_ptr)->ht_next->ht_prev = (entry_ptr); \
01978 ((cache_ptr)->index)[k] = (entry_ptr); \
01979 } \
01980 (cache_ptr)->index_len++; \
01981 (cache_ptr)->index_size += (entry_ptr)->size; \
01982 if ( (entry_ptr)->is_dirty ) { \
01983 (cache_ptr)->dirty_index_size += (entry_ptr)->size; \
01984 } else { \
01985 (cache_ptr)->clean_index_size += (entry_ptr)->size; \
01986 } \
01987 H5C__UPDATE_STATS_FOR_HT_INSERTION(cache_ptr) \
01988 }
01989
01990 #define H5C__DELETE_FROM_INDEX(cache_ptr, entry_ptr) \
01991 { \
01992 int k; \
01993 H5C__PRE_HT_REMOVE_SC(cache_ptr, entry_ptr) \
01994 k = H5C__HASH_FCN((entry_ptr)->addr); \
01995 if ( (entry_ptr)->ht_next ) \
01996 { \
01997 (entry_ptr)->ht_next->ht_prev = (entry_ptr)->ht_prev; \
01998 } \
01999 if ( (entry_ptr)->ht_prev ) \
02000 { \
02001 (entry_ptr)->ht_prev->ht_next = (entry_ptr)->ht_next; \
02002 } \
02003 if ( ((cache_ptr)->index)[k] == (entry_ptr) ) \
02004 { \
02005 ((cache_ptr)->index)[k] = (entry_ptr)->ht_next; \
02006 } \
02007 (entry_ptr)->ht_next = NULL; \
02008 (entry_ptr)->ht_prev = NULL; \
02009 (cache_ptr)->index_len--; \
02010 (cache_ptr)->index_size -= (entry_ptr)->size; \
02011 if ( (entry_ptr)->is_dirty ) { \
02012 (cache_ptr)->dirty_index_size -= (entry_ptr)->size; \
02013 } else { \
02014 (cache_ptr)->clean_index_size -= (entry_ptr)->size; \
02015 } \
02016 H5C__UPDATE_STATS_FOR_HT_DELETION(cache_ptr) \
02017 }
02018
02019 #define H5C__SEARCH_INDEX(cache_ptr, Addr, entry_ptr, fail_val) \
02020 { \
02021 int k; \
02022 int depth = 0; \
02023 H5C__PRE_HT_SEARCH_SC(cache_ptr, Addr, fail_val) \
02024 k = H5C__HASH_FCN(Addr); \
02025 entry_ptr = ((cache_ptr)->index)[k]; \
02026 while ( ( entry_ptr ) && ( H5F_addr_ne(Addr, (entry_ptr)->addr) ) ) \
02027 { \
02028 (entry_ptr) = (entry_ptr)->ht_next; \
02029 (depth)++; \
02030 } \
02031 if ( entry_ptr ) \
02032 { \
02033 H5C__POST_SUC_HT_SEARCH_SC(cache_ptr, entry_ptr, Addr, k, fail_val) \
02034 if ( entry_ptr != ((cache_ptr)->index)[k] ) \
02035 { \
02036 if ( (entry_ptr)->ht_next ) \
02037 { \
02038 (entry_ptr)->ht_next->ht_prev = (entry_ptr)->ht_prev; \
02039 } \
02040 HDassert( (entry_ptr)->ht_prev != NULL ); \
02041 (entry_ptr)->ht_prev->ht_next = (entry_ptr)->ht_next; \
02042 ((cache_ptr)->index)[k]->ht_prev = (entry_ptr); \
02043 (entry_ptr)->ht_next = ((cache_ptr)->index)[k]; \
02044 (entry_ptr)->ht_prev = NULL; \
02045 ((cache_ptr)->index)[k] = (entry_ptr); \
02046 H5C__POST_HT_SHIFT_TO_FRONT(cache_ptr, entry_ptr, k, fail_val) \
02047 } \
02048 } \
02049 H5C__UPDATE_STATS_FOR_HT_SEARCH(cache_ptr, (entry_ptr != NULL), depth) \
02050 }
02051
02052 #define H5C__SEARCH_INDEX_NO_STATS(cache_ptr, Addr, entry_ptr, fail_val) \
02053 { \
02054 int k; \
02055 int depth = 0; \
02056 H5C__PRE_HT_SEARCH_SC(cache_ptr, Addr, fail_val) \
02057 k = H5C__HASH_FCN(Addr); \
02058 entry_ptr = ((cache_ptr)->index)[k]; \
02059 while ( ( entry_ptr ) && ( H5F_addr_ne(Addr, (entry_ptr)->addr) ) ) \
02060 { \
02061 (entry_ptr) = (entry_ptr)->ht_next; \
02062 (depth)++; \
02063 } \
02064 if ( entry_ptr ) \
02065 { \
02066 H5C__POST_SUC_HT_SEARCH_SC(cache_ptr, entry_ptr, Addr, k, fail_val) \
02067 if ( entry_ptr != ((cache_ptr)->index)[k] ) \
02068 { \
02069 if ( (entry_ptr)->ht_next ) \
02070 { \
02071 (entry_ptr)->ht_next->ht_prev = (entry_ptr)->ht_prev; \
02072 } \
02073 HDassert( (entry_ptr)->ht_prev != NULL ); \
02074 (entry_ptr)->ht_prev->ht_next = (entry_ptr)->ht_next; \
02075 ((cache_ptr)->index)[k]->ht_prev = (entry_ptr); \
02076 (entry_ptr)->ht_next = ((cache_ptr)->index)[k]; \
02077 (entry_ptr)->ht_prev = NULL; \
02078 ((cache_ptr)->index)[k] = (entry_ptr); \
02079 H5C__POST_HT_SHIFT_TO_FRONT(cache_ptr, entry_ptr, k, fail_val) \
02080 } \
02081 } \
02082 }
02083
02084 #define H5C__UPDATE_INDEX_FOR_ENTRY_CLEAN(cache_ptr, entry_ptr) \
02085 { \
02086 H5C__PRE_HT_UPDATE_FOR_ENTRY_CLEAN_SC(cache_ptr, entry_ptr); \
02087 (cache_ptr)->dirty_index_size -= (entry_ptr)->size; \
02088 (cache_ptr)->clean_index_size += (entry_ptr)->size; \
02089 H5C__POST_HT_UPDATE_FOR_ENTRY_CLEAN_SC(cache_ptr, entry_ptr); \
02090 }
02091
02092 #define H5C__UPDATE_INDEX_FOR_ENTRY_DIRTY(cache_ptr, entry_ptr) \
02093 { \
02094 H5C__PRE_HT_UPDATE_FOR_ENTRY_DIRTY_SC(cache_ptr, entry_ptr); \
02095 (cache_ptr)->clean_index_size -= (entry_ptr)->size; \
02096 (cache_ptr)->dirty_index_size += (entry_ptr)->size; \
02097 H5C__POST_HT_UPDATE_FOR_ENTRY_DIRTY_SC(cache_ptr, entry_ptr); \
02098 }
02099
02100 #define H5C__UPDATE_INDEX_FOR_SIZE_CHANGE(cache_ptr, old_size, new_size, \
02101 entry_ptr, was_clean) \
02102 { \
02103 H5C__PRE_HT_ENTRY_SIZE_CHANGE_SC(cache_ptr, old_size, new_size, \
02104 entry_ptr, was_clean) \
02105 (cache_ptr)->index_size -= (old_size); \
02106 (cache_ptr)->index_size += (new_size); \
02107 if ( was_clean ) { \
02108 (cache_ptr)->clean_index_size -= (old_size); \
02109 } else { \
02110 (cache_ptr)->dirty_index_size -= (old_size); \
02111 } \
02112 if ( (entry_ptr)->is_dirty ) { \
02113 (cache_ptr)->dirty_index_size += (new_size); \
02114 } else { \
02115 (cache_ptr)->clean_index_size += (new_size); \
02116 } \
02117 H5C__POST_HT_ENTRY_SIZE_CHANGE_SC(cache_ptr, old_size, new_size, entry_ptr) \
02118 }
02119
02120
02121
02122
02123
02124
02125
02126
02127
02128
02129
02130
02131
02132
02133
02134
02135
02136
02137
02138
02139
02140
02141
02142
02143
02144
02145
02146
02147
02148
02149
02150
02151
02152
02153
02154
02155
02156
02157
02158
02159
02160
02161
02162
02163
02164
02165
02166
02167
02168
02169
02170
02171
02172
02173
02174
02175
02176
02177
02178
02179
02180
02181 #if H5C_DO_SANITY_CHECKS
02182
02183 #define H5C__INSERT_ENTRY_IN_SLIST(cache_ptr, entry_ptr, fail_val) \
02184 { \
02185 HDassert( (cache_ptr) ); \
02186 HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \
02187 HDassert( (entry_ptr) ); \
02188 HDassert( (entry_ptr)->size > 0 ); \
02189 HDassert( H5F_addr_defined((entry_ptr)->addr) ); \
02190 HDassert( !((entry_ptr)->in_slist) ); \
02191 \
02192 if ( H5SL_insert((cache_ptr)->slist_ptr, entry_ptr, &(entry_ptr)->addr) \
02193 < 0 ) \
02194 HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, (fail_val), \
02195 "Can't insert entry in skip list") \
02196 \
02197 (entry_ptr)->in_slist = TRUE; \
02198 (cache_ptr)->slist_len++; \
02199 (cache_ptr)->slist_size += (entry_ptr)->size; \
02200 (cache_ptr)->slist_len_increase++; \
02201 (cache_ptr)->slist_size_increase += (entry_ptr)->size; \
02202 \
02203 HDassert( (cache_ptr)->slist_len > 0 ); \
02204 HDassert( (cache_ptr)->slist_size > 0 ); \
02205 \
02206 }
02207
02208 #else
02209
02210 #define H5C__INSERT_ENTRY_IN_SLIST(cache_ptr, entry_ptr, fail_val) \
02211 { \
02212 HDassert( (cache_ptr) ); \
02213 HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \
02214 HDassert( (entry_ptr) ); \
02215 HDassert( (entry_ptr)->size > 0 ); \
02216 HDassert( H5F_addr_defined((entry_ptr)->addr) ); \
02217 HDassert( !((entry_ptr)->in_slist) ); \
02218 \
02219 if ( H5SL_insert((cache_ptr)->slist_ptr, entry_ptr, &(entry_ptr)->addr) \
02220 < 0 ) \
02221 HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, (fail_val), \
02222 "Can't insert entry in skip list") \
02223 \
02224 (entry_ptr)->in_slist = TRUE; \
02225 (cache_ptr)->slist_len++; \
02226 (cache_ptr)->slist_size += (entry_ptr)->size; \
02227 \
02228 HDassert( (cache_ptr)->slist_len > 0 ); \
02229 HDassert( (cache_ptr)->slist_size > 0 ); \
02230 \
02231 }
02232
02233 #endif
02234
02235
02236
02237
02238
02239
02240
02241
02242
02243
02244
02245
02246
02247
02248
02249
02250
02251
02252
02253
02254
02255
02256
02257
02258
02259
02260
02261
02262
02263
02264
02265
02266
02267
02268 #define H5C__REMOVE_ENTRY_FROM_SLIST(cache_ptr, entry_ptr) \
02269 { \
02270 HDassert( (cache_ptr) ); \
02271 HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \
02272 HDassert( (entry_ptr) ); \
02273 HDassert( !((entry_ptr)->is_protected) ); \
02274 HDassert( !((entry_ptr)->is_read_only) ); \
02275 HDassert( ((entry_ptr)->ro_ref_count) == 0 ); \
02276 HDassert( (entry_ptr)->size > 0 ); \
02277 HDassert( (entry_ptr)->in_slist ); \
02278 HDassert( (cache_ptr)->slist_ptr ); \
02279 \
02280 if ( H5SL_remove((cache_ptr)->slist_ptr, &(entry_ptr)->addr) \
02281 != (entry_ptr) ) \
02282 \
02283 HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, \
02284 "Can't delete entry from skip list.") \
02285 \
02286 HDassert( (cache_ptr)->slist_len > 0 ); \
02287 (cache_ptr)->slist_len--; \
02288 HDassert( (cache_ptr)->slist_size >= (entry_ptr)->size ); \
02289 (cache_ptr)->slist_size -= (entry_ptr)->size; \
02290 (entry_ptr)->in_slist = FALSE; \
02291 }
02292
02293
02294
02295
02296
02297
02298
02299
02300
02301
02302
02303
02304
02305
02306
02307
02308
02309
02310
02311
02312
02313
02314
02315
02316
02317
02318
02319
02320 #if H5C_DO_SANITY_CHECKS
02321
02322 #define H5C__UPDATE_SLIST_FOR_SIZE_CHANGE(cache_ptr, old_size, new_size) \
02323 { \
02324 HDassert( (cache_ptr) ); \
02325 HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \
02326 HDassert( (old_size) > 0 ); \
02327 HDassert( (new_size) > 0 ); \
02328 HDassert( (old_size) <= (cache_ptr)->slist_size ); \
02329 HDassert( (cache_ptr)->slist_len > 0 ); \
02330 HDassert( ((cache_ptr)->slist_len > 1) || \
02331 ( (cache_ptr)->slist_size == (old_size) ) ); \
02332 \
02333 (cache_ptr)->slist_size -= (old_size); \
02334 (cache_ptr)->slist_size += (new_size); \
02335 \
02336 (cache_ptr)->slist_size_increase -= (int64_t)(old_size); \
02337 (cache_ptr)->slist_size_increase += (int64_t)(new_size); \
02338 \
02339 HDassert( (new_size) <= (cache_ptr)->slist_size ); \
02340 HDassert( ( (cache_ptr)->slist_len > 1 ) || \
02341 ( (cache_ptr)->slist_size == (new_size) ) ); \
02342 }
02343
02344 #else
02345
02346 #define H5C__UPDATE_SLIST_FOR_SIZE_CHANGE(cache_ptr, old_size, new_size) \
02347 { \
02348 HDassert( (cache_ptr) ); \
02349 HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \
02350 HDassert( (old_size) > 0 ); \
02351 HDassert( (new_size) > 0 ); \
02352 HDassert( (old_size) <= (cache_ptr)->slist_size ); \
02353 HDassert( (cache_ptr)->slist_len > 0 ); \
02354 HDassert( ((cache_ptr)->slist_len > 1) || \
02355 ( (cache_ptr)->slist_size == (old_size) ) ); \
02356 \
02357 (cache_ptr)->slist_size -= (old_size); \
02358 (cache_ptr)->slist_size += (new_size); \
02359 \
02360 HDassert( (new_size) <= (cache_ptr)->slist_size ); \
02361 HDassert( ( (cache_ptr)->slist_len > 1 ) || \
02362 ( (cache_ptr)->slist_size == (new_size) ) ); \
02363 }
02364
02365 #endif
02366
02367
02368
02369
02370
02371
02372
02373
02374
02375
02376
02377
02378
02379
02380
02381
02382
02383
02384
02385
02386
02387
02388
02389
02390
02391
02392
02393
02394
02395
02396
02397
02398
02399
02400
02401
02402
02403
02404
02405
02406
02407
02408
02409
02410
02411 #if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS
02412
02413 #define H5C__FAKE_RP_FOR_MOST_RECENT_ACCESS(cache_ptr, entry_ptr, fail_val) \
02414 { \
02415 HDassert( (cache_ptr) ); \
02416 HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \
02417 HDassert( (entry_ptr) ); \
02418 HDassert( !((entry_ptr)->is_protected) ); \
02419 HDassert( !((entry_ptr)->is_read_only) ); \
02420 HDassert( ((entry_ptr)->ro_ref_count) == 0 ); \
02421 HDassert( (entry_ptr)->size > 0 ); \
02422 \
02423 if ( ! ((entry_ptr)->is_pinned) ) { \
02424 \
02425 \
02426 \
02427
02428 \
02429 \
02430 H5C__DLL_REMOVE((entry_ptr), (cache_ptr)->LRU_head_ptr, \
02431 (cache_ptr)->LRU_tail_ptr, \
02432 (cache_ptr)->LRU_list_len, \
02433 (cache_ptr)->LRU_list_size, (fail_val)) \
02434 \
02435 H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->LRU_head_ptr, \
02436 (cache_ptr)->LRU_tail_ptr, \
02437 (cache_ptr)->LRU_list_len, \
02438 (cache_ptr)->LRU_list_size, (fail_val)) \
02439 \
02440
02441
02442
02443
02444
02445
02446 \
02447 \
02448 if ( (entry_ptr)->is_dirty ) { \
02449 H5C__AUX_DLL_REMOVE((entry_ptr), (cache_ptr)->dLRU_head_ptr, \
02450 (cache_ptr)->dLRU_tail_ptr, \
02451 (cache_ptr)->dLRU_list_len, \
02452 (cache_ptr)->dLRU_list_size, (fail_val)) \
02453 \
02454 H5C__AUX_DLL_PREPEND((entry_ptr), (cache_ptr)->dLRU_head_ptr, \
02455 (cache_ptr)->dLRU_tail_ptr, \
02456 (cache_ptr)->dLRU_list_len, \
02457 (cache_ptr)->dLRU_list_size, (fail_val)) \
02458 } else { \
02459 H5C__AUX_DLL_REMOVE((entry_ptr), (cache_ptr)->cLRU_head_ptr, \
02460 (cache_ptr)->cLRU_tail_ptr, \
02461 (cache_ptr)->cLRU_list_len, \
02462 (cache_ptr)->cLRU_list_size, (fail_val)) \
02463 \
02464 H5C__AUX_DLL_PREPEND((entry_ptr), (cache_ptr)->cLRU_head_ptr, \
02465 (cache_ptr)->cLRU_tail_ptr, \
02466 (cache_ptr)->cLRU_list_len, \
02467 (cache_ptr)->cLRU_list_size, (fail_val)) \
02468 } \
02469 \
02470 \
02471 } \
02472 }
02473
02474 #else
02475
02476 #define H5C__FAKE_RP_FOR_MOST_RECENT_ACCESS(cache_ptr, entry_ptr, fail_val) \
02477 { \
02478 HDassert( (cache_ptr) ); \
02479 HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \
02480 HDassert( (entry_ptr) ); \
02481 HDassert( !((entry_ptr)->is_protected) ); \
02482 HDassert( !((entry_ptr)->is_read_only) ); \
02483 HDassert( ((entry_ptr)->ro_ref_count) == 0 ); \
02484 HDassert( (entry_ptr)->size > 0 ); \
02485 \
02486 if ( ! ((entry_ptr)->is_pinned) ) { \
02487 \
02488 \
02489 \
02490
02491 \
02492 \
02493 H5C__DLL_REMOVE((entry_ptr), (cache_ptr)->LRU_head_ptr, \
02494 (cache_ptr)->LRU_tail_ptr, \
02495 (cache_ptr)->LRU_list_len, \
02496 (cache_ptr)->LRU_list_size, (fail_val)) \
02497 \
02498 H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->LRU_head_ptr, \
02499 (cache_ptr)->LRU_tail_ptr, \
02500 (cache_ptr)->LRU_list_len, \
02501 (cache_ptr)->LRU_list_size, (fail_val)) \
02502 \
02503 \
02504 } \
02505 }
02506
02507 #endif
02508
02509
02510
02511
02512
02513
02514
02515
02516
02517
02518
02519
02520
02521
02522
02523
02524
02525
02526
02527
02528
02529
02530
02531
02532
02533
02534
02535
02536
02537
02538
02539
02540
02541
02542
02543
02544
02545
02546
02547
02548
02549
02550
02551
02552
02553 #if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS
02554
02555 #define H5C__UPDATE_RP_FOR_EVICTION(cache_ptr, entry_ptr, fail_val) \
02556 { \
02557 HDassert( (cache_ptr) ); \
02558 HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \
02559 HDassert( (entry_ptr) ); \
02560 HDassert( !((entry_ptr)->is_protected) ); \
02561 HDassert( !((entry_ptr)->is_read_only) ); \
02562 HDassert( ((entry_ptr)->ro_ref_count) == 0 ); \
02563 HDassert( !((entry_ptr)->is_pinned) ); \
02564 HDassert( (entry_ptr)->size > 0 ); \
02565 \
02566 \
02567 \
02568 \
02569 \
02570 H5C__DLL_REMOVE((entry_ptr), (cache_ptr)->LRU_head_ptr, \
02571 (cache_ptr)->LRU_tail_ptr, (cache_ptr)->LRU_list_len, \
02572 (cache_ptr)->LRU_list_size, (fail_val)) \
02573 \
02574
02575
02576
02577
02578 \
02579 \
02580 if ( (entry_ptr)->is_dirty ) { \
02581 \
02582 H5C__AUX_DLL_REMOVE((entry_ptr), (cache_ptr)->dLRU_head_ptr, \
02583 (cache_ptr)->dLRU_tail_ptr, \
02584 (cache_ptr)->dLRU_list_len, \
02585 (cache_ptr)->dLRU_list_size, (fail_val)) \
02586 } else { \
02587 H5C__AUX_DLL_REMOVE((entry_ptr), (cache_ptr)->cLRU_head_ptr, \
02588 (cache_ptr)->cLRU_tail_ptr, \
02589 (cache_ptr)->cLRU_list_len, \
02590 (cache_ptr)->cLRU_list_size, (fail_val)) \
02591 } \
02592 \
02593 }
02594
02595 #else
02596
02597 #define H5C__UPDATE_RP_FOR_EVICTION(cache_ptr, entry_ptr, fail_val) \
02598 { \
02599 HDassert( (cache_ptr) ); \
02600 HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \
02601 HDassert( (entry_ptr) ); \
02602 HDassert( !((entry_ptr)->is_protected) ); \
02603 HDassert( !((entry_ptr)->is_read_only) ); \
02604 HDassert( ((entry_ptr)->ro_ref_count) == 0 ); \
02605 HDassert( !((entry_ptr)->is_pinned) ); \
02606 HDassert( (entry_ptr)->size > 0 ); \
02607 \
02608 \
02609 \
02610 \
02611 \
02612 H5C__DLL_REMOVE((entry_ptr), (cache_ptr)->LRU_head_ptr, \
02613 (cache_ptr)->LRU_tail_ptr, (cache_ptr)->LRU_list_len, \
02614 (cache_ptr)->LRU_list_size, (fail_val)) \
02615 \
02616 }
02617
02618 #endif
02619
02620
02621
02622
02623
02624
02625
02626
02627
02628
02629
02630
02631
02632
02633
02634
02635
02636
02637
02638
02639
02640
02641
02642
02643
02644
02645
02646
02647
02648
02649
02650
02651
02652
02653
02654
02655
02656
02657
02658
02659
02660
02661
02662
02663
02664
02665
02666 #if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS
02667
02668 #define H5C__UPDATE_RP_FOR_FLUSH(cache_ptr, entry_ptr, fail_val) \
02669 { \
02670 HDassert( (cache_ptr) ); \
02671 HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \
02672 HDassert( (entry_ptr) ); \
02673 HDassert( !((entry_ptr)->is_protected) ); \
02674 HDassert( !((entry_ptr)->is_read_only) ); \
02675 HDassert( ((entry_ptr)->ro_ref_count) == 0 ); \
02676 HDassert( (entry_ptr)->size > 0 ); \
02677 \
02678 if ( ! ((entry_ptr)->is_pinned) ) { \
02679 \
02680 \
02681 \
02682
02683
02684 \
02685 \
02686 H5C__DLL_REMOVE((entry_ptr), (cache_ptr)->LRU_head_ptr, \
02687 (cache_ptr)->LRU_tail_ptr, \
02688 (cache_ptr)->LRU_list_len, \
02689 (cache_ptr)->LRU_list_size, (fail_val)) \
02690 \
02691 H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->LRU_head_ptr, \
02692 (cache_ptr)->LRU_tail_ptr, \
02693 (cache_ptr)->LRU_list_len, \
02694 (cache_ptr)->LRU_list_size, (fail_val)) \
02695 \
02696
02697
02698
02699
02700
02701
02702
02703
02704
02705 \
02706 \
02707 if ( (entry_ptr)->is_dirty ) { \
02708 H5C__AUX_DLL_REMOVE((entry_ptr), (cache_ptr)->dLRU_head_ptr, \
02709 (cache_ptr)->dLRU_tail_ptr, \
02710 (cache_ptr)->dLRU_list_len, \
02711 (cache_ptr)->dLRU_list_size, (fail_val)) \
02712 } else { \
02713 H5C__AUX_DLL_REMOVE((entry_ptr), (cache_ptr)->cLRU_head_ptr, \
02714 (cache_ptr)->cLRU_tail_ptr, \
02715 (cache_ptr)->cLRU_list_len, \
02716 (cache_ptr)->cLRU_list_size, (fail_val)) \
02717 } \
02718 \
02719 H5C__AUX_DLL_PREPEND((entry_ptr), (cache_ptr)->cLRU_head_ptr, \
02720 (cache_ptr)->cLRU_tail_ptr, \
02721 (cache_ptr)->cLRU_list_len, \
02722 (cache_ptr)->cLRU_list_size, (fail_val)) \
02723 \
02724 \
02725 } \
02726 }
02727
02728 #else
02729
02730 #define H5C__UPDATE_RP_FOR_FLUSH(cache_ptr, entry_ptr, fail_val) \
02731 { \
02732 HDassert( (cache_ptr) ); \
02733 HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \
02734 HDassert( (entry_ptr) ); \
02735 HDassert( !((entry_ptr)->is_protected) ); \
02736 HDassert( !((entry_ptr)->is_read_only) ); \
02737 HDassert( ((entry_ptr)->ro_ref_count) == 0 ); \
02738 HDassert( (entry_ptr)->size > 0 ); \
02739 \
02740 if ( ! ((entry_ptr)->is_pinned) ) { \
02741 \
02742 \
02743 \
02744
02745
02746 \
02747 \
02748 H5C__DLL_REMOVE((entry_ptr), (cache_ptr)->LRU_head_ptr, \
02749 (cache_ptr)->LRU_tail_ptr, \
02750 (cache_ptr)->LRU_list_len, \
02751 (cache_ptr)->LRU_list_size, (fail_val)) \
02752 \
02753 H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->LRU_head_ptr, \
02754 (cache_ptr)->LRU_tail_ptr, \
02755 (cache_ptr)->LRU_list_len, \
02756 (cache_ptr)->LRU_list_size, (fail_val)) \
02757 \
02758 \
02759 } \
02760 }
02761
02762 #endif
02763
02764
02765
02766
02767
02768
02769
02770
02771
02772
02773
02774
02775
02776
02777
02778
02779
02780
02781
02782
02783
02784
02785
02786
02787
02788
02789
02790
02791
02792
02793
02794
02795
02796
02797
02798
02799
02800
02801
02802
02803
02804
02805
02806
02807
02808
02809
02810
02811
02812 #if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS
02813
02814 #define H5C__UPDATE_RP_FOR_INSERTION(cache_ptr, entry_ptr, fail_val) \
02815 { \
02816 HDassert( (cache_ptr) ); \
02817 HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \
02818 HDassert( (entry_ptr) ); \
02819 HDassert( !((entry_ptr)->is_protected) ); \
02820 HDassert( !((entry_ptr)->is_read_only) ); \
02821 HDassert( ((entry_ptr)->ro_ref_count) == 0 ); \
02822 HDassert( (entry_ptr)->size > 0 ); \
02823 \
02824 if ( (entry_ptr)->is_pinned ) { \
02825 \
02826 H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->pel_head_ptr, \
02827 (cache_ptr)->pel_tail_ptr, \
02828 (cache_ptr)->pel_len, \
02829 (cache_ptr)->pel_size, (fail_val)) \
02830 \
02831 } else { \
02832 \
02833 \
02834 \
02835 \
02836 \
02837 H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->LRU_head_ptr, \
02838 (cache_ptr)->LRU_tail_ptr, \
02839 (cache_ptr)->LRU_list_len, \
02840 (cache_ptr)->LRU_list_size, (fail_val)) \
02841 \
02842
02843
02844 \
02845 \
02846 if ( entry_ptr->is_dirty ) { \
02847 H5C__AUX_DLL_PREPEND((entry_ptr), (cache_ptr)->dLRU_head_ptr, \
02848 (cache_ptr)->dLRU_tail_ptr, \
02849 (cache_ptr)->dLRU_list_len, \
02850 (cache_ptr)->dLRU_list_size, (fail_val)) \
02851 } else { \
02852 H5C__AUX_DLL_PREPEND((entry_ptr), (cache_ptr)->cLRU_head_ptr, \
02853 (cache_ptr)->cLRU_tail_ptr, \
02854 (cache_ptr)->cLRU_list_len, \
02855 (cache_ptr)->cLRU_list_size, (fail_val)) \
02856 } \
02857 \
02858 \
02859 } \
02860 }
02861
02862 #else
02863
02864 #define H5C__UPDATE_RP_FOR_INSERTION(cache_ptr, entry_ptr, fail_val) \
02865 { \
02866 HDassert( (cache_ptr) ); \
02867 HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \
02868 HDassert( (entry_ptr) ); \
02869 HDassert( !((entry_ptr)->is_protected) ); \
02870 HDassert( !((entry_ptr)->is_read_only) ); \
02871 HDassert( ((entry_ptr)->ro_ref_count) == 0 ); \
02872 HDassert( (entry_ptr)->size > 0 ); \
02873 \
02874 if ( (entry_ptr)->is_pinned ) { \
02875 \
02876 H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->pel_head_ptr, \
02877 (cache_ptr)->pel_tail_ptr, \
02878 (cache_ptr)->pel_len, \
02879 (cache_ptr)->pel_size, (fail_val)) \
02880 \
02881 } else { \
02882 \
02883 \
02884 \
02885 \
02886 \
02887 H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->LRU_head_ptr, \
02888 (cache_ptr)->LRU_tail_ptr, \
02889 (cache_ptr)->LRU_list_len, \
02890 (cache_ptr)->LRU_list_size, (fail_val)) \
02891 \
02892 \
02893 } \
02894 }
02895
02896 #endif
02897
02898
02899
02900
02901
02902
02903
02904
02905
02906
02907
02908
02909
02910
02911
02912
02913
02914
02915
02916
02917
02918
02919
02920
02921
02922
02923
02924
02925
02926
02927
02928
02929
02930
02931
02932
02933
02934
02935
02936
02937
02938
02939
02940
02941
02942
02943
02944
02945
02946
02947 #if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS
02948
02949 #define H5C__UPDATE_RP_FOR_PROTECT(cache_ptr, entry_ptr, fail_val) \
02950 { \
02951 HDassert( (cache_ptr) ); \
02952 HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \
02953 HDassert( (entry_ptr) ); \
02954 HDassert( !((entry_ptr)->is_protected) ); \
02955 HDassert( !((entry_ptr)->is_read_only) ); \
02956 HDassert( ((entry_ptr)->ro_ref_count) == 0 ); \
02957 HDassert( (entry_ptr)->size > 0 ); \
02958 \
02959 if ( (entry_ptr)->is_pinned ) { \
02960 \
02961 H5C__DLL_REMOVE((entry_ptr), (cache_ptr)->pel_head_ptr, \
02962 (cache_ptr)->pel_tail_ptr, \
02963 (cache_ptr)->pel_len, \
02964 (cache_ptr)->pel_size, (fail_val)) \
02965 HDassert( (cache_ptr)->pel_len >= 0 ); \
02966 \
02967 } else { \
02968 \
02969 \
02970 \
02971 \
02972 \
02973 H5C__DLL_REMOVE((entry_ptr), (cache_ptr)->LRU_head_ptr, \
02974 (cache_ptr)->LRU_tail_ptr, \
02975 (cache_ptr)->LRU_list_len, \
02976 (cache_ptr)->LRU_list_size, (fail_val)) \
02977 \
02978
02979
02980 \
02981 \
02982 if ( (entry_ptr)->is_dirty ) { \
02983 \
02984 H5C__AUX_DLL_REMOVE((entry_ptr), (cache_ptr)->dLRU_head_ptr, \
02985 (cache_ptr)->dLRU_tail_ptr, \
02986 (cache_ptr)->dLRU_list_len, \
02987 (cache_ptr)->dLRU_list_size, (fail_val)) \
02988 \
02989 } else { \
02990 \
02991 H5C__AUX_DLL_REMOVE((entry_ptr), (cache_ptr)->cLRU_head_ptr, \
02992 (cache_ptr)->cLRU_tail_ptr, \
02993 (cache_ptr)->cLRU_list_len, \
02994 (cache_ptr)->cLRU_list_size, (fail_val)) \
02995 } \
02996 \
02997 \
02998 } \
02999 \
03000
03001
03002 \
03003 \
03004 H5C__DLL_APPEND((entry_ptr), (cache_ptr)->pl_head_ptr, \
03005 (cache_ptr)->pl_tail_ptr, \
03006 (cache_ptr)->pl_len, \
03007 (cache_ptr)->pl_size, (fail_val)) \
03008 }
03009
03010 #else
03011
03012 #define H5C__UPDATE_RP_FOR_PROTECT(cache_ptr, entry_ptr, fail_val) \
03013 { \
03014 HDassert( (cache_ptr) ); \
03015 HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \
03016 HDassert( (entry_ptr) ); \
03017 HDassert( !((entry_ptr)->is_protected) ); \
03018 HDassert( !((entry_ptr)->is_read_only) ); \
03019 HDassert( ((entry_ptr)->ro_ref_count) == 0 ); \
03020 HDassert( (entry_ptr)->size > 0 ); \
03021 \
03022 if ( (entry_ptr)->is_pinned ) { \
03023 \
03024 H5C__DLL_REMOVE((entry_ptr), (cache_ptr)->pel_head_ptr, \
03025 (cache_ptr)->pel_tail_ptr, \
03026 (cache_ptr)->pel_len, \
03027 (cache_ptr)->pel_size, (fail_val)) \
03028 HDassert( (cache_ptr)->pel_len >= 0 ); \
03029 \
03030 } else { \
03031 \
03032 \
03033 \
03034 \
03035 \
03036 H5C__DLL_REMOVE((entry_ptr), (cache_ptr)->LRU_head_ptr, \
03037 (cache_ptr)->LRU_tail_ptr, \
03038 (cache_ptr)->LRU_list_len, \
03039 (cache_ptr)->LRU_list_size, (fail_val)) \
03040 \
03041 \
03042 } \
03043 \
03044
03045
03046 \
03047 \
03048 H5C__DLL_APPEND((entry_ptr), (cache_ptr)->pl_head_ptr, \
03049 (cache_ptr)->pl_tail_ptr, \
03050 (cache_ptr)->pl_len, \
03051 (cache_ptr)->pl_size, (fail_val)) \
03052 }
03053
03054 #endif
03055
03056
03057
03058
03059
03060
03061
03062
03063
03064
03065
03066
03067
03068
03069
03070
03071
03072
03073
03074
03075
03076
03077
03078
03079
03080
03081
03082
03083
03084
03085
03086
03087
03088
03089
03090
03091
03092
03093
03094
03095
03096
03097
03098
03099
03100
03101
03102
03103
03104
03105
03106
03107
03108
03109
03110
03111
03112
03113 #if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS
03114
03115 #define H5C__UPDATE_RP_FOR_RENAME(cache_ptr, entry_ptr, was_dirty, fail_val) \
03116 { \
03117 HDassert( (cache_ptr) ); \
03118 HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \
03119 HDassert( (entry_ptr) ); \
03120 HDassert( !((entry_ptr)->is_protected) ); \
03121 HDassert( !((entry_ptr)->is_read_only) ); \
03122 HDassert( ((entry_ptr)->ro_ref_count) == 0 ); \
03123 HDassert( (entry_ptr)->size > 0 ); \
03124 \
03125 if ( ! ((entry_ptr)->is_pinned) ) { \
03126 \
03127 \
03128 \
03129
03130 \
03131 \
03132 H5C__DLL_REMOVE((entry_ptr), (cache_ptr)->LRU_head_ptr, \
03133 (cache_ptr)->LRU_tail_ptr, \
03134 (cache_ptr)->LRU_list_len, \
03135 (cache_ptr)->LRU_list_size, (fail_val)) \
03136 \
03137 H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->LRU_head_ptr, \
03138 (cache_ptr)->LRU_tail_ptr, \
03139 (cache_ptr)->LRU_list_len, \
03140 (cache_ptr)->LRU_list_size, (fail_val)) \
03141 \
03142
03143
03144 \
03145 if ( was_dirty ) { \
03146 \
03147 H5C__AUX_DLL_REMOVE((entry_ptr), (cache_ptr)->dLRU_head_ptr, \
03148 (cache_ptr)->dLRU_tail_ptr, \
03149 (cache_ptr)->dLRU_list_len, \
03150 (cache_ptr)->dLRU_list_size, (fail_val)) \
03151 \
03152 } else { \
03153 \
03154 H5C__AUX_DLL_REMOVE((entry_ptr), (cache_ptr)->cLRU_head_ptr, \
03155 (cache_ptr)->cLRU_tail_ptr, \
03156 (cache_ptr)->cLRU_list_len, \
03157 (cache_ptr)->cLRU_list_size, (fail_val)) \
03158 } \
03159 \
03160
03161
03162 \
03163 \
03164 if ( (entry_ptr)->is_dirty ) { \
03165 \
03166 H5C__AUX_DLL_PREPEND((entry_ptr), (cache_ptr)->dLRU_head_ptr, \
03167 (cache_ptr)->dLRU_tail_ptr, \
03168 (cache_ptr)->dLRU_list_len, \
03169 (cache_ptr)->dLRU_list_size, (fail_val)) \
03170 \
03171 } else { \
03172 \
03173 H5C__AUX_DLL_PREPEND((entry_ptr), (cache_ptr)->cLRU_head_ptr, \
03174 (cache_ptr)->cLRU_tail_ptr, \
03175 (cache_ptr)->cLRU_list_len, \
03176 (cache_ptr)->cLRU_list_size, (fail_val)) \
03177 } \
03178 \
03179 \
03180 } \
03181 }
03182
03183 #else
03184
03185 #define H5C__UPDATE_RP_FOR_RENAME(cache_ptr, entry_ptr, was_dirty, fail_val) \
03186 { \
03187 HDassert( (cache_ptr) ); \
03188 HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \
03189 HDassert( (entry_ptr) ); \
03190 HDassert( !((entry_ptr)->is_protected) ); \
03191 HDassert( !((entry_ptr)->is_read_only) ); \
03192 HDassert( ((entry_ptr)->ro_ref_count) == 0 ); \
03193 HDassert( (entry_ptr)->size > 0 ); \
03194 \
03195 if ( ! ((entry_ptr)->is_pinned) ) { \
03196 \
03197 \
03198 \
03199
03200 \
03201 \
03202 H5C__DLL_REMOVE((entry_ptr), (cache_ptr)->LRU_head_ptr, \
03203 (cache_ptr)->LRU_tail_ptr, \
03204 (cache_ptr)->LRU_list_len, \
03205 (cache_ptr)->LRU_list_size, (fail_val)) \
03206 \
03207 H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->LRU_head_ptr, \
03208 (cache_ptr)->LRU_tail_ptr, \
03209 (cache_ptr)->LRU_list_len, \
03210 (cache_ptr)->LRU_list_size, (fail_val)) \
03211 \
03212 \
03213 } \
03214 }
03215
03216 #endif
03217
03218
03219
03220
03221
03222
03223
03224
03225
03226
03227
03228
03229
03230
03231
03232
03233
03234
03235
03236
03237
03238
03239
03240
03241
03242
03243
03244
03245
03246
03247
03248
03249
03250
03251 #if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS
03252
03253 #define H5C__UPDATE_RP_FOR_SIZE_CHANGE(cache_ptr, entry_ptr, new_size) \
03254 { \
03255 HDassert( (cache_ptr) ); \
03256 HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \
03257 HDassert( (entry_ptr) ); \
03258 HDassert( !((entry_ptr)->is_protected) ); \
03259 HDassert( !((entry_ptr)->is_read_only) ); \
03260 HDassert( ((entry_ptr)->ro_ref_count) == 0 ); \
03261 HDassert( (entry_ptr)->size > 0 ); \
03262 HDassert( new_size > 0 ); \
03263 \
03264 if ( (entry_ptr)->is_pinned ) { \
03265 \
03266 H5C__DLL_UPDATE_FOR_SIZE_CHANGE((cache_ptr)->pel_len, \
03267 (cache_ptr)->pel_size, \
03268 (entry_ptr)->size, \
03269 (new_size)); \
03270 \
03271 } else { \
03272 \
03273 \
03274 \
03275 \
03276 \
03277 H5C__DLL_UPDATE_FOR_SIZE_CHANGE((cache_ptr)->LRU_list_len, \
03278 (cache_ptr)->LRU_list_size, \
03279 (entry_ptr)->size, \
03280 (new_size)); \
03281 \
03282
03283
03284
03285 \
03286 \
03287 if ( (entry_ptr)->is_dirty ) { \
03288 \
03289 H5C__DLL_UPDATE_FOR_SIZE_CHANGE((cache_ptr)->dLRU_list_len, \
03290 (cache_ptr)->dLRU_list_size, \
03291 (entry_ptr)->size, \
03292 (new_size)); \
03293 \
03294 } else { \
03295 \
03296 H5C__DLL_UPDATE_FOR_SIZE_CHANGE((cache_ptr)->cLRU_list_len, \
03297 (cache_ptr)->cLRU_list_size, \
03298 (entry_ptr)->size, \
03299 (new_size)); \
03300 } \
03301 \
03302 \
03303 } \
03304 \
03305 }
03306
03307 #else
03308
03309 #define H5C__UPDATE_RP_FOR_SIZE_CHANGE(cache_ptr, entry_ptr, new_size) \
03310 { \
03311 HDassert( (cache_ptr) ); \
03312 HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \
03313 HDassert( (entry_ptr) ); \
03314 HDassert( !((entry_ptr)->is_protected) ); \
03315 HDassert( !((entry_ptr)->is_read_only) ); \
03316 HDassert( ((entry_ptr)->ro_ref_count) == 0 ); \
03317 HDassert( (entry_ptr)->size > 0 ); \
03318 HDassert( new_size > 0 ); \
03319 \
03320 if ( (entry_ptr)->is_pinned ) { \
03321 \
03322 H5C__DLL_UPDATE_FOR_SIZE_CHANGE((cache_ptr)->pel_len, \
03323 (cache_ptr)->pel_size, \
03324 (entry_ptr)->size, \
03325 (new_size)); \
03326 \
03327 } else { \
03328 \
03329 \
03330 \
03331 \
03332 \
03333 H5C__DLL_UPDATE_FOR_SIZE_CHANGE((cache_ptr)->LRU_list_len, \
03334 (cache_ptr)->LRU_list_size, \
03335 (entry_ptr)->size, \
03336 (new_size)); \
03337 \
03338 \
03339 } \
03340 \
03341 }
03342
03343 #endif
03344
03345
03346
03347
03348
03349
03350
03351
03352
03353
03354
03355
03356
03357
03358
03359
03360
03361
03362
03363
03364
03365
03366
03367
03368
03369
03370
03371
03372
03373
03374
03375 #if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS
03376
03377 #define H5C__UPDATE_RP_FOR_UNPIN(cache_ptr, entry_ptr, fail_val) \
03378 { \
03379 HDassert( (cache_ptr) ); \
03380 HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \
03381 HDassert( (entry_ptr) ); \
03382 HDassert( !((entry_ptr)->is_protected) ); \
03383 HDassert( !((entry_ptr)->is_read_only) ); \
03384 HDassert( ((entry_ptr)->ro_ref_count) == 0 ); \
03385 HDassert( (entry_ptr)->is_pinned); \
03386 HDassert( (entry_ptr)->size > 0 ); \
03387 \
03388
03389
03390 \
03391 H5C__DLL_REMOVE((entry_ptr), (cache_ptr)->pel_head_ptr, \
03392 (cache_ptr)->pel_tail_ptr, (cache_ptr)->pel_len, \
03393 (cache_ptr)->pel_size, (fail_val)) \
03394 HDassert( (cache_ptr)->pel_len >= 0 ); \
03395 \
03396 \
03397 \
03398 \
03399 \
03400 H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->LRU_head_ptr, \
03401 (cache_ptr)->LRU_tail_ptr, \
03402 (cache_ptr)->LRU_list_len, \
03403 (cache_ptr)->LRU_list_size, (fail_val)) \
03404 \
03405
03406
03407 \
03408 \
03409 if ( (entry_ptr)->is_dirty ) { \
03410 \
03411 H5C__AUX_DLL_PREPEND((entry_ptr), (cache_ptr)->dLRU_head_ptr, \
03412 (cache_ptr)->dLRU_tail_ptr, \
03413 (cache_ptr)->dLRU_list_len, \
03414 (cache_ptr)->dLRU_list_size, (fail_val)) \
03415 \
03416 } else { \
03417 \
03418 H5C__AUX_DLL_PREPEND((entry_ptr), (cache_ptr)->cLRU_head_ptr, \
03419 (cache_ptr)->cLRU_tail_ptr, \
03420 (cache_ptr)->cLRU_list_len, \
03421 (cache_ptr)->cLRU_list_size, (fail_val)) \
03422 } \
03423 \
03424 \
03425 \
03426 }
03427
03428 #else
03429
03430 #define H5C__UPDATE_RP_FOR_UNPIN(cache_ptr, entry_ptr, fail_val) \
03431 { \
03432 HDassert( (cache_ptr) ); \
03433 HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \
03434 HDassert( (entry_ptr) ); \
03435 HDassert( !((entry_ptr)->is_protected) ); \
03436 HDassert( !((entry_ptr)->is_read_only) ); \
03437 HDassert( ((entry_ptr)->ro_ref_count) == 0 ); \
03438 HDassert( (entry_ptr)->is_pinned); \
03439 HDassert( (entry_ptr)->size > 0 ); \
03440 \
03441
03442
03443 \
03444 H5C__DLL_REMOVE((entry_ptr), (cache_ptr)->pel_head_ptr, \
03445 (cache_ptr)->pel_tail_ptr, (cache_ptr)->pel_len, \
03446 (cache_ptr)->pel_size, (fail_val)) \
03447 HDassert( (cache_ptr)->pel_len >= 0 ); \
03448 \
03449 \
03450 \
03451 \
03452 \
03453 H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->LRU_head_ptr, \
03454 (cache_ptr)->LRU_tail_ptr, \
03455 (cache_ptr)->LRU_list_len, \
03456 (cache_ptr)->LRU_list_size, (fail_val)) \
03457 \
03458 \
03459 \
03460 }
03461
03462 #endif
03463
03464
03465
03466
03467
03468
03469
03470
03471
03472
03473
03474
03475
03476
03477
03478
03479
03480
03481
03482
03483
03484
03485
03486
03487
03488
03489
03490
03491
03492
03493
03494
03495
03496
03497
03498
03499
03500
03501
03502
03503
03504
03505
03506
03507
03508
03509 #if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS
03510
03511 #define H5C__UPDATE_RP_FOR_UNPROTECT(cache_ptr, entry_ptr, fail_val) \
03512 { \
03513 HDassert( (cache_ptr) ); \
03514 HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \
03515 HDassert( (entry_ptr) ); \
03516 HDassert( (entry_ptr)->is_protected); \
03517 HDassert( (entry_ptr)->size > 0 ); \
03518 \
03519
03520
03521 \
03522 H5C__DLL_REMOVE((entry_ptr), (cache_ptr)->pl_head_ptr, \
03523 (cache_ptr)->pl_tail_ptr, (cache_ptr)->pl_len, \
03524 (cache_ptr)->pl_size, (fail_val)) \
03525 \
03526 if ( (entry_ptr)->is_pinned ) { \
03527 \
03528 H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->pel_head_ptr, \
03529 (cache_ptr)->pel_tail_ptr, \
03530 (cache_ptr)->pel_len, \
03531 (cache_ptr)->pel_size, (fail_val)) \
03532 \
03533 } else { \
03534 \
03535 \
03536 \
03537 \
03538 \
03539 H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->LRU_head_ptr, \
03540 (cache_ptr)->LRU_tail_ptr, \
03541 (cache_ptr)->LRU_list_len, \
03542 (cache_ptr)->LRU_list_size, (fail_val)) \
03543 \
03544
03545
03546 \
03547 \
03548 if ( (entry_ptr)->is_dirty ) { \
03549 \
03550 H5C__AUX_DLL_PREPEND((entry_ptr), (cache_ptr)->dLRU_head_ptr, \
03551 (cache_ptr)->dLRU_tail_ptr, \
03552 (cache_ptr)->dLRU_list_len, \
03553 (cache_ptr)->dLRU_list_size, (fail_val)) \
03554 \
03555 } else { \
03556 \
03557 H5C__AUX_DLL_PREPEND((entry_ptr), (cache_ptr)->cLRU_head_ptr, \
03558 (cache_ptr)->cLRU_tail_ptr, \
03559 (cache_ptr)->cLRU_list_len, \
03560 (cache_ptr)->cLRU_list_size, (fail_val)) \
03561 } \
03562 \
03563 \
03564 } \
03565 \
03566 }
03567
03568 #else
03569
03570 #define H5C__UPDATE_RP_FOR_UNPROTECT(cache_ptr, entry_ptr, fail_val) \
03571 { \
03572 HDassert( (cache_ptr) ); \
03573 HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \
03574 HDassert( (entry_ptr) ); \
03575 HDassert( (entry_ptr)->is_protected); \
03576 HDassert( (entry_ptr)->size > 0 ); \
03577 \
03578
03579
03580 \
03581 H5C__DLL_REMOVE((entry_ptr), (cache_ptr)->pl_head_ptr, \
03582 (cache_ptr)->pl_tail_ptr, (cache_ptr)->pl_len, \
03583 (cache_ptr)->pl_size, (fail_val)) \
03584 \
03585 if ( (entry_ptr)->is_pinned ) { \
03586 \
03587 H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->pel_head_ptr, \
03588 (cache_ptr)->pel_tail_ptr, \
03589 (cache_ptr)->pel_len, \
03590 (cache_ptr)->pel_size, (fail_val)) \
03591 \
03592 } else { \
03593 \
03594 \
03595 \
03596 \
03597 \
03598 H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->LRU_head_ptr, \
03599 (cache_ptr)->LRU_tail_ptr, \
03600 (cache_ptr)->LRU_list_len, \
03601 (cache_ptr)->LRU_list_size, (fail_val)) \
03602 \
03603 \
03604 } \
03605 }
03606
03607 #endif
03608
03609
03610 #endif
03611