f->dump_unsigned("stripe_width", get_stripe_width());
f->dump_unsigned("expected_num_objects", expected_num_objects);
f->dump_bool("fast_read", fast_read);
+ f->dump_stream("nonprimary_shards") << nonprimary_shards;
f->open_object_section("options");
opts.dump(f);
f->close_section(); // options
return;
}
- uint8_t v = 31;
+ uint8_t v = 32;
// NOTE: any new encoding dependencies must be reflected by
// SIGNIFICANT_FEATURES
if (!HAVE_FEATURE(features, SERVER_TENTACLE)) {
auto maybe_peering_crush_data1 = maybe_peering_crush_data();
encode(maybe_peering_crush_data1, bl);
}
+ if (v >= 32) {
+ encode(nonprimary_shards, bl);
+ }
ENCODE_FINISH(bl);
}
void pg_pool_t::decode(ceph::buffer::list::const_iterator& bl)
{
- DECODE_START_LEGACY_COMPAT_LEN(31, 5, 5, bl);
+ DECODE_START_LEGACY_COMPAT_LEN(32, 5, 5, bl);
decode(type, bl);
decode(size, bl);
decode(crush_rule, bl);
peering_crush_mandatory_member) = *peering_crush_data;
}
}
+ if (struct_v >= 32) {
+ decode(nonprimary_shards, bl);
+ } else {
+ nonprimary_shards.clear();
+ }
DECODE_FINISH(bl);
calc_pg_masks();
calc_grade_table();
a.erasure_code_profile = "profile in osdmap";
a.expected_num_objects = 123456;
a.fast_read = false;
+ a.nonprimary_shards.clear();
a.application_metadata = {{"rbd", {{"key", "value"}}}};
o.push_back(new pg_pool_t(a));
uint64_t expected_num_objects = 0; ///< expected number of objects on this pool, a value of 0 indicates
///< user does not specify any expected value
bool fast_read = false; ///< whether turn on fast read on the pool or not
-
+ shard_id_set nonprimary_shards; ///< EC partial writes: shards that cannot become a primary
pool_opts_t opts; ///< options
typedef enum {
/// choose a random hash position within a pg
uint32_t get_random_pg_position(pg_t pgid, uint32_t seed) const;
+ /// EC partial writes: test if a shard is a non-primary
+ bool is_nonprimary_shard(const shard_id_t shard) const {
+ return !nonprimary_shards.empty() && nonprimary_shards.contains(shard);
+ }
+
void encode(ceph::buffer::list& bl, uint64_t features) const;
void decode(ceph::buffer::list::const_iterator& bl);