From 40f8298cd252157fa15d93f8eb470116a94069a0 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Wed, 25 Oct 2006 11:21:05 +0200 Subject: [PATCH] [PATCH] Use posix_fallocate() to force file layout Dunno how well this works on all filesystems, but at least it's a good hint to send wrt fragmentation and layout. Signed-off-by: Jens Axboe --- filesetup.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/filesetup.c b/filesetup.c index 52d822ac..0b956404 100644 --- a/filesetup.c +++ b/filesetup.c @@ -44,6 +44,11 @@ static int create_file(struct thread_data *td, struct fio_file *f) goto err; } + if (posix_fallocate(f->fd, 0, f->file_size) < 0) { + td_verror(td, errno); + goto err; + } + b = malloc(td->max_bs); memset(b, 0, td->max_bs); -- 2.25.1