[all (rust)] Make sync-io the default

Multithreaded sync-io has performance similar to async-io. Also,
sync-io saves the hassle of setting ulimits to get io_uring working
on some systems (commit ba7fd7b). Now we default to sync-io, and
leave async-io as a hidden option for testing and benchmarking.
This commit is contained in:
Ming-Hung Tsai 2021-06-23 11:40:12 +08:00
parent 361d19adaa
commit cd48f00191
6 changed files with 41 additions and 35 deletions

View File

@ -14,6 +14,12 @@ use thinp::report::*;
fn main() { fn main() {
let parser = App::new("cache_check") let parser = App::new("cache_check")
.version(thinp::version::tools_version()) .version(thinp::version::tools_version())
.arg(
Arg::with_name("ASYNC_IO")
.help("Force use of io_uring for synchronous io")
.long("async-io")
.hidden(true),
)
.arg( .arg(
Arg::with_name("INPUT") Arg::with_name("INPUT")
.help("Specify the input device to check") .help("Specify the input device to check")
@ -75,7 +81,7 @@ fn main() {
let opts = CacheCheckOptions { let opts = CacheCheckOptions {
dev: &input_file, dev: &input_file,
async_io: false, async_io: matches.is_present("ASYNC_IO"),
sb_only: matches.is_present("SB_ONLY"), sb_only: matches.is_present("SB_ONLY"),
skip_mappings: matches.is_present("SKIP_MAPPINGS"), skip_mappings: matches.is_present("SKIP_MAPPINGS"),
skip_hints: matches.is_present("SKIP_HINTS"), skip_hints: matches.is_present("SKIP_HINTS"),

View File

@ -11,6 +11,12 @@ fn main() {
let parser = App::new("cache_dump") let parser = App::new("cache_dump")
.version(thinp::version::tools_version()) .version(thinp::version::tools_version())
.about("Dump the cache metadata to stdout in XML format") .about("Dump the cache metadata to stdout in XML format")
.arg(
Arg::with_name("ASYNC_IO")
.help("Force use of io_uring for synchronous io")
.long("async-io")
.hidden(true),
)
.arg( .arg(
Arg::with_name("REPAIR") Arg::with_name("REPAIR")
.help("Repair the metadata whilst dumping it") .help("Repair the metadata whilst dumping it")
@ -42,7 +48,7 @@ fn main() {
let opts = CacheDumpOptions { let opts = CacheDumpOptions {
input: input_file, input: input_file,
output: output_file, output: output_file,
async_io: false, async_io: matches.is_present("ASYNC_IO"),
repair: matches.is_present("REPAIR"), repair: matches.is_present("REPAIR"),
}; };

View File

@ -15,6 +15,12 @@ fn main() {
let parser = App::new("cache_restore") let parser = App::new("cache_restore")
.version(thinp::version::tools_version()) .version(thinp::version::tools_version())
.about("Convert XML format metadata to binary.") .about("Convert XML format metadata to binary.")
.arg(
Arg::with_name("ASYNC_IO")
.help("Force use of io_uring for synchronous io")
.long("async-io")
.hidden(true),
)
.arg( .arg(
Arg::with_name("OVERRIDE_MAPPING_ROOT") Arg::with_name("OVERRIDE_MAPPING_ROOT")
.help("Specify a mapping root to use") .help("Specify a mapping root to use")
@ -37,11 +43,6 @@ fn main() {
.long("output") .long("output")
.value_name("OUTPUT") .value_name("OUTPUT")
.required(true), .required(true),
)
.arg(
Arg::with_name("SYNC_IO")
.help("Force use of synchronous io")
.long("sync-io"),
); );
let matches = parser.get_matches(); let matches = parser.get_matches();
@ -66,7 +67,7 @@ fn main() {
let opts = CacheRestoreOptions { let opts = CacheRestoreOptions {
input: &input_file, input: &input_file,
output: &output_file, output: &output_file,
async_io: !matches.is_present("SYNC_IO"), async_io: matches.is_present("ASYNC_IO"),
report, report,
}; };

View File

@ -16,6 +16,12 @@ fn main() {
let parser = App::new("thin_check") let parser = App::new("thin_check")
.version(thinp::version::tools_version()) .version(thinp::version::tools_version())
.about("Validates thin provisioning metadata on a device or file.") .about("Validates thin provisioning metadata on a device or file.")
.arg(
Arg::with_name("ASYNC_IO")
.help("Force use of io_uring for synchronous io")
.long("async-io")
.hidden(true),
)
.arg( .arg(
Arg::with_name("QUIET") Arg::with_name("QUIET")
.help("Suppress output messages, return only exit code.") .help("Suppress output messages, return only exit code.")
@ -66,16 +72,6 @@ fn main() {
.help("Specify the input device to check") .help("Specify the input device to check")
.required(true) .required(true)
.index(1), .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 (currently the default)")
.long("sync-io"),
); );
let matches = parser.get_matches(); let matches = parser.get_matches();
@ -96,11 +92,6 @@ fn main() {
report = Arc::new(mk_simple_report()); 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 engine: Arc<dyn IoEngine + Send + Sync>; let engine: Arc<dyn IoEngine + Send + Sync>;
if matches.is_present("ASYNC_IO") { if matches.is_present("ASYNC_IO") {

View File

@ -15,6 +15,12 @@ fn main() {
let parser = App::new("thin_dump") let parser = App::new("thin_dump")
.version(thinp::version::tools_version()) .version(thinp::version::tools_version())
.about("Dump thin-provisioning metadata to stdout in XML format") .about("Dump thin-provisioning metadata to stdout in XML format")
.arg(
Arg::with_name("ASYNC_IO")
.help("Force use of io_uring for synchronous io")
.long("async-io")
.hidden(true),
)
.arg( .arg(
Arg::with_name("QUIET") Arg::with_name("QUIET")
.help("Suppress output messages, return only exit code.") .help("Suppress output messages, return only exit code.")
@ -32,11 +38,6 @@ fn main() {
.help("Do not dump the mappings") .help("Do not dump the mappings")
.long("skip-mappings"), .long("skip-mappings"),
) )
.arg(
Arg::with_name("SYNC_IO")
.help("Force use of synchronous io")
.long("sync-io"),
)
.arg( .arg(
Arg::with_name("METADATA_SNAPSHOT") Arg::with_name("METADATA_SNAPSHOT")
.help("Access the metadata snapshot on a live pool") .help("Access the metadata snapshot on a live pool")
@ -84,7 +85,7 @@ fn main() {
let opts = ThinDumpOptions { let opts = ThinDumpOptions {
input: input_file, input: input_file,
output: output_file, output: output_file,
async_io: !matches.is_present("SYNC_IO"), async_io: matches.is_present("ASYNC_IO"),
report, report,
}; };

View File

@ -15,6 +15,12 @@ fn main() {
let parser = App::new("thin_restore") let parser = App::new("thin_restore")
.version(thinp::version::tools_version()) .version(thinp::version::tools_version())
.about("Convert XML format metadata to binary.") .about("Convert XML format metadata to binary.")
.arg(
Arg::with_name("ASYNC_IO")
.help("Force use of io_uring for synchronous io")
.long("async-io")
.hidden(true),
)
.arg( .arg(
Arg::with_name("OVERRIDE_MAPPING_ROOT") Arg::with_name("OVERRIDE_MAPPING_ROOT")
.help("Specify a mapping root to use") .help("Specify a mapping root to use")
@ -37,11 +43,6 @@ fn main() {
.long("output") .long("output")
.value_name("OUTPUT") .value_name("OUTPUT")
.required(true), .required(true),
)
.arg(
Arg::with_name("SYNC_IO")
.help("Force use of synchronous io")
.long("sync-io"),
); );
let matches = parser.get_matches(); let matches = parser.get_matches();
@ -66,7 +67,7 @@ fn main() {
let opts = ThinRestoreOptions { let opts = ThinRestoreOptions {
input: &input_file, input: &input_file,
output: &output_file, output: &output_file,
async_io: !matches.is_present("SYNC_IO"), async_io: matches.is_present("ASYNC_IO"),
report, report,
}; };