]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: add SimpleLock::dump
authorJohn Spray <john.spray@redhat.com>
Wed, 18 Mar 2015 10:39:10 +0000 (10:39 +0000)
committerJohn Spray <john.spray@redhat.com>
Thu, 19 Mar 2015 21:27:34 +0000 (21:27 +0000)
Signed-off-by: John Spray <john.spray@redhat.com>
src/mds/Makefile.am
src/mds/SimpleLock.cc [new file with mode: 0644]
src/mds/SimpleLock.h

index f64318e607b2d3b07481271b1cbdf093221eaae7..1a14a5907477bec7b2ad4a2782e0399333c85452 100644 (file)
@@ -20,6 +20,7 @@ libmds_la_SOURCES = \
        mds/JournalPointer.cc \
        mds/MDSTableClient.cc \
        mds/MDSTableServer.cc \
+       mds/SimpleLock.cc \
        mds/SnapRealm.cc \
        mds/SnapServer.cc \
        mds/snap.cc \
diff --git a/src/mds/SimpleLock.cc b/src/mds/SimpleLock.cc
new file mode 100644 (file)
index 0000000..4e5bbec
--- /dev/null
@@ -0,0 +1,43 @@
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
+/*
+ * Ceph - scalable distributed file system
+ *
+ * Copyright (C) 2015 Red Hat
+ *
+ * This is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software 
+ * Foundation.  See file COPYING.
+ * 
+ */
+
+
+#include "SimpleLock.h"
+#include "Mutation.h"
+
+void SimpleLock::dump(Formatter *f) const {
+  assert(f != NULL);
+  if (is_sync_and_unlocked()) {
+    return;
+  }
+
+  f->open_array_section("gather_set");
+  if (have_more()) {
+    for(std::set<int32_t>::iterator i = more()->gather_set.begin();
+        i != more()->gather_set.end(); ++i) {
+      f->dump_int("rank", *i);
+    }
+  }
+  f->close_section();
+
+  f->dump_int("num_client_lease", num_client_lease);
+  f->dump_int("num_rdlocks", get_num_rdlocks());
+  f->dump_int("num_wrlocks", get_num_wrlocks());
+  f->dump_int("num_xlocks", get_num_xlocks());
+  f->open_object_section("xlock_by");
+  if (get_xlock_by()) {
+    get_xlock_by()->dump(f);
+  }
+  f->close_section();
+}
index c3d05e26535cfd42212e40df58da4348ff72b9e3..085aec7f7b615b5cacd0e93f31faaf5b289b80d4 100644 (file)
@@ -16,6 +16,7 @@
 #ifndef CEPH_SIMPLELOCK_H
 #define CEPH_SIMPLELOCK_H
 
+#include "mdstypes.h"
 #include "MDSContext.h"
 
 // -- lock types --
@@ -669,6 +670,12 @@ public:
     */
   }
 
+  /**
+   * Write bare values (caller must be in an object section)
+   * to formatter, or nothing if is_sync_and_unlocked.
+   */
+  void dump(Formatter *f) const;
+
   virtual void print(ostream& out) const {
     out << "(";
     _print(out);