]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: get rid off BlueFS::get_block_device_size
authorIgor Fedotov <igor.fedotov@croit.io>
Fri, 7 Mar 2025 11:29:34 +0000 (14:29 +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 acdd0e363c76073e2fc60de5e9b55d3441c74a66)

src/os/bluestore/BlueFS.cc
src/os/bluestore/BlueFS.h
src/os/bluestore/BlueStore.cc

index 041ff732f7030e407e0667095b775dcaa61d2917..91e87e83397702f4748f4a4b8a129e75753d9300 100644 (file)
@@ -538,13 +538,6 @@ bool BlueFS::bdev_support_label(unsigned id)
   return bdev[id]->supported_bdev_label();
 }
 
-uint64_t BlueFS::get_block_device_size(unsigned id) const
-{
-  if (id < bdev.size() && bdev[id])
-    return bdev[id]->get_size();
-  return 0;
-}
-
 BlockDevice* BlueFS::get_block_device(unsigned id) const
 {
   if (id < bdev.size() && bdev[id])
@@ -595,7 +588,7 @@ uint64_t BlueFS::get_used(unsigned id)
 uint64_t BlueFS::_get_total(unsigned id) const
 {
   ceph_assert(id < bdev.size());
-  return get_block_device_size(id);
+  return bdev[id] ? bdev[id]->get_size() : 0;
 }
 
 uint64_t BlueFS::get_total(unsigned id)
@@ -688,9 +681,9 @@ int BlueFS::mkfs(uuid_d osd_uuid, const bluefs_layout_t& layout)
   if (vselector == nullptr) {
     vselector.reset(
       new OriginalVolumeSelector(
-        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));
+        _get_total(BlueFS::BDEV_WAL) * 95 / 100,
+        _get_total(BlueFS::BDEV_DB) * 95 / 100,
+        _get_total(BlueFS::BDEV_SLOW) * 95 / 100));
   }
 
   _init_logger();
@@ -1043,9 +1036,9 @@ int BlueFS::mount()
   if (vselector == nullptr) {
     vselector.reset(
       new OriginalVolumeSelector(
-        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));
+        _get_total(BlueFS::BDEV_WAL) * 95 / 100,
+        _get_total(BlueFS::BDEV_DB) * 95 / 100,
+        _get_total(BlueFS::BDEV_SLOW) * 95 / 100));
   }
 
   _init_alloc();
index ee8f50149c545a67d0daa2737235bd6f2652934e..67d8cee95228f36e9ab5444cda839bb206e704ba 100644 (file)
@@ -777,7 +777,6 @@ public:
   int add_block_device(unsigned bdev, const std::string& path, bool trim,
                        bluefs_shared_alloc_context_t* _shared_alloc = nullptr);
   bool bdev_support_label(unsigned id);
-  uint64_t get_block_device_size(unsigned bdev) const;
   BlockDevice* get_block_device(unsigned bdev) const;
 
   // handler for discard event
index 7601966c3ff5c62f9569df86d4bcbf9e44e5568c..54fb0ef4ad6b6853651a21047e53b93ba1d81c14 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_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);
+        bluefs->get_total(BlueFS::BDEV_WAL) * 95 / 100,
+        bluefs->get_total(BlueFS::BDEV_DB) * 95 / 100,
+        bluefs->get_total(BlueFS::BDEV_SLOW) * 95 / 100);
     } else {
       double reserved_factor = cct->_conf->bluestore_volume_selection_reserved_factor;
       vselector =
         new RocksDBBlueFSVolumeSelector(
-          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,
+          bluefs->get_total(BlueFS::BDEV_WAL) * 95 / 100,
+          bluefs->get_total(BlueFS::BDEV_DB) * 95 / 100,
+          bluefs->get_total(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,