From 9a359e66b8d2c9e3008e01a823a37c8c5c56af0f Mon Sep 17 00:00:00 2001 From: Adam Kupczyk Date: Tue, 13 Feb 2024 12:50:51 +0000 Subject: [PATCH] os/bluestore: Bluefs, expand api for getting BlockDevice on BD/WAL Signed-off-by: Adam Kupczyk (cherry picked from commit 0891702f23a7e98f79e58b6a35abd23a8944aa08) --- src/os/bluestore/BlueFS.cc | 7 +++++++ src/os/bluestore/BlueFS.h | 1 + 2 files changed, 8 insertions(+) diff --git a/src/os/bluestore/BlueFS.cc b/src/os/bluestore/BlueFS.cc index e199a9f8d9cc5..49c9d107af1cb 100644 --- a/src/os/bluestore/BlueFS.cc +++ b/src/os/bluestore/BlueFS.cc @@ -546,6 +546,13 @@ uint64_t BlueFS::get_block_device_size(unsigned id) const return 0; } +BlockDevice* BlueFS::get_block_device(unsigned id) const +{ + if (id < bdev.size() && bdev[id]) + return bdev[id]; + return nullptr; +} + void BlueFS::handle_discard(unsigned id, interval_set& to_release) { dout(10) << __func__ << " bdev " << id << dendl; diff --git a/src/os/bluestore/BlueFS.h b/src/os/bluestore/BlueFS.h index 86fb3cc882e1e..f656943e5984a 100644 --- a/src/os/bluestore/BlueFS.h +++ b/src/os/bluestore/BlueFS.h @@ -743,6 +743,7 @@ public: 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 void handle_discard(unsigned dev, interval_set& to_release); -- 2.39.5