From: Tony Breeds Date: Thu, 25 Sep 2014 23:14:12 +0000 (+1000) Subject: block/raw-posix: use seek_hole ahead of fiemap X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=7c15903789953ead14a417882657d52dc0c19a24;p=qmiga%2Fqemu.git block/raw-posix: use seek_hole ahead of fiemap try_fiemap() uses FIEMAP_FLAG_SYNC which has a significant performance impact. 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: Michael Steffens Signed-off-by: Tony Breeds Cc: Kevin Wolf Cc: Markus Armbruster Cc: Stefan Hajnoczi Cc: Max Reitz Cc: Pádraig Brady Cc: Eric Blake Reviewed-by: Eric Blake Reviewed-by: Max Reitz Signed-off-by: Kevin Wolf --- diff --git a/block/raw-posix.c b/block/raw-posix.c index d672c739c8..eb76f0e233 100644 --- a/block/raw-posix.c +++ b/block/raw-posix.c @@ -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;