From: Adam Kupczyk Date: Tue, 13 Feb 2024 12:50:51 +0000 (+0000) Subject: os/bluestore: Bluefs, expand api for getting BlockDevice on BD/WAL X-Git-Tag: testing/wip-rishabh-testing-20240908.191708-squid-debug~33^2~12 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=9a359e66b8d2c9e3008e01a823a37c8c5c56af0f;p=ceph-ci.git os/bluestore: Bluefs, expand api for getting BlockDevice on BD/WAL Signed-off-by: Adam Kupczyk (cherry picked from commit 0891702f23a7e98f79e58b6a35abd23a8944aa08) --- diff --git a/src/os/bluestore/BlueFS.cc b/src/os/bluestore/BlueFS.cc index e199a9f8d9c..49c9d107af1 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 86fb3cc882e..f656943e598 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);