qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>,
	qemu-devel@nongnu.org, qemu-block@nongnu.org
Cc: pbonzini@redhat.com, den@openvz.org
Subject: Re: [Qemu-devel] [PATCH 1/2] nbd/server: fix nbd_co_send_block_status
Date: Thu, 5 Jul 2018 10:42:28 -0500	[thread overview]
Message-ID: <2fd38919-a733-692f-488d-3071eeea4bd1@redhat.com> (raw)
In-Reply-To: <20180704112302.471456-2-vsementsov@virtuozzo.com>

On 07/04/2018 06:23 AM, Vladimir Sementsov-Ogievskiy wrote:
> Call nbd_co_send_extents() with correct length parameter
> (extent.length may be smaller than original length).

Only matters for tracing purposes, but indeed worth an accurate trace.

> 
> Also, switch length parameter type to uint32_t, to correspond with
> request->len and similar nbd_co_send_bitmap().

No semantic impact.

> 
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
> ---
>   nbd/server.c | 5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/nbd/server.c b/nbd/server.c
> index e52b76bd1a..ea5fe0eb33 100644
> --- a/nbd/server.c
> +++ b/nbd/server.c
> @@ -1910,7 +1910,7 @@ static int nbd_co_send_extents(NBDClient *client, uint64_t handle,
>   /* Get block status from the exported device and send it to the client */
>   static int nbd_co_send_block_status(NBDClient *client, uint64_t handle,
>                                       BlockDriverState *bs, uint64_t offset,
> -                                    uint64_t length, bool last,
> +                                    uint32_t length, bool last,
>                                       uint32_t context_id, Error **errp)
>   {
>       int ret;
> @@ -1922,7 +1922,8 @@ static int nbd_co_send_block_status(NBDClient *client, uint64_t handle,
>                   client, handle, -ret, "can't get block status", errp);
>       }
>   
> -    return nbd_co_send_extents(client, handle, &extent, 1, length, last,
> +    return nbd_co_send_extents(client, handle, &extent, 1,
> +                               be32_to_cpu(extent.length), last,

be32_to_cpu() is necessary to undo the fact that extent is already 
encoded for transmission over the wire.  Alternatively, 
blockstatus_to_extent_be() could be modified to return negative on 
error, or the total length encoded on success, or set the final length 
via a pointer parameter.  But the next patch will probably deal with 
that more directly.

This one is fine for 3.0,
Reviewed-by: Eric Blake <eblake@redhat.com>

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

  reply	other threads:[~2018-07-05 15:42 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-04 11:23 [Qemu-devel] [PATCH 0/2] nbd base:allocation several extents Vladimir Sementsov-Ogievskiy
2018-07-04 11:23 ` [Qemu-devel] [PATCH 1/2] nbd/server: fix nbd_co_send_block_status Vladimir Sementsov-Ogievskiy
2018-07-05 15:42   ` Eric Blake [this message]
2018-07-04 11:23 ` [Qemu-devel] [PATCH 2/2] nbd/server: send more than one extent of base:allocation context Vladimir Sementsov-Ogievskiy
2018-07-05 15:59   ` Eric Blake
2018-07-05 16:18     ` Vladimir Sementsov-Ogievskiy
2018-07-10 14:33   ` Vladimir Sementsov-Ogievskiy
2018-07-20 20:42     ` Eric Blake

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=2fd38919-a733-692f-488d-3071eeea4bd1@redhat.com \
    --to=eblake@redhat.com \
    --cc=den@openvz.org \
    --cc=pbonzini@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=vsementsov@virtuozzo.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).