]> git.ipfire.org Git - thirdparty/util-linux.git/commit
lsblk: add bcachefs multi-device mount propagation
authorKarel Zak <kzak@redhat.com>
Mon, 11 May 2026 13:25:19 +0000 (15:25 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 12 May 2026 11:07:23 +0000 (13:07 +0200)
commita5bf11dda4a34c48bb6776e2278f0bdd7a65cf2e
treedc01837b779c01ef65f4aaafb7d2cb5a8bd16974
parent918bb9bbd36cbb3c7e76bf610638ffc634bc1238
lsblk: add bcachefs multi-device mount propagation

Add support for bcachefs multi-device filesystems to show mount points
on all member devices, not just the one listed in mountinfo.

The implementation follows the existing btrfs/ZFS multi-device group
framework in mnt.c:

 - Enumerate member devices via /sys/fs/bcachefs/<uuid>/dev-N/block
   symlinks (similar to btrfs /sys/fs/btrfs/<uuid>/devices/).

 - Cache and propagate mount entries to all group members.

The mountinfo entry caching (previously inlined in the btrfs scanner)
has been refactored into the shared fs_devs_cache_mounts() function
used by both btrfs and bcachefs. The function now also filters
mountinfo entries by filesystem type to avoid unnecessary comparisons
with unrelated mounts.

Additionally, fs_devs_add_filesystem() now skips duplicate entries to
prevent the same mount from being cached multiple times.

Note that bcachefs uses a non-standard colon-separated source format in
mountinfo (e.g. "/dev/sdc1:/dev/sdc2") rather than a single device
path. This format is not recognized by libmount's mnt_fs_streq_srcpath(),
so an extra is_source_member() helper is used to match individual
device paths within the compound source string.

Addresses: https://github.com/util-linux/util-linux/discussions/4316
Signed-off-by: Karel Zak <kzak@redhat.com>
lsblk-cmd/mnt.c