From 181702913f5cae5fc3b4d37c60b147934175eeac Mon Sep 17 00:00:00 2001 From: Yingxin Cheng Date: Mon, 19 Dec 2022 10:47:46 +0800 Subject: [PATCH] crimson/os/seastore: fix denc device_spec_t, device_type_t and segment_type_t * device_spec_t should not include denc and be packed at the same time * the underlying type of enum:uint8_t should support denc_traits already Signed-off-by: Yingxin Cheng Signed-off-by: luo rixin --- src/crimson/os/seastore/device.h | 2 +- src/crimson/os/seastore/seastore_types.h | 72 ------------------------ 2 files changed, 1 insertion(+), 73 deletions(-) diff --git a/src/crimson/os/seastore/device.h b/src/crimson/os/seastore/device.h index 3b479d7b9b7..c49d1ff6aa2 100644 --- a/src/crimson/os/seastore/device.h +++ b/src/crimson/os/seastore/device.h @@ -25,7 +25,7 @@ struct device_spec_t { denc(v.id, p); DENC_FINISH(p); } -} __attribute__ ((packed)); +}; std::ostream& operator<<(std::ostream&, const device_spec_t&); diff --git a/src/crimson/os/seastore/seastore_types.h b/src/crimson/os/seastore/seastore_types.h index f98f800ffc8..f4c83047ec7 100644 --- a/src/crimson/os/seastore/seastore_types.h +++ b/src/crimson/os/seastore/seastore_types.h @@ -2107,78 +2107,6 @@ WRITE_CLASS_DENC_BOUNDED(crimson::os::seastore::alloc_blk_t) WRITE_CLASS_DENC_BOUNDED(crimson::os::seastore::alloc_delta_t) WRITE_CLASS_DENC_BOUNDED(crimson::os::seastore::segment_tail_t) -template<> -struct denc_traits { - static constexpr bool supported = true; - static constexpr bool featured = false; - static constexpr bool bounded = true; - static constexpr bool need_contiguous = false; - - static void bound_encode( - const crimson::os::seastore::device_type_t &o, - size_t& p, - uint64_t f=0) { - p += sizeof(crimson::os::seastore::device_type_t); - } - template - requires (!is_const_iterator) - static void encode( - const crimson::os::seastore::device_type_t &o, - It& p, - uint64_t f=0) { - get_pos_add(p) = o; - } - template - static void decode( - crimson::os::seastore::device_type_t& o, - It& p, - uint64_t f=0) { - o = get_pos_add(p); - } - static void decode( - crimson::os::seastore::device_type_t& o, - ceph::buffer::list::const_iterator &p) { - p.copy(sizeof(crimson::os::seastore::device_type_t), - reinterpret_cast(&o)); - } -}; - -template<> -struct denc_traits { - static constexpr bool supported = true; - static constexpr bool featured = false; - static constexpr bool bounded = true; - static constexpr bool need_contiguous = false; - - static void bound_encode( - const crimson::os::seastore::segment_type_t &o, - size_t& p, - uint64_t f=0) { - p += sizeof(crimson::os::seastore::segment_type_t); - } - template - requires (!is_const_iterator) - static void encode( - const crimson::os::seastore::segment_type_t &o, - It& p, - uint64_t f=0) { - get_pos_add(p) = o; - } - template - static void decode( - crimson::os::seastore::segment_type_t& o, - It& p, - uint64_t f=0) { - o = get_pos_add(p); - } - static void decode( - crimson::os::seastore::segment_type_t& o, - ceph::buffer::list::const_iterator &p) { - p.copy(sizeof(crimson::os::seastore::segment_type_t), - reinterpret_cast(&o)); - } -}; - #if FMT_VERSION >= 90000 template <> struct fmt::formatter : fmt::ostream_formatter {}; template <> struct fmt::formatter : fmt::ostream_formatter {}; -- 2.39.5