From ad7487d6419a217d0339ed9e174331beb4c3db8f Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 27 Sep 2016 17:07:16 -0400 Subject: [PATCH] os/bluestore: remove deferred_csum machinery When we added this way back in d4f4fa0312d943dd0ce3c27f5fc56c7a753bb471, we did not have our own buffer cache, and were relying on the cache at the BlockDevice layer. In that case, we would have the problem of a partial wal overwrite followed by another partial write that needed to read the rest of the chunk. However, now we have our own cache, and any data we write in the _do_write_small() wal path will go into the cache, which means we will never read the old data off of disk and need the old csum values. Remove this now-unnecessary kludge! Signed-off-by: Sage Weil --- src/os/bluestore/BlueStore.cc | 18 +----------------- src/os/bluestore/BlueStore.h | 6 ------ 2 files changed, 1 insertion(+), 23 deletions(-) diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index 923bda285c263..505a6ccf7171e 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -6488,14 +6488,6 @@ int BlueStore::queue_transactions( _txc_add_transaction(txc, &(*p)); } - // delayed csum calculation? - for (auto& d : txc->deferred_csum) { - dout(20) << __func__ << " deferred csum calc blob " << d.blob - << " b_off 0x" << std::hex << d.b_off << std::dec - << dendl; - d.blob->dirty_blob().calc_csum(d.b_off, d.data); - } - _txc_write_nodes(txc, txc->t); // journal wal items if (txc->wal_txn) { @@ -7203,7 +7195,7 @@ void BlueStore::_do_write_small( }); assert(r == 0); if (b->get_blob().csum_type) { - txc->add_deferred_csum(b, b_off, padded); + b->dirty_blob().calc_csum(b_off, padded); } op->data.claim(padded); dout(20) << __func__ << " wal write 0x" << std::hex << b_off << "~" @@ -8145,14 +8137,6 @@ int BlueStore::_do_clone_range( } } txc->write_shared_blob(e.blob->shared_blob); - // ugly: duplicate deferred csum work, if any. - for (auto& dc : txc->deferred_csum) { - if (dc.blob == e.blob) { - dout(20) << __func__ << " duplicating deferred csum for blob " - << *e.blob << dendl; - txc->add_deferred_csum(cb, dc.b_off, dc.data); - } - } dout(20) << __func__ << " new " << *cb << dendl; } // dup extent diff --git a/src/os/bluestore/BlueStore.h b/src/os/bluestore/BlueStore.h index 362e0316cf9f1..507da0fdc9e21 100644 --- a/src/os/bluestore/BlueStore.h +++ b/src/os/bluestore/BlueStore.h @@ -1089,8 +1089,6 @@ public: : blob(b), b_off(bo), data(bl) {} }; - list deferred_csum; - explicit TransContext(OpSequencer *o) : state(STATE_PREPARE), osr(o), @@ -1115,10 +1113,6 @@ public: void write_shared_blob(SharedBlobRef &sb) { shared_blobs.insert(sb); } - - void add_deferred_csum(BlobRef& b, uint64_t bo, bufferlist& bl) { - deferred_csum.emplace_back(TransContext::DeferredCsum(b, bo, bl)); - } }; class OpSequencer : public Sequencer_impl { -- 2.39.5