summaryrefslogtreecommitdiffstats
path: root/mdadm.c
diff options
context:
space:
mode:
authorMariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>2023-05-29 15:52:38 +0200
committerJes Sorensen <jes@trained-monkey.org>2023-09-01 17:36:45 +0200
commit1dea84ae38288fbefa04d9fda2b3f36c21a9e1bd (patch)
tree3aee9aecfc1c9d43c7b53f267984156cdde4e480 /mdadm.c
parentimsm: return free space after volume for expand (diff)
downloadmdadm-1dea84ae38288fbefa04d9fda2b3f36c21a9e1bd.tar.xz
mdadm-1dea84ae38288fbefa04d9fda2b3f36c21a9e1bd.zip
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>
Diffstat (limited to 'mdadm.c')
0 files changed, 0 insertions, 0 deletions