ceph_smalliobench_LDADD = librados.la -lboost_program_options $(LIBGLOBAL_LDA)
bin_DEBUGPROGRAMS += ceph_smalliobench
-ceph_smalliobenchfs_SOURCES = test/bench/small_io_bench_fs.cc test/bench/filestore_backend.cc test/bench/detailed_stat_collector.cc test/bench/bencher.cc
+ceph_smalliobenchfs_SOURCES = test/bench/small_io_bench_fs.cc test/bench/testfilestore_backend.cc test/bench/detailed_stat_collector.cc test/bench/bencher.cc
ceph_smalliobenchfs_LDADD = librados.la -lboost_program_options $(LIBOS_LDA) $(LIBGLOBAL_LDA)
ceph_smalliobenchfs_CXXFLAGS = ${CRYPTO_CXXFLAGS} ${AM_CXXFLAGS}
bin_DEBUGPROGRAMS += ceph_smalliobenchfs
test/bench/dumb_backend.h \
test/bench/stat_collector.h \
test/bench/detailed_stat_collector.h \
- test/bench/filestore_backend.h \
+ test/bench/testfilestore_backend.h \
test/common/ObjectContents.h \
test/encoding/types.h \
test/filestore/DeterministicOpSequence.h \
+++ /dev/null
-// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
-
-#include "filestore_backend.h"
-#include "global/global_init.h"
-#include "os/ObjectStore.h"
-
-struct C_DeleteTransWrapper : public Context {
- Context *c;
- ObjectStore::Transaction *t;
- C_DeleteTransWrapper(
- ObjectStore::Transaction *t,
- Context *c) : c(c), t(t) {}
- void finish(int r) {
- c->complete(r);
- delete t;
- }
-};
-
-FileStoreBackend::FileStoreBackend(
- ObjectStore *os, bool write_infos)
- : os(os), finisher(g_ceph_context), write_infos(write_infos)
-{
- finisher.start();
-}
-
-void FileStoreBackend::write(
- const string &oid,
- uint64_t offset,
- const bufferlist &bl,
- Context *on_applied,
- Context *on_commit)
-{
- ObjectStore::Transaction *t = new ObjectStore::Transaction;
- size_t sep = oid.find("/");
- assert(sep != string::npos);
- assert(sep + 1 < oid.size());
- string coll_str(oid.substr(0, sep));
-
- if (!osrs.count(coll_str))
- osrs.insert(make_pair(coll_str, ObjectStore::Sequencer(coll_str)));
- ObjectStore::Sequencer *osr = &(osrs.find(coll_str)->second);
-
-
- coll_t c(coll_str);
- hobject_t h(sobject_t(oid.substr(sep+1), 0));
- t->write(c, h, offset, bl.length(), bl);
-
- if (write_infos) {
- bufferlist bl2;
- for (uint64_t j = 0; j < 128; ++j) bl2.append(0);
- coll_t meta("meta");
- hobject_t info(sobject_t(string("info_")+coll_str, 0));
- t->write(meta, info, 0, bl2.length(), bl2);
- }
-
- os->queue_transaction(
- osr,
- t,
- new C_DeleteTransWrapper(t, on_applied),
- on_commit);
-}
-
-void FileStoreBackend::read(
- const string &oid,
- uint64_t offset,
- uint64_t length,
- bufferlist *bl,
- Context *on_complete)
-{
- size_t sep = oid.find("/");
- assert(sep != string::npos);
- assert(sep + 1 < oid.size());
- coll_t c(oid.substr(0, sep));
- hobject_t h(sobject_t(oid.substr(sep+1), 0));
- os->read(c, h, offset, length, *bl);
- finisher.queue(on_complete);
-}
+++ /dev/null
-// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
-
-#ifndef FILESTOREBACKENDH
-#define FILESTOREBACKENDH
-
-#include "common/Finisher.h"
-#include "backend.h"
-#include "include/Context.h"
-#include "os/ObjectStore.h"
-
-class FileStoreBackend : public Backend {
- ObjectStore *os;
- Finisher finisher;
- map<string, ObjectStore::Sequencer> osrs;
- const bool write_infos;
-
-public:
- FileStoreBackend(ObjectStore *os, bool write_infos);
- ~FileStoreBackend() {
- finisher.stop();
- }
- void write(
- const string &oid,
- uint64_t offset,
- const bufferlist &bl,
- Context *on_applied,
- Context *on_commit);
-
- void read(
- const string &oid,
- uint64_t offset,
- uint64_t length,
- bufferlist *bl,
- Context *on_complete);
-};
-
-#endif
#include "distribution.h"
#include "global/global_init.h"
#include "os/FileStore.h"
-#include "filestore_backend.h"
+#include "testfilestore_backend.h"
#include "common/perf_counters.h"
namespace po = boost::program_options;
Bencher *bencher = new Bencher(
gen,
col,
- new FileStoreBackend(&fs, vm["write-infos"].as<bool>()),
+ new TestFileStoreBackend(&fs, vm["write-infos"].as<bool>()),
vm["num-concurrent-ops"].as<unsigned>(),
vm["duration"].as<unsigned>(),
vm["max-ops"].as<unsigned>());
--- /dev/null
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+
+#include "testfilestore_backend.h"
+#include "global/global_init.h"
+#include "os/ObjectStore.h"
+
+struct C_DeleteTransWrapper : public Context {
+ Context *c;
+ ObjectStore::Transaction *t;
+ C_DeleteTransWrapper(
+ ObjectStore::Transaction *t,
+ Context *c) : c(c), t(t) {}
+ void finish(int r) {
+ c->complete(r);
+ delete t;
+ }
+};
+
+TestFileStoreBackend::TestFileStoreBackend(
+ ObjectStore *os, bool write_infos)
+ : os(os), finisher(g_ceph_context), write_infos(write_infos)
+{
+ finisher.start();
+}
+
+void TestFileStoreBackend::write(
+ const string &oid,
+ uint64_t offset,
+ const bufferlist &bl,
+ Context *on_applied,
+ Context *on_commit)
+{
+ ObjectStore::Transaction *t = new ObjectStore::Transaction;
+ size_t sep = oid.find("/");
+ assert(sep != string::npos);
+ assert(sep + 1 < oid.size());
+ string coll_str(oid.substr(0, sep));
+
+ if (!osrs.count(coll_str))
+ osrs.insert(make_pair(coll_str, ObjectStore::Sequencer(coll_str)));
+ ObjectStore::Sequencer *osr = &(osrs.find(coll_str)->second);
+
+
+ coll_t c(coll_str);
+ hobject_t h(sobject_t(oid.substr(sep+1), 0));
+ t->write(c, h, offset, bl.length(), bl);
+
+ if (write_infos) {
+ bufferlist bl2;
+ for (uint64_t j = 0; j < 128; ++j) bl2.append(0);
+ coll_t meta("meta");
+ hobject_t info(sobject_t(string("info_")+coll_str, 0));
+ t->write(meta, info, 0, bl2.length(), bl2);
+ }
+
+ os->queue_transaction(
+ osr,
+ t,
+ new C_DeleteTransWrapper(t, on_applied),
+ on_commit);
+}
+
+void TestFileStoreBackend::read(
+ const string &oid,
+ uint64_t offset,
+ uint64_t length,
+ bufferlist *bl,
+ Context *on_complete)
+{
+ size_t sep = oid.find("/");
+ assert(sep != string::npos);
+ assert(sep + 1 < oid.size());
+ coll_t c(oid.substr(0, sep));
+ hobject_t h(sobject_t(oid.substr(sep+1), 0));
+ os->read(c, h, offset, length, *bl);
+ finisher.queue(on_complete);
+}
--- /dev/null
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+
+#ifndef TESTFILESTOREBACKENDH
+#define TESTFILESTOREBACKENDH
+
+#include "common/Finisher.h"
+#include "backend.h"
+#include "include/Context.h"
+#include "os/ObjectStore.h"
+
+class TestFileStoreBackend : public Backend {
+ ObjectStore *os;
+ Finisher finisher;
+ map<string, ObjectStore::Sequencer> osrs;
+ const bool write_infos;
+
+public:
+ TestFileStoreBackend(ObjectStore *os, bool write_infos);
+ ~TestFileStoreBackend() {
+ finisher.stop();
+ }
+ void write(
+ const string &oid,
+ uint64_t offset,
+ const bufferlist &bl,
+ Context *on_applied,
+ Context *on_commit);
+
+ void read(
+ const string &oid,
+ uint64_t offset,
+ uint64_t length,
+ bufferlist *bl,
+ Context *on_complete);
+};
+
+#endif