write
BlueStore::queue_transactions => BlueStore::_txc_add_transaction => BlueStore::_write => BlueStore::_do_write_data
=>
if (head) _do_write_small(txc, c, o, head_offset, head_length, p, wctx);
_do_write_big(txc, c, o, middle_offset, middle_length, p, wctx);
if (tail) _do_write_small(txc, c, o, tail_offset, tail_length, p, wctx);
_txc_add_transaction 分析
1、查找CollectionRef
CollectionRef &c = cvec[op->cid];
2、循环列表,获取op
for (int pos = 0; i.have_op(); ++pos) {
Transaction::Op *op = i.decode_op();
...
}
3、获取onnode,不存在就创建一个
OnodeRef &o = ovec[op->oid];
if (!o) {
ghobject_t oid = i.get_oid(op->oid);
o = c->get_onode(oid, create, op->op == Transaction::OP_CREATE);
}
4、分配 WriteContext
int BlueStore::_do_write {
WriteContext wctx;
...
}
5、
BlueStore::_do_write_small