From c34d3fd066676d5852064ebf4e373bf886ffc2f7 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Wed, 3 Aug 2022 10:52:20 +0800 Subject: [PATCH] crimson: do not use WRITE_{EQ,CMP}_OPERATORS_2() the default-generated comparison operators can fulfill our needs. Signed-off-by: Kefu Chai --- src/crimson/os/seastore/backref/backref_tree_node.h | 8 ++++---- src/crimson/osd/scheduler/mclock_scheduler.h | 9 ++------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/src/crimson/os/seastore/backref/backref_tree_node.h b/src/crimson/os/seastore/backref/backref_tree_node.h index 2a29f94068ef9..15f1d451b0715 100644 --- a/src/crimson/os/seastore/backref/backref_tree_node.h +++ b/src/crimson/os/seastore/backref/backref_tree_node.h @@ -26,11 +26,11 @@ struct backref_map_val_t { laddr_t laddr, extent_types_t type) : len(len), laddr(laddr), type(type) {} + + bool operator==(const backref_map_val_t& rhs) const noexcept { + return len == rhs.len && laddr == rhs.laddr; + } }; -WRITE_EQ_OPERATORS_2( - backref_map_val_t, - len, - laddr); std::ostream& operator<<(std::ostream &out, const backref_map_val_t& val); diff --git a/src/crimson/osd/scheduler/mclock_scheduler.h b/src/crimson/osd/scheduler/mclock_scheduler.h index c3edbe7296c3a..153fc758bbd5f 100644 --- a/src/crimson/osd/scheduler/mclock_scheduler.h +++ b/src/crimson/osd/scheduler/mclock_scheduler.h @@ -25,7 +25,6 @@ #include "crimson/osd/scheduler/scheduler.h" #include "common/config.h" -#include "include/cmp.h" #include "common/ceph_context.h" @@ -37,20 +36,16 @@ using profile_id_t = uint64_t; struct client_profile_id_t { client_id_t client_id; profile_id_t profile_id; + auto operator<=>(const client_profile_id_t&) const = default; }; -WRITE_EQ_OPERATORS_2(client_profile_id_t, client_id, profile_id) -WRITE_CMP_OPERATORS_2(client_profile_id_t, client_id, profile_id) - struct scheduler_id_t { scheduler_class_t class_id; client_profile_id_t client_profile_id; + auto operator<=>(const scheduler_id_t&) const = default; }; -WRITE_EQ_OPERATORS_2(scheduler_id_t, class_id, client_profile_id) -WRITE_CMP_OPERATORS_2(scheduler_id_t, class_id, client_profile_id) - /** * Scheduler implementation based on mclock. * -- 2.39.5