crush_rule_add_step(rule, CRUSH_RULE_EMIT, 0, 0);
crush_add_rule(crush.map, CRUSH_REP_RULE(i), rule);
}
- /*
+
// raid
for (int i=g_conf.osd_min_raid_width; i <= g_conf.osd_max_raid_width; i++) {
- int r = CRUSH_RAID_RULE(i);
if (ndom >= i) {
- crush.rules[r].steps.push_back(RuleStep(CRUSH_RULE_TAKE, nroot));
- crush.rules[r].steps.push_back(RuleStep(CRUSH_RULE_CHOOSE_INDEP, i, 1));
- crush.rules[r].steps.push_back(RuleStep(CRUSH_RULE_CHOOSE_INDEP, 1, 0));
- crush.rules[r].steps.push_back(RuleStep(CRUSH_RULE_EMIT));
+ crush_rule *rule = crush_make_rule();
+ crush_rule_add_step(rule, CRUSH_RULE_TAKE, rootid, 0);
+ crush_rule_add_step(rule, CRUSH_RULE_CHOOSE_INDEP, i, 1);
+ crush_rule_add_step(rule, CRUSH_RULE_CHOOSE_INDEP, 1, 0);
+ crush_rule_add_step(rule, CRUSH_RULE_EMIT, 0, 0);
+ crush_add_rule(crush.map, CRUSH_RAID_RULE(i), rule);
} else {
- crush.rules[r].steps.push_back(RuleStep(CRUSH_RULE_TAKE, nroot));
- crush.rules[r].steps.push_back(RuleStep(CRUSH_RULE_CHOOSE_INDEP, i, 0));
- crush.rules[r].steps.push_back(RuleStep(CRUSH_RULE_EMIT));
+ crush_rule *rule = crush_make_rule();
+ crush_rule_add_step(rule, CRUSH_RULE_TAKE, rootid, 0);
+ crush_rule_add_step(rule, CRUSH_RULE_CHOOSE_INDEP, i, 0);
+ crush_rule_add_step(rule, CRUSH_RULE_EMIT, 0, 0);
+ crush_add_rule(crush.map, CRUSH_RAID_RULE(i), rule);
}
}
- */
} else {
// one bucket
crush_rule_add_step(rule, CRUSH_RULE_EMIT, 0, 0);
crush_add_rule(crush.map, CRUSH_REP_RULE(i), rule);
}
- /*
- // raid
+ // raid4
for (int i=g_conf.osd_min_raid_width; i <= g_conf.osd_max_raid_width; i++) {
- int r = CRUSH_RAID_RULE(i);
- crush.rules[r].steps.push_back(RuleStep(CRUSH_RULE_TAKE, root));
- crush.rules[r].steps.push_back(RuleStep(CRUSH_RULE_CHOOSE_INDEP, i, 0));
- crush.rules[r].steps.push_back(RuleStep(CRUSH_RULE_EMIT));
+ crush_rule *rule = crush_make_rule();
+ crush_rule_add_step(rule, CRUSH_RULE_TAKE, root, 0);
+ crush_rule_add_step(rule, CRUSH_RULE_CHOOSE_INDEP, i, 0);
+ crush_rule_add_step(rule, CRUSH_RULE_EMIT, 0, 0);
+ crush_add_rule(crush.map, CRUSH_RAID_RULE(i), rule);
}
- */
}
crush.finalize();
#include "ReplicatedPG.h"
-//#include "RAID4PG.h"
+#include "RAID4PG.h"
#include "Ager.h"
PG *pg;
if (pgid.is_rep())
pg = new ReplicatedPG(this, pgid);
- //else if (pgid.is_raid4())
- //pg = new RAID4PG(this, pgid);
+ else if (pgid.is_raid4())
+ pg = new RAID4PG(this, pgid);
else
assert(0);
}
// raided
- /*
for (int size = minraid; size <= maxraid; size++) {
for (ps_t ps = 0; ps < numps; ++ps)
try_create_pg(pg_t(pg_t::TYPE_RAID4, size, ps, -1), t);
for (ps_t ps = 0; ps < numlps; ++ps)
try_create_pg(pg_t(pg_t::TYPE_RAID4, size, ps, whoami), t);
}
- */
+
dout(1) << "mkfs done, created " << pg_map.size() << " pgs" << dendl;
} else {
void op_pull(MOSDOp *op);
+ void clean_up_local(ObjectStore::Transaction& t);
+ void cancel_recovery();
+ bool do_recovery();
+ void purge_strays();
+
public:
RAID4PG(OSD *o, pg_t p) : PG(o,p) { }
+ bool preprocess_op(MOSDOp *op, utime_t now);
void do_op(MOSDOp *op);
void do_op_reply(MOSDOpReply *r);
bool is_missing_object(object_t oid);
void wait_for_missing_object(object_t oid, MOSDOp *op);
- void note_failed_osd(int osd);
-
+ void note_failed_osd(int o);
void on_acker_change();
void on_role_change();
-
- void clean_up_local(ObjectStore::Transaction& t);
-
- void cancel_recovery();
- bool do_recovery();
-
- void purge_strays();
-
-
+ void on_change();
};