]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/os/seastore: fix denc device_spec_t, device_type_t and segment_type_t 49496/head
authorYingxin Cheng <yingxin.cheng@intel.com>
Mon, 19 Dec 2022 02:47:46 +0000 (10:47 +0800)
committerYingxin Cheng <yingxin.cheng@intel.com>
Mon, 19 Dec 2022 02:47:46 +0000 (10:47 +0800)
* 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 <yingxin.cheng@intel.com>
Signed-off-by: luo rixin <luorixin@huawei.com>
src/crimson/os/seastore/device.h
src/crimson/os/seastore/seastore_types.h

index 3b479d7b9b7030673a6a1a2cfe58520aad91288d..c49d1ff6aa205a82b87fb8ad43660b246ee017c9 100644 (file)
@@ -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&);
 
index f98f800ffc8ee359b467dfb90608fb2bb5972752..f4c83047ec763dbcc4f419204875a38dbc0944c3 100644 (file)
@@ -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<crimson::os::seastore::device_type_t> {
-  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<class It>
-  requires (!is_const_iterator<It>)
-  static void encode(
-    const crimson::os::seastore::device_type_t &o,
-    It& p,
-    uint64_t f=0) {
-    get_pos_add<crimson::os::seastore::device_type_t>(p) = o;
-  }
-  template<is_const_iterator It>
-  static void decode(
-    crimson::os::seastore::device_type_t& o,
-    It& p,
-    uint64_t f=0) {
-    o = get_pos_add<crimson::os::seastore::device_type_t>(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<char*>(&o));
-  }
-};
-
-template<>
-struct denc_traits<crimson::os::seastore::segment_type_t> {
-  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<class It>
-  requires (!is_const_iterator<It>)
-  static void encode(
-    const crimson::os::seastore::segment_type_t &o,
-    It& p,
-    uint64_t f=0) {
-    get_pos_add<crimson::os::seastore::segment_type_t>(p) = o;
-  }
-  template<is_const_iterator It>
-  static void decode(
-    crimson::os::seastore::segment_type_t& o,
-    It& p,
-    uint64_t f=0) {
-    o = get_pos_add<crimson::os::seastore::segment_type_t>(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<char*>(&o));
-  }
-};
-
 #if FMT_VERSION >= 90000
 template <> struct fmt::formatter<crimson::os::seastore::data_category_t> : fmt::ostream_formatter {};
 template <> struct fmt::formatter<crimson::os::seastore::delta_info_t> : fmt::ostream_formatter {};