From 7ab684c3125a1933264104b064cd7fbfc83c9323 Mon Sep 17 00:00:00 2001 From: Max Reitz Date: Tue, 18 Nov 2014 15:41:32 +0100 Subject: [PATCH 05/10] block/raw-posix: use seek_hole ahead of fiemap MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-id: <1416325296-5397-3-git-send-email-mreitz@redhat.com> Patchwork-id: 62445 O-Subject: [RHEV-7.1 qemu-kvm-rhev PATCH v2 2/6] block/raw-posix: use seek_hole ahead of fiemap Bugzilla: 1142331 RH-Acked-by: Paolo Bonzini RH-Acked-by: Kevin Wolf RH-Acked-by: Markus Armbruster From: Tony Breeds 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 (cherry picked from commit 7c15903789953ead14a417882657d52dc0c19a24) Signed-off-by: Max Reitz Signed-off-by: Miroslav Rezanina --- block/raw-posix.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/block/raw-posix.c b/block/raw-posix.c index 9fbc3eb..75c9507 100644 --- a/block/raw-posix.c +++ b/block/raw-posix.c @@ -1508,9 +1508,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; -- 1.8.3.1