From d6a2d378707cd807444243029252e9d9bc0d08b6 Mon Sep 17 00:00:00 2001 From: Igor Fedotov Date: Thu, 20 Mar 2025 20:17:42 +0300 Subject: [PATCH] os/bluestore: rename BlueFS::get_total -> get_block_device_size() Signed-off-by: Igor Fedotov --- src/os/bluestore/BlueFS.cc | 34 ++++++++++++++--------------- src/os/bluestore/BlueFS.h | 4 ++-- src/os/bluestore/BlueStore.cc | 16 +++++++------- src/test/objectstore/test_bluefs.cc | 2 +- 4 files changed, 28 insertions(+), 28 deletions(-) diff --git a/src/os/bluestore/BlueFS.cc b/src/os/bluestore/BlueFS.cc index 06b5af7adf0..567f036839f 100644 --- a/src/os/bluestore/BlueFS.cc +++ b/src/os/bluestore/BlueFS.cc @@ -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(); diff --git a/src/os/bluestore/BlueFS.h b/src/os/bluestore/BlueFS.h index abca0a36623..1932d45e0b7 100644 --- a/src/os/bluestore/BlueFS.h +++ b/src/os/bluestore/BlueFS.h @@ -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); diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index d72eb46808e..6a58d426bdb 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -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) diff --git a/src/test/objectstore/test_bluefs.cc b/src/test/objectstore/test_bluefs.cc index f77774cde78..8c8bb4c0d28 100644 --- a/src/test/objectstore/test_bluefs.cc +++ b/src/test/objectstore/test_bluefs.cc @@ -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(); } -- 2.39.5