thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone
9ae3a8
From c1a149658ffb385f55e8bb06f06b6d195b91fd1b Mon Sep 17 00:00:00 2001
9ae3a8
From: Kevin Wolf <kwolf@redhat.com>
9ae3a8
Date: Mon, 9 Sep 2013 14:28:03 +0200
9ae3a8
Subject: [PATCH 12/38] block: Always enable discard on the protocol level
9ae3a8
9ae3a8
RH-Author: Kevin Wolf <kwolf@redhat.com>
9ae3a8
Message-id: <1378736903-18489-13-git-send-email-kwolf@redhat.com>
9ae3a8
Patchwork-id: 54196
9ae3a8
O-Subject: [RHEL-7.0 qemu-kvm PATCH 12/32] block: Always enable discard on the protocol level
9ae3a8
Bugzilla: 1005818
9ae3a8
RH-Acked-by: Fam Zheng <famz@redhat.com>
9ae3a8
RH-Acked-by: Max Reitz <mreitz@redhat.com>
9ae3a8
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
9ae3a8
Bugzilla: 1005818
9ae3a8
9ae3a8
Turning on discard options in qcow2 doesn't help a lot when the discard
9ae3a8
requests that it issues are thrown away by the raw-posix layer. This
9ae3a8
patch always enables discard functionality on the protocol level so that
9ae3a8
it's the image format's responsibility to send (or not) discard
9ae3a8
requests. Requests sent by the guest will be allowed or ignored by the
9ae3a8
top level BlockDriverState, which depends on the discard=... option like
9ae3a8
before.
9ae3a8
9ae3a8
In particular, this means that even without specifying options, the
9ae3a8
qcow2 default of discarding deleted snapshots actually takes effect now,
9ae3a8
both for qemu and qemu-img.
9ae3a8
9ae3a8
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
9ae3a8
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9ae3a8
(cherry picked from commit 50b05b6f2e24296b4d739a638e1e7427767ed7cd)
9ae3a8
9ae3a8
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
9ae3a8
---
9ae3a8
 block.c | 2 +-
9ae3a8
 1 file changed, 1 insertion(+), 1 deletion(-)
9ae3a8
9ae3a8
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
---
9ae3a8
 block.c |    2 +-
9ae3a8
 1 files changed, 1 insertions(+), 1 deletions(-)
9ae3a8
9ae3a8
diff --git a/block.c b/block.c
9ae3a8
index 2584ec7..20820fa 100644
9ae3a8
--- a/block.c
9ae3a8
+++ b/block.c
9ae3a8
@@ -1055,7 +1055,7 @@ int bdrv_open(BlockDriverState *bs, const char *filename, QDict *options,
9ae3a8
     extract_subqdict(options, &file_options, "file.");
9ae3a8
 
9ae3a8
     ret = bdrv_file_open(&file, filename, file_options,
9ae3a8
-                         bdrv_open_flags(bs, flags));
9ae3a8
+                         bdrv_open_flags(bs, flags | BDRV_O_UNMAP));
9ae3a8
     if (ret < 0) {
9ae3a8
         goto fail;
9ae3a8
     }
9ae3a8
-- 
9ae3a8
1.7.1
9ae3a8