diff options
Diffstat (limited to 'tests/dd/sparse.sh')
-rwxr-xr-x | tests/dd/sparse.sh | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/tests/dd/sparse.sh b/tests/dd/sparse.sh index d9de985a..a7e90d2b 100755 --- a/tests/dd/sparse.sh +++ b/tests/dd/sparse.sh @@ -1,6 +1,6 @@ #!/bin/sh -# Copyright (C) 2012-2013 Free Software Foundation, Inc. +# Copyright (C) 2012-2014 Free Software Foundation, Inc. # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -61,8 +61,15 @@ if test $(kb_alloc file.in) -gt 3000; then dd if=file.in of=file.out bs=2M conv=sparse test 2500 -lt $(kb_alloc file.out) || fail=1 + # Note we recreate a sparse file first to avoid + # speculative preallocation seen in XFS, where a write() that + # extends a file can preallocate some extra space that + # a subsequent seek will not convert to a hole. + rm -f file.out + truncate --size=3M file.out + # Ensure that this 1MiB string of NULs *is* converted to a hole. - dd if=file.in of=file.out bs=1M conv=sparse + dd if=file.in of=file.out bs=1M conv=sparse,notrunc test $(kb_alloc file.out) -lt 2500 || fail=1 fi |