| 535 | } |
| 536 | |
| 537 | bool |
| 538 | StripeSM::walk_bucket_chain(int s) |
| 539 | { |
| 540 | CacheDirEntry *seg = this->dir_segment(s); |
| 541 | std::bitset<65536> b_bitset; |
| 542 | b_bitset.reset(); |
| 543 | for (int b = 0; b < this->_buckets; b++) { |
| 544 | CacheDirEntry *p = nullptr; |
| 545 | auto *dir_b = dir_bucket(b, seg); |
| 546 | CacheDirEntry *e = dir_b; |
| 547 | |
| 548 | while (e) { |
| 549 | int i = dir_to_offset(e, seg); |
| 550 | if (b_bitset.test(i)) { |
| 551 | std::cout << "bit already set in " << "seg " << s << " bucket " << b << std::endl; |
| 552 | } |
| 553 | if (i > 0) { // i.e., not the first dir in the segment |
| 554 | b_bitset[i] = true; |
| 555 | } |
| 556 | |
| 557 | #if 1 |
| 558 | if (!dir_valid(e) || !dir_offset(e)) { |
| 559 | // std::cout<<"dir_clean in segment "<<s<<" =>cleaning "<<e<<" tag"<<dir_tag(e)<<" boffset"<< dir_offset(e)<< " bucket: |
| 560 | // "<<dir_b<< " bucket len: "<<dir_bucket_length(dir_b, s)<<std::endl; |
| 561 | e = dir_delete_entry(e, p, s); |
| 562 | continue; |
| 563 | } |
| 564 | #endif |
| 565 | p = e; |
| 566 | e = next_dir(e, seg); |
| 567 | } |
| 568 | // std::cout<<"dir len in this bucket "<<len<<std::endl; |
| 569 | } |
| 570 | return false; |
| 571 | } |
| 572 | |
| 573 | void |
| 574 | StripeSM::dir_free_entry(CacheDirEntry *e, int s) |
nothing calls this directly
no test coverage detected