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) 2016 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.
18 #include "osd/mClockClientQueue.h"
19 #include "common/dout.h"
21 namespace dmc
= crimson::dmclock
;
22 using namespace std::placeholders
;
24 #define dout_context cct
25 #define dout_subsys ceph_subsys_osd
27 #define dout_prefix *_dout
33 * class mClockClientQueue
36 mClockClientQueue::mClockClientQueue(CephContext
*cct
) :
37 queue(std::bind(&mClockClientQueue::op_class_client_info_f
, this, _1
),
38 cct
->_conf
->osd_op_queue_mclock_anticipation_timeout
),
44 const dmc::ClientInfo
* mClockClientQueue::op_class_client_info_f(
45 const mClockClientQueue::InnerClient
& client
)
47 return client_info_mgr
.get_client_info(client
.second
);
50 mClockClientQueue::InnerClient
51 inline mClockClientQueue::get_inner_client(const Client
& cl
,
52 const Request
& request
) {
53 return InnerClient(cl
, client_info_mgr
.osd_op_type(request
));
56 // Formatted output of the queue
57 inline void mClockClientQueue::dump(ceph::Formatter
*f
) const {
61 inline void mClockClientQueue::enqueue_strict(Client cl
,
64 queue
.enqueue_strict(get_inner_client(cl
, item
), priority
,
68 // Enqueue op in the front of the strict queue
69 inline void mClockClientQueue::enqueue_strict_front(Client cl
,
72 queue
.enqueue_strict_front(get_inner_client(cl
, item
), priority
,
76 // Enqueue op in the back of the regular queue
77 inline void mClockClientQueue::enqueue(Client cl
,
81 queue
.enqueue(get_inner_client(cl
, item
), priority
, 1u, std::move(item
));
84 // Enqueue the op in the front of the regular queue
85 inline void mClockClientQueue::enqueue_front(Client cl
,
89 queue
.enqueue_front(get_inner_client(cl
, item
), priority
, 1u,
93 // Return an op to be dispatched
94 inline Request
mClockClientQueue::dequeue() {
95 return queue
.dequeue();