]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: Cleanup. Move ZBD related functions into one place and add zoned 37951/head
authorAbutalib Aghayev <agayev@psu.edu>
Wed, 4 Nov 2020 18:57:05 +0000 (13:57 -0500)
committerAbutalib Aghayev <agayev@psu.edu>
Wed, 4 Nov 2020 18:57:05 +0000 (13:57 -0500)
prefix to all of them.

Signed-off-by: Abutalib Aghayev <agayev@psu.edu>
src/os/bluestore/BlueStore.cc
src/os/bluestore/BlueStore.h

index b75ee5972c5a2d86cc59501e85c45f1ccd628df6..21f0325eeb48872d0e137d7f2f869d7c48d50679 100644 (file)
@@ -11152,7 +11152,7 @@ void BlueStore::BSPerfTracker::update_from_perfcounters(
 // and insert a new tuple corresponding to the new location of the object.  The
 // cleaner can now identify live objects within the zone <zone_num> by
 // enumerating all the keys starting with <zone_num> prefix.
-void BlueStore::zoned_update_cleaning_metadata(TransContext *txc) {
+void BlueStore::_zoned_update_cleaning_metadata(TransContext *txc) {
   for (const auto &[o, offsets] : txc->zoned_onode_to_offset_map) {
     std::string key;
     get_object_key(cct, o->oid, &key);
@@ -11160,15 +11160,15 @@ void BlueStore::zoned_update_cleaning_metadata(TransContext *txc) {
       if (offset > 0) {
        bufferlist offset_bl;
        encode(offset, offset_bl);
-        txc->t->set(zoned_get_prefix(offset), key, offset_bl);
+        txc->t->set(_zoned_get_prefix(offset), key, offset_bl);
       } else {
-        txc->t->rmkey(zoned_get_prefix(-offset), key);
+        txc->t->rmkey(_zoned_get_prefix(-offset), key);
       }
     }
   }
 }
 
-std::string BlueStore::zoned_get_prefix(uint64_t offset) {
+std::string BlueStore::_zoned_get_prefix(uint64_t offset) {
   uint64_t zone_num = offset / bdev->get_zone_size();
   std::string zone_key;
   _key_encode_u64(zone_num, &zone_key);
@@ -11262,7 +11262,7 @@ void BlueStore::_txc_finalize_kv(TransContext *txc, KeyValueDB::Transaction t)
   }
 
   if (bdev->is_smr()) {
-    zoned_update_cleaning_metadata(txc);
+    _zoned_update_cleaning_metadata(txc);
   }
 
   _txc_update_store_statfs(txc);
index fdde77dabb7fe79cab767d9856903774abff1694..4d8a669e0e98ffb7aa5cb2622c817a1df985b4a9 100644 (file)
@@ -1153,7 +1153,7 @@ public:
     // are laid out contiguously on disk, which is not the case in general.
     // Also, it should always be called after calling extent_map.fault_range(),
     // so that the extent map is loaded.
-    int64_t get_ondisk_starting_offset() const {
+    int64_t zoned_get_ondisk_starting_offset() const {
       return extent_map.extent_map.begin()->blob->
          get_blob().calc_offset(0, nullptr);
     }
@@ -1672,12 +1672,12 @@ public:
 
     void zoned_note_new_object(OnodeRef &o) {
       auto [_, ok] = zoned_onode_to_offset_map.emplace(
-         std::pair<OnodeRef, std::vector<int64_t>>(o, {o->get_ondisk_starting_offset()}));
+         std::pair<OnodeRef, std::vector<int64_t>>(o, {o->zoned_get_ondisk_starting_offset()}));
       ceph_assert(ok);
     }
 
     void zoned_note_updated_object(OnodeRef &o, int64_t prev_offset) {
-      int64_t new_offset = o->get_ondisk_starting_offset();
+      int64_t new_offset = o->zoned_get_ondisk_starting_offset();
       auto [it, ok] = zoned_onode_to_offset_map.emplace(
          std::pair<OnodeRef, std::vector<int64_t>>(o, {-prev_offset, new_offset}));
       if (!ok) {
@@ -2393,6 +2393,8 @@ private:
   // Functions related to zoned storage.
   uint64_t _zoned_piggyback_device_parameters_onto(uint64_t min_alloc_size);
   int _zoned_check_config_settings();
+  void _zoned_update_cleaning_metadata(TransContext *txc);
+  std::string _zoned_get_prefix(uint64_t offset);
 
 public:
   utime_t get_deferred_last_submitted() {
@@ -3432,10 +3434,6 @@ private:
 
   void _fsck_check_objects(FSCKDepth depth,
     FSCK_ObjectCtx& ctx);
-
-  // Zoned storage related stuff
-  void zoned_update_cleaning_metadata(TransContext *txc);
-  std::string zoned_get_prefix(uint64_t offset);
 };
 
 inline std::ostream& operator<<(std::ostream& out, const BlueStore::volatile_statfs& s) {