[PATCH] tools/writeback: parse help before importing drgn
From: Yousef Alhouseen
Date: Wed Jun 24 2026 - 08:39:07 EST
wb_monitor.py imports drgn before argparse can handle "-h". That makes
help fail on systems where drgn is not installed, even though the script
does not need drgn to print usage text.
Parse arguments before importing drgn so the help path works without the
runtime debugging dependency. While there, fix a typo in the help text.
Signed-off-by: Yousef Alhouseen <alhouseenyousef@xxxxxxxxx>
---
tools/writeback/wb_monitor.py | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/tools/writeback/wb_monitor.py b/tools/writeback/wb_monitor.py
index 5e3591f1f..e09e00ee2 100644
--- a/tools/writeback/wb_monitor.py
+++ b/tools/writeback/wb_monitor.py
@@ -14,7 +14,7 @@ backing dev. For more info on drgn, visit https://github.com/osandov/drgn.
dirtied(kB) Amount of pages have been dirtied.
- wrttien(kB) Amount of dirty pages have been written back to disk.
+ written(kB) Amount of dirty pages have been written back to disk.
avg_wb(kBps) Smoothly estimated write bandwidth of writing dirty pages
back to disk.
@@ -25,9 +25,6 @@ import re
import time
import json
-import drgn
-from drgn.helpers.linux.list import list_for_each_entry
-
import argparse
parser = argparse.ArgumentParser(description=desc,
formatter_class=argparse.RawTextHelpFormatter)
@@ -41,6 +38,9 @@ parser.add_argument('-c', '--cgroup', action='store_true',
help='show writeback of bdi in cgroup')
args = parser.parse_args()
+import drgn
+from drgn.helpers.linux.list import list_for_each_entry
+
bdi_list = prog['bdi_list']
WB_RECLAIMABLE = prog['WB_RECLAIMABLE']
--
2.54.0