]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/osd: bring the skeleton of SnapTrimEvent
authorRadoslaw Zarzynski <rzarzyns@redhat.com>
Wed, 26 Oct 2022 18:46:37 +0000 (18:46 +0000)
committerRadoslaw Zarzynski <rzarzyns@redhat.com>
Tue, 28 Feb 2023 16:22:04 +0000 (16:22 +0000)
Signed-off-by: Radoslaw Zarzynski <rzarzyns@redhat.com>
src/crimson/osd/CMakeLists.txt
src/crimson/osd/osd_operation.h
src/crimson/osd/osd_operations/snaptrim_event.cc [new file with mode: 0644]
src/crimson/osd/osd_operations/snaptrim_event.h [new file with mode: 0644]

index 7cdb27d2e1983c28f79e5dd93f244aa17de45ed1..3b7c7a3f58e76e5356bc22e93434d588cc24e104 100644 (file)
@@ -26,6 +26,7 @@ add_executable(crimson-osd
   osd_operations/logmissing_request_reply.cc
   osd_operations/background_recovery.cc
   osd_operations/recovery_subrequest.cc
+  osd_operations/snaptrim_event.cc
   pg_recovery.cc
   recovery_backend.cc
   replicated_recovery_backend.cc
index dbc13c20c6e67c0c3cee33d0cdd6604c5bc05795..f0f668c1c8bcbcbee629c5bb0614f66cdf34dea8 100644 (file)
@@ -46,6 +46,7 @@ enum class OperationTypeCode {
   historic_client_request,
   logmissing_request,
   logmissing_request_reply,
+  snaptrim_event,
   last_op
 };
 
@@ -62,6 +63,7 @@ static constexpr const char* const OP_NAMES[] = {
   "historic_client_request",
   "logmissing_request",
   "logmissing_request_reply",
+  "snaptrim_event",
 };
 
 // prevent the addition of OperationTypeCode-s with no matching OP_NAMES entry:
diff --git a/src/crimson/osd/osd_operations/snaptrim_event.cc b/src/crimson/osd/osd_operations/snaptrim_event.cc
new file mode 100644 (file)
index 0000000..d3fd67e
--- /dev/null
@@ -0,0 +1,36 @@
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab
+
+#include "crimson/osd/osd_operations/snaptrim_event.h"
+#include "crimson/osd/pg.h"
+
+namespace {
+  seastar::logger& logger() {
+    return crimson::get_logger(ceph_subsys_osd);
+  }
+}
+
+namespace crimson::osd {
+
+void SnapTrimEvent::print(std::ostream &lhs) const
+{
+  lhs << "SnapTrimEvent("
+      << "pgid=" << pg->get_pgid()
+      << " snapid=" << snapid
+      << ")";
+}
+
+void SnapTrimEvent::dump_detail(Formatter *f) const
+{
+  f->open_object_section("SnapTrimEvent");
+  f->dump_stream("pgid") << pg->get_pgid();
+  f->close_section();
+}
+
+seastar::future<> SnapTrimEvent::start()
+{
+  logger().debug("{}", __func__);
+  return seastar::now();
+}
+
+} // namespace crimson::osd
diff --git a/src/crimson/osd/osd_operations/snaptrim_event.h b/src/crimson/osd/osd_operations/snaptrim_event.h
new file mode 100644 (file)
index 0000000..bcb20e4
--- /dev/null
@@ -0,0 +1,49 @@
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab
+
+#pragma once
+
+#include <iostream>
+#include <seastar/core/future.hh>
+
+#include "crimson/osd/osdmap_gate.h"
+#include "crimson/osd/osd_operation.h"
+#include "crimson/osd/osd_operations/background_recovery.h"
+#include "osd/osd_types.h"
+#include "osd/PGPeeringEvent.h"
+#include "osd/PeeringState.h"
+
+namespace ceph {
+  class Formatter;
+}
+
+namespace crimson::osd {
+
+class OSD;
+class ShardServices;
+class PG;
+
+class SnapTrimEvent final : public PhasedOperationT<SnapTrimEvent> {
+public:
+  static constexpr OperationTypeCode type = OperationTypeCode::snaptrim_event;
+
+  SnapTrimEvent(Ref<PG> pg, snapid_t snapid)
+    : pg(std::move(pg)),
+      snapid(snapid) {}
+
+  void print(std::ostream &) const final;
+  void dump_detail(ceph::Formatter* f) const final;
+  seastar::future<> start();
+  seastar::future<> with_pg(
+    ShardServices &shard_services, Ref<PG> pg);
+
+private:
+  Ref<PG> pg;
+  const snapid_t snapid;
+};
+
+} // namespace crimson::osd
+
+#if FMT_VERSION >= 90000
+template <> struct fmt::formatter<crimson::osd::SnapTrimEvent> : fmt::ostream_formatter {};
+#endif