cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

Blame SOURCES/kvm-block-raw-posix-use-seek_hole-ahead-of-fiemap.patch

958e1b
From 1e5cc3d3a5f9bf21d1df2967ac76b15d0e384950 Mon Sep 17 00:00:00 2001
09b1b5
From: Max Reitz <mreitz@redhat.com>
09b1b5
Date: Tue, 18 Nov 2014 15:30:16 +0100
958e1b
Subject: [PATCH 37/41] block/raw-posix: use seek_hole ahead of fiemap
09b1b5
MIME-Version: 1.0
09b1b5
Content-Type: text/plain; charset=UTF-8
09b1b5
Content-Transfer-Encoding: 8bit
09b1b5
09b1b5
Message-id: <1416324620-16229-4-git-send-email-mreitz@redhat.com>
09b1b5
Patchwork-id: 62438
09b1b5
O-Subject: [RHEL-7.1/7.0.z qemu-kvm PATCH v3 3/7] block/raw-posix: use seek_hole ahead of fiemap
958e1b
Bugzilla: 1160237
09b1b5
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
09b1b5
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
09b1b5
RH-Acked-by: Markus Armbruster <armbru@redhat.com>
09b1b5
09b1b5
From: Tony Breeds <tony@bakeyournoodle.com>
09b1b5
09b1b5
try_fiemap() uses FIEMAP_FLAG_SYNC which has a significant performance
09b1b5
impact.
09b1b5
09b1b5
Prefer seek_hole() over fiemap() to avoid this impact where possible.
09b1b5
seek_hole is more widely used and, arguably, has potential to be
09b1b5
optimised in the kernel.
09b1b5
09b1b5
Reported-By: Michael Steffens <michael_steffens@posteo.de>
09b1b5
Signed-off-by: Tony Breeds <tony@bakeyournoodle.com>
09b1b5
Cc: Kevin Wolf <kwolf@redhat.com>
09b1b5
Cc: Markus Armbruster <armbru@redhat.com>
09b1b5
Cc: Stefan Hajnoczi <stefanha@redhat.com>
09b1b5
Cc: Max Reitz <mreitz@redhat.com>
09b1b5
Cc: Pádraig Brady <pbrady@redhat.com>
09b1b5
Cc: Eric Blake <eblake@redhat.com>
09b1b5
Reviewed-by: Eric Blake <eblake@redhat.com>
09b1b5
Reviewed-by: Max Reitz <mreitz@redhat.com>
09b1b5
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
09b1b5
(cherry picked from commit 7c15903789953ead14a417882657d52dc0c19a24)
09b1b5
09b1b5
Signed-off-by: Max Reitz <mreitz@redhat.com>
09b1b5
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
09b1b5
---
09b1b5
 block/raw-posix.c | 4 ++--
09b1b5
 1 file changed, 2 insertions(+), 2 deletions(-)
09b1b5
09b1b5
diff --git a/block/raw-posix.c b/block/raw-posix.c
958e1b
index 8d31628..781ebf3 100644
09b1b5
--- a/block/raw-posix.c
09b1b5
+++ b/block/raw-posix.c
958e1b
@@ -1414,9 +1414,9 @@ static int64_t coroutine_fn raw_co_get_block_status(BlockDriverState *bs,
09b1b5
 
09b1b5
     start = sector_num * BDRV_SECTOR_SIZE;
09b1b5
 
09b1b5
-    ret = try_fiemap(bs, start, &data, &hole, nb_sectors, pnum);
09b1b5
+    ret = try_seek_hole(bs, start, &data, &hole, pnum);
09b1b5
     if (ret < 0) {
09b1b5
-        ret = try_seek_hole(bs, start, &data, &hole, pnum);
09b1b5
+        ret = try_fiemap(bs, start, &data, &hole, nb_sectors, pnum);
09b1b5
         if (ret < 0) {
09b1b5
             /* Assume everything is allocated. */
09b1b5
             data = 0;
09b1b5
-- 
09b1b5
1.8.3.1
09b1b5