summaryrefslogtreecommitdiff
path: root/memory.c
diff options
context:
space:
mode:
authorJens Axboe <jens.axboe@oracle.com>2007-03-19 14:00:54 +0100
committerJens Axboe <jens.axboe@oracle.com>2007-03-19 14:00:54 +0100
commit5d4a35e1c90938710f8d3ef99d30bfbc23ebc4c6 (patch)
treee04ee4619ccf731c7a541dcf24f8b095c1c87488 /memory.c
parentf085737f15364ba194e5582b19a71eb35d4b8d11 (diff)
downloadfio-5d4a35e1c90938710f8d3ef99d30bfbc23ebc4c6.tar.gz
fio-5d4a35e1c90938710f8d3ef99d30bfbc23ebc4c6.tar.bz2
Make sure mmaphuge file backed file is the size we need
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'memory.c')
-rw-r--r--memory.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/memory.c b/memory.c
index be664c9c..e5680389 100644
--- a/memory.c
+++ b/memory.c
@@ -96,6 +96,11 @@ int allocate_io_mem(struct thread_data *td)
td->orig_buffer = NULL;
return 1;
}
+ if (ftruncate(td->mmapfd, td->orig_buffer_size) < 0) {
+ td_verror(td, errno, "truncate mmap file");
+ td->orig_buffer = NULL;
+ return 1;
+ }
} else
flags |= OS_MAP_ANON;