summaryrefslogtreecommitdiff
path: root/file.h
diff options
context:
space:
mode:
authorEric Gouriou <egouriou@google.com>2011-06-17 09:11:45 +0200
committerJens Axboe <jaxboe@fusionio.com>2011-06-17 09:11:45 +0200
commita596f047e2b3d447ccca76bd075f05473a1f8d1c (patch)
tree4833642f157f78499fdcc5a120977ffb80821ab6 /file.h
parentd06093e70ee89e8440431b78846fa3815a9cb89d (diff)
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>
Diffstat (limited to 'file.h')
-rw-r--r--file.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/file.h b/file.h
index 04c0d45..b3ff051 100644
--- a/file.h
+++ b/file.h
@@ -43,6 +43,16 @@ enum {
};
/*
+ * No pre-allocation when laying down files, or call posix_fallocate(), or
+ * call fallocate() with FALLOC_FL_KEEP_SIZE set.
+ */
+enum fio_fallocate_mode {
+ FIO_FALLOCATE_NONE = 1,
+ FIO_FALLOCATE_POSIX = 2,
+ FIO_FALLOCATE_KEEP_SIZE = 3,
+};
+
+/*
* Each thread_data structure has a number of files associated with it,
* this structure holds state information for a single file.
*/