Skip to content

Commit 7d15784

Browse files
authored
Merge pull request ceph#65204 from ifed01/wip-ifed-fix-ec-contiguous
erasure-code: make bufferlist contiguous in ErasureCode::encode_prepare Reviewed-by: Radoslaw Zarzynski <[email protected]> Reviewed-by: Alex Ainscow <[email protected]>
2 parents 4876523 + 6b07e75 commit 7d15784

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/erasure-code/ErasureCode.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ int ErasureCode::encode_prepare(const bufferlist &raw,
247247
for (unsigned int i = 0; i < k - padded_chunks; i++) {
248248
bufferlist &chunk = encoded[chunk_index(i)];
249249
chunk.substr_of(prepared, i * blocksize, blocksize);
250-
chunk.rebuild_aligned_size_and_memory(blocksize, SIMD_ALIGN);
250+
chunk.rebuild_aligned_size_and_memory(blocksize, SIMD_ALIGN, 1);
251251
ceph_assert(chunk.is_contiguous());
252252
}
253253
if (padded_chunks) {
@@ -285,7 +285,7 @@ int ErasureCode::encode_prepare(const bufferlist &raw,
285285
for (raw_shard_id_t i; i < k - padded_chunks; ++i) {
286286
bufferlist &chunk = encoded[chunk_index(i)];
287287
chunk.substr_of(prepared, (int)i * blocksize, blocksize);
288-
chunk.rebuild_aligned_size_and_memory(blocksize, SIMD_ALIGN);
288+
chunk.rebuild_aligned_size_and_memory(blocksize, SIMD_ALIGN, 1);
289289
ceph_assert(chunk.is_contiguous());
290290
}
291291
if (padded_chunks) {

src/test/bufferlist.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1867,6 +1867,9 @@ TEST(BufferList, rebuild_aligned_size_and_memory) {
18671867
EXPECT_TRUE(bl.is_n_align_sized(BUFFER_SIZE));
18681868
EXPECT_EQ(3U, bl.get_num_buffers());
18691869

1870+
bl.rebuild_aligned_size_and_memory(BUFFER_SIZE, SIMD_ALIGN, 1);
1871+
EXPECT_EQ(1U, bl.get_num_buffers());
1872+
18701873
{
18711874
/* bug replicator, to test rebuild_aligned_size_and_memory() in the
18721875
* scenario where the first bptr is both size and memory aligned and

0 commit comments

Comments
 (0)