diff options
author | myoungwon oh <ohmyoungwon@gmail.com> | 2021-12-03 17:31:30 +0900 |
---|---|---|
committer | myoungwon oh <ohmyoungwon@gmail.com> | 2022-01-19 01:32:42 +0900 |
commit | 30d722e86114cc5cde6da4ee3e62912e4427b0e6 (patch) | |
tree | be5c7d191d8e2ce6e720c6810ff8b6f3afff5191 | |
parent | fa365d84d1d3fc85095ee5052142ffcd5e593fdd (diff) | |
download | ceph-30d722e86114cc5cde6da4ee3e62912e4427b0e6.tar.gz |
seastore/seastore_types: fix wrong masking
Fix bit operation due to device_id_t is 8 bit for now
Signed-off-by: Myoungwon Oh <myoungwon.oh@samsung.com>
-rw-r--r-- | src/crimson/os/seastore/seastore_types.h | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/crimson/os/seastore/seastore_types.h b/src/crimson/os/seastore/seastore_types.h index f7036b99ece..db7c907a29a 100644 --- a/src/crimson/os/seastore/seastore_types.h +++ b/src/crimson/os/seastore/seastore_types.h @@ -78,7 +78,7 @@ private: // mask for segment manager id static constexpr internal_segment_id_t SM_ID_MASK = - 0xF << (std::numeric_limits<internal_segment_id_t>::digits - DEVICE_ID_LEN_BITS); + 0xFF << (std::numeric_limits<internal_segment_id_t>::digits - DEVICE_ID_LEN_BITS); // default internal segment id static constexpr internal_segment_id_t DEFAULT_INTERNAL_SEG_ID = (std::numeric_limits<internal_segment_id_t>::max() >> 1) - 1; @@ -452,10 +452,11 @@ public: // use 1bit in device_id_t for address type void set_device_id(device_id_t id, addr_types_t type = addr_types_t::SEGMENT) { dev_addr &= static_cast<common_addr_t>( - std::numeric_limits<device_segment_id_t>::max()); - dev_addr |= static_cast<common_addr_t>(id & 0x8) << DEV_ADDR_LEN_BITS; - dev_addr |= static_cast<common_addr_t>(type) - << (std::numeric_limits<common_addr_t>::digits - 1); + std::numeric_limits<common_addr_t>::max() >> DEVICE_ID_LEN_BITS); + dev_addr |= (static_cast<common_addr_t>(id & + std::numeric_limits<device_id_t>::max() >> 1) << DEV_ADDR_LEN_BITS); + dev_addr |= (static_cast<common_addr_t>(type) + << (std::numeric_limits<common_addr_t>::digits - 1)); } device_id_t get_device_id() const { |