Add ability to invoke fallocate() FALLOC_FL_KEEP_SIZE.
authorEric Gouriou <egouriou@google.com>
Fri, 17 Jun 2011 07:11:45 +0000 (09:11 +0200)
committerJens Axboe <jaxboe@fusionio.com>
Fri, 17 Jun 2011 07:11:45 +0000 (09:11 +0200)
commita596f047e2b3d447ccca76bd075f05473a1f8d1c
tree4833642f157f78499fdcc5a120977ffb80821ab6
parentd06093e70ee89e8440431b78846fa3815a9cb89d
Add ability to invoke fallocate() FALLOC_FL_KEEP_SIZE.

Linux offers fallocate() and the FALLOC_FL_KEEP_SIZE option as
an alternative to posix_fallocate(). When FALLOC_FL_KEEP_SIZE is
specified for an falloc request going beyond the end of the file,
the requested blocks get preallocated without changing the apparent
size of the file. This is is a commonly recommended use of fallocate()
for workloads performing append writes.

This patch modifies the fallocate option from a boolean option
to a string option accepting none/posix/keep/0/1. 'keep' is only
made available on systems where FALLOC_FL_KEEP_SIZE is available
(i.e., Linux at this time). If specified, fallocate() is used
with FALLOC_FL_KEEP_SIZE set. 'none' disables pre-allocation while
'posix' uses posix_fallocate(). The default behavior remains unchaned,
i.e., invoking posix_fallocate. The settings '0'/'1' are there to
provide backward compatibility for users who had explicitly set the
boolean option.

Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
HOWTO
file.h
filesetup.c
fio.1
fio.h
options.c
os/os-linux.h