Re: [Qemu-block] [PATCH v2 10/13] block/mirror: condense cancellation and relax calls

2018-02-07 Thread Max Reitz
On 2018-01-19 21:58, John Snow wrote:
> We can count on the relax call to check cancellation for us, so
> condense these concurrent calls.
> 
> Signed-off-by: John Snow 
> ---
>  block/mirror.c | 8 ++--
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/block/mirror.c b/block/mirror.c
> index 3c73caed5e..a0e0044de2 100644
> --- a/block/mirror.c
> +++ b/block/mirror.c
> @@ -610,9 +610,7 @@ static int coroutine_fn mirror_dirty_init(MirrorBlockJob 
> *s)
>  int bytes = MIN(s->bdev_length - offset,
>  QEMU_ALIGN_DOWN(INT_MAX, s->granularity));
>  
> -block_job_relax(>common, 0);
> -
> -if (block_job_is_cancelled(>common)) {
> +if (block_job_relax(>common, 0)) {
>  s->initial_zeroing_ongoing = false;
>  return 0;
>  }
> @@ -638,9 +636,7 @@ static int coroutine_fn mirror_dirty_init(MirrorBlockJob 
> *s)
>  int bytes = MIN(s->bdev_length - offset,
>  QEMU_ALIGN_DOWN(INT_MAX, s->granularity));
>  
> -block_job_relax(>common, 0);
> -
> -if (block_job_is_cancelled(>common)) {
> +if (block_job_relax(>common, 0)) {
>  return 0;
>  }

“See last patch.”



signature.asc
Description: OpenPGP digital signature


[Qemu-block] [PATCH v2 10/13] block/mirror: condense cancellation and relax calls

2018-01-19 Thread John Snow
We can count on the relax call to check cancellation for us, so
condense these concurrent calls.

Signed-off-by: John Snow 
---
 block/mirror.c | 8 ++--
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/block/mirror.c b/block/mirror.c
index 3c73caed5e..a0e0044de2 100644
--- a/block/mirror.c
+++ b/block/mirror.c
@@ -610,9 +610,7 @@ static int coroutine_fn mirror_dirty_init(MirrorBlockJob *s)
 int bytes = MIN(s->bdev_length - offset,
 QEMU_ALIGN_DOWN(INT_MAX, s->granularity));
 
-block_job_relax(>common, 0);
-
-if (block_job_is_cancelled(>common)) {
+if (block_job_relax(>common, 0)) {
 s->initial_zeroing_ongoing = false;
 return 0;
 }
@@ -638,9 +636,7 @@ static int coroutine_fn mirror_dirty_init(MirrorBlockJob *s)
 int bytes = MIN(s->bdev_length - offset,
 QEMU_ALIGN_DOWN(INT_MAX, s->granularity));
 
-block_job_relax(>common, 0);
-
-if (block_job_is_cancelled(>common)) {
+if (block_job_relax(>common, 0)) {
 return 0;
 }
 
-- 
2.14.3