From be22724a956c89b520560f32a0499600f09978f0 Mon Sep 17 00:00:00 2001 From: Andrea Mazzoleni Date: Thu, 15 Jan 2015 22:45:07 +0100 Subject: [PATCH] Add a comment about reserving space in Windows. --- cmdline/mingw.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/cmdline/mingw.c b/cmdline/mingw.c index 25b1c4f5..d2beff32 100644 --- a/cmdline/mingw.c +++ b/cmdline/mingw.c @@ -869,6 +869,15 @@ int windows_ftruncate(int fd, off64_t off) return -1; } + /* + * Windows effectively reserves space, but it doesn't initialize it. + * It's then important to write starting from the begin to the end, + * to avoid to have Windows to fill the holes writing zeros. + * + * See: + * "Why does my single-byte write take forever?" + * http://blogs.msdn.com/b/oldnewthing/archive/2011/09/22/10215053.aspx + */ if (!SetEndOfFile(h)) { windows_errno(GetLastError()); return -1;