1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00
lvm2/lib/locking
corubba 4f4554164b lvmlockd: Fix sanlock lvmlock lv size calculation
The number of extents for the sanlock lvmlock lv is calculated using
integer division, which rounds towards zero. With a physical extent size
of 129M, instead of the requested 256M the lv is only 129M (1 extent).
With any physical extent size greater than 256M the lv creation fails
because the number of extents is zero.

This is fixed by replacing the integer division with a division macro
that rounds up and thus guarantees that the size of the lv will always
be equal or greater than the requested size. Using the examples above, a
pes of 129M will result in a 258M lv (2 extents), pes of 300M in a 300M
lv (1 extent).

The re-calculation of the lv size in bytes and megabytes is only so the
debug output shows the correct values. The size in mb there is still
not byte-perfect-accurate, but good enough for a human-readable estimate;
and the exact size in bytes and extents is right next to it.

Signed-off-by: corubba <corubba@gmx.de>
2022-10-12 09:19:01 -05:00
..
.exported_symbols Pre-release cleanups. 2009-05-21 03:04:52 +00:00
file_locking.c locking: unify global lock for flock and lockd 2019-04-29 13:01:05 -05:00
locking_types.h Implement lock-override options without locking type 2018-06-07 16:17:04 +01:00
locking.c label: cache dm device list 2021-12-20 16:13:28 +01:00
locking.h backup: automatically store data on vg_unlock 2021-06-09 14:56:13 +02:00
lvmlockd.c lvmlockd: Fix sanlock lvmlock lv size calculation 2022-10-12 09:19:01 -05:00
lvmlockd.h build: fix compilation without lvmlockd 2019-05-03 13:17:22 +02:00