[PATCH] D39464: Define fs::allocate_file which preallocates disk blocks.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 13 16:59:56 PST 2017


On Tue, Nov 14, 2017 at 2:40 AM, Kamil Rytarowski <n54 at gmx.com> wrote:

> On 13.11.2017 18:19, Rafael Avila de Espindola wrote:
> > Kamil Rytarowski via Phabricator <reviews at reviews.llvm.org> writes:
> >
> >> krytarowski added inline comments.
> >>
> >>
> >> ================
> >> Comment at: llvm/lib/Support/Unix/Path.inc:436
> >>        return std::error_code(Err, std::generic_category());
> >> +    return make_error_code(errc::function_not_supported);
> >>    }
> >> ----------------
> >> NetBSD needs `ftruncate`(2) as a fallback for `posix_fallocate`(2).
> >>
> >> In the default setup `posix_fallocate`() returns EOPNOTSUPP.
> >
> > Will ftruncate allocate space on netbsd? Note that it is OK for
> > allocate_file to fail. The user then has to use a buffer and write(2)
> > instead of mmap for output.
> >
> > Cheers,
> > Rafael
> >
>
> ftruncate(2)/NetBSD as an extension extends area and makes it
> zero-filled. It's equivalent to lseek(2) + write(2).
>

If ftruncate is equivalent to lseek and write on that platform, it creates
a sparse file.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171114/feb4507e/attachment.html>


More information about the llvm-commits mailing list