aboutsummaryrefslogtreecommitdiff
path: root/b3sum/src
diff options
context:
space:
mode:
authorAlbert Safin <[email protected]>2020-01-15 17:22:20 +0000
committerJack O'Connor <[email protected]>2020-01-17 12:58:32 -0500
commitf26880e2824a63fb968adaa2b9ec528ddb679760 (patch)
treea1d0ca7ada5cbfdb2621d00149e2d1e533158c00 /b3sum/src
parent28701d1585b5f0bd42a422f3e7c1a57fc878b975 (diff)
b3sum: do not mmap files smaller than 16 KiB
Diffstat (limited to 'b3sum/src')
-rw-r--r--b3sum/src/main.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/b3sum/src/main.rs b/b3sum/src/main.rs
index e6c6efd..2e24dd1 100644
--- a/b3sum/src/main.rs
+++ b/b3sum/src/main.rs
@@ -78,6 +78,9 @@ fn maybe_memmap_file(file: &File) -> Result<Option<memmap::Mmap>> {
// Mapping an empty file currently fails.
// https://github.com/danburkert/memmap-rs/issues/72
None
+ } else if file_size < 16 * 1024 {
+ // Mapping small files is not worth it.
+ None
} else {
// Explicitly set the length of the memory map, so that filesystem
// changes can't race to violate the invariants we just checked.