From: Sage Weil Date: Mon, 18 Oct 2021 19:28:42 +0000 (-0500) Subject: os/bluestore: use simpler map<> to track (onode, zone) -> offset X-Git-Tag: v17.1.0~535^2~5 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=35b3ecb1ad3d07be6bb33114ce21ada600cf9808;p=ceph.git os/bluestore: use simpler map<> to track (onode, zone) -> offset Signed-off-by: Sage Weil --- diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index a6293e3abcd..22f2fe32ef3 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -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 diff --git a/src/os/bluestore/BlueStore.h b/src/os/bluestore/BlueStore.h index f3d16d1ace3..0a157edce11 100644 --- a/src/os/bluestore/BlueStore.h +++ b/src/os/bluestore/BlueStore.h @@ -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> new_zone_offset_refs; - std::map> old_zone_offset_refs; + std::map, uint64_t> new_zone_offset_refs; + std::map, uint64_t> old_zone_offset_refs; #endif std::set 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