On 2011-06-14 21:40, Eric Gouriou wrote: > 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. > > On systems where FALLOC_FL_KEEP_SIZE is available (i.e., Linux at this > time), this patch add a fallocate_keep_size option, which is off by > default. When *both* the options fallocate and fallocate_keep_size are > set, then fallocate() will be used with FALLOC_FL_KEEP_SIZE set, > instead of the default posix_fallocate(). > > Signed-off-by: Eric Gouriou <egouriou@xxxxxxxxxx> > --- > I tried to follow the existing style and practices. I am wondering > whether introducing 'fallocate_keep_size' is the best way, or whether > I should have changed the existing 'fallocate' option from a boolean > option to a string option. Let me know what you think. Perhaps we could use just the one option, and have 0/1 retain they meaning and add "keep" or something as the new variant. Other than that, just one comment: > diff --git a/helpers.c b/helpers.c > index 377dd02..0da2fd7 100644 > --- a/helpers.c > +++ b/helpers.c > @@ -14,6 +14,11 @@ int __weak posix_fallocate(int fd, off_t offset, off_t len) > { > return 0; > } > + > +int __weak fallocate(int fd, int mode, off_t offset, off_t len) > +{ > + return 0; > +} > #endif Say we have posix_fallocate() and not fallocate(), have it call posix_fallocate()? -- Jens Axboe -- To unsubscribe from this list: send the line "unsubscribe fio" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html