test -n "$E2IMAGE_PROG" || _fail "e2image not installed"
$E2IMAGE_PROG -Q "$device" "$dumpfile"
[ "$compressopt" = "compress" ] && [ -n "$DUMP_COMPRESSOR" ] &&
- $DUMP_COMPRESSOR "$dumpfile" &>> "$seqres.full"
+ $DUMP_COMPRESSOR -f "$dumpfile" &>> "$seqres.full"
}
_test_mkfs()
fi
export MOUNT_OPTIONS="-o size=$fssize $TMPFS_MOUNT_OPTIONS"
;;
+ bcachefs)
+ $MKFS_PROG -t $FSTYP -- $MKFS_OPTIONS --fs_size=$fssize --block_size=$blocksize $SCRATCH_DEV
+ ;;
*)
_notrun "Filesystem $FSTYP not supported in _scratch_mkfs_sized"
;;
fi
case $FSTYP in
+ btrfs)
+ test -f /sys/fs/btrfs/features/supported_sectorsizes || \
+ _notrun "Subpage sectorsize support is not found in $FSTYP"
+
+ grep -wq $blocksize /sys/fs/btrfs/features/supported_sectorsizes || \
+ _notrun "$FSTYP does not support sectorsize=$blocksize yet"
+
+ _scratch_mkfs --sectorsize=$blocksize
+ ;;
xfs)
_scratch_mkfs_xfs $MKFS_OPTIONS -b size=$blocksize
;;
ocfs2)
yes | ${MKFS_PROG} -t $FSTYP -F $MKFS_OPTIONS -b $blocksize -C $blocksize $SCRATCH_DEV
;;
+ bcachefs)
+ ${MKFS_PROG} -t $FSTYP $MKFS_OPTIONS --block_size=$blocksize $SCRATCH_DEV
+ ;;
*)
_notrun "Filesystem $FSTYP not supported in _scratch_mkfs_blocksized"
;;
fi
return $res
;;
+ bcachefs)
+ # With bcachefs, if fsck detects any errors we consider it a bug and we
+ # want the test to fail:
+ _check_scratch_fs
+ ;;
*)
local dev=$SCRATCH_DEV
local fstyp=$FSTYP
fi
}
+_zone_type()
+{
+ local target=$1
+ if [ -z $target ]; then
+ echo "Usage: _zone_type <device>"
+ exit 1
+ fi
+ local sdev=`_short_dev $target`
+
+ if [ -e /sys/block/${sdev}/queue/zoned ]; then
+ cat /sys/block/${sdev}/queue/zoned
+ else
+ echo none
+ fi
+}
+
+_require_zoned_device()
+{
+ local target=$1
+ if [ -z $target ]; then
+ echo "Usage: _require_zoned_device <device>"
+ exit 1
+ fi
+
+ local type=`_zone_type ${target}`
+ if [ "${type}" = "none" ]; then
+ _notrun "this test require zoned block device"
+ fi
+}
+
+_require_non_zoned_device()
+{
+ local target=$1
+ if [ -z $target ]; then
+ echo "Usage: _require_non_zoned_device <device>"
+ exit 1
+ fi
+
+ local type=`_zone_type ${target}`
+ if [ "${type}" != "none" ]; then
+ _notrun "this test require non-zoned block device"
+ fi
+}
+
# this test requires the ext4 kernel support crc feature on scratch device
#
_require_scratch_ext4_crc()
# Minimum size for mkswap is 10 pages
_format_swapfile "$SCRATCH_MNT/swap" $(($(get_page_size) * 10))
- # ext* and xfs have supported all variants of swap files since their
+ # ext* has supported all variants of swap files since their
# introduction, so swapon should not fail.
case "$FSTYP" in
- ext2|ext3|ext4|xfs)
+ ext2|ext3|ext4)
if ! swapon "$SCRATCH_MNT/swap" >/dev/null 2>&1; then
- _scratch_unmount
- _fail "swapon failed for $FSTYP"
+ if _check_s_dax "$SCRATCH_MNT/swap" 1 >/dev/null; then
+ _scratch_unmount
+ _notrun "swapfiles are not supported"
+ else
+ _scratch_unmount
+ _fail "swapon failed for $FSTYP"
+ fi
fi
;;
*)
{
local target=$1
local exp_s_dax=$2
+ local ret=0
local attributes=$($XFS_IO_PROG -c 'statx -r' $target | awk '/stat.attributes / { print $3 }')
fi
if [ $exp_s_dax -eq 0 ]; then
- (( attributes & 0x00200000 )) && echo "$target has unexpected S_DAX flag"
+ if (( attributes & 0x00200000 )); then
+ echo "$target has unexpected S_DAX flag"
+ ret=1
+ fi
else
- (( attributes & 0x00200000 )) || echo "$target doesn't have expected S_DAX flag"
+ if ! (( attributes & 0x00200000 )); then
+ echo "$target doesn't have expected S_DAX flag"
+ ret=2
+ fi
fi
+ return $ret
}
_check_xflag()
}
# Require that the fundamental allocation unit of a file is the same as the
-# filesystem block size.
+# filesystem block size. The sole parameter must be the root dir of a
+# filesystem.
_require_file_block_size_equals_fs_block_size()
{
local file_alloc_unit="$(_get_file_block_size $1)"