From 1aae3b66fa55f893f7ec002854bb699541635d53 Mon Sep 17 00:00:00 2001 From: Igor Fedotov Date: Fri, 28 Feb 2025 10:54:57 +0300 Subject: [PATCH] os/bluestore: show allocator types in metadata dump Signed-off-by: Igor Fedotov --- src/os/bluestore/BlueFS.cc | 14 ++++++++++---- src/os/bluestore/BlueStore.cc | 1 + src/os/bluestore/bluefs_types.h | 2 +- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/os/bluestore/BlueFS.cc b/src/os/bluestore/BlueFS.cc index 8c7c85a8ea3..ad1327ebb8d 100644 --- a/src/os/bluestore/BlueFS.cc +++ b/src/os/bluestore/BlueFS.cc @@ -827,15 +827,17 @@ void BlueFS::_init_alloc() name += devnames[id]; else name += to_string(uintptr_t(this)); + string alloc_type = cct->_conf->bluefs_allocator; + dout(1) << __func__ << " new, id " << id << std::hex << ", allocator name " << name - << ", allocator type " << cct->_conf->bluefs_allocator + << ", allocator type " << alloc_type << ", capacity 0x" << bdev[id]->get_size() << ", reserved 0x" << block_reserved[id] << ", block size 0x" << alloc_size[id] << ", max alloc size 0x" << super.bluefs_max_alloc_size[id] << std::dec << dendl; - alloc[id] = Allocator::create(cct, cct->_conf->bluefs_allocator, + alloc[id] = Allocator::create(cct, alloc_type, bdev[id]->get_size(), super.bluefs_max_alloc_size[id], name); @@ -1174,10 +1176,14 @@ int BlueFS::prepare_new_device(int id, const bluefs_layout_t& layout) void BlueFS::collect_metadata(map *pm, unsigned skip_bdev_id) { - if (skip_bdev_id != BDEV_DB && bdev[BDEV_DB]) + if (skip_bdev_id != BDEV_DB && bdev[BDEV_DB]) { bdev[BDEV_DB]->collect_metadata("bluefs_db_", pm); - if (bdev[BDEV_WAL]) + (*pm)["bluefs_db_allocator"]= alloc[BDEV_DB] ? alloc[BDEV_DB]->get_type(): "null"; + } + if (bdev[BDEV_WAL]) { bdev[BDEV_WAL]->collect_metadata("bluefs_wal_", pm); + (*pm)["bluefs_wal_allocator"]= alloc[BDEV_WAL] ? alloc[BDEV_WAL]->get_type(): "null"; + } } void BlueFS::get_devices(set *ls) diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index 7dca7f49f1e..c54bc3bb28a 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -12009,6 +12009,7 @@ void BlueStore::collect_metadata(map *pm) } (*pm)["bluestore_min_alloc_size"] = stringify(min_alloc_size); (*pm)["bluestore_allocation_from_file"] = stringify(fm && fm->is_null_manager()); + (*pm)["bluestore_allocator"] = alloc ? alloc->get_type() : "null"; } int BlueStore::get_numa_node( diff --git a/src/os/bluestore/bluefs_types.h b/src/os/bluestore/bluefs_types.h index 08b3ca0cf41..d4ba5f8aa5c 100644 --- a/src/os/bluestore/bluefs_types.h +++ b/src/os/bluestore/bluefs_types.h @@ -213,7 +213,7 @@ WRITE_CLASS_ENCODER(bluefs_layout_t) struct bluefs_super_t { uuid_d uuid; ///< unique to this bluefs instance uuid_d osd_uuid; ///< matches the osd that owns us - uint64_t version; + uint64_t version; ///< In fact that's update counter uint32_t block_size; bluefs_fnode_t log_fnode; -- 2.39.5