qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 06/12] iscsi: add .bdrv_get_info


From: Peter Lieven
Subject: [Qemu-devel] [PATCH 06/12] iscsi: add .bdrv_get_info
Date: Fri, 13 Sep 2013 12:25:03 +0200

Signed-off-by: Peter Lieven <address@hidden>
---
 block/iscsi.c |   24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/block/iscsi.c b/block/iscsi.c
index 3d7961d..438d45e 100644
--- a/block/iscsi.c
+++ b/block/iscsi.c
@@ -1577,6 +1577,29 @@ out:
     return ret;
 }
 
+static int iscsi_get_info(BlockDriverState *bs, BlockDriverInfo *bdi)
+{
+    IscsiLun *iscsilun = bs->opaque;
+    int max_discard = iscsilun->bl.max_unmap;
+    int max_write_zeroes = iscsilun->bl.max_ws_len;
+
+    if (max_discard == 0xffffffff) {
+        max_discard = ISCSI_MAX_UNMAP;
+    }
+    bdi->max_discard = sector_lun2qemu(max_discard, iscsilun);
+
+    if (max_write_zeroes == 0xffffffff) {
+        max_write_zeroes = ISCSI_MAX_WRITESAME;
+    }
+    bdi->max_write_zeroes = sector_lun2qemu(max_write_zeroes, iscsilun);
+
+    bdi->discard_zeroes =  iscsilun->lbprz;
+    bdi->discard_write_zeroes =  (bs->open_flags & BDRV_O_UNMAP) &&
+                                 iscsilun->lbprz && iscsilun->lbp.lbpws;
+
+    return 0;
+}
+
 static QEMUOptionParameter iscsi_create_options[] = {
     {
         .name = BLOCK_OPT_SIZE,
@@ -1597,6 +1620,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.9.5




reply via email to

[Prev in Thread] Current Thread [Next in Thread]