_txc_add_transaction(txc, &(*p));
}
+ // delayed csum calculation?
+ for (auto& d : txc->deferred_csum) {
+ bluestore_blob_t *b = d.onode->get_blob_ptr(d.blob);
+ dout(20) << __func__ << " deferred csum calc blob " << d.blob
+ << " b_off 0x" << std::hex << d.b_off << std::dec
+ << " on " << d.onode->oid << dendl;
+ checksummer->calculate(b->csum_type, b->get_csum_block_size(),
+ d.b_off, d.data.length(), d.data, &b->csum_data);
+ }
+
_txc_write_nodes(txc, txc->t);
// journal wal items
op->extents.emplace_back(bluestore_pextent_t(offset, length));
});
if (b->csum_type) {
- checksummer->calculate(b->csum_type, b->get_csum_block_size(),
- b_off, padded.length(), padded, &b->csum_data);
+ txc->add_deferred_csum(o, blob, b_off, padded);
}
op->data.claim(padded);
dout(20) << __func__ << " wal write 0x" << std::hex << b_off << "~0x"
uint64_t seq = 0;
utime_t start;
+ struct DeferredCsum {
+ OnodeRef onode;
+ int64_t blob;
+ uint64_t b_off;
+ bufferlist data;
+
+ DeferredCsum(OnodeRef& o, int64_t b, uint64_t bo, bufferlist& bl)
+ : onode(o), blob(b), b_off(bo), data(bl) {}
+ };
+
+ list<DeferredCsum> deferred_csum;
+
explicit TransContext(OpSequencer *o)
: state(STATE_PREPARE),
osr(o),
void write_bnode(BnodeRef &e) {
bnodes.insert(e);
}
+
+ void add_deferred_csum(OnodeRef& o, int64_t b, uint64_t bo, bufferlist& bl) {
+ deferred_csum.emplace_back(TransContext::DeferredCsum(o, b, bo, bl));
+ }
};
class OpSequencer : public Sequencer_impl {