Blob Blame Raw
From 8edbab3c2116944b96ba6bcbd36e8c2c5236cf5f Mon Sep 17 00:00:00 2001
Message-Id: <8edbab3c2116944b96ba6bcbd36e8c2c5236cf5f.1389014116.git.minovotn@redhat.com>
In-Reply-To: <c8cc35838d42aa286242772d97e3a9be7bb786ba.1389014116.git.minovotn@redhat.com>
References: <c8cc35838d42aa286242772d97e3a9be7bb786ba.1389014116.git.minovotn@redhat.com>
From: Paolo Bonzini <pbonzini@redhat.com>
Date: Mon, 9 Dec 2013 14:08:59 +0100
Subject: [PATCH 11/50] block/iscsi: add .bdrv_get_info

RH-Author: Paolo Bonzini <pbonzini@redhat.com>
Message-id: <1386598178-11845-14-git-send-email-pbonzini@redhat.com>
Patchwork-id: 56048
O-Subject: [RHEL 7.0 qemu-kvm PATCH 13/52] block/iscsi: add .bdrv_get_info
Bugzilla: 1007815
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
RH-Acked-by: Fam Zheng <famz@redhat.com>
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>

From: Peter Lieven <pl@kamp.de>

Signed-off-by: Peter Lieven <pl@kamp.de>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
(cherry picked from commit 186d4f2b1deaae5c404798959bfbdb781e762045)
---
 block/iscsi.c | 9 +++++++++
 1 file changed, 9 insertions(+)

Signed-off-by: Michal Novotny <minovotn@redhat.com>
---
 block/iscsi.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/block/iscsi.c b/block/iscsi.c
index 3a34eb7..1e8a2bb 100644
--- a/block/iscsi.c
+++ b/block/iscsi.c
@@ -1508,6 +1508,14 @@ out:
     return ret;
 }
 
+static int iscsi_get_info(BlockDriverState *bs, BlockDriverInfo *bdi)
+{
+    IscsiLun *iscsilun = bs->opaque;
+    bdi->unallocated_blocks_are_zero = !!iscsilun->lbprz;
+    bdi->can_write_zeroes_with_unmap = iscsilun->lbprz && iscsilun->lbp.lbpws;
+    return 0;
+}
+
 static QEMUOptionParameter iscsi_create_options[] = {
     {
         .name = BLOCK_OPT_SIZE,
@@ -1528,6 +1536,7 @@ static BlockDriver bdrv_iscsi = {
     .create_options  = iscsi_create_options,
 
     .bdrv_getlength  = iscsi_getlength,
+    .bdrv_get_info   = iscsi_get_info,
     .bdrv_truncate   = iscsi_truncate,
 
     .bdrv_co_get_block_status = iscsi_co_get_block_status,
-- 
1.7.11.7