All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@redhat.com>
To: Fam Zheng <famz@redhat.com>
Cc: qemu-devel@nongnu.org, Paolo Bonzini <pbonzini@redhat.com>,
	Ronnie Sahlberg <ronniesahlberg@gmail.com>,
	qemu-block@nongnu.org, Kevin Wolf <kwolf@redhat.com>,
	Peter Lieven <pl@kamp.de>, Max Reitz <mreitz@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v3 7/9] iscsi: Implement copy offloading
Date: Thu, 10 May 2018 10:04:34 +0100	[thread overview]
Message-ID: <20180510090434.GI1296@stefanha-x1.localdomain> (raw)
In-Reply-To: <20180509145815.3330-8-famz@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1199 bytes --]

On Wed, May 09, 2018 at 10:58:13PM +0800, Fam Zheng wrote:
> +static int iscsi_populate_target_desc(unsigned char *desc, IscsiLun *lun)

The return values of these iscsi_populate_*() functions are unused and
don't make sense since the caller must already know the size ahead of
time.  I suggest removing them to simplify the code.

> +{
> +    struct scsi_inquiry_device_designator *dd = lun->dd;
> +
> +    memset(desc, 0, 32);
> +    desc[0] = IDENT_DESCR_TGT_DESCR;
> +    desc[4] = dd->code_set;
> +    desc[5] = (dd->designator_type & 0xF)
> +        | ((dd->association & 3) << 4);
> +    desc[7] = dd->designator_length;
> +    memcpy(desc + 8, dd->designator, dd->designator_length);
> +
> +    desc[28] = 0;
> +    desc[29] = (lun->block_size >> 16) & 0xFF;
> +    desc[30] = (lun->block_size >> 8) & 0xFF;
> +    desc[31] = lun->block_size & 0xFF;
> +
> +    return 32;
> +}
> +
> +static int iscsi_xcopy_desc_hdr(uint8_t *hdr, int dc, int cat, int src_index,
> +                                int dst_index)
> +{
> +    int desc_len = 28;

s/desc_len/XCOPY_BLK2BLK_SEG_DESC_SIZE/ ?

Then the 28 constant doesn't need to be duplicated.

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]

  reply	other threads:[~2018-05-10  9:04 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-09 14:58 [Qemu-devel] [PATCH v3 0/9] qemu-img convert with copy offloading Fam Zheng
2018-05-09 14:58 ` [Qemu-devel] [PATCH v3 1/9] block: Introduce API for " Fam Zheng
2018-05-10  8:44   ` Stefan Hajnoczi
2018-05-09 14:58 ` [Qemu-devel] [PATCH v3 2/9] raw: Implement " Fam Zheng
2018-05-09 15:17   ` Eric Blake
2018-05-11  6:19     ` Fam Zheng
2018-05-09 14:58 ` [Qemu-devel] [PATCH v3 3/9] qcow2: " Fam Zheng
2018-05-10  9:25   ` Stefan Hajnoczi
2018-05-10 14:51     ` Fam Zheng
2018-05-09 14:58 ` [Qemu-devel] [PATCH v3 4/9] file-posix: Implement bdrv_co_copy_range Fam Zheng
2018-05-10  8:50   ` Stefan Hajnoczi
2018-05-11  7:20     ` Fam Zheng
2018-05-09 14:58 ` [Qemu-devel] [PATCH v3 5/9] iscsi: Query and save device designator when opening Fam Zheng
2018-05-10  8:54   ` Stefan Hajnoczi
2018-05-09 14:58 ` [Qemu-devel] [PATCH v3 6/9] iscsi: Create and use iscsi_co_wait_for_task Fam Zheng
2018-05-09 15:19   ` Eric Blake
2018-05-10  8:58   ` Stefan Hajnoczi
2018-05-09 14:58 ` [Qemu-devel] [PATCH v3 7/9] iscsi: Implement copy offloading Fam Zheng
2018-05-10  9:04   ` Stefan Hajnoczi [this message]
2018-05-09 14:58 ` [Qemu-devel] [PATCH v3 8/9] block-backend: Add blk_co_copy_range Fam Zheng
2018-05-10  9:05   ` Stefan Hajnoczi
2018-05-09 14:58 ` [Qemu-devel] [PATCH v3 9/9] qemu-img: Convert with copy offloading Fam Zheng
2018-05-10  9:08   ` Stefan Hajnoczi

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=20180510090434.GI1296@stefanha-x1.localdomain \
    --to=stefanha@redhat.com \
    --cc=famz@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=pl@kamp.de \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=ronniesahlberg@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.