[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 05/10] parallels: Use highest_offset() helper in leak check
From: |
Alexander Ivanov |
Subject: |
[PATCH 05/10] parallels: Use highest_offset() helper in leak check |
Date: |
Wed, 17 Aug 2022 17:53:56 +0200 |
Deduplicate code by using highest_offset() helper.
Signed-off-by: Alexander Ivanov <alexander.ivanov@virtuozzo.com>
---
block/parallels.c | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)
diff --git a/block/parallels.c b/block/parallels.c
index bd129f44fa..93d21804f2 100644
--- a/block/parallels.c
+++ b/block/parallels.c
@@ -530,15 +530,8 @@ static int parallels_check_leak(BlockDriverState *bs,
{
BDRVParallelsState *s = bs->opaque;
int64_t off, high_off, count, cut_out;
- int i;
- high_off = 0;
- for (i = 0; i < s->bat_size; i++) {
- off = bat2sect(s, i) << BDRV_SECTOR_BITS;
- if (off > high_off) {
- high_off = off;
- }
- }
+ high_off = highest_offset(s);
cut_out = parallels_handle_leak(bs, res, high_off, fix & BDRV_FIX_LEAKS);
if (cut_out < 0) {
--
2.34.1
- [PATCH 00/10] parallels: Add duplication check, refactor, fix bugs, Alexander Ivanov, 2022/08/17
- [PATCH 02/10] parallels: Incorrect data end calculation in parallels_open, Alexander Ivanov, 2022/08/17
- [PATCH 01/10] parallels: Incorrect condition in out-of-image check, Alexander Ivanov, 2022/08/17
- [PATCH 03/10] parallels: Create parallels_handle_leak() to truncate excess clusters, Alexander Ivanov, 2022/08/17
- [PATCH 04/10] parallels: Add checking and repairing duplicate offsets in BAT, Alexander Ivanov, 2022/08/17
- [PATCH 05/10] parallels: Use highest_offset() helper in leak check,
Alexander Ivanov <=
- [PATCH 10/10] iotests: Fix cluster size in parallels images tests (131), Alexander Ivanov, 2022/08/17
- [PATCH 07/10] iotests: Add leak check test for parallels format, Alexander Ivanov, 2022/08/17
- [PATCH 06/10] iotests: Add out-of-image check test for parallels format, Alexander Ivanov, 2022/08/17
- [PATCH 08/10] iotests: Add test for BAT entries duplication check, Alexander Ivanov, 2022/08/17
- [PATCH 09/10] iotests: Refactor tests of parallels images checks (131), Alexander Ivanov, 2022/08/17