[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
- Re: [Qemu-devel] [PATCH 07/12] block: introduce bdrv_zeroize, (continued)
[Qemu-devel] [PATCH 06/12] iscsi: add .bdrv_get_info,
Peter Lieven <=
[Qemu-devel] [PATCH 11/12] block/get_block_status: avoid redundant callouts on raw devices, Peter Lieven, 2013/09/13
[Qemu-devel] [PATCH 09/12] block/get_block_status: set *pnum = 0 on error, Peter Lieven, 2013/09/13
[Qemu-devel] [PATCH 10/12] block/get_block_status: avoid segfault if there is no backing_hd, Peter Lieven, 2013/09/13
[Qemu-devel] [PATCH 12/12] block/get_block_status: fix BDRV_BLOCK_ZERO for unallocated blocks, Peter Lieven, 2013/09/13