Patchwork [PATCHv2,10/20] iscsi: set limits in BlockDriverState

login
register
mail settings
Submitter Peter Lieven
Date Sept. 17, 2013, 1:48 p.m.
Message ID <1379425736-11326-11-git-send-email-pl@kamp.de>
Download mbox | patch
Permalink /patch/275467/
State New
Headers show

Comments

Peter Lieven - Sept. 17, 2013, 1:48 p.m.
Signed-off-by: Peter Lieven <pl@kamp.de>
---
 block/iscsi.c |   10 ++++++++++
 1 file changed, 10 insertions(+)
Eric Blake - Sept. 19, 2013, 8:14 p.m.
On 09/17/2013 07:48 AM, Peter Lieven wrote:
> Signed-off-by: Peter Lieven <pl@kamp.de>
> ---
>  block/iscsi.c |   10 ++++++++++
>  1 file changed, 10 insertions(+)

Reviewed-by: Eric Blake <eblake@redhat.com>

> 
> diff --git a/block/iscsi.c b/block/iscsi.c
> index aabcddb..21b1ecf 100644
> --- a/block/iscsi.c
> +++ b/block/iscsi.c
> @@ -1362,6 +1362,16 @@ static int iscsi_open(BlockDriverState *bs, QDict *options, int flags)
>                 sizeof(struct scsi_inquiry_block_limits));
>          scsi_free_scsi_task(task);
>          task = NULL;
> +        
> +        if (iscsilun->bl.max_unmap < 0xffffffff) {
> +            bs->max_discard = sector_lun2qemu(iscsilun->bl.max_unmap, iscsilun);
> +        }
> +        bs->discard_alignment = sector_lun2qemu(iscsilun->bl.opt_unmap_gran, iscsilun);
> +        
> +        if (iscsilun->bl.max_ws_len < 0xffffffff) {
> +            bs->max_write_zeroes = sector_lun2qemu(iscsilun->bl.max_ws_len, iscsilun);
> +        }
> +        bs->write_zeroes_alignment = sector_lun2qemu(iscsilun->bl.opt_unmap_gran, iscsilun);
>      }
>  
>  #if defined(LIBISCSI_FEATURE_NOP_COUNTER)
>

Patch

diff --git a/block/iscsi.c b/block/iscsi.c
index aabcddb..21b1ecf 100644
--- a/block/iscsi.c
+++ b/block/iscsi.c
@@ -1362,6 +1362,16 @@  static int iscsi_open(BlockDriverState *bs, QDict *options, int flags)
                sizeof(struct scsi_inquiry_block_limits));
         scsi_free_scsi_task(task);
         task = NULL;
+        
+        if (iscsilun->bl.max_unmap < 0xffffffff) {
+            bs->max_discard = sector_lun2qemu(iscsilun->bl.max_unmap, iscsilun);
+        }
+        bs->discard_alignment = sector_lun2qemu(iscsilun->bl.opt_unmap_gran, iscsilun);
+        
+        if (iscsilun->bl.max_ws_len < 0xffffffff) {
+            bs->max_write_zeroes = sector_lun2qemu(iscsilun->bl.max_ws_len, iscsilun);
+        }
+        bs->write_zeroes_alignment = sector_lun2qemu(iscsilun->bl.opt_unmap_gran, iscsilun);
     }
 
 #if defined(LIBISCSI_FEATURE_NOP_COUNTER)