From 52904aa88690f71b8bb84b70645e39cd4962f616 Mon Sep 17 00:00:00 2001 From: Kent Overstreet Date: Sat, 4 May 2024 15:26:14 -0400 Subject: [PATCH] BCACHEFS_KERNEL_ONLY Add an environment variable that indicates we prefer to run bcachefs code in the kernel, not userspace - this is for the test environment where it's easier to debug kernel code. Signed-off-by: Kent Overstreet --- c_src/cmd_format.c | 3 +++ c_src/cmd_fsck.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/c_src/cmd_format.c b/c_src/cmd_format.c index e2468350..4bafa171 100644 --- a/c_src/cmd_format.c +++ b/c_src/cmd_format.c @@ -128,6 +128,9 @@ int cmd_format(int argc, char *argv[]) bch2_cmdline_opts_get(&argc, argv, OPT_FORMAT); struct bch_opts fs_opts = bch2_parse_opts(fs_opt_strs); + if (getenv("BCACHEFS_KERNEL_ONLY")) + initialize = false; + while ((opt = getopt_long(argc, argv, "-L:U:g:fqhv", format_opts, diff --git a/c_src/cmd_fsck.c b/c_src/cmd_fsck.c index 05582d4a..f1f4ae89 100644 --- a/c_src/cmd_fsck.c +++ b/c_src/cmd_fsck.c @@ -171,6 +171,9 @@ int cmd_fsck(int argc, char *argv[]) int opt, ret = 0; struct printbuf opts_str = PRINTBUF; + if (getenv("BCACHEFS_KERNEL_ONLY")) + kernel = true; + append_opt(&opts_str, "degraded"); append_opt(&opts_str, "fsck"); append_opt(&opts_str, "fix_errors=ask");