Skip to content

Commit

Permalink
block/block-copy: Simplify block_copy_do_copy()
Browse files Browse the repository at this point in the history
block_copy_do_copy() is static, only used in block_copy_task_entry
with the error_is_read argument set. No need to check for it,
simplify.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20200507121129.29760-3-philmd@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
  • Loading branch information
philmd authored and kevmw committed May 18, 2020
1 parent c78dd00 commit d7eca54
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions block/block-copy.c
Expand Up @@ -343,9 +343,7 @@ static int coroutine_fn block_copy_do_copy(BlockCopyState *s,
~BDRV_REQ_WRITE_COMPRESSED);
if (ret < 0) {
trace_block_copy_write_zeroes_fail(s, offset, ret);
if (error_is_read) {
*error_is_read = false;
}
*error_is_read = false;
}
return ret;
}
Expand Down Expand Up @@ -393,19 +391,15 @@ static int coroutine_fn block_copy_do_copy(BlockCopyState *s,
ret = bdrv_co_pread(s->source, offset, nbytes, bounce_buffer, 0);
if (ret < 0) {
trace_block_copy_read_fail(s, offset, ret);
if (error_is_read) {
*error_is_read = true;
}
*error_is_read = true;
goto out;
}

ret = bdrv_co_pwrite(s->target, offset, nbytes, bounce_buffer,
s->write_flags);
if (ret < 0) {
trace_block_copy_write_fail(s, offset, ret);
if (error_is_read) {
*error_is_read = false;
}
*error_is_read = false;
goto out;
}

Expand Down

0 comments on commit d7eca54

Please sign in to comment.