On Thu, May 08, 2014 at 08:57:55PM +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, 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 <[email protected]>
> ---
> v4:
>  - If the order of FIEMAP and SEEK_HOLE are reversed (that is, kept the
>    way they are now), the tristates from v3 are not required anymore, as
>    FIEMAP can never be in an “unknown” state and the worst that
>    SEEK_HOLE can do is to report everything as allocated (which is the
>    final fallback anyway). This patch is thus basically the same as v2,
>    only with the order of FIEMAP and SEEK_HOLE reversed (first FIEMAP,
>    then SEEK_HOLE). [Paolo]
> ---
>  block/raw-posix.c | 127 
> +++++++++++++++++++++++++++++++++---------------------
>  1 file changed, 77 insertions(+), 50 deletions(-)

Thanks, applied to my block tree:
https://github.com/stefanha/qemu/commits/block

Stefan

Reply via email to