[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] build regression on osx in block layer
From: |
Peter Maydell |
Subject: |
Re: [Qemu-devel] build regression on osx in block layer |
Date: |
Mon, 29 Sep 2014 14:58:05 +0100 |
On 29 September 2014 11:10, Igor Mammedov <address@hidden> wrote:
> Build fails with:
>
> $ make
> LINK qemu-nbd
> Undefined symbols for architecture x86_64:
> "_posix_fallocate", referenced from:
> _raw_create in raw-posix.o
> ld: symbol(s) not found for architecture x86_64
>
> introduced by
> 06247428be raw-posix: Add falloc and full preallocation
I think the MacOSX interface to this involves
fcntl(F_PREALLOCATE). This is what Mozilla uses:
fstore_t store = {F_ALLOCATECONTIG, F_PEOFPOSMODE, 0, aLength};
// Try to get a continous chunk of disk space
int ret = fcntl(fd, F_PREALLOCATE, &store);
if(-1 == ret){
// OK, perhaps we are too fragmented, allocate non-continuous
store.fst_flags = F_ALLOCATEALL;
ret = fcntl(fd, F_PREALLOCATE, &store);
if (-1 == ret)
return false;
}
return 0 == ftruncate(fd, aLength);
This has probably broken compilation on the BSDs
as well, since I don't suppose they all have
posix_fallocate(). In extremis we can implement
it with truncate-and-write, cf:
http://stackoverflow.com/questions/11497567/fallocate-command-equivalent-in-os-x
We probably need a util/qemu-fallocate.c...
In the meantime, maybe we should revert commits
06247428b and 0e4271b711a8 ?
thanks
-- PMM