From c4b213984f48baa00fc038397f0ab368f0e04f28 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Mon, 16 Aug 2021 20:03:22 +0800 Subject: [PATCH] librbd: trade a map<> for a plain arrary for two reasons * to avoid the overhead of copying the loop variables. * no need to keep a map<> if what we need is just an arrary * no need to keep a string if what we need is but an array of char also mark the array "const", as we never change it. Signed-off-by: Kefu Chai --- src/librbd/io/QosImageDispatch.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/librbd/io/QosImageDispatch.cc b/src/librbd/io/QosImageDispatch.cc index 51b9f399239..96be195c59a 100644 --- a/src/librbd/io/QosImageDispatch.cc +++ b/src/librbd/io/QosImageDispatch.cc @@ -6,7 +6,7 @@ #include "librbd/AsioEngine.h" #include "librbd/ImageCtx.h" #include "librbd/io/FlushTracker.h" -#include +#include #define dout_subsys ceph_subsys_rbd #undef dout_prefix @@ -36,7 +36,7 @@ uint64_t calculate_tokens(bool read_op, uint64_t extent_length, uint64_t flag) { return (((flag & IMAGE_DISPATCH_FLAG_QOS_BPS_MASK) != 0) ? extent_length : 1); } -static std::map throttle_flags = { +static const std::pair throttle_flags[] = { {IMAGE_DISPATCH_FLAG_QOS_IOPS_THROTTLE, "rbd_qos_iops_throttle" }, {IMAGE_DISPATCH_FLAG_QOS_BPS_THROTTLE, "rbd_qos_bps_throttle" }, {IMAGE_DISPATCH_FLAG_QOS_READ_IOPS_THROTTLE, "rbd_qos_read_iops_throttle" }, -- 2.39.5