]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: use simpler map<> to track (onode, zone) -> offset
authorSage Weil <sage@newdream.net>
Mon, 18 Oct 2021 19:28:42 +0000 (14:28 -0500)
committerSage Weil <sage@newdream.net>
Fri, 29 Oct 2021 13:56:43 +0000 (09:56 -0400)
Signed-off-by: Sage Weil <sage@newdream.net>
src/os/bluestore/BlueStore.cc
src/os/bluestore/BlueStore.h

index a6293e3abcd58bdec9e8f722ff6ce9ffcb2e01b8..22f2fe32ef3aee70fe89d1c74e16eb9e5c9db19a 100644 (file)
@@ -12309,26 +12309,22 @@ void BlueStore::_txc_finalize_kv(TransContext *txc, KeyValueDB::Transaction t)
 #ifdef HAVE_LIBZBD
   if (bdev->is_smr()) {
     for (auto& i : txc->old_zone_offset_refs) {
-      for (auto& j : i.second) {
-       dout(20) << __func__ << " rm ref zone 0x" << std::hex << j.first
-                << " offset 0x" << j.second << std::dec
-                << " -> " << i.first->oid << dendl;
-       string key;
-       get_zone_offset_object_key(j.first, j.second, i.first->oid, &key);
-       txc->t->rmkey(PREFIX_ZONED_CL_INFO, key);
-      }
+      dout(20) << __func__ << " rm ref zone 0x" << std::hex << i.first.second
+              << " offset 0x" << i.second << std::dec
+              << " -> " << i.first.first->oid << dendl;
+      string key;
+      get_zone_offset_object_key(i.first.second, i.second, i.first.first->oid, &key);
+      txc->t->rmkey(PREFIX_ZONED_CL_INFO, key);
     }
     for (auto& i : txc->new_zone_offset_refs) {
-      for (auto& j : i.second) {
-       // (zone, offset) -> oid
-       dout(20) << __func__ << " add ref zone 0x" << std::hex << j.first
-                << " offset 0x" << j.second << std::dec
-                << " -> " << i.first->oid << dendl;
-       string key;
-       get_zone_offset_object_key(j.first, j.second, i.first->oid, &key);
-       bufferlist v;
-       txc->t->set(PREFIX_ZONED_CL_INFO, key, v);
-      }
+      // (zone, offset) -> oid
+      dout(20) << __func__ << " add ref zone 0x" << std::hex << i.first.second
+              << " offset 0x" << i.second << std::dec
+              << " -> " << i.first.first->oid << dendl;
+      string key;
+      get_zone_offset_object_key(i.first.second, i.second, i.first.first->oid, &key);
+      bufferlist v;
+      txc->t->set(PREFIX_ZONED_CL_INFO, key, v);
     }
   }
 #endif
index f3d16d1ace374402e67459e0d8e5fa27cf9d5455..0a157edce1160e5519dc531297f31e88cbdb62bb 100644 (file)
@@ -1608,8 +1608,8 @@ public:
     // to that zone do not generate additional refs.  This is a bit imprecise but
     // is sufficient to generate reasonably sequential reads when doing zone
     // cleaning with less metadata than a ref for every extent.
-    std::map<OnodeRef, std::map<uint32_t, uint64_t>> new_zone_offset_refs;
-    std::map<OnodeRef, std::map<uint32_t, uint64_t>> old_zone_offset_refs;
+    std::map<std::pair<OnodeRef, uint32_t>, uint64_t> new_zone_offset_refs;
+    std::map<std::pair<OnodeRef, uint32_t>, uint64_t> old_zone_offset_refs;
 #endif
     
     std::set<SharedBlobRef> shared_blobs;  ///< these need to be updated/written
@@ -1687,10 +1687,10 @@ public:
 #ifdef HAVE_LIBZBD
     void note_write_zone_offset(OnodeRef& o, uint32_t zone, uint64_t offset) {
       o->onode.zone_offset_refs[zone] = offset;
-      new_zone_offset_refs[o][zone] = offset;
+      new_zone_offset_refs[std::make_pair(o, zone)] = offset;
     }
     void note_release_zone_offset(OnodeRef& o, uint32_t zone, uint64_t offset) {
-      old_zone_offset_refs[o][zone] = offset;
+      old_zone_offset_refs[std::make_pair(o, zone)] = offset;
       o->onode.zone_offset_refs.erase(zone);
     }
 #endif