Re: an interface for filesystem preallocation that doesn't suck?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Richard W.M. Jones wrote:
> On Thu, Apr 02, 2009 at 05:44:07PM -0500, Eric Sandeen wrote:
>> James Ralston wrote:
>>
>>> I intend to start filing bugs against anything I can find that doesn't
>>> use fallocate(), yes.  But I needed a better implementation to suggest
>>> than posix_fallocate().
>> Cool.  Feel free to cc: me on them?
>>
>> FWIW transmission already can do it though it requires some
>> undocumented(?) configuration.
>>
>> It also gives you the choice of posix_fallocate(), or not.   It'd be
>> nice if you could say "fallocate if you've got it; but no
>> posix_fallocate, thanks"
> 
> I just wrote a new program that uses posix_fallocate to allocate large
> files (of zeroes).  Should I change it to use fallocate?  What's the
> recommended code snippet / autoconf configuration?

Good question, it'd be nice to have some canned recipe for this... but
TBH I'm no autoconf expert.

The downside of posix_fallocate is that it will fall back to explicit
zero-writing if the filesystem (or the kernel) doesn't support
sys_fallocate - and you won't know the difference, if you care ...

To call the syscall directly when glibc doesn't have fallocate(2) it's
something like:

error = syscall(SYS_fallocate, fd, falloc_mode, offset, length);

(modulo the vagaries of syscalls on some architectures) and for
fallocate(2) it's:

error = fallocate(fd, falloc_mode, offset, length);

but you probably meant a code snippet & autoconf magic for navigating
the possible calls available at any given time... :)

-Eric

> Rich.
> 

-- 
fedora-devel-list mailing list
fedora-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/fedora-devel-list

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]
  Powered by Linux