On Tue, May 06, 2014 at 09:00:54PM +0200, Max Reitz wrote: > The current version of raw-posix always uses ioctl(FS_IOC_FIEMAP) if > FIEMAP is available; lseek with SEEK_HOLE/SEEK_DATA are not even > compiled in in this case. However, there may be implementations which > support the latter but not the former (e.g., NFSv4.2) as well as vice > versa. > > To cover both cases, always try SEEK_HOLE/SEEK_DATA (as this will > probably be covered by POSIX soon) and if that does not work, fall back > to FIEMAP; and if that does not work either, treat everything as > allocated.
Btw, while I think that SEEK_HOLE/SEEK_DATA generally is the better API for qemu, the NFS 4.2 SEEK operation will be sufficient for a proper FIEMAP implementation, and we'll implement it for the Linux NFS client.