]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: make coll_t::META static to each file
authorAdam Crume <adamcrume@gmail.com>
Thu, 31 Jul 2014 19:19:50 +0000 (12:19 -0700)
committerDavid Zafman <dzafman@redhat.com>
Fri, 22 Aug 2014 05:33:55 +0000 (22:33 -0700)
Signed-off-by: Adam Crume <adamcrume@gmail.com>
src/osd/OSD.cc
src/osd/PG.cc
src/osd/PGLog.cc
src/osd/osd_types.cc
src/osd/osd_types.h
src/tools/ceph_filestore_dump.cc

index 1171b7072d8da08ff88b60044a35fe5ed3c9cbab..22643452a1d8149f34094d7a6d1b845b5d78a443 100644 (file)
 #include "tracing/osd.h"
 #endif
 
+static coll_t META_COLL("meta");
+
 #define dout_subsys ceph_subsys_osd
 #undef dout_prefix
 #define dout_prefix _prefix(_dout, whoami, get_osdmap_epoch())
@@ -1098,7 +1100,7 @@ bool OSDService::_get_map_bl(epoch_t e, bufferlist& bl)
   if (found)
     return true;
   found = store->read(
-    coll_t::META_COLL, OSD::get_osdmap_pobject_name(e), 0, 0, bl) >= 0;
+    META_COLL, OSD::get_osdmap_pobject_name(e), 0, 0, bl) >= 0;
   if (found)
     _add_map_bl(e, bl);
   return found;
@@ -1111,7 +1113,7 @@ bool OSDService::get_inc_map_bl(epoch_t e, bufferlist& bl)
   if (found)
     return true;
   found = store->read(
-    coll_t::META_COLL, OSD::get_inc_osdmap_pobject_name(e), 0, 0, bl) >= 0;
+    META_COLL, OSD::get_inc_osdmap_pobject_name(e), 0, 0, bl) >= 0;
   if (found)
     _add_map_inc_bl(e, bl);
   return found;
