On 25.06.2020 18:22, Max Reitz wrote:
Signed-off-by: Max Reitz <mre...@redhat.com>
---
  block/backup-top.c |  2 +-
  block/backup.c     |  9 +++++----
  blockdev.c         | 19 +++++++++++++++----
  3 files changed, 21 insertions(+), 9 deletions(-)


diff --git a/block/backup.c b/block/backup.c
index 4f13bb20a5..9afa0bf3b4 100644
--- a/block/backup.c
+++ b/block/backup.c
@@ -297,6 +297,7 @@ static int64_t 
backup_calculate_cluster_size(BlockDriverState *target,
  {
      int ret;
      BlockDriverInfo bdi;
+    bool target_does_cow = bdrv_backing_chain_next(target);


Wouldn't it better to make the explicit type conversion or use "!!" approach?

Andrey


      /*
       * If there is no backing file on the target, we cannot rely on COW if our
@@ -304,7 +305,7 @@ static int64_t 
backup_calculate_cluster_size(BlockDriverState *target,
       * targets with a backing file, try to avoid COW if possible.
       */
      ret = bdrv_get_info(target, &bdi);
-    if (ret == -ENOTSUP && !target->backing) {
+    if (ret == -ENOTSUP && !target_does_cow) {
          /* Cluster size is not defined */

...

Reviewed-by: Andrey Shinkevich <andrey.shinkev...@virtuozzo.com>



Reply via email to