From 15d0204f9698f13e54d25c88fc61542afbad882a Mon Sep 17 00:00:00 2001 From: Vitaliy Filippov Date: Sun, 20 Apr 2025 01:21:03 +0300 Subject: [PATCH] Hide "Ran out of journal space" log messages by default --- src/blockstore/blockstore_impl.h | 2 ++ src/blockstore/blockstore_journal.cpp | 11 +++++++---- src/blockstore/blockstore_open.cpp | 1 + 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/blockstore/blockstore_impl.h b/src/blockstore/blockstore_impl.h index 800e3f87..e3743542 100644 --- a/src/blockstore/blockstore_impl.h +++ b/src/blockstore/blockstore_impl.h @@ -266,6 +266,8 @@ class blockstore_impl_t int throttle_threshold_us = 50; // Maximum writes between automatically added fsync operations uint64_t autosync_writes = 128; + // Log level (0-10) + int log_level = 0; /******* END OF OPTIONS *******/ struct ring_consumer_t ring_consumer; diff --git a/src/blockstore/blockstore_journal.cpp b/src/blockstore/blockstore_journal.cpp index 78cad803..9a20bd03 100644 --- a/src/blockstore/blockstore_journal.cpp +++ b/src/blockstore/blockstore_journal.cpp @@ -113,10 +113,13 @@ int blockstore_journal_check_t::check_available(blockstore_op_t *op, int entries if (!right_dir && next_pos >= bs->journal.used_start-bs->journal.block_size) { // No space in the journal. Wait until used_start changes. - printf( - "Ran out of journal space (used_start=%08jx, next_free=%08jx, dirty_start=%08jx)\n", - bs->journal.used_start, bs->journal.next_free, bs->journal.dirty_start - ); + if (bs->log_level > 5) + { + printf( + "Ran out of journal space (used_start=%08jx, next_free=%08jx, dirty_start=%08jx)\n", + bs->journal.used_start, bs->journal.next_free, bs->journal.dirty_start + ); + } PRIV(op)->wait_for = WAIT_JOURNAL; bs->flusher->request_trim(); PRIV(op)->wait_detail = bs->journal.used_start; diff --git a/src/blockstore/blockstore_open.cpp b/src/blockstore/blockstore_open.cpp index 7980f11e..252c6f88 100644 --- a/src/blockstore/blockstore_open.cpp +++ b/src/blockstore/blockstore_open.cpp @@ -101,6 +101,7 @@ void blockstore_impl_t::parse_config(blockstore_config_t & config, bool init) config["journal_no_same_sector_overwrites"] == "1" || config["journal_no_same_sector_overwrites"] == "yes"; journal.inmemory = config["inmemory_journal"] != "false" && config["inmemory_journal"] != "0" && config["inmemory_journal"] != "no"; + log_level = strtoull(config["log_level"].c_str(), NULL, 10); // Validate if (journal.sector_count < 2) {