$XFS_INFO_PROG "$path" | grep realtime | sed -e 's/^.*extsz=\([0-9]*\).*$/\1/g'
}
+# Set or clear the realtime status of every supplied path. The first argument
+# is either 'data' or 'realtime'. All other arguments should be paths to
+# existing directories or empty regular files.
+#
+# For each directory, each file subsequently created will target the given
+# device for file data allocations. For each empty regular file, each
+# subsequent file data allocation will be on the given device.
+_xfs_force_bdev()
+{
+ local device="$1"
+ shift
+ local chattr_arg=""
+
+ case "$device" in
+ "data") chattr_arg="-t";;
+ "realtime") chattr_arg="+t";;
+ *)
+ echo "${device}: Don't know what device this is?"
+ return 1
+ ;;
+ esac
+
+ $XFS_IO_PROG -c "chattr $chattr_arg" "$@"
+}
+
_xfs_get_fsxattr()
{
local field="$1"
$XFS_METADUMP_PROG $options "$device" "$metadump"
res=$?
[ "$compressopt" = "compress" ] && [ -n "$DUMP_COMPRESSOR" ] &&
- $DUMP_COMPRESSOR "$metadump" &> /dev/null
+ $DUMP_COMPRESSOR -f "$metadump" &> /dev/null
return $res
}
ok=0
fi
- # xfs_check runs out of memory on large files, so even providing the test
- # option (-t) to avoid indexing the free space trees doesn't make it pass on
- # large filesystems. Avoid it.
- if [ "$LARGE_SCRATCH_DEV" != yes ]; then
+ # xfs_check runs out of memory on large files, so even providing the
+ # test option (-t) to avoid indexing the free space trees doesn't make
+ # it pass on large filesystems. Avoid it.
+ #
+ # As of August 2021, xfs_repair completely supersedes xfs_check's
+ # ability to find corruptions, so we no longer run xfs_check unless
+ # forced to run it.
+ if [ "$LARGE_SCRATCH_DEV" != yes ] && [ "$FORCE_XFS_CHECK_PROG" = "yes" ]; then
_xfs_check $extra_log_options $device 2>&1 > $tmp.fs_check
fi
if [ -s $tmp.fs_check ]; then
done
}
+# Unmount an XFS with a dirty log
+_scratch_xfs_unmount_dirty()
+{
+ local f="$SCRATCH_MNT/.dirty_umount"
+
+ rm -f "$f"
+ echo "test" > "$f"
+ sync
+ _scratch_shutdown
+ _scratch_unmount
+}
+
# Skip if we are running an older binary without the stricter input checks.
# Make multiple checks to be sure that there is no regression on the one
# selected feature check, which would skew the result.
fi
}
+_require_scratch_xfs_shrink()
+{
+ _require_scratch
+ _require_command "$XFS_GROWFS_PROG" xfs_growfs
+
+ _scratch_mkfs_xfs | _filter_mkfs 2>$tmp.mkfs >/dev/null
+ . $tmp.mkfs
+ _scratch_mount
+ # here just to check if kernel supports, no need do more extra work
+ local errmsg
+ errmsg=$($XFS_GROWFS_PROG -D$((dblocks-1)) "$SCRATCH_MNT" 2>&1)
+ if [ "$?" -ne 0 ]; then
+ echo "$errmsg" | grep 'XFS_IOC_FSGROWFSDATA xfsctl failed: Invalid argument' > /dev/null && \
+ _notrun "kernel does not support shrinking"
+ echo "$errmsg" | grep 'data size .* too small, old size is ' > /dev/null && \
+ _notrun "xfsprogs does not support shrinking"
+ _fail "$XFS_GROWFS_PROG failed unexpectedly: $errmsg"
+ fi
+ _scratch_unmount
+}
+
# XFS ability to change UUIDs on V5/CRC filesystems
#
_require_meta_uuid()