From 546e40091cc82d8d8b153b7678a2e62d7494e880 Mon Sep 17 00:00:00 2001 From: Adam Kupczyk Date: Mon, 16 Jan 2023 09:28:47 +0000 Subject: [PATCH] os/bluestore: Add operator<< for BufferSpace Signed-off-by: Adam Kupczyk --- src/os/bluestore/BlueStore.cc | 17 +++++++++++++++++ src/os/bluestore/BlueStore.h | 1 + 2 files changed, 18 insertions(+) diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index 0ab8a77c1ed..c7cfbf9029c 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -1943,6 +1943,23 @@ void BlueStore::BufferSpace::split(BufferCacheShard* cache, size_t pos, BlueStor cache->_trim(); } +// lists content of BufferSpace +// BufferSpace must be under exclusive access +std::ostream& operator<<(std::ostream& out, const BlueStore::BufferSpace& bc) +{ + for (auto& [i, j] : bc.buffer_map) { + out << " [0x" << std::hex << i << "]=" << *j << std::dec; + } + if (!bc.writing.empty()) { + out << " writing:"; + for (auto i = bc.writing.begin(); i != bc.writing.end(); ++i) { + out << " " << *i; + } + } + return out; +} + + // OnodeSpace #undef dout_prefix diff --git a/src/os/bluestore/BlueStore.h b/src/os/bluestore/BlueStore.h index ef8e380dbb3..e2ed810c0b3 100644 --- a/src/os/bluestore/BlueStore.h +++ b/src/os/bluestore/BlueStore.h @@ -477,6 +477,7 @@ public: } f->close_section(); } + friend std::ostream& operator<<(std::ostream& out, const BufferSpace& bc); }; struct SharedBlobSet; -- 2.47.3