Blame SOURCES/kvm-block-Always-enable-discard-on-the-protocol-level.patch

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