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: v20.0.0~1321^2~12 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=0891702f23a7e98f79e58b6a35abd23a8944aa08;p=ceph.git os/bluestore: Bluefs, expand api for getting BlockDevice on BD/WAL Signed-off-by: Adam Kupczyk --- diff --git a/src/os/bluestore/BlueFS.cc b/src/os/bluestore/BlueFS.cc index d369f7397d19..89accf7880a9 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 86a4971d798c..17ba9bed32c5 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);