Commit 7c159037 authored by Tony Breeds's avatar Tony Breeds Committed by Kevin Wolf

block/raw-posix: use seek_hole ahead of fiemap

try_fiemap() uses FIEMAP_FLAG_SYNC which has a significant performance

Prefer seek_hole() over fiemap() to avoid this impact where possible.
seek_hole is more widely used and, arguably, has potential to be
optimised in the kernel.
Reported-By: default avatarMichael Steffens <>
Signed-off-by: default avatarTony Breeds <>
Cc: Kevin Wolf <>
Cc: Markus Armbruster <>
Cc: Stefan Hajnoczi <>
Cc: Max Reitz <>
Cc: Pádraig Brady <>
Cc: Eric Blake <>
Reviewed-by: default avatarEric Blake <>
Reviewed-by: default avatarMax Reitz <>
Signed-off-by: default avatarKevin Wolf <>
parent 38c4d0ae
......@@ -1571,9 +1571,9 @@ static int64_t coroutine_fn raw_co_get_block_status(BlockDriverState *bs,
start = sector_num * BDRV_SECTOR_SIZE;
ret = try_fiemap(bs, start, &data, &hole, nb_sectors, pnum);
ret = try_seek_hole(bs, start, &data, &hole, pnum);
if (ret < 0) {
ret = try_seek_hole(bs, start, &data, &hole, pnum);
ret = try_fiemap(bs, start, &data, &hole, nb_sectors, pnum);
if (ret < 0) {
/* Assume everything is allocated. */
data = 0;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment