[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 05/18] parallels: Add "explicit" argument to parallels_check_leak(
From: |
Denis V. Lunev |
Subject: |
[PULL 05/18] parallels: Add "explicit" argument to parallels_check_leak() |
Date: |
Wed, 6 Sep 2023 17:49:38 +0200 |
From: Alexander Ivanov <alexander.ivanov@virtuozzo.com>
In the on of the next patches we need to repair leaks without changing
leaks and leaks_fixed info in res. Also we don't want to print any warning
about leaks. Add "explicit" argument to skip info changing if the argument
is false.
Signed-off-by: Alexander Ivanov <alexander.ivanov@virtuozzo.com>
Reviewed-by: Denis V. Lunev <den@openvz.org>
Signed-off-by: Denis V. Lunev <den@openvz.org>
---
block/parallels.c | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
diff --git a/block/parallels.c b/block/parallels.c
index 6a3d41373a..8bb5d115fc 100644
--- a/block/parallels.c
+++ b/block/parallels.c
@@ -488,7 +488,7 @@ parallels_check_outside_image(BlockDriverState *bs,
BdrvCheckResult *res,
static int coroutine_fn GRAPH_RDLOCK
parallels_check_leak(BlockDriverState *bs, BdrvCheckResult *res,
- BdrvCheckMode fix)
+ BdrvCheckMode fix, bool explicit)
{
BDRVParallelsState *s = bs->opaque;
int64_t size;
@@ -503,10 +503,13 @@ parallels_check_leak(BlockDriverState *bs,
BdrvCheckResult *res,
if (size > res->image_end_offset) {
int64_t count;
count = DIV_ROUND_UP(size - res->image_end_offset, s->cluster_size);
- fprintf(stderr, "%s space leaked at the end of the image %" PRId64
"\n",
- fix & BDRV_FIX_LEAKS ? "Repairing" : "ERROR",
- size - res->image_end_offset);
- res->leaks += count;
+ if (explicit) {
+ fprintf(stderr,
+ "%s space leaked at the end of the image %" PRId64 "\n",
+ fix & BDRV_FIX_LEAKS ? "Repairing" : "ERROR",
+ size - res->image_end_offset);
+ res->leaks += count;
+ }
if (fix & BDRV_FIX_LEAKS) {
Error *local_err = NULL;
@@ -521,7 +524,9 @@ parallels_check_leak(BlockDriverState *bs, BdrvCheckResult
*res,
res->check_errors++;
return ret;
}
- res->leaks_fixed += count;
+ if (explicit) {
+ res->leaks_fixed += count;
+ }
}
}
@@ -574,7 +579,7 @@ parallels_co_check(BlockDriverState *bs, BdrvCheckResult
*res,
return ret;
}
- ret = parallels_check_leak(bs, res, fix);
+ ret = parallels_check_leak(bs, res, fix, true);
if (ret < 0) {
return ret;
}
--
2.34.1
- [PULL 00/18] Parallels format driver, Denis V. Lunev, 2023/09/06
- [PULL 04/18] parallels: Check if data_end greater than the file size, Denis V. Lunev, 2023/09/06
- [PULL 05/18] parallels: Add "explicit" argument to parallels_check_leak(),
Denis V. Lunev <=
- [PULL 07/18] parallels: Add checking and repairing duplicate offsets in BAT, Denis V. Lunev, 2023/09/06
- [PULL 01/18] MAINTAINERS: add tree to keep parallels format driver changes, Denis V. Lunev, 2023/09/06
- [PULL 03/18] parallels: Incorrect data end calculation in parallels_open(), Denis V. Lunev, 2023/09/06
- [PULL 02/18] parallels: Fix comments formatting inside parallels driver, Denis V. Lunev, 2023/09/06
- [PULL 06/18] parallels: Add data_start field to BDRVParallelsState, Denis V. Lunev, 2023/09/06
- [PULL 09/18] parallels: Use bdrv_co_getlength() in parallels_check_outside_image(), Denis V. Lunev, 2023/09/06
- [PULL 08/18] parallels: Image repairing in parallels_open(), Denis V. Lunev, 2023/09/06
- [PULL 10/18] parallels: Add data_off check, Denis V. Lunev, 2023/09/06