#define CEPH_MOSDPGCREATE_H
#include "msg/Message.h"
+#include "osd/osd_types.h"
/*
* PGCreate - instruct an OSD to create a pg, if it doesn't already exist
struct MOSDPGCreate : public Message {
version_t epoch;
- struct create_rec {
- epoch_t created; // epoch pg created
- pg_t parent; // split from parent (if != pg_t())
- __s32 split_bits;
-
- void encode(bufferlist &bl) const {
- ::encode(created, bl);
- ::encode(parent, bl);
- ::encode(split_bits, bl);
- }
- void decode(bufferlist::iterator &bl) {
- ::decode(created, bl);
- ::decode(parent, bl);
- ::decode(split_bits, bl);
- }
- };
- WRITE_CLASS_ENCODER(create_rec)
-
- map<pg_t,create_rec> mkpg;
+ map<pg_t,pg_create_t> mkpg;
MOSDPGCreate() : Message(MSG_OSD_PG_CREATE) {}
MOSDPGCreate(epoch_t e) :
void print(ostream& out) const {
out << "osd pg create(";
- for (map<pg_t,create_rec>::const_iterator i = mkpg.begin();
+ for (map<pg_t,pg_create_t>::const_iterator i = mkpg.begin();
i != mkpg.end();
++i) {
out << "pg" << i->first << "," << i->second.created << "; ";
}
};
-WRITE_CLASS_ENCODER(MOSDPGCreate::create_rec)
-
#endif
int num_created = 0;
- for (map<pg_t,MOSDPGCreate::create_rec>::iterator p = m->mkpg.begin();
+ for (map<pg_t,pg_create_t>::iterator p = m->mkpg.begin();
p != m->mkpg.end();
p++) {
pg_t pgid = p->first;
missing.erase(m);
}
+// -- pg_create_t --
+
+void pg_create_t::encode(bufferlist &bl) const
+{
+ ::encode(created, bl);
+ ::encode(parent, bl);
+ ::encode(split_bits, bl);
+}
+
+void pg_create_t::decode(bufferlist::iterator &bl)
+{
+ ::decode(created, bl);
+ ::decode(parent, bl);
+ ::decode(split_bits, bl);
+}
+
+void pg_create_t::dump(Formatter *f) const
+{
+ f->dump_unsigned("created", created);
+ f->dump_stream("parent") << parent;
+ f->dump_int("split_bits", split_bits);
+}
+
+void pg_create_t::generate_test_instances(list<pg_create_t*>& o)
+{
+ o.push_back(new pg_create_t);
+ o.push_back(new pg_create_t(1, 2));
+ o.back()->parent = pg_t(1, 2, 3);
+}
+
// -- OSDSuperblock --
void OSDSuperblock::encode(bufferlist &bl) const
WRITE_CLASS_ENCODER(pg_ls_response_t)
+/**
+ * pg creation info
+ */
+struct pg_create_t {
+ epoch_t created; // epoch pg created
+ pg_t parent; // split from parent (if != pg_t())
+ __s32 split_bits;
+
+ pg_create_t(unsigned c=0, int s=0) : created(c), split_bits(s) {}
+
+ void encode(bufferlist &bl) const;
+ void decode(bufferlist::iterator &bl);
+ void dump(Formatter *f) const;
+ static void generate_test_instances(list<pg_create_t*>& o);
+};
+WRITE_CLASS_ENCODER(pg_create_t)
+
// -----------------------------------------
struct osd_peer_stat_t {
TYPE(pg_missing_t::item)
TYPE(pg_missing_t)
TYPE(pg_ls_response_t)
+TYPE(pg_create_t)
TYPE(watch_info_t)
TYPE(object_info_t)
TYPE(SnapSet)