Skip to content

Commit 7719091

Browse files
committed
test/allocsim: trim bufferlist before sending
Signed-off-by: Pere Diaz Bou <[email protected]>
1 parent 100e44d commit 7719091

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/test/objectstore/allocsim/ops_replayer.cc

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
#include <algorithm>
22
#include <cassert>
33
#include <fcntl.h>
4-
#include <ranges>
5-
#include <string_view>
64
#include <sys/mman.h>
75
#include <sys/stat.h>
86
#include <thread>
@@ -15,7 +13,6 @@
1513
#include <rados/librados.hpp>
1614
#include <atomic>
1715
#include <fmt/format.h>
18-
#include <fstream>
1916
#include <map>
2017
#include <memory>
2118
#include <random>
@@ -219,14 +216,18 @@ void worker_thread_entry(uint64_t id, uint64_t nworker_threads, vector<Op> &ops,
219216
op.completion = librados::Rados::aio_create_completion(static_cast<void*>(&op), completion_cb);
220217
switch (op.type) {
221218
case Write: {
222-
int ret = io->aio_write(*op.object, op.completion, bl, op.length, op.offset);
219+
bufferlist trimmed;
220+
trimmed.substr_of(bl, 0, op.length);
221+
int ret = io->aio_write(*op.object, op.completion, trimmed, op.length, op.offset);
223222
if (ret != 0) {
224223
cout << fmt::format("Error writing ecode={}", ret) << endl;;
225224
}
226225
break;
227226
}
228227
case WriteFull: {
229-
int ret = io->aio_write_full(*op.object, op.completion, bl);
228+
bufferlist trimmed;
229+
trimmed.substr_of(bl, 0, op.length);
230+
int ret = io->aio_write_full(*op.object, op.completion, trimmed);
230231
if (ret != 0) {
231232
cout << fmt::format("Error writing full ecode={}", ret) << endl;;
232233
}

0 commit comments

Comments
 (0)