From 2dac3f9a088cc27a96b2607540480a8e490a2d3b Mon Sep 17 00:00:00 2001 From: Igor Fedotov Date: Fri, 18 May 2018 17:50:40 +0300 Subject: [PATCH] os/bluestore: introduce new BlueFS perf counter to track the amount of data written to slow device. Signed-off-by: Igor Fedotov --- src/os/bluestore/BlueFS.cc | 9 +++++++++ src/os/bluestore/BlueFS.h | 1 + 2 files changed, 10 insertions(+) diff --git a/src/os/bluestore/BlueFS.cc b/src/os/bluestore/BlueFS.cc index 13af495349591..29e6217a5cc8e 100644 --- a/src/os/bluestore/BlueFS.cc +++ b/src/os/bluestore/BlueFS.cc @@ -115,6 +115,9 @@ void BlueFS::_init_logger() b.add_u64_counter(l_bluefs_bytes_written_sst, "bytes_written_sst", "Bytes written to SSTs", "sst", PerfCountersBuilder::PRIO_CRITICAL, unit_t(UNIT_BYTES)); + b.add_u64_counter(l_bluefs_bytes_written_slow, "bytes_written_slow", + "Bytes written to WAL/SSTs at slow device", NULL, + PerfCountersBuilder::PRIO_USEFUL, unit_t(UNIT_BYTES)); logger = b.create_perf_counters(); cct->get_perfcounters_collection()->add(logger); } @@ -1763,6 +1766,7 @@ int BlueFS::_flush_range(FileWriter *h, uint64_t offset, uint64_t length) h->tail_block.clear(); uint64_t bloff = 0; + uint64_t bytes_written_slow = 0; while (length > 0) { uint64_t x_len = std::min(p->length - x_off, length); bufferlist t; @@ -1798,11 +1802,16 @@ int BlueFS::_flush_range(FileWriter *h, uint64_t offset, uint64_t length) bdev[p->bdev]->aio_write(p->offset + x_off, t, h->iocv[p->bdev], buffered); } h->dirty_devs[p->bdev] = true; + if (p->bdev == BDEV_SLOW) { + bytes_written_slow += t.length(); + } + bloff += x_len; length -= x_len; ++p; x_off = 0; } + logger->inc(l_bluefs_bytes_written_slow, bytes_written_slow); for (unsigned i = 0; i < MAX_BDEV; ++i) { if (bdev[i]) { assert(h->iocv[i]); diff --git a/src/os/bluestore/BlueFS.h b/src/os/bluestore/BlueFS.h index 8e7113519b8cc..71c294a0b9719 100644 --- a/src/os/bluestore/BlueFS.h +++ b/src/os/bluestore/BlueFS.h @@ -35,6 +35,7 @@ enum { l_bluefs_files_written_sst, l_bluefs_bytes_written_wal, l_bluefs_bytes_written_sst, + l_bluefs_bytes_written_slow, l_bluefs_last, }; -- 2.39.5