From: Jens Axboe Date: Wed, 25 Oct 2006 09:21:05 +0000 (+0200) Subject: [PATCH] Use posix_fallocate() to force file layout X-Git-Tag: fio-1.8~39 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=40f8298cd252157fa15d93f8eb470116a94069a0 [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 --- 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);