From: Adam Kupczyk Date: Wed, 23 Nov 2022 11:49:47 +0000 (+0000) Subject: os/bluestore: Refactor finish_write X-Git-Tag: v19.0.0~486^2~28 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=8fe776a30cd27fa4852f4480a1f77ad7c81dcfff;p=ceph.git os/bluestore: Refactor finish_write Move finish_write from SharedBlob to Blob. Signed-off-by: Adam Kupczyk --- diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index a43bcc2faeb61..9f3e80d73c65c 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -2176,23 +2176,6 @@ void BlueStore::SharedBlob::put_ref(uint64_t offset, uint32_t length, unshare && !*unshare ? unshare : nullptr); } -void BlueStore::SharedBlob::finish_write(uint64_t seq) -{ - while (true) { - BufferCacheShard *cache = coll->cache; - std::lock_guard l(cache->lock); - if (coll->cache != cache) { - dout(20) << __func__ - << " raced with sb cache update, was " << cache - << ", now " << coll->cache << ", retrying" - << dendl; - continue; - } - bc._finish_write(cache, seq); - break; - } -} - // SharedBlobSet #undef dout_prefix @@ -2404,6 +2387,24 @@ bool BlueStore::Blob::can_reuse_blob(uint32_t min_alloc_size, return true; } +void BlueStore::Blob::finish_write(uint64_t seq) +{ + while (true) { + auto coll = shared_blob->coll; + BufferCacheShard *cache = coll->cache; + std::lock_guard l(cache->lock); + if (coll->cache != cache) { + dout(20) << __func__ + << " raced with sb cache update, was " << cache + << ", now " << coll->cache << ", retrying" + << dendl; + continue; + } + shared_blob->bc._finish_write(cache, seq); + break; + } +} + void BlueStore::Blob::split(Collection *coll, uint32_t blob_offset, Blob *r) { dout(10) << __func__ << " 0x" << std::hex << blob_offset << std::dec @@ -13008,7 +13009,7 @@ void BlueStore::_txc_finish(TransContext *txc) ceph_assert(txc->get_state() == TransContext::STATE_FINISHING); for (auto& sb : txc->blobs_written) { - sb->shared_blob->finish_write(txc->seq); + sb->finish_write(txc->seq); } txc->blobs_written.clear(); diff --git a/src/os/bluestore/BlueStore.h b/src/os/bluestore/BlueStore.h index ef54b780ee4d8..19a3416cdbb03 100644 --- a/src/os/bluestore/BlueStore.h +++ b/src/os/bluestore/BlueStore.h @@ -526,8 +526,6 @@ public: void put_ref(uint64_t offset, uint32_t length, PExtentVector *r, bool *unshare); - void finish_write(uint64_t seq); - friend bool operator==(const SharedBlob &l, const SharedBlob &r) { return l.get_sbid() == r.get_sbid(); } @@ -678,7 +676,8 @@ public: /// put logical references, and get back any released extents bool put_ref(Collection *coll, uint32_t offset, uint32_t length, PExtentVector *r); - + // update caches to reflect content up to seq + void finish_write(uint64_t seq); /// split the blob void split(Collection *coll, uint32_t blob_offset, Blob *o);