mirror of
https://github.com/linux-apfs/apfstests.git
synced 2026-05-01 15:01:44 -07:00
common: unify _require_batched_discard
To check for FITRIM tests used _require_fstrim() and _test_batched_discard() but as _test_batched_discard() already includes _test_fstrim() unify FSTRIM check throughout xfstests with _require_batched_discard(). Signed-off-by: Dushan Tcholich <dusanc@gmail.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
This commit is contained in:
committed by
Dave Chinner
parent
ba3fc9f85b
commit
01d42b7efe
@@ -2347,14 +2347,14 @@ _require_fstrim()
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
_test_batched_discard()
|
_require_batched_discard()
|
||||||
{
|
{
|
||||||
if [ $# -ne 1 ]; then
|
if [ $# -ne 1 ]; then
|
||||||
echo "Usage: _test_batched_discard mnt_point" 1>&2
|
echo "Usage: _require_batched_discard mnt_point" 1>&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
_require_fstrim
|
_require_fstrim
|
||||||
$FSTRIM_PROG ${1} &>/dev/null
|
[$FSTRIM_PROG $1 > /dev/null 2>&1] || _notrun "FITRIM not supported on $1"
|
||||||
}
|
}
|
||||||
|
|
||||||
_require_dumpe2fs()
|
_require_dumpe2fs()
|
||||||
|
|||||||
+1
-1
@@ -69,7 +69,6 @@ _need_to_be_root
|
|||||||
_supported_fs generic
|
_supported_fs generic
|
||||||
_supported_os Linux
|
_supported_os Linux
|
||||||
_require_scratch
|
_require_scratch
|
||||||
_require_fstrim
|
|
||||||
|
|
||||||
rm -f $seqres.full
|
rm -f $seqres.full
|
||||||
|
|
||||||
@@ -123,6 +122,7 @@ create_files()
|
|||||||
_scratch_mkfs >>$seqres.full 2>&1
|
_scratch_mkfs >>$seqres.full 2>&1
|
||||||
_require_fs_space $SCRATCH_MNT $((10 * 1024 * 1024))
|
_require_fs_space $SCRATCH_MNT $((10 * 1024 * 1024))
|
||||||
_scratch_mount
|
_scratch_mount
|
||||||
|
_require_batched_discard $SCRATCH_MNT
|
||||||
|
|
||||||
for ((i = 0; i < $((4 * $LOAD_FACTOR)); i++)); do
|
for ((i = 0; i < $((4 * $LOAD_FACTOR)); i++)); do
|
||||||
trim_loop &
|
trim_loop &
|
||||||
|
|||||||
+1
-6
@@ -43,9 +43,9 @@ mypid=$$
|
|||||||
_supported_fs generic
|
_supported_fs generic
|
||||||
_supported_os Linux
|
_supported_os Linux
|
||||||
_require_scratch
|
_require_scratch
|
||||||
_require_fstrim
|
|
||||||
_scratch_mkfs >/dev/null 2>&1
|
_scratch_mkfs >/dev/null 2>&1
|
||||||
_scratch_mount
|
_scratch_mount
|
||||||
|
_require_batched_discard $SCRATCH_MNT
|
||||||
|
|
||||||
_cleanup()
|
_cleanup()
|
||||||
{
|
{
|
||||||
@@ -150,11 +150,6 @@ function run_process() {
|
|||||||
nproc=20
|
nproc=20
|
||||||
content=$here
|
content=$here
|
||||||
|
|
||||||
# Check for FITRIM support
|
|
||||||
echo -n "Checking FITRIM support: "
|
|
||||||
_test_batched_discard $SCRATCH_MNT || _notrun "FITRIM not supported on $SCRATCH_DEV"
|
|
||||||
echo "done."
|
|
||||||
|
|
||||||
mkdir -p $tmp
|
mkdir -p $tmp
|
||||||
|
|
||||||
(
|
(
|
||||||
|
|||||||
@@ -1,3 +1,2 @@
|
|||||||
QA output created by 251
|
QA output created by 251
|
||||||
Checking FITRIM support: done.
|
|
||||||
Running the test: done.
|
Running the test: done.
|
||||||
|
|||||||
+1
-2
@@ -40,13 +40,12 @@ mypid=$$
|
|||||||
_supported_fs generic
|
_supported_fs generic
|
||||||
_supported_os Linux
|
_supported_os Linux
|
||||||
_require_math
|
_require_math
|
||||||
_require_fstrim
|
|
||||||
|
|
||||||
_require_scratch
|
_require_scratch
|
||||||
_scratch_mkfs >/dev/null 2>&1
|
_scratch_mkfs >/dev/null 2>&1
|
||||||
_scratch_mount
|
_scratch_mount
|
||||||
|
|
||||||
_test_batched_discard $SCRATCH_MNT || _notrun "FITRIM not supported on $SCRATCH_DEV"
|
_require_batched_discard $SCRATCH_MNT
|
||||||
|
|
||||||
fssize=$($DF_PROG -k | grep "$SCRATCH_MNT" | grep "$SCRATCH_DEV" | awk '{print $3}')
|
fssize=$($DF_PROG -k | grep "$SCRATCH_MNT" | grep "$SCRATCH_DEV" | awk '{print $3}')
|
||||||
|
|
||||||
|
|||||||
+1
-2
@@ -36,12 +36,11 @@ trap "exit \$status" 0 1 2 3 15
|
|||||||
_supported_fs generic
|
_supported_fs generic
|
||||||
_supported_os Linux
|
_supported_os Linux
|
||||||
|
|
||||||
_require_fstrim
|
|
||||||
_require_scratch
|
_require_scratch
|
||||||
|
|
||||||
_scratch_mkfs >/dev/null 2>&1
|
_scratch_mkfs >/dev/null 2>&1
|
||||||
_scratch_mount
|
_scratch_mount
|
||||||
_test_batched_discard $SCRATCH_MNT || _notrun "FITRIM not supported on $SCRATCH_DEV"
|
_require_batched_discard $SCRATCH_MNT
|
||||||
|
|
||||||
echo "[+] Length is zero (should fail)"
|
echo "[+] Length is zero (should fail)"
|
||||||
out=$("$FSTRIM_PROG" -v -o0 -l0 $SCRATCH_MNT 2>&1)
|
out=$("$FSTRIM_PROG" -v -o0 -l0 $SCRATCH_MNT 2>&1)
|
||||||
|
|||||||
Reference in New Issue
Block a user