summaryrefslogtreecommitdiffstats
path: root/src/client/MetaSession.cc
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 18:24:20 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 18:24:20 +0000
commit483eb2f56657e8e7f419ab1a4fab8dce9ade8609 (patch)
treee5d88d25d870d5dedacb6bbdbe2a966086a0a5cf /src/client/MetaSession.cc
parentInitial commit. (diff)
downloadceph-483eb2f56657e8e7f419ab1a4fab8dce9ade8609.tar.xz
ceph-483eb2f56657e8e7f419ab1a4fab8dce9ade8609.zip
Adding upstream version 14.2.21.upstream/14.2.21upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/client/MetaSession.cc')
-rw-r--r--src/client/MetaSession.cc54
1 files changed, 54 insertions, 0 deletions
diff --git a/src/client/MetaSession.cc b/src/client/MetaSession.cc
new file mode 100644
index 00000000..b721fb10
--- /dev/null
+++ b/src/client/MetaSession.cc
@@ -0,0 +1,54 @@
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab
+
+#include "include/types.h"
+#include "messages/MClientCapRelease.h"
+
+#include "MetaSession.h"
+
+#include "common/Formatter.h"
+
+const char *MetaSession::get_state_name() const
+{
+ switch (state) {
+ case STATE_NEW: return "new";
+ case STATE_OPENING: return "opening";
+ case STATE_OPEN: return "open";
+ case STATE_CLOSING: return "closing";
+ case STATE_CLOSED: return "closed";
+ case STATE_STALE: return "stale";
+ default: return "unknown";
+ }
+}
+
+void MetaSession::dump(Formatter *f) const
+{
+ f->dump_int("mds", mds_num);
+ f->dump_object("addrs", addrs);
+ f->dump_unsigned("seq", seq);
+ f->dump_unsigned("cap_gen", cap_gen);
+ f->dump_stream("cap_ttl") << cap_ttl;
+ f->dump_stream("last_cap_renew_request") << last_cap_renew_request;
+ f->dump_unsigned("cap_renew_seq", cap_renew_seq);
+ f->dump_int("num_caps", caps.size());
+ f->dump_string("state", get_state_name());
+}
+
+void MetaSession::enqueue_cap_release(inodeno_t ino, uint64_t cap_id, ceph_seq_t iseq,
+ ceph_seq_t mseq, epoch_t osd_barrier)
+{
+ if (!release) {
+ release.reset(new MClientCapRelease, false);
+ }
+
+ if (osd_barrier > release->osd_epoch_barrier) {
+ release->osd_epoch_barrier = osd_barrier;
+ }
+
+ ceph_mds_cap_item i;
+ i.ino = ino;
+ i.cap_id = cap_id;
+ i.seq = iseq;
+ i.migrate_seq = mseq;
+ release->caps.push_back(i);
+}