From ba7fd7bd2b8cd1ed35daed688163a31ad2e5a621 Mon Sep 17 00:00:00 2001 From: Joe Thornber Date: Wed, 2 Dec 2020 11:33:05 +0000 Subject: [PATCH] [thin_check (rust)] Make --sync-io the default. For some systems you have to adjust the ulimits to get io_uring to work, so we now default to using sync io. Also added --async-io flag. --- src/bin/thin_check.rs | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/src/bin/thin_check.rs b/src/bin/thin_check.rs index 09759dc..8d96510 100644 --- a/src/bin/thin_check.rs +++ b/src/bin/thin_check.rs @@ -68,9 +68,14 @@ fn main() { .required(true) .index(1), ) + .arg( + Arg::with_name("ASYNC_IO") + .help("Force use of io_uring for asynchronous IO") + .long("async-io"), + ) .arg( Arg::with_name("SYNC_IO") - .help("Force use of synchronous io") + .help("Force use of synchronous IO (currently the default)") .long("sync-io"), ); @@ -92,9 +97,25 @@ fn main() { report = Arc::new(mk_simple_report()); } + if matches.is_present("SYNC_IO") && + matches.is_present("ASYNC_IO") { + eprintln!("--sync-io and --async-io may not be used at the same time."); + process::exit(1); + } + + let mut async_io = false; + if matches.is_present("ASYNC_IO") { + async_io = true; + } + + // redundant since sync is the default. + if matches.is_present("SYNC_IO") { + async_io = false; + } + let opts = ThinCheckOptions { dev: &input_file, - async_io: !matches.is_present("SYNC_IO"), + async_io: async_io, sb_only: matches.is_present("SB_ONLY"), skip_mappings: matches.is_present("SKIP_MAPPINGS"), ignore_non_fatal: matches.is_present("IGNORE_NON_FATAL"), @@ -103,7 +124,7 @@ fn main() { }; if let Err(reason) = check(opts) { - println!("{}", reason); + eprintln!("{}", reason); process::exit(1); } }