From: Igor Fedotov Date: Thu, 20 Mar 2025 17:17:42 +0000 (+0300) Subject: os/bluestore: rename BlueFS::get_total -> get_block_device_size() X-Git-Tag: v19.2.3~166^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=7a317c4550cc42a5d20ef79fc232e1b391ad520a;p=ceph.git os/bluestore: rename BlueFS::get_total -> get_block_device_size() Signed-off-by: Igor Fedotov (cherry picked from commit d6a2d378707cd807444243029252e9d9bc0d08b6) --- diff --git a/src/os/bluestore/BlueFS.cc b/src/os/bluestore/BlueFS.cc index 91e87e83397..9ed06c09450 100644 --- a/src/os/bluestore/BlueFS.cc +++ b/src/os/bluestore/BlueFS.cc @@ -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(); diff --git a/src/os/bluestore/BlueFS.h b/src/os/bluestore/BlueFS.h index 67d8cee9522..60c905f00cb 100644 --- a/src/os/bluestore/BlueFS.h +++ b/src/os/bluestore/BlueFS.h @@ -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); diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index 54fb0ef4ad6..01948bcd237 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -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) diff --git a/src/test/objectstore/test_bluefs.cc b/src/test/objectstore/test_bluefs.cc index a00fe8b7f3c..ef874898b79 100644 --- a/src/test/objectstore/test_bluefs.cc +++ b/src/test/objectstore/test_bluefs.cc @@ -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(); }