parallels: Add checking and repairing duplicate offsets in BAT
authorAlexander Ivanov <alexander.ivanov@virtuozzo.com>
Tue, 18 Jul 2023 10:44:28 +0000 (12:44 +0200)
committerDenis V. Lunev <den@openvz.org>
Wed, 6 Sep 2023 15:36:49 +0000 (17:36 +0200)
commit6bb8bc63677adf16af663d863e5fe943244bf879
treef87c6f452d403e9a0a0e382afe202f1b380c7c22
parentc0b154533ee55b875176f632fe06993f7661b25a
parallels: Add checking and repairing duplicate offsets in BAT

Cluster offsets must be unique among all the BAT entries. Find duplicate
offsets in the BAT and fix it by copying the content of the relevant
cluster to a newly allocated cluster and set the new cluster offset to the
duplicated entry.

Add host_cluster_index() helper to deduplicate the code.

When new clusters are allocated, the file size increases by 128 Mb. Call
parallels_check_leak() to fix this leak.

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