From: "Michael R. Hines" <mrhines@linux.vnet.ibm.com>
To: Isaku Yamahata <yamahata@private.email.ne.jp>
Cc: owasserm@redhat.com, quintela@redhat.com, mrhines@us.ibm.com,
qemu-devel@nongnu.org, pbonzini@redhat.com
Subject: Re: [Qemu-devel] [PATCH 1/3] rdma: don't use negative index to array
Date: Fri, 02 Aug 2013 09:28:34 -0400 [thread overview]
Message-ID: <51FBB402.1040108@linux.vnet.ibm.com> (raw)
In-Reply-To: <d046deff608a5a5592688b1a672fae5c8b71afc1.1375415452.git.yamahata@private.email.ne.jp>
On 08/01/2013 11:56 PM, Isaku Yamahata wrote:
> Cc: Michael R. Hines <mrhines@us.ibm.com>
> Signed-off-by: Isaku Yamahata <yamahata@private.email.ne.jp>
> ---
> migration-rdma.c | 27 +++++++++++++++------------
> 1 file changed, 15 insertions(+), 12 deletions(-)
>
> diff --git a/migration-rdma.c b/migration-rdma.c
> index 4828738..edbae9f 100644
> --- a/migration-rdma.c
> +++ b/migration-rdma.c
> @@ -1931,10 +1931,21 @@ static int qemu_rdma_write_flush(QEMUFile *f, RDMAContext *rdma)
> static inline int qemu_rdma_buffer_mergable(RDMAContext *rdma,
> uint64_t offset, uint64_t len)
> {
> - RDMALocalBlock *block =
> - &(rdma->local_ram_blocks.block[rdma->current_index]);
> - uint8_t *host_addr = block->local_host_addr + (offset - block->offset);
> - uint8_t *chunk_end = ram_chunk_end(block, rdma->current_chunk);
> + RDMALocalBlock *block;
> + uint8_t *host_addr;
> + uint8_t *chunk_end;
> +
> + if (rdma->current_index < 0) {
> + return 0;
> + }
> +
> + if (rdma->current_chunk < 0) {
> + return 0;
> + }
> +
> + block = &(rdma->local_ram_blocks.block[rdma->current_index]);
> + host_addr = block->local_host_addr + (offset - block->offset);
> + chunk_end = ram_chunk_end(block, rdma->current_chunk);
>
> if (rdma->current_length == 0) {
> return 0;
> @@ -1947,10 +1958,6 @@ static inline int qemu_rdma_buffer_mergable(RDMAContext *rdma,
> return 0;
> }
>
> - if (rdma->current_index < 0) {
> - return 0;
> - }
> -
> if (offset < block->offset) {
> return 0;
> }
> @@ -1959,10 +1966,6 @@ static inline int qemu_rdma_buffer_mergable(RDMAContext *rdma,
> return 0;
> }
>
> - if (rdma->current_chunk < 0) {
> - return 0;
> - }
> -
> if ((host_addr + len) > chunk_end) {
> return 0;
> }
Reviewed-by: Michael R. Hines <mrhines@us.ibm.com>
next prev parent reply other threads:[~2013-08-02 13:29 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-02 3:56 [Qemu-devel] [PATCH 0/3] rdma fixes and clean ups Isaku Yamahata
2013-08-02 3:56 ` [Qemu-devel] [PATCH 1/3] rdma: don't use negative index to array Isaku Yamahata
2013-08-02 13:28 ` Michael R. Hines [this message]
2013-08-02 3:56 ` [Qemu-devel] [PATCH 2/3] rdma: qemu_rdma_post_send_control uses wrongly RDMA_WRID_MAX Isaku Yamahata
2013-08-02 13:40 ` Michael R. Hines
2013-08-02 3:56 ` [Qemu-devel] [PATCH 3/3] rdma: use RDMA_WRID_READY Isaku Yamahata
2013-08-02 13:40 ` Michael R. Hines
2013-08-02 13:40 ` [Qemu-devel] [PATCH 0/3] rdma fixes and clean ups Michael R. Hines
2013-08-04 1:24 ` Isaku Yamahata
2013-08-04 2:55 ` Michael R. Hines
2013-08-14 16:28 ` Anthony Liguori
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=51FBB402.1040108@linux.vnet.ibm.com \
--to=mrhines@linux.vnet.ibm.com \
--cc=mrhines@us.ibm.com \
--cc=owasserm@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
--cc=yamahata@private.email.ne.jp \
/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).