]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/osd: pass RWState using template parameter
authorKefu Chai <kchai@redhat.com>
Wed, 11 Nov 2020 05:38:22 +0000 (13:38 +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/object_context.h

index 4815a28529b1c1bd4eee44f330913015b4df6126..72f271beb37f46d221745891816c27c6d9eea95f 100644 (file)
@@ -112,9 +112,9 @@ private:
   }
 
 public:
-  template<typename Func>
-  auto with_lock(RWState::State type, Func&& func) {
-    switch (type) {
+  template<RWState::State Type, typename Func>
+  auto with_lock(Func&& func) {
+    switch (Type) {
     case RWState::RWWRITE:
       return seastar::with_lock(lock.for_write(), std::forward<Func>(func));
     case RWState::RWREAD:
@@ -125,9 +125,9 @@ public:
       assert(0 == "noop");
     }
   }
-  template<typename Func>
-  auto with_promoted_lock(RWState::State type, Func&& func) {
-    switch (type) {
+  template<RWState::State Type, typename Func>
+  auto with_promoted_lock(Func&& func) {
+    switch (Type) {
     case RWState::RWWRITE:
       return seastar::with_lock(lock.excl_from_write(), std::forward<Func>(func));
     case RWState::RWREAD: