Richard W.M. Jones wrote:
On Wed, Sep 03, 2008 at 12:36:55PM -0500, Eric Sandeen wrote:
Hm, I probably need to get the fallocate.h header file included if it's not so that sys_fallocate can be used directly, but it is also exposed via posix_fallocate in glibc - tested here on xfs just because xfs_bmap is a handy way to show that it actually works via glibc:
Uh, stupid me - I was looking for the wrong call. Rawhide _does_ have it.
(c) Does ext4 preallocate in the background? A synchronous preallocate call isn't much use to virt-manager.
It does not, but what is the concern? It doesn't take much time:
(on ext4 this time):
[root@inode test]# time test_posix_fallocate testfile 0 10737418240
real 0m0.009s user 0m0.000s sys 0m0.009s
OK ... I'm assuming though that the zeroes aren't all written to disk in this time, so that is exactly what I wanted.
No, zeros are never written to disk if the ->fallocate call is supported. They are allocated, but flagged on-disk as unwritten/uninitialized, so any read (before a write, of course) will return zeros without the need for all that pesky writing business....
-Eric