From d48fa60ed8882d75e3f4f0e23162f6b0f9a85835 Mon Sep 17 00:00:00 2001 From: Christopher Obbard Date: Mon, 6 Apr 2026 00:00:37 +0100 Subject: [PATCH] bmap-rs: Use sync_data instead of sync_all sync_all calls fsync which flushes both data and metadata to the device. For large image writes to slow storage (e.g. SD cards or USB drives) this blocks until all pages have been physically written which takes a LONG time. sync_data (fdatasync) flushes only the file data which is sufficient to ensure the written image is safe to use. Signed-off-by: Christopher Obbard --- bmap-rs/src/main.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bmap-rs/src/main.rs b/bmap-rs/src/main.rs index b8cdcc9..4d8a78e 100644 --- a/bmap-rs/src/main.rs +++ b/bmap-rs/src/main.rs @@ -217,7 +217,7 @@ fn copy_local_input(source: PathBuf, destination: PathBuf) -> Result<()> { pb.finish_and_clear(); println!("Done: Syncing..."); - output.sync_all()?; + output.sync_data()?; Ok(()) } @@ -255,7 +255,7 @@ async fn copy_remote_input(source: Url, destination: PathBuf) -> Result<()> { pb.finish_and_clear(); println!("Done: Syncing..."); - output.sync_all().await?; + output.sync_data().await?; Ok(()) } @@ -275,7 +275,7 @@ fn copy_local_input_nobmap(source: PathBuf, destination: PathBuf) -> Result<()> pb.finish_and_clear(); println!("Done: Syncing..."); - output.sync_all().expect("Sync failure"); + output.sync_data().expect("Sync failure"); Ok(()) } @@ -301,7 +301,7 @@ async fn copy_remote_input_nobmap(source: Url, destination: PathBuf) -> Result<( pb.finish_and_clear(); println!("Done: Syncing..."); - output.sync_all().await?; + output.sync_data().await?; Ok(()) }