From: Joe Buck Date: Thu, 15 Aug 2013 05:29:46 +0000 (-0700) Subject: Renamed filestore_backend test X-Git-Tag: v0.68~63^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=3d7a94954c58b80ca15219449b197bc45f6cd2ad;p=ceph.git Renamed filestore_backend test Renamed filestore_backend to testfilestore_backend in order to resolve compilation time issue. Signed-off-by: Joe Buck --- diff --git a/src/Makefile.am b/src/Makefile.am index f268cab5e2b2..353a1db639ac 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -268,7 +268,7 @@ ceph_smalliobench_SOURCES = test/bench/small_io_bench.cc test/bench/rados_backen 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 @@ -2281,7 +2281,7 @@ noinst_HEADERS = \ 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 \ diff --git a/src/test/bench/filestore_backend.cc b/src/test/bench/filestore_backend.cc deleted file mode 100644 index 44abee98b6b8..000000000000 --- a/src/test/bench/filestore_backend.cc +++ /dev/null @@ -1,77 +0,0 @@ -// -*- 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); -} diff --git a/src/test/bench/filestore_backend.h b/src/test/bench/filestore_backend.h deleted file mode 100644 index 714299338607..000000000000 --- a/src/test/bench/filestore_backend.h +++ /dev/null @@ -1,37 +0,0 @@ -// -*- 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 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 diff --git a/src/test/bench/small_io_bench_fs.cc b/src/test/bench/small_io_bench_fs.cc index a37a7e71153a..6f4ac07d3620 100644 --- a/src/test/bench/small_io_bench_fs.cc +++ b/src/test/bench/small_io_bench_fs.cc @@ -21,7 +21,7 @@ #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; @@ -217,7 +217,7 @@ int main(int argc, char **argv) Bencher *bencher = new Bencher( gen, col, - new FileStoreBackend(&fs, vm["write-infos"].as()), + new TestFileStoreBackend(&fs, vm["write-infos"].as()), vm["num-concurrent-ops"].as(), vm["duration"].as(), vm["max-ops"].as()); diff --git a/src/test/bench/testfilestore_backend.cc b/src/test/bench/testfilestore_backend.cc new file mode 100644 index 000000000000..4e2ca80033b5 --- /dev/null +++ b/src/test/bench/testfilestore_backend.cc @@ -0,0 +1,77 @@ +// -*- 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); +} diff --git a/src/test/bench/testfilestore_backend.h b/src/test/bench/testfilestore_backend.h new file mode 100644 index 000000000000..2c3f8e6dc052 --- /dev/null +++ b/src/test/bench/testfilestore_backend.h @@ -0,0 +1,37 @@ +// -*- 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 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