]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/osd: move PG::with_locked_obc() into .cc
authorKefu Chai <kchai@redhat.com>
Wed, 4 Nov 2020 03:40:18 +0000 (11:40 +0800)
committerKefu Chai <kchai@redhat.com>
Wed, 18 Nov 2020 09:37:59 +0000 (17:37 +0800)
Signed-off-by: Kefu Chai <kchai@redhat.com>
src/crimson/osd/pg.cc
src/crimson/osd/pg.h

index eab8452b8d5e8af898059afdd09262305aa90771..f05d6f4d6979efd3c211a66043863ccfc5e89320 100644 (file)
@@ -865,6 +865,23 @@ PG::load_head_obc(ObjectContextRef obc)
   });
 }
 
+PG::load_obc_ertr::future<>
+PG::with_locked_obc(Ref<MOSDOp> &m, const OpInfo &op_info,
+                   Operation *op, PG::with_obc_func_t &&f)
+{
+  if (__builtin_expect(stopping, false)) {
+    throw crimson::common::system_shutdown_exception();
+  }
+  RWState::State type = get_lock_type(op_info);
+  return get_locked_obc(op, get_oid(*m), type)
+    .safe_then([f=std::move(f), type=type](auto obc) {
+    return f(obc).finally([obc, type=type] {
+      obc->put_lock_type(type);
+      return load_obc_ertr::now();
+    });
+  });
+}
+
 PG::load_obc_ertr::future<crimson::osd::ObjectContextRef>
 PG::get_locked_obc(
   Operation *op, const hobject_t &oid, RWState::State type)
index 930aa5e73d913cae3128b3c51e46fe8319c4a15e..9cd17c5054a267c5aed754fb6c1344de55897543 100644 (file)
@@ -513,24 +513,12 @@ public:
     const hobject_t &oid,
     RWState::State type);
 public:
-  template <typename F>
-  auto with_locked_obc(
+  using with_obc_func_t = std::function<seastar::future<> (ObjectContextRef)>;
+  load_obc_ertr::future<> with_locked_obc(
     Ref<MOSDOp> &m,
     const OpInfo &op_info,
     Operation *op,
-    F &&f) {
-    if (__builtin_expect(stopping, false)) {
-      throw crimson::common::system_shutdown_exception();
-    }
-    RWState::State type = get_lock_type(op_info);
-    return get_locked_obc(op, get_oid(*m), type)
-      .safe_then([f=std::forward<F>(f), type=type](auto obc) {
-       return f(obc).finally([obc, type=type] {
-         obc->put_lock_type(type);
-         return load_obc_ertr::now();
-       });
-      });
-  }
+    with_obc_func_t&& f);
 
   seastar::future<> handle_rep_op(Ref<MOSDRepOp> m);
   void handle_rep_op_reply(crimson::net::Connection* conn,