cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

Blame SOURCES/kvm-block-add-default-get_block_status-implementation-fo.patch

218e99
From 815d053228bffeb0c2774f283c249ddf7f5fb03e Mon Sep 17 00:00:00 2001
218e99
From: Paolo Bonzini <pbonzini@redhat.com>
218e99
Date: Fri, 18 Oct 2013 08:14:46 +0200
218e99
Subject: [PATCH 21/81] block: add default get_block_status implementation for protocols
218e99
218e99
RH-Author: Paolo Bonzini <pbonzini@redhat.com>
218e99
Message-id: <1382084091-16636-22-git-send-email-pbonzini@redhat.com>
218e99
Patchwork-id: 55004
218e99
O-Subject: [RHEL 7.0 qemu-kvm PATCH 21/26] block: add default get_block_status implementation for protocols
218e99
Bugzilla: 989646
218e99
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
218e99
RH-Acked-by: Max Reitz <mreitz@redhat.com>
218e99
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
218e99
218e99
Protocols return raw data, so you can assume the offsets to pass
218e99
through unchanged.
218e99
218e99
Reviewed-by: Eric Blake <eblake@redhat.com>
218e99
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
218e99
(cherry picked from commit 918e92d71b38306a6bf4fedfd1109367f1425587)
218e99
---
218e99
 block.c | 6 +++++-
218e99
 1 file changed, 5 insertions(+), 1 deletion(-)
218e99
218e99
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
218e99
---
218e99
 block.c |    6 +++++-
218e99
 1 files changed, 5 insertions(+), 1 deletions(-)
218e99
218e99
diff --git a/block.c b/block.c
218e99
index 36a2f24..2a4a9dd 100644
218e99
--- a/block.c
218e99
+++ b/block.c
218e99
@@ -3060,7 +3060,11 @@ static int64_t coroutine_fn bdrv_co_get_block_status(BlockDriverState *bs,
218e99
 
218e99
     if (!bs->drv->bdrv_co_get_block_status) {
218e99
         *pnum = nb_sectors;
218e99
-        return BDRV_BLOCK_DATA;
218e99
+        ret = BDRV_BLOCK_DATA;
218e99
+        if (bs->drv->protocol_name) {
218e99
+            ret |= BDRV_BLOCK_OFFSET_VALID | (sector_num * BDRV_SECTOR_SIZE);
218e99
+        }
218e99
+        return ret;
218e99
     }
218e99
 
218e99
     ret = bs->drv->bdrv_co_get_block_status(bs, sector_num, nb_sectors, pnum);
218e99
-- 
218e99
1.7.1
218e99