Skip to content

Commit cdafef6

Browse files
committed
fix sparsify message: report resulting disk size, not amount removed
Signed-off-by: danbugs <danilochiarlone@gmail.com>
1 parent a633326 commit cdafef6

1 file changed

Lines changed: 4 additions & 10 deletions

File tree

host/src/lib.rs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1578,11 +1578,8 @@ fn sparsify_snapshot(path: &Path) -> Result<()> {
15781578
drop(mmap);
15791579

15801580
if punched > 0 {
1581-
eprintln!(
1582-
" sparsified: punched {} zero pages ({} MiB saved on disk)",
1583-
punched,
1584-
punched * 4 / 1024
1585-
);
1581+
let disk_mib = (len as u64 - punched * PAGE as u64) / 1024 / 1024;
1582+
eprintln!(" sparsified: {disk_mib} MiB on disk (punched {punched} zero pages)",);
15861583
}
15871584

15881585
Ok(())
@@ -1669,11 +1666,8 @@ fn sparsify_snapshot(path: &Path) -> Result<()> {
16691666
drop(mmap);
16701667

16711668
if punched > 0 {
1672-
eprintln!(
1673-
" sparsified: punched {} zero pages ({} MiB saved on disk)",
1674-
punched,
1675-
punched * 4 / 1024
1676-
);
1669+
let disk_mib = (len as u64 - punched * PAGE as u64) / 1024 / 1024;
1670+
eprintln!(" sparsified: {disk_mib} MiB on disk (punched {punched} zero pages)",);
16771671
}
16781672

16791673
Ok(())

0 commit comments

Comments
 (0)