]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: Refactor finish_write
authorAdam Kupczyk <akupczyk@redhat.com>
Wed, 23 Nov 2022 11:49:47 +0000 (11:49 +0000)
committerAdam Kupczyk <akupczyk@ibm.com>
Thu, 11 May 2023 06:52:45 +0000 (06:52 +0000)
Move finish_write from SharedBlob to Blob.

Signed-off-by: Adam Kupczyk <akupczyk@redhat.com>
src/os/bluestore/BlueStore.cc
src/os/bluestore/BlueStore.h

index a43bcc2faeb6160a58f659de953029a215df686f..9f3e80d73c65cc8ef162bf4618ae17f967a88872 100644 (file)
@@ -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();
 
index ef54b780ee4d8071916c849e2673158e43902329..19a3416cdbb03c1ecf447ead4e959659393325c4 100644 (file)
@@ -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);