Implement the ErasureCode::sanity_check_k helper for plugins
that need to verify k >= 2.
http://tracker.ceph.com/issues/10358 Fixes: #10358
Signed-off-by: Loic Dachary <ldachary@redhat.com>
const unsigned ErasureCode::SIMD_ALIGN = 32;
+int ErasureCode::sanity_check_k(int k, ostream *ss)
+{
+ if (k < 2) {
+ *ss << "k=" << k << " must be >= 2" << std::endl;
+ return -EINVAL;
+ } else {
+ return 0;
+ }
+}
+
int ErasureCode::chunk_index(unsigned int i) const
{
return chunk_mapping.size() > i ? chunk_mapping[i] : i;
return _profile;
}
+ int sanity_check_k(int k, ostream *ss);
+
virtual unsigned int get_coding_chunk_count() const {
return get_chunk_count() - get_data_chunk_count();
}