| 685 | } |
| 686 | |
| 687 | int |
| 688 | StripeSM::check_loop(int s) |
| 689 | { |
| 690 | // look for loop in the segment |
| 691 | // rewrite the freelist if loop is present |
| 692 | CacheDirEntry *seg = this->dir_segment(s); |
| 693 | CacheDirEntry *e = dir_from_offset(this->freelist[s], seg); |
| 694 | std::bitset<65536> f_bitset; |
| 695 | f_bitset.reset(); |
| 696 | while (e) { |
| 697 | int i = dir_next(e); |
| 698 | if (f_bitset.test(i)) { |
| 699 | // bit was set in a previous round so a loop is present |
| 700 | std::cout << "<check_loop> Loop present in Span" << this->_span->_path.string() << " Stripe: " << this->hashText |
| 701 | << "Segment: " << s << std::endl; |
| 702 | this->dir_init_segment(s); |
| 703 | return 1; |
| 704 | } |
| 705 | f_bitset[i] = true; |
| 706 | e = dir_from_offset(i, seg); |
| 707 | } |
| 708 | |
| 709 | return 0; |
| 710 | } |
| 711 | |
| 712 | int |
| 713 | compare_ushort(void const *a, void const *b) |
no test coverage detected