]> rtime.felk.cvut.cz Git - lisovros/qemu_apohw.git/commit
block/raw-posix: Try both FIEMAP and SEEK_HOLE
authorMax Reitz <mreitz@redhat.com>
Thu, 8 May 2014 18:57:55 +0000 (20:57 +0200)
committerStefan Hajnoczi <stefanha@redhat.com>
Fri, 9 May 2014 18:57:32 +0000 (20:57 +0200)
commit4f11aa8a40351b28c0e67c7276e0003b38cc46ac
treeaa252335b23db6769a12fcc2e7466d54daaf2bf0
parent4557117d9eed8cadc360aec23b42fc39a7011864
block/raw-posix: Try both FIEMAP and SEEK_HOLE

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, try FIEMAP first (as this will return -ENOTSUP if
not supported instead of returning a failsafe value (everything
allocated as a single extent)) and if that does not work, fall back to
SEEK_HOLE/SEEK_DATA.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
block/raw-posix.c