Does FreeBSD have fallocate(2) or equivalent? On Mon, Oct 30, 2017 at 4:32 PM, Ed Maste <emaste at freebsd.org> wrote:> On 23 October 2017 at 18:49, Rui Ueyama via llvm-dev > <llvm-dev at lists.llvm.org> wrote: > >> > >> BTW, posix_fallocate() might provide better portability and decrease the > >> likelihood of falling back on ftruncate(). > > > > Yes, but we want to avoid that function because when it falls back, it is > > very slow. What it does when fallocate(2) is not available is to actually > > write 0 to every block to make sure that all disk blocks are allocated. > > Note that posix_fallocate may return EINVAL if the underlying > filesystem does not support the operation. >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20171031/5c474aab/attachment.html>
On 31 October 2017 at 11:02, Rui Ueyama <ruiu at google.com> wrote:> Does FreeBSD have fallocate(2) or equivalent?FreeBSD has posix_fallocate; we do not have fallocate or fcntl(fd, F_PREALLOCATE, ...).
If you are still interested, this is the latest patch: https://reviews.llvm.org/D39464 With this patch, disk blocks are preallocated using fallocate (Linux), posix_fallocate (other Unices), or fcntl (macOS) before mmap'ing it. If an operating system or a filesystem don't support fallocate or equivalent, it uses an in-memory buffer instead so that a disk full error can be detected on FileOutputBuffer::commit(). On Mon, Nov 6, 2017 at 10:03 AM, Ed Maste <emaste at freebsd.org> wrote:> On 31 October 2017 at 11:02, Rui Ueyama <ruiu at google.com> wrote: > > Does FreeBSD have fallocate(2) or equivalent? > > FreeBSD has posix_fallocate; we do not have fallocate or fcntl(fd, > F_PREALLOCATE, ...). >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20171108/9ecc647b/attachment.html>