]>
git.proxmox.com Git - ceph.git/blob - ceph/src/osd/mClockOpClassSupport.h
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 * Ceph - scalable distributed file system
6 * Copyright (C) 2017 Red Hat Inc.
8 * This is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License version 2.1, as published by the Free Software
11 * Foundation. See file COPYING.
20 #include "dmclock/src/dmclock_server.h"
21 #include "osd/OpRequest.h"
22 #include "osd/OpQueueItem.h"
28 using op_item_type_t
= OpQueueItem::OpQueueable::op_type_t
;
30 enum class osd_op_type_t
{
31 client_op
, osd_rep_op
, bg_snaptrim
, bg_recovery
, bg_scrub
, bg_pg_delete
,
35 class OpClassClientInfoMgr
{
36 crimson::dmclock::ClientInfo client_op
;
37 crimson::dmclock::ClientInfo osd_rep_op
;
38 crimson::dmclock::ClientInfo snaptrim
;
39 crimson::dmclock::ClientInfo recov
;
40 crimson::dmclock::ClientInfo scrub
;
41 crimson::dmclock::ClientInfo pg_delete
;
42 crimson::dmclock::ClientInfo peering_event
;
44 static constexpr std::size_t rep_op_msg_bitset_size
= 128;
45 std::bitset
<rep_op_msg_bitset_size
> rep_op_msg_bitset
;
46 void add_rep_op_msg(int message_code
);
50 OpClassClientInfoMgr(CephContext
*cct
);
52 inline const crimson::dmclock::ClientInfo
*
53 get_client_info(osd_op_type_t type
) {
55 case osd_op_type_t::client_op
:
57 case osd_op_type_t::osd_rep_op
:
59 case osd_op_type_t::bg_snaptrim
:
61 case osd_op_type_t::bg_recovery
:
63 case osd_op_type_t::bg_scrub
:
65 case osd_op_type_t::bg_pg_delete
:
67 case osd_op_type_t::peering_event
:
68 return &peering_event
;
75 // converts operation type from op queue internal to mclock
77 inline static osd_op_type_t
convert_op_type(op_item_type_t t
) {
79 case op_item_type_t::client_op
:
80 return osd_op_type_t::client_op
;
81 case op_item_type_t::bg_snaptrim
:
82 return osd_op_type_t::bg_snaptrim
;
83 case op_item_type_t::bg_recovery
:
84 return osd_op_type_t::bg_recovery
;
85 case op_item_type_t::bg_scrub
:
86 return osd_op_type_t::bg_scrub
;
87 case op_item_type_t::bg_pg_delete
:
88 return osd_op_type_t::bg_pg_delete
;
89 case op_item_type_t::peering_event
:
90 return osd_op_type_t::peering_event
;
96 osd_op_type_t
osd_op_type(const OpQueueItem
&) const;
98 // used for debugging since faster implementation can be done
99 // with rep_op_msg_bitmap
100 static bool is_rep_op(uint16_t);
101 }; // OpClassClientInfoMgr
102 } // namespace mclock