qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: Peter Lieven <pl@kamp.de>
Cc: pbonzini@redhat.com, ronniesahlberg@gmail.com,
	qemu-devel@nongnu.org, stefanha@redhat.com
Subject: Re: [Qemu-devel] [PATCHv2 01/11] iscsi: add logical block provisioning information to iscsilun
Date: Wed, 10 Jul 2013 11:19:32 +0200	[thread overview]
Message-ID: <20130710091932.GB3898@dhcp-200-207.str.redhat.com> (raw)
In-Reply-To: <1372338695-411-2-git-send-email-pl@kamp.de>

Am 27.06.2013 um 15:11 hat Peter Lieven geschrieben:
> Signed-off-by: Peter Lieven <pl@kamp.de>
> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  block/iscsi.c |   47 +++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 47 insertions(+)
> 
> diff --git a/block/iscsi.c b/block/iscsi.c
> index 0bbf0b1..a38a1bf 100644
> --- a/block/iscsi.c
> +++ b/block/iscsi.c
> @@ -49,6 +49,11 @@ typedef struct IscsiLun {
>      uint64_t num_blocks;
>      int events;
>      QEMUTimer *nop_timer;
> +    uint8_t lbpme;
> +    uint8_t lbprz;
> +    uint8_t lbpu;
> +    uint8_t lbpws;
> +    uint8_t lbpws10;
>  } IscsiLun;
>  
>  typedef struct IscsiAIOCB {
> @@ -948,6 +953,8 @@ static int iscsi_readcapacity_sync(IscsiLun *iscsilun)
>                  } else {
>                      iscsilun->block_size = rc16->block_length;
>                      iscsilun->num_blocks = rc16->returned_lba + 1;
> +                    iscsilun->lbpme = rc16->lbpme;
> +                    iscsilun->lbprz = rc16->lbprz;
>                  }
>              }
>              break;
> @@ -1130,6 +1137,46 @@ static int iscsi_open(BlockDriverState *bs, QDict *options, int flags)
>          bs->sg = 1;
>      }
>  
> +    if (iscsilun->lbpme) {
> +        struct scsi_inquiry_logical_block_provisioning *inq_lbp;
> +        int full_size;
> +
> +        task = iscsi_inquiry_sync(iscsi, iscsilun->lun, 1,
> +                                  SCSI_INQUIRY_PAGECODE_LOGICAL_BLOCK_PROVISIONING,
> +                                  64);
> +        if (task == NULL || task->status != SCSI_STATUS_GOOD) {
> +            error_report("iSCSI: Inquiry command failed : %s",
> +                   iscsi_get_error(iscsilun->iscsi));

The indentation is off here.

> +            ret = -EINVAL;
> +            goto out;
> +        }
> +        full_size = scsi_datain_getfullsize(task);
> +        if (full_size > task->datain.size) {
> +            scsi_free_scsi_task(task);
> +
> +            /* we need more data for the full list */
> +            task = iscsi_inquiry_sync(iscsi, iscsilun->lun, 1,
> +                                      SCSI_INQUIRY_PAGECODE_LOGICAL_BLOCK_PROVISIONING,
> +                                      full_size);
> +            if (task == NULL || task->status != SCSI_STATUS_GOOD) {
> +                error_report("iSCSI: Inquiry command failed : %s",
> +                             iscsi_get_error(iscsilun->iscsi));
> +                ret = -EINVAL;
> +                goto out;
> +            }
> +        }
> +
> +        inq_lbp = scsi_datain_unmarshall(task);
> +        if (inq_lbp == NULL) {
> +            error_report("iSCSI: failed to unmarshall inquiry datain blob");
> +            ret = -EINVAL;
> +            goto out;
> +        }
> +        iscsilun->lbpu = inq_lbp->lbpu;
> +        iscsilun->lbpws = inq_lbp->lbpws;
> +        iscsilun->lbpws10 = inq_lbp->lbpws10;
> +    }

As mentioned in Stefan's mail, scsi_free_scsi_task() should be added in
this patch rather than patch 2.

Kevin

  parent reply	other threads:[~2013-07-10  9:19 UTC|newest]

