From 07c56b8172f7e205feae1545fa68047552a068bd Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Wed, 21 May 2008 12:03:19 -0700 Subject: [PATCH] objectstore: remove list_objects --- src/ebofs/Ebofs.cc | 20 -------------------- src/ebofs/Ebofs.h | 2 -- src/kernel/file.c | 2 +- src/os/FileStore.cc | 34 ++++++---------------------------- src/os/FileStore.h | 2 -- src/os/ObjectStore.h | 2 -- src/vstartnew.sh | 4 ++-- 7 files changed, 9 insertions(+), 57 deletions(-) diff --git a/src/ebofs/Ebofs.cc b/src/ebofs/Ebofs.cc index eaab1fd90cd30..3bfad06e4b5f9 100644 --- a/src/ebofs/Ebofs.cc +++ b/src/ebofs/Ebofs.cc @@ -3410,26 +3410,6 @@ int Ebofs::listattr(coll_t cid, pobject_t oid, vector& attrs) return 0; } -int Ebofs::list_objects(list& ls) -{ - ebofs_lock.Lock(); - dout(9) << "list_objects " << dendl; - - Table::Cursor cursor(object_tab); - - int num = 0; - if (object_tab->find(pobject_t(), cursor) >= 0) { - while (1) { - ls.push_back(cursor.current().key); - num++; - if (cursor.move_right() <= 0) break; - } - } - - ebofs_lock.Unlock(); - return num; -} - /***************** collections ******************/ diff --git a/src/ebofs/Ebofs.h b/src/ebofs/Ebofs.h index 3eb2b3e1a9246..3fb85c374c83d 100644 --- a/src/ebofs/Ebofs.h +++ b/src/ebofs/Ebofs.h @@ -275,8 +275,6 @@ protected: int rename(pobject_t from, pobject_t to); int clone(coll_t cid, pobject_t from, pobject_t to, Context *onsafe); - int list_objects(list& ls); - // object attr int setattr(coll_t cid, pobject_t oid, const char *name, const void *value, size_t size, Context *onsafe=0); int setattrs(coll_t cid, pobject_t oid, map& attrset, Context *onsafe=0); diff --git a/src/kernel/file.c b/src/kernel/file.c index 1526346381ce0..a8ab96c930849 100644 --- a/src/kernel/file.c +++ b/src/kernel/file.c @@ -120,7 +120,7 @@ int ceph_open(struct inode *inode, struct file *file) if (err == 0) err = ceph_init_file(inode, file, req->r_fmode); ceph_mdsc_put_request(req); - dout(5, "ceph_open result=%d on %llx\n", err, ceph_ino(inode)); + dout(5, "open result=%d on %llx\n", err, ceph_ino(inode)); out: dput(dentry); return err; diff --git a/src/os/FileStore.cc b/src/os/FileStore.cc index a39a0c179c8c0..9b07857a92c53 100644 --- a/src/os/FileStore.cc +++ b/src/os/FileStore.cc @@ -113,7 +113,7 @@ int FileStore::statfs(struct statfs *buf) */ void FileStore::append_oname(const pobject_t &oid, char *s) { - assert(sizeof(oid) == 28); + //assert(sizeof(oid) == 28); char *t = s + strlen(s); #ifdef __LP64__ sprintf(t, "/%04x.%04x.%016lx.%08x.%lx", @@ -128,7 +128,7 @@ void FileStore::append_oname(const pobject_t &oid, char *s) pobject_t FileStore::parse_object(char *s) { pobject_t o; - assert(sizeof(o) == 28); + //assert(sizeof(o) == 28); dout(0) << " got object " << s << dendl; o.volume = strtoll(s, 0, 16); assert(s[4] == '.'); @@ -152,9 +152,9 @@ void FileStore::get_cdir(coll_t cid, char *s) { assert(sizeof(cid) == 8); #ifdef __LP64__ - sprintf(s, "%s/collections/%016lx", basedir.c_str(), cid); + sprintf(s, "%s/%016lx", basedir.c_str(), cid); #else - sprintf(s, "%s/collections/%016llx", basedir.c_str(), cid); + sprintf(s, "%s/%016llx", basedir.c_str(), cid); #endif } @@ -179,8 +179,8 @@ int FileStore::mkfs() dout(1) << "mkfs in " << basedir << dendl; // wipe - sprintf(cmd, "test -d %s && rm -r %s ; mkdir -p %s/collections && mkdir -p %s/objects", - basedir.c_str(), basedir.c_str(), basedir.c_str(), basedir.c_str()); + sprintf(cmd, "test -d %s && rm -r %s ; mkdir -p %s", + basedir.c_str(), basedir.c_str(), basedir.c_str()); dout(5) << "wipe: " << cmd << dendl; system(cmd); @@ -812,28 +812,6 @@ int FileStore::collection_listattr(coll_t c, char *attrs, size_t size) */ -int FileStore::list_objects(list& ls) -{ - char fn[200]; - sprintf(fn, "%s/objects", basedir.c_str()); - - DIR *dir = ::opendir(fn); - assert(dir); - - struct dirent *de; - while ((de = ::readdir(dir)) != 0) { - if (de->d_name[0] == '.') continue; - // parse - pobject_t o = parse_object(de->d_name); - if (errno) continue; - ls.push_back(o); - } - - ::closedir(dir); - return 0; -} - - // -------------------------- // collections diff --git a/src/os/FileStore.h b/src/os/FileStore.h index 5ee5b156bf79a..882386070e979 100644 --- a/src/os/FileStore.h +++ b/src/os/FileStore.h @@ -105,8 +105,6 @@ class FileStore : public JournalingObjectStore { void sync(); void sync(Context *onsafe); - int list_objects(list& ls); - // attrs int setattr(coll_t cid, pobject_t oid, const char *name, const void *value, size_t size, Context *onsafe=0); int setattrs(coll_t cid, pobject_t oid, map& aset); diff --git a/src/os/ObjectStore.h b/src/os/ObjectStore.h index d0cdc47b65f55..df13023af25ae 100644 --- a/src/os/ObjectStore.h +++ b/src/os/ObjectStore.h @@ -633,8 +633,6 @@ public: return -1; } - virtual int list_objects(list& ls) = 0;//{ return -1; } - virtual int get_object_collections(coll_t cid, pobject_t oid, set& ls) { return -1; } //virtual int listattr(pobject_t oid, char *attrs, size_t size) {return 0;} //= 0; diff --git a/src/vstartnew.sh b/src/vstartnew.sh index e3359d22c9f0a..487e2f2b117bb 100755 --- a/src/vstartnew.sh +++ b/src/vstartnew.sh @@ -37,10 +37,10 @@ ARGS="-d" $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 4 --print .ceph_osdmap # --pgbits 2 +$CEPH_BIN/osdmaptool --clobber --createsimple .ceph_monmap 16 --print .ceph_osdmap # --pgbits 2 $CEPH_BIN/cmonctl osd setmap -i .ceph_osdmap -for osd in 0 1 2 3 #4 5 6 7 8 9 10 11 12 13 14 15 +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_filestore 10 1>out/o$osd & #--debug_osd 40 -- 2.39.5