From 5ca0095bb20892c9aacf3c9e3e8eee6de94f5dbd Mon Sep 17 00:00:00 2001 From: John Spray Date: Wed, 18 Mar 2015 10:39:10 +0000 Subject: [PATCH] mds: add SimpleLock::dump Signed-off-by: John Spray --- src/mds/Makefile.am | 1 + src/mds/SimpleLock.cc | 43 +++++++++++++++++++++++++++++++++++++++++++ src/mds/SimpleLock.h | 7 +++++++ 3 files changed, 51 insertions(+) create mode 100644 src/mds/SimpleLock.cc diff --git a/src/mds/Makefile.am b/src/mds/Makefile.am index f64318e607b2d..1a14a5907477b 100644 --- a/src/mds/Makefile.am +++ b/src/mds/Makefile.am @@ -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 index 0000000000000..4e5bbec64c4f2 --- /dev/null +++ b/src/mds/SimpleLock.cc @@ -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::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(); +} diff --git a/src/mds/SimpleLock.h b/src/mds/SimpleLock.h index c3d05e26535cf..085aec7f7b615 100644 --- a/src/mds/SimpleLock.h +++ b/src/mds/SimpleLock.h @@ -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); -- 2.39.5