]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
tests: (lsblk) capture multi-device filesystem sysfs in mk-input.sh
authorKarel Zak <kzak@redhat.com>
Tue, 12 May 2026 11:33:17 +0000 (13:33 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 12 May 2026 11:33:17 +0000 (13:33 +0200)
Add capture of /sys/fs/btrfs/<uuid>/devices/ and
/sys/fs/bcachefs/<uuid>/dev-*/block symlinks so that dumps
generated on systems with multi-device btrfs or bcachefs
filesystems include the sysfs data needed for mount propagation
testing.

Also add a "mnt" output with KNAME,FSTYPE,MOUNTPOINT,MOUNTPOINTS
columns.

Signed-off-by: Karel Zak <kzak@redhat.com>
tests/ts/lsblk/mk-input.sh

index 019b8e4a9f9d98f8625128d5e9d98d102b3ad387..23e085990df9ee48709348402df0e776b693a5ed 100755 (executable)
@@ -70,6 +70,34 @@ for x in ${DEVS}; do
 
 done
 
+#
+# multi-device filesystem sysfs
+#
+if [ -d /sys/fs/btrfs ]; then
+       for uuid_dir in /sys/fs/btrfs/*/; do
+               [ -d "$uuid_dir/devices" ] || continue
+               dst="${TS_DUMP}${uuid_dir}devices"
+               mkdir -p "$dst"
+               for dev in "$uuid_dir"devices/*; do
+                       [ -e "$dev" ] || continue
+                       cp --no-dereference "$dev" "$dst/" 2>/dev/null
+               done
+       done
+fi
+
+if [ -d /sys/fs/bcachefs ]; then
+       for uuid_dir in /sys/fs/bcachefs/*/; do
+               [ -d "$uuid_dir" ] || continue
+               for dev_dir in "$uuid_dir"dev-*/; do
+                       [ -d "$dev_dir" ] || continue
+                       dst="${TS_DUMP}${dev_dir}"
+                       mkdir -p "$dst"
+                       [ -L "${dev_dir}block" ] && \
+                               cp --no-dereference "${dev_dir}block" "$dst/"
+               done
+       done
+fi
+
 #
 # udev a lsblk specific
 #
@@ -114,6 +142,7 @@ mk_output rw RA,WSAME
 mk_output topo SIZE,ALIGNMENT,MIN-IO,OPT-IO,PHY-SEC,LOG-SEC,RQ-SIZE
 mk_output discard DISC-ALN,DISC-GRAN,DISC-MAX,DISC-ZERO
 mk_output zone ZONED
+mk_output mnt KNAME,FSTYPE,MOUNTPOINT,MOUNTPOINTS
 
 
 tar --xz -cvf ${TS_TARBALL} $TS_DUMP