- Set TEST_FS_MODULE_RELOAD=1 to unload the module and reload
it between test invocations. This assumes that the name of
the module is the same as FSTYP.
- - Set DUMP_CORRUPT_FS=1 to record metadata dumps of XFS or ext*
- filesystems if a filesystem check fails.
+ - Set DUMP_CORRUPT_FS=1 to record metadata dumps of XFS, ext* or
+ btrfs filesystems if a filesystem check fails.
- Set DUMP_COMPRESSOR to a compression program to compress
metadumps of filesystems. This program must accept '-f' and the
name of a file to compress; and it must accept '-d -f -k' and
fi
rm -f $tmp.fsck
+ if [ $ok -eq 0 ] && [ "$DUMP_CORRUPT_FS" = "1" ]; then
+ local flatdev="$(basename "$device")"
+ _btrfs_metadump "$device" "$seqres.$flatdev.check.md" >>$seqres.full
+ fi
+
if [ $ok -eq 0 ]; then
echo "*** mount output ***" >>$seqres.full
_mount >>$seqres.full
grep -wq $sectorsize /sys/fs/btrfs/features/supported_sectorsizes || \
_notrun "sectorsize $sectorsize is not supported"
}
+
+_btrfs_metadump()
+{
+ local device="$1"
+ local dumpfile="$2"
+
+ test -n "$BTRFS_IMAGE_PROG" || _fail "btrfs-image not installed"
+ $BTRFS_IMAGE_PROG "$device" "$dumpfile"
+ [ -n "$DUMP_COMPRESSOR" ] && $DUMP_COMPRESSOR -f "$dumpfile" &> /dev/null
+}
export E2IMAGE_PROG="$(type -P e2image)"
export BLKZONE_PROG="$(type -P blkzone)"
export GZIP_PROG="$(type -P gzip)"
+export BTRFS_IMAGE_PROG="$(type -P btrfs-image)"
# use 'udevadm settle' or 'udevsettle' to wait for lv to be settled.
# newer systems have udevadm command but older systems like RHEL5 don't.
test "$DUMP_CORRUPT_FS" = 1 || return 0
case "$FSTYP" in
+ btrfs)
+ _btrfs_metadump $device $dumpfile
+ ;;
ext*)
_ext4_metadump $device $dumpfile $compressopt
;;