Thread overview: 69+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-27 13:11 [Qemu-devel] [PATCHv2 00/11] iscsi/qemu-img/block-migration enhancements Peter Lieven
2013-06-27 13:11 ` [Qemu-devel] [PATCHv2 01/11] iscsi: add logical block provisioning information to iscsilun Peter Lieven
2013-07-01 13:35   ` Stefan Hajnoczi
2013-07-01 16:08     ` Peter Lieven
2013-07-10  9:19   ` Kevin Wolf [this message]
2013-06-27 13:11 ` [Qemu-devel] [PATCHv2 02/11] iscsi: read unmap info from block limits vpd page Peter Lieven
2013-07-03  3:43   ` ronnie sahlberg
2013-07-03 21:23     ` Peter Lieven
2013-07-04 12:37       ` Paolo Bonzini
2013-07-04 21:07         ` Peter Lieven
2013-07-05  6:28           ` Paolo Bonzini
2013-07-05  7:11           ` ronnie sahlberg
2013-07-06 22:15             ` Peter Lieven
2013-07-06 23:23               ` ronnie sahlberg
2013-07-10  9:23   ` Kevin Wolf
2013-07-10  9:25   ` Kevin Wolf
2013-06-27 13:11 ` [Qemu-devel] [PATCHv2 03/11] iscsi: add bdrv_co_is_allocated Peter Lieven
2013-07-01 13:46   ` Stefan Hajnoczi
2013-07-01 16:00     ` Peter Lieven
2013-07-10  9:41   ` Kevin Wolf
2013-07-10 13:49     ` Peter Lieven
2013-07-10 14:43       ` Kevin Wolf
2013-07-10 14:49         ` Peter Lieven
2013-07-10 14:54           ` Kevin Wolf
2013-06-27 13:11 ` [Qemu-devel] [PATCHv2 04/11] iscsi: add bdrv_co_write_zeroes Peter Lieven
2013-07-10  9:54   ` Kevin Wolf
2013-06-27 13:11 ` [Qemu-devel] [PATCHv2 05/11] block: add bdrv_write_zeroes() Peter Lieven
2013-07-10  9:56   ` Kevin Wolf
2013-06-27 13:11 ` [Qemu-devel] [PATCHv2 06/11] block/raw: add bdrv_co_write_zeroes Peter Lieven
2013-07-10  9:57   ` Kevin Wolf
2013-06-27 13:11 ` [Qemu-devel] [PATCHv2 07/11] iscsi: let bdrv_create conditionally zero out the device Peter Lieven
2013-07-01 13:58   ` Stefan Hajnoczi
2013-07-01 20:20   ` Paolo Bonzini
2013-07-01 21:36     ` Peter Lieven
2013-07-02  9:22       ` Paolo Bonzini
2013-07-02 10:36         ` Peter Lieven
2013-07-02 10:49           ` Paolo Bonzini
2013-07-02 10:56             ` Peter Lieven
2013-07-02 11:04               ` Paolo Bonzini
2013-07-02 11:18                 ` Peter Lieven
2013-07-10 10:14   ` Kevin Wolf
2013-07-10 13:52     ` Peter Lieven
2013-06-27 13:11 ` [Qemu-devel] [PATCHv2 08/11] block-migration: efficiently encode zero blocks Peter Lieven
2013-07-01 14:13   ` Stefan Hajnoczi
2013-07-01 15:55     ` Peter Lieven
2013-07-02  7:40       ` Stefan Hajnoczi
2013-07-02 10:51         ` Paolo Bonzini
2013-07-01 16:09     ` Peter Lieven
2013-07-02  7:36       ` Stefan Hajnoczi
2013-06-27 13:11 ` [Qemu-devel] [PATCHv2 09/11] iscsi: factor out sector conversions Peter Lieven
2013-07-10 11:29   ` Kevin Wolf
2013-07-10 14:07     ` Peter Lieven
2013-06-27 13:11 ` [Qemu-devel] [PATCHv2 10/11] iscsi: ignore aio_discard if unsupported Peter Lieven
2013-07-10 11:33   ` Kevin Wolf
2013-07-10 14:04     ` Peter Lieven
2013-07-10 14:28       ` Kevin Wolf
2013-07-10 14:49         ` Peter Lieven
2013-07-10 14:58           ` Kevin Wolf
2013-07-10 20:31             ` Peter Lieven
2013-06-27 13:11 ` [Qemu-devel] [PATCHv2 11/11] iscsi: assert that sectors are aligned to LUN blocksize Peter Lieven
2013-07-01 14:35   ` Stefan Hajnoczi
2013-07-01 15:59     ` Peter Lieven
2013-07-02  7:44       ` Stefan Hajnoczi
2013-07-02  8:28         ` Peter Lieven
2013-07-02 10:44           ` Paolo Bonzini
2013-07-02 10:49             ` Peter Lieven
2013-07-02 10:53               ` Paolo Bonzini
2013-07-10 11:38   ` Kevin Wolf
2013-07-10 14:02     ` Peter Lieven

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130710091932.GB3898@dhcp-200-207.str.redhat.com \
    --to=kwolf@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=pl@kamp.de \
    --cc=qemu-devel@nongnu.org \
    --cc=ronniesahlberg@gmail.com \
    --cc=stefanha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).