]> git.apps.os.sepia.ceph.com Git - ceph-ci.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>
Fri, 21 Mar 2025 17:26:18 +0000 (20:26 +0300)
Signed-off-by: Igor Fedotov <igor.fedotov@croit.io>
src/os/bluestore/BlueFS.cc
src/os/bluestore/BlueFS.h
src/os/bluestore/BlueStore.cc
src/test/objectstore/test_bluefs.cc

index 06b5af7adf02b4287b6d1aaf3a7607334a325d81..567f036839f9c236a42d7b7964e65e2a6905f7bf 100644 (file)
@@ -134,7 +134,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);
 
@@ -480,15 +480,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));
   }
 }
@@ -587,7 +587,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;
 }
@@ -599,15 +599,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)
@@ -658,7 +658,7 @@ void BlueFS::dump_block_extents(ostream& out)
     if (!bdev[i] || !alloc[i]) {
       continue;
     }
-    auto total = get_total(i);
+    auto total = get_block_device_size(i);
     auto free = get_free(i);
 
     out << i << " : device size 0x" << std::hex << total
@@ -695,9 +695,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();
@@ -816,7 +816,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) {
@@ -839,7 +839,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);
     }
   }
@@ -1050,9 +1050,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 abca0a36623d76ffbaecd7895e129fd5fcb42a3d..1932d45e0b72837594d071f7548f233f34a14160 100644 (file)
@@ -556,7 +556,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);
@@ -708,7 +708,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 d72eb46808e7763f68486868d6e17957f3d7e5e6..6a58d426bdbf0e209e8c20c75c5ea55271e5dbd6 100644 (file)
@@ -7698,16 +7698,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,
@@ -12120,7 +12120,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 =
@@ -19138,7 +19138,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 f77774cde787405c32bf4473c1d58e547ec49ded..8c8bb4c0d28969056e489077f8bf4f2f26adc868 100644 (file)
@@ -112,7 +112,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();
 }