]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/SnapMapper: Add logs to ctor and update_bits()
authorMatan Breizman <mbreizma@redhat.com>
Tue, 14 Jan 2025 13:26:41 +0000 (13:26 +0000)
committerMatan Breizman <mbreizma@redhat.com>
Mon, 20 Jan 2025 16:07:50 +0000 (16:07 +0000)
Signed-off-by: Matan Breizman <mbreizma@redhat.com>
src/osd/SnapMapper.cc
src/osd/SnapMapper.h

index 76f02c51522018b3fe659f57cb770eee5a3cfddd..8395d2c913bbda4548aea93f7893225df4a88c66 100644 (file)
@@ -205,6 +205,20 @@ int OSDriver::get_next_or_current(
 }
 #endif // WITH_SEASTAR
 
+  SnapMapper::SnapMapper(
+    CephContext* cct,
+    MapCacher::StoreDriver<std::string, ceph::buffer::list> *driver,
+    uint32_t match,  ///< [in] pgid
+    uint32_t bits,   ///< [in] current split bits
+    int64_t pool,    ///< [in] pool
+    shard_id_t shard ///< [in] shard
+    )
+    : cct(cct), backend(driver), mask_bits(bits), match(match), pool(pool),
+      shard(shard), shard_prefix(make_shard_prefix(shard)) {
+    dout(10) << *this << __func__ << dendl;
+    update_bits(mask_bits);
+  }
+
 string SnapMapper::get_prefix(int64_t pool, snapid_t snap)
 {
   static_assert(sizeof(pool) == 8, "assumed by the formatting code");
@@ -483,6 +497,24 @@ void SnapMapper::set_snaps(
   backend.set_keys(to_set, t);
 }
 
+void SnapMapper::update_bits(
+  uint32_t new_bits)  ///< [in] new split bits
+{
+    dout(20) << *this << __func__ << " new_bits: " << new_bits << dendl;
+    mask_bits = new_bits;
+    std::set<std::string> _prefixes = hobject_t::get_prefixes(
+      mask_bits,
+      match,
+      pool);
+    prefixes.clear();
+    for (auto i = _prefixes.begin(); i != _prefixes.end(); ++i) {
+      prefixes.insert(shard_prefix + *i);
+    }
+    dout(20) << *this <<__func__ << " prefix updated" << dendl;
+
+    reset_prefix_itr(CEPH_NOSNAP, "update_bits");
+  }
+
 int SnapMapper::update_snaps(
   const hobject_t &oid,
   const set<snapid_t> &new_snaps,
index 3dd4366c2d4180b55f39baf461d0d530fd44ad18..cdd3bb5e37357d07c71588429945e15bd1daf927 100644 (file)
@@ -331,28 +331,12 @@ private:
     uint32_t bits,   ///< [in] current split bits
     int64_t pool,    ///< [in] pool
     shard_id_t shard ///< [in] shard
-    )
-    : cct(cct), backend(driver), mask_bits(bits), match(match), pool(pool),
-      shard(shard), shard_prefix(make_shard_prefix(shard)) {
-    update_bits(mask_bits);
-  }
+    );
 
   /// Update bits in case of pg split or merge
   void update_bits(
     uint32_t new_bits  ///< [in] new split bits
-    ) {
-    mask_bits = new_bits;
-    std::set<std::string> _prefixes = hobject_t::get_prefixes(
-      mask_bits,
-      match,
-      pool);
-    prefixes.clear();
-    for (auto i = _prefixes.begin(); i != _prefixes.end(); ++i) {
-      prefixes.insert(shard_prefix + *i);
-    }
-
-    reset_prefix_itr(CEPH_NOSNAP, "update_bits");
-  }
+    );
 
   const std::set<std::string>::iterator get_prefix_itr() {
     return prefix_itr;