@@ -1455,7 +1457,7 @@ int OSD::mkfs(CephContext *cct, ObjectStore *store, const string &dev,
 
     OSDSuperblock sb;
     bufferlist sbbl;
-    ret = store->read(coll_t::META_COLL, OSD_SUPERBLOCK_POBJECT, 0, 0, sbbl);
+    ret = store->read(META_COLL, OSD_SUPERBLOCK_POBJECT, 0, 0, sbbl);
     if (ret >= 0) {
       dout(0) << " have superblock" << dendl;
       if (whoami != sb.whoami) {
@@ -1492,7 +1494,7 @@ int OSD::mkfs(CephContext *cct, ObjectStore *store, const string &dev,
        object_t oid("disk_bw_test");
        for (int i=0; i<1000; i++) {
          ObjectStore::Transaction *t = new ObjectStore::Transaction;
-         t->write(coll_t::META_COLL, hobject_t(sobject_t(oid, 0)), i*bl.length(), bl.length(), bl);
+         t->write(META_COLL, hobject_t(sobject_t(oid, 0)), i*bl.length(), bl.length(), bl);
          store->queue_transaction_and_cleanup(NULL, t);
        }
        store->sync();
@@ -1500,7 +1502,7 @@ int OSD::mkfs(CephContext *cct, ObjectStore *store, const string &dev,
        end -= start;
        dout(0) << "measured " << (1000.0 / (double)end) << " mb/sec" << dendl;
        ObjectStore::Transaction tr;
-       tr.remove(coll_t::META_COLL, hobject_t(sobject_t(oid, 0)));
+       tr.remove(META_COLL, hobject_t(sobject_t(oid, 0)));
        ret = store->apply_transaction(tr);
        if (ret) {
          derr << "OSD::mkfs: error while benchmarking: apply_transaction returned "
@@ -1516,8 +1518,8 @@ int OSD::mkfs(CephContext *cct, ObjectStore *store, const string &dev,
       ::encode(sb, bl);
 
       ObjectStore::Transaction t;
-      t.create_collection(coll_t::META_COLL);
-      t.write(coll_t::META_COLL, OSD_SUPERBLOCK_POBJECT, 0, bl.length(), bl);
+      t.create_collection(META_COLL);
+      t.write(META_COLL, OSD_SUPERBLOCK_POBJECT, 0, bl.length(), bl);
       ret = store->apply_transaction(t);
       if (ret) {
        derr << "OSD::mkfs: error while writing OSD_SUPERBLOCK_POBJECT: "
@@ -1950,20 +1952,20 @@ int OSD::init()
   }
 
   // make sure info object exists
-  if (!store->exists(coll_t::META_COLL, service.infos_oid)) {
+  if (!store->exists(META_COLL, service.infos_oid)) {
     dout(10) << "init creating/touching infos object" << dendl;
     ObjectStore::Transaction t;
-    t.touch(coll_t::META_COLL, service.infos_oid);
+    t.touch(META_COLL, service.infos_oid);
     r = store->apply_transaction(t);
     if (r < 0)
       goto out;
   }
 
   // make sure snap mapper object exists
-  if (!store->exists(coll_t::META_COLL, OSD::make_snapmapper_oid())) {
+  if (!store->exists(META_COLL, OSD::make_snapmapper_oid())) {
     dout(10) << "init creating/touching snapmapper object" << dendl;
     ObjectStore::Transaction t;
-    t.touch(coll_t::META_COLL, OSD::make_snapmapper_oid());
+    t.touch(META_COLL, OSD::make_snapmapper_oid());
     r = store->apply_transaction(t);
     if (r < 0)
       goto out;
@@ -2529,13 +2531,13 @@ void OSD::write_superblock(ObjectStore::Transaction& t)
 
   bufferlist bl;
   ::encode(superblock, bl);
-  t.write(coll_t::META_COLL, OSD_SUPERBLOCK_POBJECT, 0, bl.length(), bl);
+  t.write(META_COLL, OSD_SUPERBLOCK_POBJECT, 0, bl.length(), bl);
 }
 
 int OSD::read_superblock()
 {
   bufferlist bl;
-  int r = store->read(coll_t::META_COLL, OSD_SUPERBLOCK_POBJECT, 0, 0, bl);
+  int r = store->read(META_COLL, OSD_SUPERBLOCK_POBJECT, 0, 0, bl);
   if (r < 0)
     return r;
 
@@ -5178,9 +5180,9 @@ void OSD::do_command(Connection *con, ceph_tid_t tid, vector<string>& cmd, buffe
       object_t oid(nm);
       hobject_t soid(sobject_t(oid, 0));
       ObjectStore::Transaction *t = new ObjectStore::Transaction;
-      t->write(coll_t::META_COLL, soid, 0, bsize, bl);
+      t->write(META_COLL, soid, 0, bsize, bl);
       store->queue_transaction_and_cleanup(NULL, t);
-      cleanupt->remove(coll_t::META_COLL, soid);
+      cleanupt->remove(META_COLL, soid);
     }
     store->sync_and_flush();
     utime_t end = ceph_clock_now(cct);
@@ -6210,7 +6212,7 @@ void OSD::handle_osd_map(MOSDMap *m)
        last_marked_full = e;
 
       hobject_t fulloid = get_osdmap_pobject_name(e);
-      t.write(coll_t::META_COLL, fulloid, 0, bl.length(), bl);
+      t.write(META_COLL, fulloid, 0, bl.length(), bl);
       pin_map_bl(e, bl);
       pinned_maps.push_back(add_map(o));
       continue;
@@ -6221,7 +6223,7 @@ void OSD::handle_osd_map(MOSDMap *m)
       dout(10) << "handle_osd_map  got inc map for epoch " << e << dendl;
       bufferlist& bl = p->second;
       hobject_t oid = get_inc_osdmap_pobject_name(e);
-      t.write(coll_t::META_COLL, oid, 0, bl.length(), bl);
+      t.write(META_COLL, oid, 0, bl.length(), bl);
       pin_map_inc_bl(e, bl);
 
       OSDMap *o = new OSDMap;
@@ -6247,7 +6249,7 @@ void OSD::handle_osd_map(MOSDMap *m)
       o->encode(fbl);
 
       hobject_t fulloid = get_osdmap_pobject_name(e);
-      t.write(coll_t::META_COLL, fulloid, 0, fbl.length(), fbl);
+      t.write(META_COLL, fulloid, 0, fbl.length(), fbl);
       pin_map_bl(e, fbl);
       pinned_maps.push_back(add_map(o));
       continue;
@@ -6263,8 +6265,8 @@ void OSD::handle_osd_map(MOSDMap *m)
          service.map_cache.cached_key_lower_bound()));
     for (epoch_t e = superblock.oldest_map; e < min; ++e) {
       dout(20) << " removing old osdmap epoch " << e << dendl;
-      t.remove(coll_t::META_COLL, get_osdmap_pobject_name(e));
-      t.remove(coll_t::META_COLL, get_inc_osdmap_pobject_name(e));
+      t.remove(META_COLL, get_osdmap_pobject_name(e));
+      t.remove(META_COLL, get_inc_osdmap_pobject_name(e));
       superblock.oldest_map = e+1;
       num++;
       if (num >= cct->_conf->osd_target_transaction_size &&
index 902335ac6e72fbd6c5ab3c1db466d07e5755c9b9..acee96c499039d69fcf37b1ab458c70df7b78275 100644 (file)
@@ -51,6 +51,9 @@
 #define dout_subsys ceph_subsys_osd
 #undef dout_prefix
 #define dout_prefix _prefix(_dout, this)
+
+static coll_t META_COLL("meta");
+
 template <class T>
 static ostream& _prefix(std::ostream *_dout, T *t)
 {
@@ -2612,7 +2615,7 @@ int PG::_write_info(ObjectStore::Transaction& t, epoch_t epoch,
     //dout(20) << "write_info bigbl " << bigbl.length() << dendl;
   }
 
-  t.omap_setkeys(coll_t::META_COLL, infos_oid, v);
+  t.omap_setkeys(META_COLL, infos_oid, v);
 
   return 0;
 }
@@ -2656,7 +2659,7 @@ epoch_t PG::peek_map_epoch(ObjectStore *store, coll_t coll, hobject_t &infos_oid
     set<string> keys;
     keys.insert(get_epoch_key(pgid));
     map<string,bufferlist> values;
-    store->omap_get_values(coll_t::META_COLL, infos_oid, keys, &values);
+    store->omap_get_values(META_COLL, infos_oid, keys, &values);
     assert(values.size() == 1);
     tmpbl = values[ek];
     bufferlist::iterator p = tmpbl.begin();
@@ -2762,7 +2765,7 @@ void PG::append_log(
   }
 
   dout(10) << "append_log  adding " << keys.size() << " keys" << dendl;
-  t.omap_setkeys(coll_t::META_COLL, log_oid, keys);
+  t.omap_setkeys(META_COLL, log_oid, keys);
 
   pg_log.trim(&handler, trim_to, info);
 
@@ -2821,7 +2824,7 @@ int PG::read_info(
     ::decode(struct_v, p);
   } else {
     if (struct_v < 6) {
-      int r = store->read(coll_t::META_COLL, biginfo_oid, 0, 0, lbl);
+      int r = store->read(META_COLL, biginfo_oid, 0, 0, lbl);
       if (r < 0)
         return r;
       p = lbl.begin();
@@ -2834,7 +2837,7 @@ int PG::read_info(
       keys.insert(k);
       keys.insert(bk);
       map<string,bufferlist> values;
-      store->omap_get_values(coll_t::META_COLL, infos_oid, keys, &values);
+      store->omap_get_values(META_COLL, infos_oid, keys, &values);
       assert(values.size() == 2);
       lbl = values[k];
       p = lbl.begin();
index 9523b12bf9281baae613d9f23ba3dd4971f3f804..80b0f85330c4709bc925ef9355ce072047efa585 100644 (file)
@@ -22,6 +22,8 @@
 
 #define dout_subsys ceph_subsys_osd
 
+static coll_t META_COLL("meta");
+
 //////////////////// PGLog::IndexedLog ////////////////////
 
 void PGLog::IndexedLog::advance_rollback_info_trimmed_to(
@@ -152,8 +154,8 @@ void PGLog::clear_info_log(
   keys_to_remove.insert(PG::get_biginfo_key(pgid));
   keys_to_remove.insert(PG::get_info_key(pgid));
 
-  t->remove(coll_t::META_COLL, log_oid);
-  t->omap_rmkeys(coll_t::META_COLL, infos_oid, keys_to_remove);
+  t->remove(META_COLL, log_oid);
+  t->omap_rmkeys(META_COLL, infos_oid, keys_to_remove);
 }
 
 void PGLog::trim(
@@ -796,8 +798,8 @@ void PGLog::_write_log(
   }
   ::encode(log.can_rollback_to, keys["can_rollback_to"]);
 
-  t.omap_rmkeys(coll_t::META_COLL, log_oid, to_remove);
-  t.omap_setkeys(coll_t::META_COLL, log_oid, keys);
+  t.omap_rmkeys(META_COLL, log_oid, to_remove);
+  t.omap_setkeys(META_COLL, log_oid, keys);
 }
 
 bool PGLog::read_log(ObjectStore *store, coll_t coll, hobject_t log_oid,
@@ -812,7 +814,7 @@ bool PGLog::read_log(ObjectStore *store, coll_t coll, hobject_t log_oid,
 
   // legacy?
   struct stat st;
-  int r = store->stat(coll_t::META_COLL, log_oid, &st);
+  int r = store->stat(META_COLL, log_oid, &st);
   assert(r == 0);
   if (st.st_size > 0) {
     read_log_old(store, coll, log_oid, info, divergent_priors, log, missing, oss, log_keys_debug);
@@ -821,7 +823,7 @@ bool PGLog::read_log(ObjectStore *store, coll_t coll, hobject_t log_oid,
     log.tail = info.log_tail;
     // will get overridden below if it had been recorded
     log.can_rollback_to = info.last_update;
-    ObjectMap::ObjectMapIterator p = store->get_omap_iterator(coll_t::META_COLL, log_oid);
+    ObjectMap::ObjectMapIterator p = store->get_omap_iterator(META_COLL, log_oid);
     if (p) for (p->seek_to_first(); p->valid() ; p->next()) {
       bufferlist bl = p->value();//Copy bufferlist before creating iterator
       bufferlist::iterator bp = bl.begin();
@@ -958,7 +960,7 @@ void PGLog::read_log_old(ObjectStore *store, coll_t coll, hobject_t log_oid,
   if (ondisklog_head > 0) {
     // read
     bufferlist bl;
-    store->read(coll_t::META_COLL, log_oid, ondisklog_tail, ondisklog_length, bl);
+    store->read(META_COLL, log_oid, ondisklog_tail, ondisklog_length, bl);
     if (bl.length() < ondisklog_length) {
       std::ostringstream oss;
       oss << "read_log got " << bl.length() << " bytes, expected "
index 1dc2af14e4c7d04f1af8214ab742872099765b65..3591355142fc5c051e8eca23fda272b9dc84768d 100644 (file)
@@ -500,8 +500,6 @@ ostream& operator<<(ostream& out, const pg_t &pg)
 
 // -- coll_t --
 
-const coll_t coll_t::META_COLL("meta");
-
 bool coll_t::is_temp(spg_t& pgid) const
 {
   const char *cstr(str.c_str());
index 4dab643f137e82d293ce0ee56f4de03022f4b105..3495392d6b94c3c88ea896482e1d09220d9fb7f9 100644 (file)
@@ -468,8 +468,6 @@ ostream& operator<<(ostream& out, const spg_t &pg);
 
 class coll_t {
 public:
-  const static coll_t META_COLL;
-
   coll_t()
     : str("meta")
   { }
index 425dd68b39570008fb6ca268087fd9c135e88400..920aedfc1e66d11d47e1042c2195211f435396b8 100644 (file)
@@ -31,6 +31,8 @@
 namespace po = boost::program_options;
 using namespace std;
 
+static coll_t META_COLL("meta");
+
 enum {
     TYPE_NONE = 0,
     TYPE_PG_BEGIN,
@@ -491,10 +493,10 @@ int initiate_new_remove_pg(ObjectStore *store, spg_t r_pgid,
     return ENOENT;
   }
 
-  cout << "remove " << coll_t::META_COLL << " " << log_oid.oid << std::endl;
-  rmt->remove(coll_t::META_COLL, log_oid);
-  cout << "remove " << coll_t::META_COLL << " " << biginfo_oid.oid << std::endl;
-  rmt->remove(coll_t::META_COLL, biginfo_oid);
+  cout << "remove " << META_COLL << " " << log_oid.oid << std::endl;
+  rmt->remove(META_COLL, log_oid);
+  cout << "remove " << META_COLL << " " << biginfo_oid.oid << std::endl;
+  rmt->remove(META_COLL, biginfo_oid);
 
   store->apply_transaction(*rmt);
 
@@ -1250,7 +1252,7 @@ int main(int argc, char **argv)
   bufferlist bl;
   OSDSuperblock superblock;
   bufferlist::iterator p;
-  r = fs->read(coll_t::META_COLL, OSD_SUPERBLOCK_POBJECT, 0, 0, bl);
+  r = fs->read(META_COLL, OSD_SUPERBLOCK_POBJECT, 0, 0, bl);
   if (r < 0) {
     cout << "Failure to read OSD superblock error= " << r << std::endl;
     goto out;