From 59c757cc572f9436eeec3593392963648d5139c2 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 20 May 2008 12:11:56 -0700 Subject: [PATCH] filestore, not fakestore. add os/ dir --- src/Makefile.am | 22 ++--- src/config.cc | 40 ++++---- src/config.h | 14 +-- src/dupstore.cc | 10 +- src/ebofs/Ebofs.cc | 2 +- src/ebofs/Ebofs.h | 6 +- src/include/types.h | 2 +- src/messages/MOSDOpReply.h | 2 +- src/messages/MOSDSubOpReply.h | 2 +- src/{osd => os}/BDBMap.h | 0 src/{osd => os}/Fake.h | 8 +- src/{osd => os}/FakeStoreBDBCollections.h | 0 src/{osd => os}/FileJournal.cc | 0 src/{osd => os}/FileJournal.h | 0 src/{osd/FakeStore.cc => os/FileStore.cc} | 112 +++++++++++----------- src/{osd/FakeStore.h => os/FileStore.h} | 16 ++-- src/{osd => os}/Journal.h | 0 src/{osd => os}/JournalingObjectStore.cc | 0 src/{osd => os}/JournalingObjectStore.h | 0 src/{osd => os}/ObjectStore.cc | 0 src/{osd => os}/ObjectStore.h | 1 - src/osd/Ager.cc | 2 +- src/osd/Ager.h | 2 +- src/osd/OSD.cc | 11 +-- src/osd/OSD.h | 2 +- src/osd/PG.h | 2 +- src/osd/osd_types.h | 2 - src/streamtest.cc | 4 +- src/vstartnew.sh | 14 ++- 29 files changed, 138 insertions(+), 138 deletions(-) rename src/{osd => os}/BDBMap.h (100%) rename src/{osd => os}/Fake.h (97%) rename src/{osd => os}/FakeStoreBDBCollections.h (100%) rename src/{osd => os}/FileJournal.cc (100%) rename src/{osd => os}/FileJournal.h (100%) rename src/{osd/FakeStore.cc => os/FileStore.cc} (87%) rename src/{osd/FakeStore.h => os/FileStore.h} (93%) rename src/{osd => os}/Journal.h (100%) rename src/{osd => os}/JournalingObjectStore.cc (100%) rename src/{osd => os}/JournalingObjectStore.h (100%) rename src/{osd => os}/ObjectStore.cc (100%) rename src/{osd => os}/ObjectStore.h (99%) diff --git a/src/Makefile.am b/src/Makefile.am index cee2a69dfc368..97a6e6b5b1157 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -213,9 +213,9 @@ libebofs_a_SOURCES = \ ebofs/Ebofs.cc \ ebofs/Allocator.cc libos_a_SOURCES = \ - osd/FileJournal.cc \ - osd/FakeStore.cc \ - osd/JournalingObjectStore.cc + os/FileJournal.cc \ + os/FileStore.cc \ + os/JournalingObjectStore.cc libosd_a_SOURCES = \ osd/PG.cc \ @@ -269,12 +269,12 @@ noinst_HEADERS = \ ebofs/csum.h\ ebofs/BlockDevice.h\ ebofs/Ebofs.h\ - osd/FileJournal.h\ - osd/JournalingObjectStore.h\ + os/FileJournal.h\ + os/JournalingObjectStore.h\ ebofs/types.h\ ebofs/Allocator.h\ ebofs/BufferCache.h\ - osd/Journal.h\ + os/Journal.h\ ebofs/nodes.h\ ebofs/Cnode.h\ ebofs/Onode.h\ @@ -468,16 +468,16 @@ noinst_HEADERS = \ msg/SimpleMessenger.h\ osbdb/OSBDB.h\ osd/Ager.h\ - osd/BDBMap.h\ - osd/Fake.h\ - osd/FakeStoreBDBCollections.h\ - osd/ObjectStore.h\ + os/BDBMap.h\ + os/Fake.h\ + os/FakeStoreBDBCollections.h\ + os/ObjectStore.h\ osd/ObjectVersioner.h\ osd/RAID4PG.h\ osd/ReplicatedPG.h\ osd/PG.h\ osd/OSDMap.h\ - osd/FakeStore.h\ + os/FileStore.h\ osd/OSD.h\ osd/osd_types.h\ osdc/Blinker.h\ diff --git a/src/config.cc b/src/config.cc index 84181a607b5fa..6891dba0616a9 100644 --- a/src/config.cc +++ b/src/config.cc @@ -209,7 +209,7 @@ md_config_t g_conf = { debug_client: 0, debug_osd: 0, debug_ebofs: 1, - debug_fakestore: 1, + debug_filestore: 1, debug_journal: 1, debug_bdev: 1, // block device debug_ns: 0, @@ -391,12 +391,12 @@ md_config_t g_conf = { osd_auto_weight: false, - // --- fakestore --- - fakestore: false, - fakestore_sync_interval: .2, // seconds - fakestore_fake_attrs: false, - fakestore_fake_collections: false, - fakestore_dev: 0, + // --- filestore --- + filestore: false, + filestore_sync_interval: .2, // seconds + filestore_fake_attrs: false, + filestore_fake_collections: false, + filestore_dev: 0, // --- ebofs --- ebofs: false, @@ -698,11 +698,11 @@ void parse_config_options(std::vector& args) g_conf.debug_ebofs = atoi(args[++i]); else g_debug_after_conf.debug_ebofs = atoi(args[++i]); - else if (strcmp(args[i], "--debug_fakestore") == 0) + else if (strcmp(args[i], "--debug_filestore") == 0) if (!g_conf.debug_after) - g_conf.debug_fakestore = atoi(args[++i]); + g_conf.debug_filestore = atoi(args[++i]); else - g_debug_after_conf.debug_fakestore = atoi(args[++i]); + g_debug_after_conf.debug_filestore = atoi(args[++i]); else if (strcmp(args[i], "--debug_journal") == 0) if (!g_conf.debug_after) g_conf.debug_journal = atoi(args[++i]); @@ -898,16 +898,16 @@ void parse_config_options(std::vector& args) else if (strcmp(args[i], "--journal_max_write_bytes") == 0) g_conf.journal_max_write_bytes = atoi(args[++i]); - else if (strcmp(args[i], "--fakestore") == 0) - g_conf.fakestore = true; - else if (strcmp(args[i], "--fakestore_sync_interval") == 0) - g_conf.fakestore_sync_interval = atoi(args[++i]); - else if (strcmp(args[i], "--fakestore_dev") == 0) - g_conf.fakestore_dev = args[++i]; - else if (strcmp(args[i], "--fakestore_fake_attrs") == 0) - g_conf.fakestore_fake_attrs = true;//atoi(args[++i]); - else if (strcmp(args[i], "--fakestore_fake_collections") == 0) - g_conf.fakestore_fake_collections = true;//atoi(args[++i]); + else if (strcmp(args[i], "--filestore") == 0) + g_conf.filestore = true; + else if (strcmp(args[i], "--filestore_sync_interval") == 0) + g_conf.filestore_sync_interval = atoi(args[++i]); + else if (strcmp(args[i], "--filestore_dev") == 0) + g_conf.filestore_dev = args[++i]; + else if (strcmp(args[i], "--filestore_fake_attrs") == 0) + g_conf.filestore_fake_attrs = true;//atoi(args[++i]); + else if (strcmp(args[i], "--filestore_fake_collections") == 0) + g_conf.filestore_fake_collections = true;//atoi(args[++i]); else if (strcmp(args[i], "--osd_balance_reads") == 0) g_conf.osd_balance_reads = atoi(args[++i]); diff --git a/src/config.h b/src/config.h index e4da033c1b18f..f5979f5f7b0fd 100644 --- a/src/config.h +++ b/src/config.h @@ -89,7 +89,7 @@ struct md_config_t { int debug_client; int debug_osd; int debug_ebofs; - int debug_fakestore; + int debug_filestore; int debug_journal; int debug_bdev; int debug_ns; @@ -276,12 +276,12 @@ struct md_config_t { bool osd_auto_weight; - // fakestore - bool fakestore; - double fakestore_sync_interval; - bool fakestore_fake_attrs; - bool fakestore_fake_collections; - const char *fakestore_dev; + // filestore + bool filestore; + double filestore_sync_interval; + bool filestore_fake_attrs; + bool filestore_fake_collections; + const char *filestore_dev; // ebofs bool ebofs; diff --git a/src/dupstore.cc b/src/dupstore.cc index f07f009f9955c..63b3659e52b07 100644 --- a/src/dupstore.cc +++ b/src/dupstore.cc @@ -14,7 +14,7 @@ #include #include "ebofs/Ebofs.h" -#include "osd/FakeStore.h" +#include "os/FileStore.h" int dupstore(ObjectStore* src, ObjectStore* dst) @@ -88,14 +88,14 @@ int main(int argc, const char **argv) if (strcmp(args[0], "ebofs") == 0) src = new Ebofs(args[1]); - else if (strcmp(args[0], "fakestore") == 0) - src = new FakeStore(args[1]); + else if (strcmp(args[0], "filestore") == 0) + src = new FileStore(args[1]); else usage(); if (strcmp(args[2], "ebofs") == 0) dst = new Ebofs(args[3]); - else if (strcmp(args[2], "fakestore") == 0) - dst = new FakeStore(args[3]); + else if (strcmp(args[2], "filestore") == 0) + dst = new FileStore(args[3]); else usage(); return dupstore(src, dst); diff --git a/src/ebofs/Ebofs.cc b/src/ebofs/Ebofs.cc index c267652c797b1..e4f560ceac793 100644 --- a/src/ebofs/Ebofs.cc +++ b/src/ebofs/Ebofs.cc @@ -16,7 +16,7 @@ #include "Ebofs.h" -#include "osd/FileJournal.h" +#include "os/FileJournal.h" #include diff --git a/src/ebofs/Ebofs.h b/src/ebofs/Ebofs.h index 10cb660e75ce2..413a369642bde 100644 --- a/src/ebofs/Ebofs.h +++ b/src/ebofs/Ebofs.h @@ -30,14 +30,14 @@ using namespace __gnu_cxx; #include "nodes.h" #include "Allocator.h" #include "Table.h" -#include "osd/Journal.h" + +#include "os/Journal.h" +#include "os/ObjectStore.h" #include "common/Mutex.h" #include "common/Cond.h" #include "common/Finisher.h" -#include "osd/ObjectStore.h" - //typedef pair object_coll_t; typedef pair coll_pobject_t; diff --git a/src/include/types.h b/src/include/types.h index 3ad84c0b4dd55..af5aa2bf776a8 100644 --- a/src/include/types.h +++ b/src/include/types.h @@ -136,7 +136,7 @@ typedef __u32 epoch_t; // map epoch (32bits -> 13 epochs/second for 10 ye #define O_LAZY 01000000 - +typedef __u64 coll_t; // -------------------------------------- diff --git a/src/messages/MOSDOpReply.h b/src/messages/MOSDOpReply.h index 3216bede1d74b..2608209ca36ee 100644 --- a/src/messages/MOSDOpReply.h +++ b/src/messages/MOSDOpReply.h @@ -19,7 +19,7 @@ #include "msg/Message.h" #include "MOSDOp.h" -#include "osd/ObjectStore.h" +#include "os/ObjectStore.h" /* * OSD op reply diff --git a/src/messages/MOSDSubOpReply.h b/src/messages/MOSDSubOpReply.h index 30b5c1ca5f085..7c907043ad024 100644 --- a/src/messages/MOSDSubOpReply.h +++ b/src/messages/MOSDSubOpReply.h @@ -19,7 +19,7 @@ #include "msg/Message.h" #include "MOSDSubOp.h" -#include "osd/ObjectStore.h" +#include "os/ObjectStore.h" /* * OSD op reply diff --git a/src/osd/BDBMap.h b/src/os/BDBMap.h similarity index 100% rename from src/osd/BDBMap.h rename to src/os/BDBMap.h diff --git a/src/osd/Fake.h b/src/os/Fake.h similarity index 97% rename from src/osd/Fake.h rename to src/os/Fake.h index f364438d3b088..1c381ce9befb6 100644 --- a/src/osd/Fake.h +++ b/src/os/Fake.h @@ -24,14 +24,14 @@ using namespace std; using namespace __gnu_cxx; -class FakeStoreCollections { +class FakeCollections { private: Mutex faker_lock; ObjectStore *store; hash_map > fakecollections; public: - FakeStoreCollections(ObjectStore *s) : store(s) {} + FakeCollections(ObjectStore *s) : store(s) {} // faked collections int list_collections(list& ls) { @@ -114,7 +114,7 @@ class FakeStoreCollections { }; -class FakeStoreAttrs { +class FakeAttrs { private: class FakeAttrSet { @@ -168,7 +168,7 @@ class FakeStoreAttrs { hash_map fakecattrs; public: - FakeStoreAttrs(ObjectStore *s) : store(s) {} + FakeAttrs(ObjectStore *s) : store(s) {} int setattr(pobject_t oid, const char *name, const void *value, size_t size, diff --git a/src/osd/FakeStoreBDBCollections.h b/src/os/FakeStoreBDBCollections.h similarity index 100% rename from src/osd/FakeStoreBDBCollections.h rename to src/os/FakeStoreBDBCollections.h diff --git a/src/osd/FileJournal.cc b/src/os/FileJournal.cc similarity index 100% rename from src/osd/FileJournal.cc rename to src/os/FileJournal.cc diff --git a/src/osd/FileJournal.h b/src/os/FileJournal.h similarity index 100% rename from src/osd/FileJournal.h rename to src/os/FileJournal.h diff --git a/src/osd/FakeStore.cc b/src/os/FileStore.cc similarity index 87% rename from src/osd/FakeStore.cc rename to src/os/FileStore.cc index cb356665841da..8bab2813dbfeb 100644 --- a/src/osd/FakeStore.cc +++ b/src/os/FileStore.cc @@ -14,7 +14,7 @@ -#include "FakeStore.h" +#include "FileStore.h" #include "include/types.h" #include "FileJournal.h" @@ -56,8 +56,8 @@ #include "config.h" -#define dout(l) if (l<=g_conf.debug_fakestore) *_dout << dbeginl << g_clock.now() << " fakestore(" << basedir << ") " -#define derr(l) if (l<=g_conf.debug_fakestore) *_derr << dbeginl << g_clock.now() << " fakestore(" << basedir << ") " +#define dout(l) if (l<=g_conf.debug_filestore) *_dout << dbeginl << g_clock.now() << " filestore(" << basedir << ") " +#define derr(l) if (l<=g_conf.debug_filestore) *_derr << dbeginl << g_clock.now() << " filestore(" << basedir << ") " #include "include/buffer.h" @@ -100,7 +100,7 @@ int do_listxattr(const char *fn, char *names, size_t len) { -int FakeStore::statfs(struct statfs *buf) +int FileStore::statfs(struct statfs *buf) { if (::statfs(basedir.c_str(), buf) < 0) return -errno; @@ -111,7 +111,7 @@ int FakeStore::statfs(struct statfs *buf) /* * sorry, these are sentitive to the pobject_t and coll_t typing. */ -void FakeStore::get_oname(pobject_t oid, char *s) +void FileStore::get_oname(pobject_t oid, char *s) { assert(sizeof(oid) == 24); #ifdef __LP64__ @@ -127,7 +127,7 @@ void FakeStore::get_oname(pobject_t oid, char *s) #endif } -pobject_t FakeStore::parse_object(char *s) +pobject_t FileStore::parse_object(char *s) { pobject_t o; assert(sizeof(o) == 24); @@ -143,12 +143,12 @@ pobject_t FakeStore::parse_object(char *s) return o; } -coll_t FakeStore::parse_coll(char *s) +coll_t FileStore::parse_coll(char *s) { return strtoll(s, 0, 16); } -void FakeStore::get_cdir(coll_t cid, char *s) +void FileStore::get_cdir(coll_t cid, char *s) { assert(sizeof(cid) == 8); #ifdef __LP64__ @@ -160,7 +160,7 @@ void FakeStore::get_cdir(coll_t cid, char *s) #endif } -void FakeStore::get_coname(coll_t cid, pobject_t oid, char *s) +void FileStore::get_coname(coll_t cid, pobject_t oid, char *s) { assert(sizeof(oid) == 24); #ifdef __LP64__ @@ -179,12 +179,12 @@ void FakeStore::get_coname(coll_t cid, pobject_t oid, char *s) -int FakeStore::mkfs() +int FileStore::mkfs() { char cmd[200]; - if (g_conf.fakestore_dev) { + if (g_conf.filestore_dev) { dout(0) << "mounting" << dendl; - sprintf(cmd,"mount %s", g_conf.fakestore_dev); + sprintf(cmd,"mount %s", g_conf.filestore_dev); system(cmd); } @@ -222,10 +222,10 @@ int FakeStore::mkfs() dout(10) << "mkfs no journal at " << fn << dendl; } - if (g_conf.fakestore_dev) { + if (g_conf.filestore_dev) { char cmd[100]; dout(0) << "umounting" << dendl; - sprintf(cmd,"umount %s", g_conf.fakestore_dev); + sprintf(cmd,"umount %s", g_conf.filestore_dev); //system(cmd); } @@ -234,12 +234,12 @@ int FakeStore::mkfs() return 0; } -int FakeStore::mount() +int FileStore::mount() { - if (g_conf.fakestore_dev) { + if (g_conf.filestore_dev) { dout(0) << "mounting" << dendl; char cmd[100]; - sprintf(cmd,"mount %s", g_conf.fakestore_dev); + sprintf(cmd,"mount %s", g_conf.filestore_dev); //system(cmd); } @@ -253,21 +253,21 @@ int FakeStore::mount() return -errno; } - if (g_conf.fakestore_fake_collections) { + if (g_conf.filestore_fake_collections) { dout(0) << "faking collections (in memory)" << dendl; fake_collections = true; } // fake attrs? // let's test to see if they work. - if (g_conf.fakestore_fake_attrs) { + if (g_conf.filestore_fake_attrs) { dout(0) << "faking attrs (in memory)" << dendl; fake_attrs = true; } else { char names[1000]; r = do_listxattr(basedir.c_str(), names, 1000); if (r < 0) { - derr(0) << "xattrs don't appear to work (" << strerror(errno) << "), specify --fakestore_fake_attrs to fake them (in memory)." << dendl; + derr(0) << "xattrs don't appear to work (" << strerror(errno) << "), specify --filestore_fake_attrs to fake them (in memory)." << dendl; assert(0); } } @@ -322,7 +322,7 @@ int FakeStore::mount() return 0; } -int FakeStore::umount() +int FileStore::umount() { dout(5) << "umount " << basedir << dendl; @@ -340,10 +340,10 @@ int FakeStore::umount() btrfs_fd = -1; } - if (g_conf.fakestore_dev) { + if (g_conf.filestore_dev) { char cmd[100]; dout(0) << "umounting" << dendl; - sprintf(cmd,"umount %s", g_conf.fakestore_dev); + sprintf(cmd,"umount %s", g_conf.filestore_dev); //system(cmd); } @@ -352,7 +352,7 @@ int FakeStore::umount() } -int FakeStore::transaction_start() +int FileStore::transaction_start() { if (btrfs_fd < 0) return 0; @@ -371,7 +371,7 @@ int FakeStore::transaction_start() return fd; } -void FakeStore::transaction_end(int fd) +void FileStore::transaction_end(int fd) { if (btrfs_fd < 0) return; @@ -383,7 +383,7 @@ void FakeStore::transaction_end(int fd) // -------------------- // objects -bool FakeStore::exists(pobject_t oid) +bool FileStore::exists(pobject_t oid) { struct stat st; if (stat(oid, &st) == 0) @@ -392,7 +392,7 @@ bool FakeStore::exists(pobject_t oid) return false; } -int FakeStore::stat(pobject_t oid, struct stat *st) +int FileStore::stat(pobject_t oid, struct stat *st) { dout(20) << "stat " << oid << dendl; char fn[200]; @@ -403,7 +403,7 @@ int FakeStore::stat(pobject_t oid, struct stat *st) } -int FakeStore::remove(pobject_t oid, Context *onsafe) +int FileStore::remove(pobject_t oid, Context *onsafe) { dout(20) << "remove " << oid << dendl; char fn[200]; @@ -416,7 +416,7 @@ int FakeStore::remove(pobject_t oid, Context *onsafe) return r < 0 ? -errno:r; } -int FakeStore::truncate(pobject_t oid, off_t size, Context *onsafe) +int FileStore::truncate(pobject_t oid, off_t size, Context *onsafe) { dout(20) << "truncate " << oid << " size " << size << dendl; @@ -427,7 +427,7 @@ int FakeStore::truncate(pobject_t oid, off_t size, Context *onsafe) return r < 0 ? -errno:r; } -int FakeStore::read(pobject_t oid, +int FileStore::read(pobject_t oid, off_t offset, size_t len, bufferlist& bl) { dout(20) << "read " << oid << " len " << len << " off " << offset << dendl; @@ -463,7 +463,7 @@ int FakeStore::read(pobject_t oid, } -int FakeStore::write(pobject_t oid, +int FileStore::write(pobject_t oid, off_t offset, size_t len, const bufferlist& bl, Context *onsafe) @@ -515,7 +515,7 @@ int FakeStore::write(pobject_t oid, return did; } -int FakeStore::clone(pobject_t oldoid, pobject_t newoid) +int FileStore::clone(pobject_t oldoid, pobject_t newoid) { char ofn[200], nfn[200]; get_oname(oldoid, ofn); @@ -570,11 +570,11 @@ int FakeStore::clone(pobject_t oldoid, pobject_t newoid) } -void FakeStore::sync_entry() +void FileStore::sync_entry() { lock.Lock(); utime_t interval; - interval.set_from_double(g_conf.fakestore_sync_interval); + interval.set_from_double(g_conf.filestore_sync_interval); while (!stop) { dout(20) << "sync_entry waiting for " << interval << dendl; sync_cond.WaitInterval(lock, interval); @@ -600,13 +600,13 @@ void FakeStore::sync_entry() lock.Unlock(); } -void FakeStore::sync() +void FileStore::sync() { Mutex::Locker l(lock); sync_cond.Signal(); } -void FakeStore::sync(Context *onsafe) +void FileStore::sync(Context *onsafe) { journal_sync(onsafe); sync(); @@ -618,7 +618,7 @@ void FakeStore::sync(Context *onsafe) // objects -int FakeStore::setattr(pobject_t oid, const char *name, +int FileStore::setattr(pobject_t oid, const char *name, const void *value, size_t size, Context *onsafe) { @@ -637,7 +637,7 @@ int FakeStore::setattr(pobject_t oid, const char *name, return r < 0 ? -errno:r; } -int FakeStore::setattrs(pobject_t oid, map& aset) +int FileStore::setattrs(pobject_t oid, map& aset) { int r; if (fake_attrs) @@ -661,7 +661,7 @@ int FakeStore::setattrs(pobject_t oid, map& aset) return r < 0 ? -errno:r; } -int FakeStore::getattr(pobject_t oid, const char *name, +int FileStore::getattr(pobject_t oid, const char *name, void *value, size_t size) { int r; @@ -675,7 +675,7 @@ int FakeStore::getattr(pobject_t oid, const char *name, return r < 0 ? -errno:r; } -int FakeStore::getattrs(pobject_t oid, map& aset) +int FileStore::getattrs(pobject_t oid, map& aset) { int r; if (fake_attrs) @@ -700,7 +700,7 @@ int FakeStore::getattrs(pobject_t oid, map& aset) return r < 0 ? -errno:r; } -int FakeStore::rmattr(pobject_t oid, const char *name, Context *onsafe) +int FileStore::rmattr(pobject_t oid, const char *name, Context *onsafe) { int r; if (fake_attrs) @@ -721,7 +721,7 @@ int FakeStore::rmattr(pobject_t oid, const char *name, Context *onsafe) // collections -int FakeStore::collection_setattr(coll_t c, const char *name, +int FileStore::collection_setattr(coll_t c, const char *name, void *value, size_t size, Context *onsafe) { @@ -740,7 +740,7 @@ int FakeStore::collection_setattr(coll_t c, const char *name, return r < 0 ? -errno:r; } -int FakeStore::collection_rmattr(coll_t c, const char *name, +int FileStore::collection_rmattr(coll_t c, const char *name, Context *onsafe) { int r; @@ -754,7 +754,7 @@ int FakeStore::collection_rmattr(coll_t c, const char *name, return r < 0 ? -errno:r; } -int FakeStore::collection_getattr(coll_t c, const char *name, +int FileStore::collection_getattr(coll_t c, const char *name, void *value, size_t size) { int r; @@ -768,7 +768,7 @@ int FakeStore::collection_getattr(coll_t c, const char *name, return r < 0 ? -errno:r; } -int FakeStore::collection_setattrs(coll_t cid, map& aset) +int FileStore::collection_setattrs(coll_t cid, map& aset) { int r; if (fake_attrs) @@ -789,7 +789,7 @@ int FakeStore::collection_setattrs(coll_t cid, map& aset) return r < 0 ? -errno:r; } -int FakeStore::collection_getattrs(coll_t cid, map& aset) +int FileStore::collection_getattrs(coll_t cid, map& aset) { int r; if (fake_attrs) @@ -817,7 +817,7 @@ int FakeStore::collection_getattrs(coll_t cid, map& aset) /* -int FakeStore::collection_listattr(coll_t c, char *attrs, size_t size) +int FileStore::collection_listattr(coll_t c, char *attrs, size_t size) { if (fake_attrs) return collection_listattr(c, attrs, size); return 0; @@ -825,7 +825,7 @@ int FakeStore::collection_listattr(coll_t c, char *attrs, size_t size) */ -int FakeStore::list_objects(list& ls) +int FileStore::list_objects(list& ls) { char fn[200]; sprintf(fn, "%s/objects", basedir.c_str()); @@ -850,7 +850,7 @@ int FakeStore::list_objects(list& ls) // -------------------------- // collections -int FakeStore::list_collections(list& ls) +int FileStore::list_collections(list& ls) { if (fake_collections) return collections.list_collections(ls); @@ -872,7 +872,7 @@ int FakeStore::list_collections(list& ls) return 0; } -int FakeStore::create_collection(coll_t c, +int FileStore::create_collection(coll_t c, Context *onsafe) { if (fake_collections) return collections.create_collection(c, onsafe); @@ -889,7 +889,7 @@ int FakeStore::create_collection(coll_t c, return r < 0 ? -errno:r; } -int FakeStore::destroy_collection(coll_t c, +int FileStore::destroy_collection(coll_t c, Context *onsafe) { if (fake_collections) return collections.destroy_collection(c, onsafe); @@ -908,7 +908,7 @@ int FakeStore::destroy_collection(coll_t c, return 0; } -int FakeStore::collection_stat(coll_t c, struct stat *st) +int FileStore::collection_stat(coll_t c, struct stat *st) { if (fake_collections) return collections.collection_stat(c, st); @@ -918,7 +918,7 @@ int FakeStore::collection_stat(coll_t c, struct stat *st) return r < 0 ? -errno:r; } -bool FakeStore::collection_exists(coll_t c) +bool FileStore::collection_exists(coll_t c) { if (fake_collections) return collections.collection_exists(c); @@ -927,7 +927,7 @@ bool FakeStore::collection_exists(coll_t c) } -int FakeStore::collection_add(coll_t c, pobject_t o, +int FileStore::collection_add(coll_t c, pobject_t o, Context *onsafe) { int r; @@ -947,7 +947,7 @@ int FakeStore::collection_add(coll_t c, pobject_t o, return r < 0 ? -errno:r; } -int FakeStore::collection_remove(coll_t c, pobject_t o, +int FileStore::collection_remove(coll_t c, pobject_t o, Context *onsafe) { int r; @@ -965,7 +965,7 @@ int FakeStore::collection_remove(coll_t c, pobject_t o, return r < 0 ? -errno:r; } -int FakeStore::collection_list(coll_t c, list& ls) +int FileStore::collection_list(coll_t c, list& ls) { if (fake_collections) return collections.collection_list(c, ls); diff --git a/src/osd/FakeStore.h b/src/os/FileStore.h similarity index 93% rename from src/osd/FakeStore.h rename to src/os/FileStore.h index d930ef58dfbb5..59ee140dcc15f 100644 --- a/src/osd/FakeStore.h +++ b/src/os/FileStore.h @@ -13,8 +13,8 @@ */ -#ifndef __FAKESTORE_H -#define __FAKESTORE_H +#ifndef __FILESTORE_H +#define __FILESTORE_H #include "ObjectStore.h" #include "JournalingObjectStore.h" @@ -34,18 +34,18 @@ using namespace __gnu_cxx; // fake attributes in memory, if we need to. -class FakeStore : public JournalingObjectStore { +class FileStore : public JournalingObjectStore { string basedir; __u64 fsid; int btrfs_fd; // >= if btrfs // fake attrs? - FakeStoreAttrs attrs; + FakeAttrs attrs; bool fake_attrs; // fake collections? - FakeStoreCollections collections; + FakeCollections collections; bool fake_collections; // helper fns @@ -61,8 +61,8 @@ class FakeStore : public JournalingObjectStore { bool stop; void sync_entry(); struct SyncThread : public Thread { - FakeStore *fs; - SyncThread(FakeStore *f) : fs(f) {} + FileStore *fs; + SyncThread(FileStore *f) : fs(f) {} void *entry() { fs->sync_entry(); return 0; @@ -72,7 +72,7 @@ class FakeStore : public JournalingObjectStore { void sync_fs(); // actuall sync underlying fs public: - FakeStore(const char *base) : + FileStore(const char *base) : basedir(base), btrfs_fd(-1), attrs(this), fake_attrs(false), diff --git a/src/osd/Journal.h b/src/os/Journal.h similarity index 100% rename from src/osd/Journal.h rename to src/os/Journal.h diff --git a/src/osd/JournalingObjectStore.cc b/src/os/JournalingObjectStore.cc similarity index 100% rename from src/osd/JournalingObjectStore.cc rename to src/os/JournalingObjectStore.cc diff --git a/src/osd/JournalingObjectStore.h b/src/os/JournalingObjectStore.h similarity index 100% rename from src/osd/JournalingObjectStore.h rename to src/os/JournalingObjectStore.h diff --git a/src/osd/ObjectStore.cc b/src/os/ObjectStore.cc similarity index 100% rename from src/osd/ObjectStore.cc rename to src/os/ObjectStore.cc diff --git a/src/osd/ObjectStore.h b/src/os/ObjectStore.h similarity index 99% rename from src/osd/ObjectStore.h rename to src/os/ObjectStore.h index aa4b6adfa2c72..ee6da1be43328 100644 --- a/src/osd/ObjectStore.h +++ b/src/os/ObjectStore.h @@ -17,7 +17,6 @@ #define __OBJECTSTORE_H #include "include/types.h" -#include "osd_types.h" #include "include/Context.h" #include "include/buffer.h" #include "include/pobject.h" diff --git a/src/osd/Ager.cc b/src/osd/Ager.cc index f462d14d00ffa..813093ee56dfe 100644 --- a/src/osd/Ager.cc +++ b/src/osd/Ager.cc @@ -4,7 +4,7 @@ #include "include/types.h" #include "Ager.h" -#include "ObjectStore.h" +#include "os/ObjectStore.h" #include "config.h" #include "common/Clock.h" diff --git a/src/osd/Ager.h b/src/osd/Ager.h index a916005def8ba..d55c53eea73db 100644 --- a/src/osd/Ager.h +++ b/src/osd/Ager.h @@ -5,7 +5,7 @@ #include "include/types.h" #include "include/Distribution.h" -#include "ObjectStore.h" +#include "os/ObjectStore.h" #include "common/Clock.h" #include diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index d72bde14a0629..d6c715da1453a 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -19,8 +19,7 @@ #include "OSD.h" #include "OSDMap.h" -#include "FakeStore.h" - +#include "os/FileStore.h" #include "ebofs/Ebofs.h" #ifdef USE_OSBDB @@ -129,11 +128,11 @@ ObjectStore *OSD::create_object_store(const char *dev) if (g_conf.ebofs) return new Ebofs(dev); - if (g_conf.fakestore) - return new FakeStore(dev); + if (g_conf.filestore) + return new FileStore(dev); if (S_ISDIR(st.st_mode)) - return new FakeStore(dev); + return new FileStore(dev); else return new Ebofs(dev); } @@ -179,7 +178,7 @@ int OSD::peek_whoami(const char *dev) -// force remount hack for performance testing FakeStore +// force remount hack for performance testing FileStore class C_Remount : public Context { OSD *osd; public: diff --git a/src/osd/OSD.h b/src/osd/OSD.h index 346b49f3cb313..9c263e64353ce 100644 --- a/src/osd/OSD.h +++ b/src/osd/OSD.h @@ -23,7 +23,7 @@ #include "mon/MonMap.h" -#include "ObjectStore.h" +#include "os/ObjectStore.h" #include "PG.h" #include "common/DecayCounter.h" diff --git a/src/osd/PG.h b/src/osd/PG.h index f20ef80ceae0e..c0d9d149f53df 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -21,7 +21,7 @@ #include "include/buffer.h" #include "OSDMap.h" -#include "ObjectStore.h" +#include "os/ObjectStore.h" #include "msg/Messenger.h" #include "common/DecayCounter.h" diff --git a/src/osd/osd_types.h b/src/osd/osd_types.h index e1c0362032bd5..9058a517d9512 100644 --- a/src/osd/osd_types.h +++ b/src/osd/osd_types.h @@ -73,8 +73,6 @@ namespace __gnu_cxx { -// osd types -typedef uint64_t coll_t; // collection id // pg stuff diff --git a/src/streamtest.cc b/src/streamtest.cc index fb08def2e2df1..57f149f6648b1 100644 --- a/src/streamtest.cc +++ b/src/streamtest.cc @@ -16,7 +16,7 @@ #include #include "ebofs/Ebofs.h" -#include "osd/FakeStore.h" +#include "os/FileStore.h" struct io { utime_t start, ack, commit; @@ -97,7 +97,7 @@ int main(int argc, const char **argv) << seconds << " seconds, " << bytes << " bytes per write" << std::endl; //ObjectStore *fs = new Ebofs(filename, journal); - ObjectStore *fs = new FakeStore(filename); + ObjectStore *fs = new FileStore(filename); if (g_conf.mkfs && fs->mkfs() < 0) { diff --git a/src/vstartnew.sh b/src/vstartnew.sh index dbd119b565194..e3359d22c9f0a 100755 --- a/src/vstartnew.sh +++ b/src/vstartnew.sh @@ -30,17 +30,21 @@ $CEPH_BIN/mkmonfs --clobber mondata/mon0 --mon 0 --monmap .ceph_monmap ARGS="-d" # start monitor -$CEPH_BIN/cmon $ARGS mondata/mon0 --debug_mon 20 --debug_ms 1 +#valgrind --tool=massif +#valgrind --leak-check=full --show-reachable=yes $CEPH_BIN/cmon mondata/mon0 --debug_mon 20 --debug_ms 1 > out/mon0 & +#valgrind --tool=massif $CEPH_BIN/cmon mondata/mon0 --debug_mon 20 --debug_ms 1 > out/mon0 & +#sleep 1 +$CEPH_BIN/cmon -d mondata/mon0 --debug_mon 20 --debug_ms 1 # build and inject an initial osd map -$CEPH_BIN/osdmaptool --clobber --createsimple .ceph_monmap 8 --print .ceph_osdmap --pgbits 2 +$CEPH_BIN/osdmaptool --clobber --createsimple .ceph_monmap 4 --print .ceph_osdmap # --pgbits 2 $CEPH_BIN/cmonctl osd setmap -i .ceph_osdmap -for osd in 0 1 2 3 #4 5 6 7 +for osd in 0 1 2 3 #4 5 6 7 8 9 10 11 12 13 14 15 do $CEPH_BIN/cosd --mkfs_for_osd $osd dev/osd$osd # initialize empty object store - #valgrind --tool=massif $CEPH_BIN/cosd dev/osd$osd --debug_ms 1 --debug_osd 20 --debug_fakestore 10 1>out/o$osd & #--debug_osd 40 - $CEPH_BIN/cosd dev/osd$osd -d --debug_ms 1 --debug_osd 20 --debug_fakestore 10 + #valgrind --tool=massif $CEPH_BIN/cosd dev/osd$osd --debug_ms 1 --debug_osd 20 --debug_filestore 10 1>out/o$osd & #--debug_osd 40 + $CEPH_BIN/cosd dev/osd$osd -d --debug_ms 1 --debug_osd 20 --debug_filestore 10 done # mds -- 2.39.5