]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
interval_set: kill subset_of 21108/head
authorxie xingguo <xie.xingguo@zte.com.cn>
Thu, 29 Mar 2018 01:45:54 +0000 (09:45 +0800)
committerxie xingguo <xie.xingguo@zte.com.cn>
Thu, 29 Mar 2018 02:12:54 +0000 (10:12 +0800)
It is originally introduced in https://github.com/ceph/ceph/pull/15199
aiming at improving the pool-based **du** stats.
For performance concerns, https://github.com/ceph/ceph/pull/19616 did
an incomplete revert of that PR and hence comes the following clean-up job...

Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
src/include/interval_set.h
src/test/common/test_interval_set.cc

index 14f9ba82e7269cc23be82d27b4353def9d5d0b69..33ab2681ebe07d779bef8618c146503923c47223 100644 (file)
@@ -680,48 +680,6 @@ class interval_set {
     return true;
   }  
 
- /*
-   * build a subset of @other for given rage [@start, @end)
-   * E.g.:
-   * subset_of([5~10,20~5], 0, 100) -> [5~10,20~5]
-   * subset_of([5~10,20~5], 5, 25)  -> [5~10,20~5]
-   * subset_of([5~10,20~5], 1, 10)  -> [5~5]
-   * subset_of([5~10,20~5], 8, 24)  -> [8~7, 20~4]
-   */
-  void subset_of(const interval_set &other, T start, T end) {
-    assert(end >= start);
-    clear();
-    if (end == start) {
-      return;
-    }
-    typename Map::const_iterator p = other.find_inc(start);
-    if (p == other.m.end())
-      return;
-    if (p->first < start) {
-      if (p->first + p->second >= end) {
-        insert(start, end - start);
-        return;
-      } else {
-        insert(start, p->first + p->second - start);
-        ++p;
-      }
-    }
-    while (p != other.m.end()) {
-      assert(p->first >= start);
-      if (p->first >= end) {
-        return;
-      }
-      if (p->first + p->second >= end) {
-        insert(p->first, end - p->first);
-        return;
-      } else {
-        // whole
-        insert(p->first, p->second);
-        ++p;
-      }
-    }
-  }
-
   /*
    * build a subset of @other, starting at or after @start, and including
    * @len worth of values, skipping holes.  e.g.,
index 7b35f895896b566b41d1e165368c50012197d2c6..e63953a6bb136c3c9e3bafb08b5d85a38b3c7d15 100644 (file)
@@ -564,53 +564,6 @@ TYPED_TEST(IntervalSetTest, subset_of) {
   iset1.insert( 50, 5);
   iset2.insert( 55, 2);
   ASSERT_FALSE(iset1.subset_of(iset2));
-
-  ISet iset3, iset4, expected;
-  iset3.insert(5, 10);
-  iset3.insert(20, 5);
-
-  iset4.subset_of(iset3, 0, 100);
-  expected.insert(5, 10);
-  expected.insert(20, 5);
-  ASSERT_TRUE(iset4 == expected);
-
-  iset4.clear();
-  iset4.subset_of(iset3, 5, 25);
-  ASSERT_TRUE(iset4 == expected);
-
-  iset4.clear();
-  iset4.subset_of(iset3, 1, 10);
-  expected.clear();
-  expected.insert(5, 5);
-  ASSERT_TRUE(iset4 == expected);
-
-  iset4.clear();
-  iset4.subset_of(iset3, 8, 24);
-  expected.clear();
-  expected.insert(8, 7);
-  expected.insert(20, 4);
-  ASSERT_TRUE(iset4 == expected);
-
-  iset4.clear();
-  iset4.subset_of(iset3, 0, 0);
-  expected.clear();
-  ASSERT_TRUE(iset4 == expected);
-
-  iset4.clear();
-  iset4.subset_of(iset3, 0, 1);
-  ASSERT_TRUE(iset4 == expected);
-
-  iset4.clear();
-  iset4.subset_of(iset3, 0, 5);
-  ASSERT_TRUE(iset4 == expected);
-
-  iset4.clear();
-  iset4.subset_of(iset3, 25, 30);
-  ASSERT_TRUE(iset4 == expected);
-
-  iset4.clear();
-  iset4.subset_of(iset3, 26, 40);
-  ASSERT_TRUE(iset4 == expected);
 }
 
 TYPED_TEST(IntervalSetTest, span_of) {