]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: rename BlueFS::get_total -> get_block_device_size()
authorIgor Fedotov <igor.fedotov@croit.io>
Thu, 20 Mar 2025 17:17:42 +0000 (20:17 +0300)
committerIgor Fedotov <igor.fedotov@croit.io>
Tue, 29 Apr 2025 09:27:40 +0000 (12:27 +0300)
Signed-off-by: Igor Fedotov <igor.fedotov@croit.io>
(cherry picked from commit d6a2d378707cd807444243029252e9d9bc0d08b6)

src/os/bluestore/BlueFS.cc
src/os/bluestore/BlueFS.h
src/os/bluestore/BlueStore.cc
src/test/objectstore/test_bluefs.cc

index 91e87e83397702f4748f4a4b8a129e75753d9300..9ed06c094500eaf925eb6ea5ed9f60584d458898 100644 (file)
@@ -125,7 +125,7 @@ private:
          f->open_object_section("dev");
          f->dump_string("device", bluefs->get_device_name(dev));
          ceph_assert(bluefs->alloc[dev]);
-          auto total = bluefs->get_total(dev);
+          auto total = bluefs->get_block_device_size(dev);
           auto free = bluefs->get_free(dev);
           auto used = bluefs->get_used(dev);
 
@@ -466,15 +466,15 @@ void BlueFS::_shutdown_logger()
 void BlueFS::_update_logger_stats()
 {
   if (alloc[BDEV_WAL]) {
-    logger->set(l_bluefs_wal_total_bytes, _get_total(BDEV_WAL));
+    logger->set(l_bluefs_wal_total_bytes, _get_block_device_size(BDEV_WAL));
     logger->set(l_bluefs_wal_used_bytes, _get_used(BDEV_WAL));
   }
   if (alloc[BDEV_DB]) {
-    logger->set(l_bluefs_db_total_bytes, _get_total(BDEV_DB));
+    logger->set(l_bluefs_db_total_bytes, _get_block_device_size(BDEV_DB));
     logger->set(l_bluefs_db_used_bytes, _get_used(BDEV_DB));
   }
   if (alloc[BDEV_SLOW]) {
-    logger->set(l_bluefs_slow_total_bytes, _get_total(BDEV_SLOW));
+    logger->set(l_bluefs_slow_total_bytes, _get_block_device_size(BDEV_SLOW));
     logger->set(l_bluefs_slow_used_bytes, _get_used(BDEV_SLOW));
   }
 }
@@ -573,7 +573,7 @@ uint64_t BlueFS::_get_used(unsigned id) const
   if (is_shared_alloc(id)) {
     used = shared_alloc->bluefs_used;
   } else {
-    used = _get_total(id) - alloc[id]->get_free();
+    used = _get_block_device_size(id) - alloc[id]->get_free();
   }
   return used;
 }
@@ -585,15 +585,15 @@ uint64_t BlueFS::get_used(unsigned id)
   return _get_used(id);
 }
 
-uint64_t BlueFS::_get_total(unsigned id) const
+uint64_t BlueFS::_get_block_device_size(unsigned id) const
 {
   ceph_assert(id < bdev.size());
   return bdev[id] ? bdev[id]->get_size() : 0;
 }
 
-uint64_t BlueFS::get_total(unsigned id)
+uint64_t BlueFS::get_block_device_size(unsigned id)
 {
-  return _get_total(id);
+  return _get_block_device_size(id);
 }
 
 uint64_t BlueFS::get_free(unsigned id)
@@ -644,7 +644,7 @@ void BlueFS::dump_block_extents(ostream& out)
     if (!bdev[i] || !alloc[i]) {
       continue;
     }
-    auto total = get_total(i) + block_reserved[i];
+    auto total = get_block_device_size(i);
     auto free = get_free(i);
 
     out << i << " : device size 0x" << std::hex << total
@@ -681,9 +681,9 @@ int BlueFS::mkfs(uuid_d osd_uuid, const bluefs_layout_t& layout)
   if (vselector == nullptr) {
     vselector.reset(
       new OriginalVolumeSelector(
-        _get_total(BlueFS::BDEV_WAL) * 95 / 100,
-        _get_total(BlueFS::BDEV_DB) * 95 / 100,
-        _get_total(BlueFS::BDEV_SLOW) * 95 / 100));
+        _get_block_device_size(BlueFS::BDEV_WAL) * 95 / 100,
+        _get_block_device_size(BlueFS::BDEV_DB) * 95 / 100,
+        _get_block_device_size(BlueFS::BDEV_SLOW) * 95 / 100));
   }
 
   _init_logger();
@@ -802,7 +802,7 @@ void BlueFS::_init_alloc()
         // isn't aligned with recommended alloc unit.
         // Final decision whether locked tail to be maintained is made after
         // BlueFS replay depending on existing allocations.
-        uint64_t size0 = _get_total(id);
+        uint64_t size0 = _get_block_device_size(id);
         uint64_t size = size0 - reserved;
         size = p2align(size, alloc_size[id]) + reserved;
         if (size < size0) {
@@ -825,7 +825,7 @@ void BlueFS::_init_alloc()
                                    bdev[id]->get_size(),
                                    bdev[id]->get_block_size(),
                                    name);
-      uint64_t free_len = locked_offs ? locked_offs : _get_total(id) - reserved;
+      uint64_t free_len = locked_offs ? locked_offs : _get_block_device_size(id) - reserved;
       alloc[id]->init_add_free(reserved, free_len);
     }
   }
