@@ -298,21 +298,17 @@ void Btree2Allocator::_try_remove_from_tree(uint64_t start, uint64_t size,
298298 return ;
299299 }
300300 do {
301- auto next_p = rt_p;
302- ++next_p;
303-
304301 if (start < rt_p->first ) {
305302 cb (start, rt_p->first - start, false );
306303 start = rt_p->first ;
307304 }
308305 auto range_end = std::min (rt_p->second , end);
309306
310- _remove_from_tree (rt_p, start, range_end);
307+ rt_p = _remove_from_tree (rt_p, start, range_end);
311308
312309 cb (start, range_end - start, true );
313310 start = range_end;
314311
315- rt_p = next_p;
316312 } while (rt_p != range_tree.end () && rt_p->first < end && start < end);
317313 if (start < end) {
318314 cb (start, end - start, false );
@@ -461,8 +457,9 @@ void Btree2Allocator::_remove_from_tree(uint64_t start, uint64_t size)
461457 _remove_from_tree (rt_p, start, end);
462458}
463459
464- void Btree2Allocator::_remove_from_tree (
465- Btree2Allocator::range_tree_t ::iterator rt_p,
460+ Btree2Allocator::range_tree_iterator
461+ Btree2Allocator::_remove_from_tree (
462+ Btree2Allocator::range_tree_iterator rt_p,
466463 uint64_t start,
467464 uint64_t end)
468465{
@@ -472,13 +469,14 @@ void Btree2Allocator::_remove_from_tree(
472469 auto rs_p = rs_tree->find (rs);
473470 ceph_assert (rs_p != rs_tree->end ());
474471
475- _remove_from_tree (rs_tree, rs_p, rt_p, start, end);
472+ return _remove_from_tree (rs_tree, rs_p, rt_p, start, end);
476473}
477474
478- void Btree2Allocator::_remove_from_tree (
475+ Btree2Allocator::range_tree_iterator
476+ Btree2Allocator::_remove_from_tree (
479477 Btree2Allocator::range_size_tree_t * rs_tree,
480478 Btree2Allocator::range_size_tree_t ::iterator rs_p,
481- Btree2Allocator::range_tree_t ::iterator rt_p,
479+ Btree2Allocator::range_tree_iterator rt_p,
482480 uint64_t start,
483481 uint64_t end)
484482{
@@ -505,6 +503,7 @@ void Btree2Allocator::_remove_from_tree(
505503 rs.start = end;
506504 __try_insert_range (rs, &rt_p);
507505 }
506+ return rt_p;
508507}
509508
510509void Btree2Allocator::_try_insert_range (const range_seg_t & rs)
@@ -519,7 +518,7 @@ void Btree2Allocator::_try_insert_range(const range_seg_t& rs)
519518
520519bool Btree2Allocator::__try_insert_range (
521520 const Btree2Allocator::range_seg_t & rs,
522- Btree2Allocator::range_tree_t ::iterator * rt_p_insert)
521+ Btree2Allocator::range_tree_iterator * rt_p_insert)
523522{
524523 ceph_assert (rs.end > rs.start );
525524 // Check if amount of range_seg_t entries isn't above the threshold,
0 commit comments