From cf03cb0c04772f9b128dec948dc9643be146c0b6 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Sat, 26 Feb 2011 23:26:00 +1100 Subject: [PATCH] Fallocate space in advance on decompression. This often can speed up decompression of large files and decreases fragmentation. --- main.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/main.c b/main.c index 1c46520..8c9d2b4 100644 --- a/main.c +++ b/main.c @@ -350,6 +350,9 @@ static void decompress_file(void) failure("Inadequate free space to decompress file, use -f to override.\n"); } + if (unlikely(posix_fallocate(fd_out, 0, expected_size))) + failure("Failed to fallocate fd_out in decompress_file\n"); + fd_hist = open(control.outfile, O_RDONLY); if (unlikely(fd_hist == -1)) fatal("Failed to open history file %s\n", control.outfile);