]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: add coll_t::is_pg() method
authorSage Weil <sage@newdream.net>
Sat, 25 Sep 2010 03:10:08 +0000 (20:10 -0700)
committerSage Weil <sage@newdream.net>
Sat, 25 Sep 2010 03:10:08 +0000 (20:10 -0700)
This makes the interface a bit more adaptable for a situation where it has
a simple string representation instead of the strict structure it has now.
Eventually this function can simply attempt a pg_t parse.

Signed-off-by: Sage Weil <sage@newdream.net>
src/osd/OSD.cc
src/osd/osd_types.h

index ff5fa37f0af6c6e36a2a9a3295a19104b9b8afab..0c6371b878755282db74e33801f13c8a64c15a4e 100644 (file)
@@ -966,11 +966,12 @@ void OSD::load_pgs()
   for (vector<coll_t>::iterator it = ls.begin();
        it != ls.end();
        it++) {
-    if (*it == meta_coll)
+    pg_t pgid;
+    snapid_t snap;
+    if (!it->is_pg(pgid, snap))
       continue;
-    if (it->snap != CEPH_NOSNAP)
+    if (snap != CEPH_NOSNAP)
       continue;
-    pg_t pgid = it->pgid;
     PG *pg = _open_lock_pg(pgid);
 
     // read pg state, log
index d847b73d07fbb08b6f085ce8cc782e6f1657f2a4..4eedb91bd82e3abf27cea641edcdcb364778efdc 100644 (file)
@@ -248,6 +248,15 @@ struct coll_t {
     return coll_t(TYPE_PG, p, s);
   }
 
+  bool is_pg(pg_t& p, snapid_t& sn) {
+    if (type == TYPE_PG) {
+      p = pgid;
+      sn = snap;
+      return true;
+    }
+    return false;
+  }
+
   ostream& print(ostream& out) const {
     switch (type) {
     case TYPE_META: