]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/os/seastore/segment_allocator: simplify close_segment()
authorYingxin Cheng <yingxin.cheng@intel.com>
Thu, 28 Apr 2022 08:46:47 +0000 (16:46 +0800)
committerYingxin Cheng <yingxin.cheng@intel.com>
Fri, 13 May 2022 07:51:19 +0000 (15:51 +0800)
Signed-off-by: Yingxin Cheng <yingxin.cheng@intel.com>
src/crimson/os/seastore/journal/segment_allocator.cc
src/crimson/os/seastore/journal/segment_allocator.h
src/crimson/os/seastore/segment_cleaner.cc

index 015d31286f313f9df8d79f113c94c5e593521a94..ad82a122db1115dfc2a032eb1317c12efd7a7672 100644 (file)
@@ -138,7 +138,7 @@ SegmentAllocator::roll_ertr::future<>
 SegmentAllocator::roll()
 {
   ceph_assert(can_write());
-  return close_segment(true).safe_then([this] {
+  return close_segment().safe_then([this] {
     return do_open().discard_result();
   });
 }
@@ -191,7 +191,7 @@ SegmentAllocator::close()
     LOG_PREFIX(SegmentAllocator::close);
     if (current_segment) {
       INFO("{} close current segment", print_name);
-      return close_segment(false);
+      return close_segment();
     } else {
       INFO("{} no current segment", print_name);
       return close_segment_ertr::now();
@@ -202,16 +202,14 @@ SegmentAllocator::close()
 }
 
 SegmentAllocator::close_segment_ertr::future<>
-SegmentAllocator::close_segment(bool is_rolling)
+SegmentAllocator::close_segment()
 {
   LOG_PREFIX(SegmentAllocator::close_segment);
   assert(can_write());
   // Note: make sure no one can access the current segment once closing
   auto seg_to_close = std::move(current_segment);
   auto close_segment_id = seg_to_close->get_segment_id();
-  if (is_rolling) {
-    segment_provider.close_segment(close_segment_id);
-  }
+  segment_provider.close_segment(close_segment_id);
   auto close_seg_info = segment_provider.get_seg_info(close_segment_id);
   journal_seq_t cur_journal_tail;
   journal_seq_t new_alloc_replay_from;
index ebb7ff08430c3af4d5cb2c974e5071d157c32147..b5a583e998cb561cd8e2d8c7f2003cf0c897528d 100644 (file)
@@ -108,9 +108,8 @@ class SegmentAllocator {
     current_segment_nonce = 0;
   }
 
-  // FIXME: remove the unnecessary is_rolling
   using close_segment_ertr = base_ertr;
-  close_segment_ertr::future<> close_segment(bool is_rolling);
+  close_segment_ertr::future<> close_segment();
 
   const std::string name;
   // device id is not available during construction,
index fd81d0d313e2f7ec51d0e634b92e1ab32899a81d..e9251e718bd9311bce7a686f2c91cd948e72956d 100644 (file)
@@ -550,7 +550,6 @@ void SegmentCleaner::update_journal_tail_committed(journal_seq_t committed)
 void SegmentCleaner::close_segment(segment_id_t segment)
 {
   LOG_PREFIX(SegmentCleaner::close_segment);
-  ceph_assert(init_complete);
   segments.mark_closed(segment);
   INFO("closed, should_block_on_gc {}, projected_avail_ratio {}, "
        "projected_reclaim_ratio {}",