]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds/Mutation: un-inline print() to resolve circular dependency
authorMax Kellermann <max.kellermann@ionos.com>
Thu, 17 Apr 2025 15:04:26 +0000 (17:04 +0200)
committerMax Kellermann <max.kellermann@ionos.com>
Thu, 17 Apr 2025 15:25:00 +0000 (17:25 +0200)
Mutation.h and SimpleLock.h have a circular dependency and we have to
resolve it using forward-declarations.  To make that possible, move
print() to Mutation.cc.

Signed-off-by: Max Kellermann <max.kellermann@ionos.com>
src/mds/Mutation.cc
src/mds/Mutation.h

index 4ba5f1ff4ba068d4a22777b58578b32e4431ff6d..0628019807801a40c9a3138ce4077917c4c4ed5b 100644 (file)
@@ -14,6 +14,7 @@
 
 #include "Mutation.h"
 #include "ScatterLock.h"
+#include "SimpleLock.h"
 #include "BatchOp.h"
 #include "CDentry.h"
 #include "CInode.h"
@@ -105,6 +106,16 @@ bool MutationImpl::is_wrlocked(SimpleLock *lock) const {
   return false;
 }
 
+void MutationImpl::LockOp::print(std::ostream& out) const {
+  CachedStackStringStream css;
+  *css << "0x" << std::hex << flags;
+  out << "LockOp(l=" << *lock << ",f=" << css->strv();
+  if (wrlock_target != MDS_RANK_NONE) {
+    out << ",wt=" << wrlock_target;
+  }
+  out << ")";
+}
+
 void MutationImpl::LockOpVec::erase_rdlock(SimpleLock* lock)
 {
   for (int i = size() - 1; i >= 0; --i) {
index ef48c938988b243736f483bfa0f808076a09f230..7a1aece2643637af60135151739d9f950e0b93f6 100644 (file)
@@ -29,7 +29,6 @@
 
 #include "MDSContext.h"
 
-#include "SimpleLock.h"
 #include "Capability.h"
 
 #include "common/StackStringStream.h"
@@ -45,6 +44,7 @@ class CDentry;
 class MDSCacheObject;
 class Session;
 class ScatterLock;
+class SimpleLock;
 struct sr_t;
 struct MDLockCache;
 
@@ -84,15 +84,7 @@ public:
       return lock < r.lock;
     }
 
-    void print(std::ostream& out) const {
-      CachedStackStringStream css;
-      *css << "0x" << std::hex << flags;
-      out << "LockOp(l=" << *lock << ",f=" << css->strv();
-      if (wrlock_target != MDS_RANK_NONE) {
-        out << ",wt=" << wrlock_target;
-      }
-      out << ")";
-    }
+    void print(std::ostream& out) const;
 
     SimpleLock* lock;
     mutable unsigned flags;