From c1ca6f485f6b874595eddb20afda839e5c2a4251 Mon Sep 17 00:00:00 2001 From: Bill Scales Date: Sun, 23 Mar 2025 14:20:33 +0000 Subject: [PATCH] osd: EC optimizations: additional types for EC Add some extra types required by the EC optimizations code: raw_shard_id_t is an equivalent type to shard_id_t but is used for storing raw shards. Strong typing prevents bugs where code forgets to translate between the two types. shard_id_map is a mini_flat_map indexed by shard_id_t which will be used by the EC optimizations I/O path to track updates to each shard. shard_id_set is a bitset_set of shard_id_t which is a compact and fast way of storing a set of shards involved in an EC operation. Signed-off-by: Bill Scales --- src/osd/ECTypes.h | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/osd/ECTypes.h b/src/osd/ECTypes.h index 932d6424ed2..325ac5428a1 100644 --- a/src/osd/ECTypes.h +++ b/src/osd/ECTypes.h @@ -21,16 +21,14 @@ struct ec_align_t { uint64_t offset; uint64_t size; uint32_t flags; - friend std::ostream &operator<<(std::ostream &lhs, const ec_align_t &rhs) { - return lhs << rhs.offset << "," - << rhs.size << "," - << rhs.flags; - } ec_align_t(std::pair p, uint32_t flags) : offset(p.first), size(p.second), flags(flags) {} ec_align_t(uint64_t offset, uint64_t size, uint32_t flags) : offset(offset), size(size), flags(flags) {} bool operator==(const ec_align_t &other) const; + void print(std::ostream &os) const { + os << offset << "," << size << "," << flags; + } }; struct raw_shard_id_t { -- 2.39.5