@@ -1036,9 +1036,9 @@ int BlueFS::mount()
   if (vselector == nullptr) {
     vselector.reset(
       new OriginalVolumeSelector(
-        _get_total(BlueFS::BDEV_WAL) * 95 / 100,
-        _get_total(BlueFS::BDEV_DB) * 95 / 100,
-        _get_total(BlueFS::BDEV_SLOW) * 95 / 100));
+        _get_block_device_size(BlueFS::BDEV_WAL) * 95 / 100,
+        _get_block_device_size(BlueFS::BDEV_DB) * 95 / 100,
+        _get_block_device_size(BlueFS::BDEV_SLOW) * 95 / 100));
   }
 
   _init_alloc();
index 67d8cee95228f36e9ab5444cda839bb206e704ba..60c905f00cbeadba6d681c4dcce7732f7dcf3d8a 100644 (file)
@@ -557,7 +557,7 @@ private:
   void _pad_bl(ceph::buffer::list& bl, uint64_t pad_size = 0);
 
   uint64_t _get_used(unsigned id) const;
-  uint64_t _get_total(unsigned id) const;
+  uint64_t _get_block_device_size(unsigned id) const;
   uint64_t _get_minimal_reserved(unsigned id) const;
 
   FileRef _get_file(uint64_t ino);
@@ -712,7 +712,7 @@ public:
     const bluefs_layout_t& layout);
 
   uint64_t get_used();
-  uint64_t get_total(unsigned id);
+  uint64_t get_block_device_size(unsigned id);
   uint64_t get_free(unsigned id);
   uint64_t get_used(unsigned id);
   uint64_t get_full_reserved(unsigned id);
index 54fb0ef4ad6b6853651a21047e53b93ba1d81c14..01948bcd2370a3123e5fff3b742ded5a9d3611dd 100644 (file)
@@ -7627,16 +7627,16 @@ int BlueStore::_open_bluefs(bool create, bool read_only)
     }
     if (cct->_conf->bluestore_volume_selection_policy == "fit_to_fast") {
       vselector = new FitToFastVolumeSelector(
-        bluefs->get_total(BlueFS::BDEV_WAL) * 95 / 100,
-        bluefs->get_total(BlueFS::BDEV_DB) * 95 / 100,
-        bluefs->get_total(BlueFS::BDEV_SLOW) * 95 / 100);
+        bluefs->get_block_device_size(BlueFS::BDEV_WAL) * 95 / 100,
+        bluefs->get_block_device_size(BlueFS::BDEV_DB) * 95 / 100,
+        bluefs->get_block_device_size(BlueFS::BDEV_SLOW) * 95 / 100);
     } else {
       double reserved_factor = cct->_conf->bluestore_volume_selection_reserved_factor;
       vselector =
         new RocksDBBlueFSVolumeSelector(
-          bluefs->get_total(BlueFS::BDEV_WAL) * 95 / 100,
-          bluefs->get_total(BlueFS::BDEV_DB) * 95 / 100,
-          bluefs->get_total(BlueFS::BDEV_SLOW) * 95 / 100,
+          bluefs->get_block_device_size(BlueFS::BDEV_WAL) * 95 / 100,
+          bluefs->get_block_device_size(BlueFS::BDEV_DB) * 95 / 100,
+          bluefs->get_block_device_size(BlueFS::BDEV_SLOW) * 95 / 100,
          rocks_opts.write_buffer_size * rocks_opts.max_write_buffer_number,
           rocks_opts.max_bytes_for_level_base,
           rocks_opts.max_bytes_for_level_multiplier,
@@ -11976,7 +11976,7 @@ void BlueStore::_get_statfs_overall(struct store_statfs_t *buf)
     buf->internally_reserved = 0;
     // include dedicated db, too, if that isn't the shared device.
     if (bluefs_layout.shared_bdev != BlueFS::BDEV_DB) {
-      buf->total += bluefs->get_total(BlueFS::BDEV_DB);
+      buf->total += bluefs->get_block_device_size(BlueFS::BDEV_DB);
     }
     // call any non-omap bluefs space "internal metadata"
     buf->internal_metadata =
@@ -18889,7 +18889,7 @@ void BlueStore::_log_alerts(osd_alert_list_t& alerts)
     bluefs->get_used(BlueFS::BDEV_SLOW) : 0;
   if (used > 0) {
       auto db_used = bluefs->get_used(BlueFS::BDEV_DB);
-      auto db_total = bluefs->get_total(BlueFS::BDEV_DB);
+      auto db_total = bluefs->get_block_device_size(BlueFS::BDEV_DB);
       ostringstream ss;
       ss << "spilled over " << byte_u_t(used)
          << " metadata from 'db' device (" << byte_u_t(db_used)
index a00fe8b7f3c87c71e8ab2664a558b53673134ca6..ef874898b79dbc676af53b6560e1ced0b8dc5c23 100644 (file)
@@ -107,7 +107,7 @@ TEST(BlueFS, mkfs_mount) {
   ASSERT_EQ(0, fs.mkfs(fsid, { BlueFS::BDEV_DB, false, false }));
   ASSERT_EQ(0, fs.mount());
   ASSERT_EQ(0, fs.maybe_verify_layout({ BlueFS::BDEV_DB, false, false }));
-  ASSERT_EQ(fs.get_total(BlueFS::BDEV_DB), size);
+  ASSERT_EQ(fs.get_block_device_size(BlueFS::BDEV_DB), size);
   ASSERT_LT(fs.get_free(BlueFS::BDEV_DB), size);
   fs.umount();
 }