diff mbox series

[09/10] btrfs-progs: check: introduce --noscan option

Message ID 9a7e479cb5122a04adf00a434eb003d6b386b8ee.1687943122.git.anand.jain@oracle.com (mailing list archive)
State New, archived
Headers show
Series btrfs-progs: check and tune: add device and noscan options | expand

Commit Message

Anand Jain June 28, 2023, 11:56 a.m. UTC
The function check_where_mounted() scans the system for other btrfs
devices, but in certain cases, we may need a way to instruct
btrfs check not to perform the system scan and instead only work on the
devices provided through the command line. And so, add an option
--noscan.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
 check/main.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/check/main.c b/check/main.c
index 7eb57f10aded..d4aa0db2514a 100644
--- a/check/main.c
+++ b/check/main.c
@@ -10015,7 +10015,7 @@  static int cmd_check(const struct cmd_struct *cmd, int argc, char **argv)
 			GETOPT_VAL_READONLY, GETOPT_VAL_CHUNK_TREE,
 			GETOPT_VAL_MODE, GETOPT_VAL_CLEAR_SPACE_CACHE,
 			GETOPT_VAL_CLEAR_INO_CACHE, GETOPT_VAL_FORCE,
-			GETOPT_VAL_DEVICE };
+			GETOPT_VAL_DEVICE, GETOPT_VAL_NOSCAN };
 		static const struct option long_options[] = {
 			{ "super", required_argument, NULL, 's' },
 			{ "repair", no_argument, NULL, GETOPT_VAL_REPAIR },
@@ -10041,6 +10041,7 @@  static int cmd_check(const struct cmd_struct *cmd, int argc, char **argv)
 				GETOPT_VAL_CLEAR_INO_CACHE},
 			{ "force", no_argument, NULL, GETOPT_VAL_FORCE },
 			{ "device", required_argument, NULL, GETOPT_VAL_DEVICE },
+			{ "noscan", no_argument, NULL, GETOPT_VAL_NOSCAN },
 			{ NULL, 0, NULL, 0}
 		};
 
@@ -10148,6 +10149,9 @@  static int cmd_check(const struct cmd_struct *cmd, int argc, char **argv)
 					exit(1);
 				}
 				break;
+			case GETOPT_VAL_NOSCAN:
+				ctree_flags |= OPEN_CTREE_NO_DEVICES;
+				break;
 		}
 	}