@@ -1667,6 +1667,57 @@ void ECBackend::objects_read_async(
16671667 cct)));
16681668}
16691669
1670+ bool ECBackend::ec_can_decode (const shard_id_set &available_shards) const {
1671+ if (sinfo.supports_sub_chunks ()) {
1672+ ceph_abort_msg (" Interface does not support subchunks" );
1673+ return false ;
1674+ }
1675+
1676+ mini_flat_map<shard_id_t , std::vector<std::pair<int , int >>>
1677+ minimum_sub_chunks{ec_impl->get_chunk_count ()};
1678+ shard_id_set want_to_read = sinfo.get_all_shards ();
1679+ shard_id_set available (available_shards);
1680+ shard_id_set minimum_set;
1681+
1682+ int r = ec_impl->minimum_to_decode (want_to_read, available, minimum_set,
1683+ &minimum_sub_chunks);
1684+ return (r == 0 );
1685+ }
1686+
1687+ shard_id_map<bufferlist> ECBackend::ec_encode_acting_set (
1688+ const bufferlist &in_bl) const {
1689+ shard_id_set want_to_encode;
1690+ for (raw_shard_id_t raw_shard_id;raw_shard_id < ec_impl->get_chunk_count ();
1691+ ++raw_shard_id) {
1692+ want_to_encode.insert (sinfo.get_shard (raw_shard_id));
1693+ }
1694+ shard_id_map<bufferlist> encoded{ec_impl->get_chunk_count ()};
1695+ ec_impl->encode (want_to_encode, in_bl, &encoded);
1696+ return encoded;
1697+ }
1698+
1699+ shard_id_map<bufferlist> ECBackend::ec_decode_acting_set (
1700+ const shard_id_map<bufferlist> &shard_map, int chunk_size) const {
1701+ shard_id_set want_to_read;
1702+ for (raw_shard_id_t raw_shard_id; raw_shard_id < ec_impl->get_chunk_count ();
1703+ ++raw_shard_id) {
1704+ shard_id_t shard_id = sinfo.get_shard (raw_shard_id);
1705+ if (!shard_map.contains (shard_id)) want_to_read.insert (shard_id);
1706+ }
1707+
1708+ shard_id_map<bufferlist> decoded_buffers (ec_impl->get_chunk_count ());
1709+ ec_impl->decode (want_to_read, shard_map, &decoded_buffers, chunk_size);
1710+
1711+ shard_id_map<bufferlist> decoded_buffer_map{ec_impl->get_chunk_count ()};
1712+ for (auto &[shard_id, bl] : decoded_buffers) {
1713+ decoded_buffer_map[shard_id] = bl;
1714+ }
1715+
1716+ return decoded_buffer_map;
1717+ }
1718+
1719+ ECUtil::stripe_info_t ECBackend::ec_get_sinfo () const { return sinfo; }
1720+
16701721void ECBackend::objects_read_and_reconstruct (
16711722 const map<hobject_t , std::list<ec_align_t >> &reads,
16721723 bool fast_read,
@@ -1760,7 +1811,16 @@ int ECBackend::be_deep_scrub(
17601811 return -EINPROGRESS;
17611812 }
17621813
1763- o.digest = 0 ;
1814+ if (sinfo.supports_encode_decode_crcs ()) {
1815+ // We pass the calculated digest here
1816+ // This will be used along with the plugin to verify data consistency
1817+ o.digest = pos.data_hash .digest ();
1818+ }
1819+ else
1820+ {
1821+ o.digest = 0 ;
1822+ }
1823+
17641824 o.digest_present = true ;
17651825 o.omap_digest = -1 ;
17661826 o.omap_digest_present = true ;
0 commit comments