MCPcopy Create free account
hub / github.com/ceph/ceph / _commit_ops

Method _commit_ops

src/mds/PurgeQueue.cc:554–629  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

552};
553
554void PurgeQueue::_commit_ops(int r, const std::vector<PurgeItemCommitOp>& ops_vec, uint64_t expire_to)
555{
556 if (r < 0) {
557 derr << " r = " << r << dendl;
558 return;
559 }
560
561 SnapContext nullsnapc;
562 C_GatherBuilder gather(cct);
563
564 for (auto &op : ops_vec) {
565 dout(10) << op.item.get_type_str() << dendl;
566 if (op.type == PurgeItemCommitOp::PURGE_OP_RANGE) {
567 uint64_t first_obj = 0, num_obj = 0;
568 uint64_t num = Striper::get_num_objects(op.item.layout, op.item.size);
569 num_obj = num;
570
571 if (op.item.action == PurgeItem::TRUNCATE_FILE) {
572 first_obj = 1;
573 if (num > 1)
574 num_obj = num - 1;
575 else
576 continue;
577 }
578
579 filer.purge_range(op.item.ino, &op.item.layout, op.item.snapc,
580 first_obj, num_obj, ceph::real_clock::now(), op.flags,
581 gather.new_sub());
582 } else if (op.type == PurgeItemCommitOp::PURGE_OP_REMOVE) {
583 if (op.item.action == PurgeItem::PURGE_DIR) {
584 objecter->remove(op.oid, op.oloc, nullsnapc,
585 ceph::real_clock::now(), op.flags,
586 gather.new_sub());
587 } else {
588 objecter->remove(op.oid, op.oloc, op.item.snapc,
589 ceph::real_clock::now(), op.flags,
590 gather.new_sub());
591 }
592 } else if (op.type == PurgeItemCommitOp::PURGE_OP_ZERO) {
593 filer.zero(op.item.ino, &op.item.layout, op.item.snapc,
594 0, op.item.layout.object_size, ceph::real_clock::now(), 0, true,
595 gather.new_sub());
596 } else {
597 derr << "Invalid purge op: " << op.type << dendl;
598 ceph_abort();
599 }
600 }
601
602 ceph_assert(gather.has_subs());
603
604 gather.set_finisher(new C_OnFinisher(
605 new LambdaContext([this, expire_to](int r) {
606 std::lock_guard l(lock);
607
608 if (r == -EBLOCKLISTED) {
609 finisher.queue(on_error, r);
610 on_error = nullptr;
611 return;

Callers 1

finishMethod · 0.45

Calls 13

purge_rangeMethod · 0.80
has_subsMethod · 0.80
write_head_neededMethod · 0.80
nowFunction · 0.50
get_type_strMethod · 0.45
new_subMethod · 0.45
removeMethod · 0.45
zeroMethod · 0.45
set_finisherMethod · 0.45
queueMethod · 0.45
emptyMethod · 0.45
write_headMethod · 0.45

Tested by

no test coverage detected