{
if [ -f ${RESULT_DIR}/require_test ]; then
_check_test_fs || err=true
- rm -f ${RESULT_DIR}/require_test
+ rm -f ${RESULT_DIR}/require_test*
fi
if [ -f ${RESULT_DIR}/require_scratch ]; then
_check_scratch_fs || err=true
- rm -f ${RESULT_DIR}/require_scratch
+ rm -f ${RESULT_DIR}/require_scratch*
fi
}
[ $? -eq 0 ] || _notrun "$BTRFS_UTIL_PROG too old (must support $cmd $param)"
}
+# Require extra check on btrfs qgroup numbers
+_require_btrfs_qgroup_report()
+{
+ _require_btrfs_command check --qgroup-report
+ touch ${RESULT_DIR}/require_scratch.require_qgroup_report
+}
+
_run_btrfs_util_prog()
{
run_check $BTRFS_UTIL_PROG $*
mountpoint=`_umount_or_remount_ro $device`
fi
- btrfsck $device >$tmp.fsck 2>&1
+ if [ -f ${RESULT_DIR}/require_scratch.require_qgroup_report ]; then
+ $BTRFS_UTIL_PROG check $device --qgroup-report > $tmp.qgroup_report 2>&1
+ if grep -qE "Counts for qgroup.*are different" $tmp.qgroup_report ; then
+ echo "_check_btrfs_filesystem: filesystem on $device has wrong qgroup numbers (see $seqres.full)"
+ echo "_check_btrfs_filesystem: filesystem on $device has wrong qgroup numbers" \
+ >> $seqres.full
+ echo "*** qgroup_report.$FSTYP output ***" >>$seqres.full
+ cat $tmp.qgroup_report >>$seqres.full
+ echo "*** qgroup_report.$FSTYP output ***" >>$seqres.full
+ fi
+ rm -f $tmp.qgroup_report
+ fi
+
+ $BTRFS_UTIL_PROG check $device >$tmp.fsck 2>&1
if [ $? -ne 0 ]; then
echo "_check_btrfs_filesystem: filesystem on $device is inconsistent (see $seqres.full)"
{
echo "$*" > $seqres.notrun
echo "$seq not run: $*"
- rm -f ${RESULT_DIR}/require_test
- rm -f ${RESULT_DIR}/require_scratch
+ rm -f ${RESULT_DIR}/require_test*
+ rm -f ${RESULT_DIR}/require_scratch*
+
status=0
exit
}
_supported_fs btrfs
_supported_os Linux
_require_scratch
+_require_btrfs_qgroup_report
rm -f $seqres.full
_scratch_mount
_basic_test
_scratch_unmount
+_check_scratch_fs
_scratch_mkfs > /dev/null 2>&1
_scratch_mount
_rescan_test
_scratch_unmount
+_check_scratch_fs
_scratch_mkfs > /dev/null 2>&1
_scratch_mount
_limit_test_exceed
_scratch_unmount
+_check_scratch_fs
_scratch_mkfs > /dev/null 2>&1
_scratch_mount
_supported_fs btrfs
_supported_os Linux
_require_scratch
+_require_btrfs_qgroup_report
_scratch_mkfs
_scratch_mount
_scratch_unmount
-# generate a qgroup report and look for inconsistent groups
-$BTRFS_UTIL_PROG check --qgroup-report $SCRATCH_DEV 2>&1 | \
- grep -E "Counts for qgroup.*are different"
+# qgroup will be checked at _check_scratch_fs() by fstest.
echo "Silence is golden"
status=0
_supported_fs btrfs
_supported_os Linux
_require_scratch
+_require_btrfs_qgroup_report
rm -f $seqres.full
_supported_fs btrfs
_supported_os Linux
_require_scratch
+_require_btrfs_qgroup_report
# Use big blocksize to ensure there is still enough space left for metadata
# space reserve.
_supported_fs btrfs
_supported_os Linux
_require_scratch
+_require_btrfs_qgroup_report
rm -f $seqres.full
# referenced above.
_run_btrfs_util_prog subvolume delete $SCRATCH_MNT/snap1
-# There is no way from userspace to force btrfs_drop_snapshot to run
-# at a given time (even via mount/unmount). We must wait for it to
-# start and complete. This is the shortest time on my tests systems I
-# have found which always allows drop_snapshot to run to completion.
-sleep 45
+# "btrfs filesystem sync" will trigger subvolume deletion
+_run_btrfs_util_prog filesystem sync $SCRATCH_MNT
-_scratch_unmount
-
-# generate a qgroup report and look for inconsistent groups
-# - don't use _run_btrfs_util_prog here as it captures the output and
-# we need to grep it.
-$BTRFS_UTIL_PROG check --qgroup-report $SCRATCH_DEV 2>&1 | \
- grep -E -q "Counts for qgroup.*are different"
-if [ $? -ne 0 ]; then
- status=0
-fi
+# Qgroup will be checked by fstest at _check_scratch_fs()
+status=0
exit
_supported_fs btrfs
_supported_os Linux
_require_scratch
+_require_btrfs_qgroup_report
rm -f $seqres.full
_scratch_unmount
-# generate a qgroup report and look for inconsistent groups
-$BTRFS_UTIL_PROG check --qgroup-report $SCRATCH_DEV 2>&1 | \
- grep -q -E "Counts for qgroup.*are different"
-if [ $? -ne 0 ]; then
- status=0
-fi
+# qgroup will be checked by fstest at _check_scratch_fs()
+status=0
exit
_supported_fs btrfs
_supported_os Linux
_require_scratch
+_require_btrfs_qgroup_report
_scratch_mkfs
# Need to use inline extents to fill metadata rapidly
_run_btrfs_util_prog balance start -d $SCRATCH_MNT
_scratch_unmount
-# generate a qgroup report and look for inconsistent groups
-$BTRFS_UTIL_PROG check --qgroup-report $SCRATCH_DEV 2>&1 | \
- grep -E "Counts for qgroup.*are different"
+# qgroup will be check at _check_scratch_fs() by fstest
# success, all done
status=0
_supported_fs btrfs
_supported_os Linux
_require_scratch
+_require_btrfs_qgroup_report
_scratch_mkfs
# Use enospc_debug mount option to trigger restrict space info check