]> git.apps.os.sepia.ceph.com Git - ceph-ci.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>
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

index f301badfbe0c45d9bda6163197546352246e36e8..06b5af7adf02b4287b6d1aaf3a7607334a325d81 100644 (file)
@@ -552,13 +552,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])
@@ -609,7 +602,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)
@@ -702,9 +695,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();
@@ -1057,9 +1050,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 e0676d7967f31f6e462664e852208f00a4f5b704..abca0a36623d76ffbaecd7895e129fd5fcb42a3d 100644 (file)
@@ -773,7 +773,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 c54bc3bb28a97281b83eb68114d8fe41f771e108..d72eb46808e7763f68486868d6e17957f3d7e5e6 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_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,