From: Zygo Blaxell Date: Tue, 11 Feb 2025 05:31:29 +0000 (-0500) Subject: extent scan: only write a detailed debug log when there's an exception X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bc7c35aa2d996dc43dfdea0ffe28146a8b38fb07;p=bees extent scan: only write a detailed debug log when there's an exception Note that when enabled, the logs are still very CPU-intensive, but most of the logs will be discarded. Signed-off-by: Zygo Blaxell --- diff --git a/src/bees-roots.cc b/src/bees-roots.cc index a5936008..499dfcbe 100644 --- a/src/bees-roots.cc +++ b/src/bees-roots.cc @@ -933,6 +933,7 @@ BeesScanModeExtent::SizeTier::find_next_extent() // Low-level extent search debugging shared_ptr debug_oss; + const bool debug_oss_only_exceptions = true; #if 0 // Enable a _lot_ of debugging output debug_oss = make_shared(); @@ -966,7 +967,9 @@ BeesScanModeExtent::SizeTier::find_next_extent() ); } if (debug_oss) { - BEESLOGDEBUG("debug oss trace:\n" << debug_oss->str()); + if (!debug_oss_only_exceptions || exception_check()) { + BEESLOGDEBUG("debug oss trace:\n" << debug_oss->str()); + } } } BtrfsIoctlSearchKey::s_debug_ostream.reset(); @@ -1002,7 +1005,9 @@ BeesScanModeExtent::SizeTier::find_next_extent() // There is a lot of debug output. Dump it if it gets too long if (!debug_oss->str().empty()) { if (crawl_time.age() > 1) { - BEESLOGDEBUG("debug oss trace (so far):\n" << debug_oss->str()); + if (!debug_oss_only_exceptions) { + BEESLOGDEBUG("debug oss trace (so far):\n" << debug_oss->str()); + } debug_oss->str(""); } }