From 0891702f23a7e98f79e58b6a35abd23a8944aa08 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 --- 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 d369f7397d1..89accf7880a 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 86a4971d798..17ba9bed32c 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.47.3