// to_ref_down is going off
}
+void OSDOperationRegistry::put_historic(const ClientRequest& op) {
+ // unlink the op from the client request registry. this is a part of
+ // the re-link procedure. finally it will be in historic registry.
+ constexpr auto client_reg_index =
+ static_cast<size_t>(OperationTypeCode::client_request);
+ constexpr auto historic_reg_index =
+ static_cast<size_t>(OperationTypeCode::historic_client_request);
+ auto& client_registry = get_registry<client_reg_index>();
+ auto& historic_registry = get_registry<historic_reg_index>();
+
+ historic_registry.splice(std::end(historic_registry),
+ client_registry,
+ client_registry.iterator_to(op));
+ ClientRequest::ICRef(
+ &op, /* add_ref= */true
+ ).detach(); // yes, "leak" it for now!
+
+ // check whether the history size limit is not exceeded; if so, then
+ // purge the oldest op.
+ // NOTE: Operation uses the auto-unlink feature of boost::intrusive.
+ // NOTE: the cleaning happens in OSDOperationRegistry::do_stop()
+ using crimson::common::local_conf;
+ if (historic_registry.size() > local_conf()->osd_op_history_size) {
+ const auto& oldest_historic_op =
+ static_cast<const ClientRequest&>(historic_registry.front());
+ // clear a previously "leaked" op
+ ClientRequest::ICRef(&oldest_historic_op, /* add_ref= */false);
+ }
+}
+
size_t OSDOperationRegistry::dump_client_requests(ceph::Formatter* f) const
{
const auto& client_registry =
static_cast<size_t>(OperationTypeCode::last_op)
> {
void do_stop() override;
+
+ void put_historic(const class ClientRequest& op);
+
size_t dump_client_requests(ceph::Formatter* f) const;
size_t dump_historic_client_requests(ceph::Formatter* f) const;
namespace crimson::osd {
-void HistoricBackend::handle(ClientRequest::CompletionEvent&,
- const Operation& op)
-{
- // early exit if the history is disabled
- using crimson::common::local_conf;
- if (!local_conf()->osd_op_history_size) {
- return;
- }
-
-#ifdef NDEBUG
- const auto& client_request = static_cast<const ClientRequest&>(op);
-#else
- const auto& client_request = dynamic_cast<const ClientRequest&>(op);
-#endif
- auto& main_registry = client_request.osd.get_shard_services().registry;
-
- // unlink the op from the client request registry. this is a part of
- // the re-link procedure. finally it will be in historic registry.
- constexpr auto client_reg_index =
- static_cast<size_t>(OperationTypeCode::client_request);
- constexpr auto historic_reg_index =
- static_cast<size_t>(OperationTypeCode::historic_client_request);
- auto& client_registry = main_registry.get_registry<client_reg_index>();
- auto& historic_registry = main_registry.get_registry<historic_reg_index>();
-
- historic_registry.splice(std::end(historic_registry),
- client_registry,
- client_registry.iterator_to(client_request));
- ClientRequest::ICRef(
- &client_request, /* add_ref= */true
- ).detach(); // yes, "leak" it for now!
-
- // check whether the history size limit is not exceeded; if so, then
- // purge the oldest op.
- // NOTE: Operation uses the auto-unlink feature of boost::intrusive.
- // NOTE: the cleaning happens in OSDOperationRegistry::do_stop()
- if (historic_registry.size() > local_conf()->osd_op_history_size) {
- const auto& oldest_historic_op =
- static_cast<const ClientRequest&>(historic_registry.front());
- // clear a previously "leaked" op
- ClientRequest::ICRef(&oldest_historic_op, /* add_ref= */false);
- }
-}
-
} // namespace crimson::osd
#pragma once
+#include "crimson/osd/osd.h"
#include "crimson/osd/osdmap_gate.h"
#include "crimson/osd/osd_operations/background_recovery.h"
#include "crimson/osd/osd_operations/client_request.h"
const ClientRequest::PGPipeline::SendReply& blocker) override {
}
- void handle(ClientRequest::CompletionEvent&,
- const Operation&) override;
+ static const ClientRequest& to_client_request(const Operation& op) {
+#ifdef NDEBUG
+ return static_cast<const ClientRequest&>(op);
+#else
+ return dynamic_cast<const ClientRequest&>(op);
+#endif
+ }
+
+ void handle(ClientRequest::CompletionEvent&, const Operation& op) override {
+ if (crimson::common::local_conf()->osd_op_history_size) {
+ const auto& client_op = to_client_request(op);
+ client_op.osd.get_shard_services().registry.put_historic(client_op);
+ }
+ }
};
} // namespace crimson::osd