]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
crimson/os/seastore/async_cleaner: sort GCProcess interfaces
authorYingxin Cheng <yingxin.cheng@intel.com>
Wed, 24 Aug 2022 08:29:33 +0000 (16:29 +0800)
committerYingxin Cheng <yingxin.cheng@intel.com>
Fri, 26 Aug 2022 09:47:30 +0000 (17:47 +0800)
Signed-off-by: Yingxin Cheng <yingxin.cheng@intel.com>
src/crimson/os/seastore/async_cleaner.h

index b431cb118975db2938d4c5a89e0e4415bd077613..9d4b9f3f1cb329eb85f5051f0518e35587dde05b 100644 (file)
@@ -1086,38 +1086,6 @@ private:
    */
   using gc_cycle_ret = seastar::future<>;
   class GCProcess {
-    std::optional<gc_cycle_ret> process_join;
-
-    AsyncCleaner &cleaner;
-
-    std::optional<seastar::promise<>> blocking;
-
-    bool is_stopping() const {
-      return !process_join;
-    }
-
-    gc_cycle_ret run();
-
-    void wake() {
-      if (blocking) {
-       blocking->set_value();
-       blocking = std::nullopt;
-      }
-    }
-
-    seastar::future<> maybe_wait_should_run() {
-      return seastar::do_until(
-       [this] {
-         cleaner.log_gc_state("GCProcess::maybe_wait_should_run");
-         return is_stopping() || cleaner.gc_should_run();
-       },
-       [this] {
-         ceph_assert(!blocking);
-         blocking = seastar::promise<>();
-         return blocking->get_future();
-       });
-    }
-    bool is_running_until_halt = false;
   public:
     GCProcess(AsyncCleaner &cleaner) : cleaner(cleaner) {}
 
@@ -1128,6 +1096,15 @@ private:
       assert(!is_stopping());
     }
 
+    void maybe_wake_on_space_used() {
+      if (is_stopping()) {
+        return;
+      }
+      if (cleaner.gc_should_run()) {
+       wake();
+      }
+    }
+
     gc_cycle_ret stop() {
       if (is_stopping()) {
         return seastar::now();
@@ -1162,14 +1139,37 @@ private:
       );
     }
 
-    void maybe_wake_on_space_used() {
-      if (is_stopping()) {
-        return;
-      }
-      if (cleaner.gc_should_run()) {
-       wake();
+  private:
+    bool is_stopping() const {
+      return !process_join;
+    }
+
+    gc_cycle_ret run();
+
+    void wake() {
+      if (blocking) {
+       blocking->set_value();
+       blocking = std::nullopt;
       }
     }
+
+    seastar::future<> maybe_wait_should_run() {
+      return seastar::do_until(
+       [this] {
+         cleaner.log_gc_state("GCProcess::maybe_wait_should_run");
+         return is_stopping() || cleaner.gc_should_run();
+       },
+       [this] {
+         ceph_assert(!blocking);
+         blocking = seastar::promise<>();
+         return blocking->get_future();
+       });
+    }
+
+    AsyncCleaner &cleaner;
+    std::optional<gc_cycle_ret> process_join;
+    std::optional<seastar::promise<>> blocking;
+    bool is_running_until_halt = false;
   } gc_process;
 
   using gc_ertr = work_ertr::extend_ertr<