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

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