]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/run_bench(): modify perform_write_test() to adopt Crimson's 67963/head
authorRonen Friedman <rfriedma@redhat.com>
Mon, 23 Mar 2026 16:25:24 +0000 (16:25 +0000)
committerRonen Friedman <rfriedma@redhat.com>
Fri, 27 Mar 2026 12:14:28 +0000 (15:14 +0300)
randomness implementation.

Changed from memset with a single random byte to std::generate_n()
with per-byte randomness, matching Crimson.

Signed-off-by: Ronen Friedman <rfriedma@redhat.com>
src/osd/OSD.cc

index 34c47e148f024b774fbaed3041f87ce230d4b533..8c66d945eb3053d4c566cb2c2bb0f709e3e878c7 100644 (file)
@@ -18,6 +18,7 @@
 
 #include "acconfig.h"
 
+#include <algorithm>
 #include <cctype>
 #include <fstream>
 #include <iomanip>
@@ -11739,7 +11740,9 @@ void OSDBenchTest::perform_write_test()
     std::string nm;
     unsigned offset = 0;
     bufferptr bp(bsize);
-    memset(bp.c_str(), random_gen() & 0xff, bp.length());
+    std::generate_n(bp.c_str(), bp.length(), [&random_gen]() {
+        return static_cast<char>(random_gen() & 0xff);
+    });
     bl.push_back(std::move(bp));
     bl.rebuild_page_aligned();
     if (onum && osize) {