1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-06-24 19:16:58 +03:00
lvm2/lib/metadata
Su Yue 93013c09be lvresize: add btrfs support
This commit adds lvresize/lvextend/lvreduce support for btrfs.
'btrfs filesystem resize [devid:][+/-]<newsize>[kKmMgGtTpPeE]|[devid:]max <path>'
is used to resize one device only when it's mounted.
The code pattern is like xfs but it supports shrink.

For multi-devices btrfs, There is one difficulty to be handled:

If `lvreduce --fs resize` is given, lvm2 will check newsize vs current fs size
to judge if it's need to shrink fs or not.
For one device btrfs, fslastblock * fsblocksize/FSSIZE is the correct value like
ext* and xfs. But for multi-devices btrfs, the two values are whole fs size.
There is no other way without relying btrfs superblock parse. It's too
complicated and inproper to implemnt the logic in lvm2.
So here just sets fs_last_byte to 0 for btrfs and skips boundary check in
_fs_reduce_allow(). It's safe as btrfs will handle it well.

The another complicated part is how to get mount point info if multi-devices.
There is only one mnt entry per mounted fs in /etc/mtab even it's a
multi-devices btrfs. So we first get uuid from lv device then traverse devices
under /sys/fs/btrfs/$uuid/devices and compare them to the mnt entry to get the
mount point.

Signed-off-by: Su Yue <glass.su@suse.com>
2025-05-13 12:27:17 -05:00
..
2025-05-13 12:27:17 -05:00
2024-10-30 12:59:08 +01:00
2025-01-17 14:06:21 -06:00
2025-02-17 15:51:03 +01:00
2016-01-21 12:11:37 +01:00
2022-02-24 17:22:04 -06:00
2021-08-16 11:31:15 -05:00
2018-06-05 16:23:18 +02:00
2024-05-04 01:01:57 +02:00
2025-02-10 11:31:53 +01:00
2024-10-31 17:55:31 +01:00
2024-10-31 17:55:31 +01:00