]> git.ipfire.org Git - thirdparty/mdadm.git/commit
imsm: fix free space calculations
authorMariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
Mon, 29 May 2023 13:52:38 +0000 (15:52 +0200)
committerJes Sorensen <jes@trained-monkey.org>
Fri, 1 Sep 2023 15:36:45 +0000 (11:36 -0400)
commit1dea84ae38288fbefa04d9fda2b3f36c21a9e1bd
tree3aee9aecfc1c9d43c7b53f267984156cdde4e480
parentaa19fdd45b2ba474f6a51a6d4b8f3c44ef19dafd
imsm: fix free space calculations

Between two volumes or between last volume and metadata at least
IMSM_RESERVED_SECTORS gap must exist. Currently the gap can be doubled
because metadata reservation contains IMSM_RESERVED_SECTORS too.

Divide reserve variable into pre_reservation and post_reservation to be
more flexible and decide separately if each reservation is needed.

Pre_reservation is needed only when a volume is created and it is not a
real first volume in a container (we can check that by extent_idx).
This type of reservation is not needed for expand.

Post_reservation is not needed only if real last volume is created or
expanded because reservation is done with the metadata.

The volume index in metadata cannot be trusted, because the real volume
order can be reversed. It is safer to use extent table, it is sorted by
start position.

Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
Signed-off-by: Jes Sorensen <jes@trained-monkey.org>
super-intel.c