当前位置 : 主页 > 编程语言 > c语言 >

bluestore读写分析

来源:互联网 收集:自由互联 发布时间:2023-08-28
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_

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







上一篇:C语言:数据类型之整形(一)
下一篇:没有了
网友评论