summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmit Shah <amit.shah@redhat.com>2009-03-19 18:22:28 +0530
committerAmit Shah <amit.shah@redhat.com>2009-03-19 18:22:28 +0530
commit09517a9839f530a34971a236a3043c51c74ccf9f (patch)
treece461f108e63779415b3ac19aba4042b83af2997
parent7de1f286de85fd1e8359eee716536666a76fbb88 (diff)
downloadalloc-perf-09517a9839f530a34971a236a3043c51c74ccf9f.tar.gz
alloc-perf-09517a9839f530a34971a236a3043c51c74ccf9f.tar.xz
alloc-perf-09517a9839f530a34971a236a3043c51c74ccf9f.zip
Use ftruncate instead of lseek and write to create sparse file
Signed-off-by: Amit Shah <amit.shah@redhat.com>
-rw-r--r--test-file-zero-alloc-speed.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/test-file-zero-alloc-speed.c b/test-file-zero-alloc-speed.c
index 73a7975..8081c74 100644
--- a/test-file-zero-alloc-speed.c
+++ b/test-file-zero-alloc-speed.c
@@ -99,9 +99,9 @@ int do_mmap(char *name, off_t len)
return -1;
}
/* memset has to have the mmap'ed file backed by something on
- * disk -- bus error otherwise */
- lseek(fd, len - 1, SEEK_SET);
- write(fd, "0", 1);
+ * disk -- bus error otherwise
+ */
+ ftruncate(fd, len);
addr = mmap(NULL, len, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
if (addr == MAP_FAILED) {