mirror of https://github.com/xemu-project/xemu.git
parallels: Add "explicit" argument to parallels_check_leak()
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>
This commit is contained in:
parent
09eb64f9e3
commit
728e10173b
|
@ -488,7 +488,7 @@ parallels_check_outside_image(BlockDriverState *bs, BdrvCheckResult *res,
|
||||||
|
|
||||||
static int coroutine_fn GRAPH_RDLOCK
|
static int coroutine_fn GRAPH_RDLOCK
|
||||||
parallels_check_leak(BlockDriverState *bs, BdrvCheckResult *res,
|
parallels_check_leak(BlockDriverState *bs, BdrvCheckResult *res,
|
||||||
BdrvCheckMode fix)
|
BdrvCheckMode fix, bool explicit)
|
||||||
{
|
{
|
||||||
BDRVParallelsState *s = bs->opaque;
|
BDRVParallelsState *s = bs->opaque;
|
||||||
int64_t size;
|
int64_t size;
|
||||||
|
@ -503,10 +503,13 @@ parallels_check_leak(BlockDriverState *bs, BdrvCheckResult *res,
|
||||||
if (size > res->image_end_offset) {
|
if (size > res->image_end_offset) {
|
||||||
int64_t count;
|
int64_t count;
|
||||||
count = DIV_ROUND_UP(size - res->image_end_offset, s->cluster_size);
|
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",
|
if (explicit) {
|
||||||
fix & BDRV_FIX_LEAKS ? "Repairing" : "ERROR",
|
fprintf(stderr,
|
||||||
size - res->image_end_offset);
|
"%s space leaked at the end of the image %" PRId64 "\n",
|
||||||
res->leaks += count;
|
fix & BDRV_FIX_LEAKS ? "Repairing" : "ERROR",
|
||||||
|
size - res->image_end_offset);
|
||||||
|
res->leaks += count;
|
||||||
|
}
|
||||||
if (fix & BDRV_FIX_LEAKS) {
|
if (fix & BDRV_FIX_LEAKS) {
|
||||||
Error *local_err = NULL;
|
Error *local_err = NULL;
|
||||||
|
|
||||||
|
@ -521,7 +524,9 @@ parallels_check_leak(BlockDriverState *bs, BdrvCheckResult *res,
|
||||||
res->check_errors++;
|
res->check_errors++;
|
||||||
return ret;
|
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;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = parallels_check_leak(bs, res, fix);
|
ret = parallels_check_leak(bs, res, fix, true);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue