mirror of
https://github.com/ceph/ceph
synced 2025-03-11 02:39:05 +00:00
erasure-code: delegate chunk remapping to the plugin
Remapping the chunks after they have been encoded by the plugin is fine if remapping is transparent to the plugin. However, the goal is to delegate the remapping of the chunks to the plugin, for LRC in particular. The chunks are therefore reordered according to the directions found in the mapping array before they are passed to decode_chunks. Signed-off-by: Loic Dachary <loic-201408@dachary.org>
This commit is contained in:
parent
b517ca4888
commit
c2ca011708
@ -4,6 +4,7 @@
|
||||
* Ceph distributed storage system
|
||||
*
|
||||
* Copyright (C) 2014 Cloudwatt <libre.licensing@cloudwatt.com>
|
||||
* Copyright (C) 2014 Red Hat <contact@redhat.com>
|
||||
*
|
||||
* Author: Loic Dachary <loic@dachary.org>
|
||||
*
|
||||
@ -83,16 +84,12 @@ int ErasureCode::encode(const set<int> &want_to_encode,
|
||||
if (err)
|
||||
return err;
|
||||
unsigned blocksize = get_chunk_size(in.length());
|
||||
map<int, bufferlist> sorted_encoded;
|
||||
for (unsigned int i = 0; i < k + m; i++) {
|
||||
bufferlist &chunk = sorted_encoded[i];
|
||||
int chunk_index = chunk_mapping.size() > 0 ? chunk_mapping[i] : i;
|
||||
bufferlist &chunk = (*encoded)[chunk_index];
|
||||
chunk.substr_of(out, i * blocksize, blocksize);
|
||||
}
|
||||
encode_chunks(want_to_encode, &sorted_encoded);
|
||||
for (unsigned int i = 0; i < k + m; i++) {
|
||||
int chunk = chunk_mapping.size() > 0 ? chunk_mapping[i] : i;
|
||||
(*encoded)[chunk].claim(sorted_encoded[i]);
|
||||
}
|
||||
encode_chunks(want_to_encode, encoded);
|
||||
for (unsigned int i = 0; i < k + m; i++) {
|
||||
if (want_to_encode.count(i) == 0)
|
||||
encoded->erase(i);
|
||||
|
Loading…
Reference in New Issue
Block a user