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>
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
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: