Use upstream version of fstrim instead of the local one
[xfstests-dev.git] / common.rc
index e7037c1766b9b57baba353d5337a9e16cc78a77d..966fc93a7790efbf221f3e5ec3c18f33391eadfa 100644 (file)
--- a/common.rc
+++ b/common.rc
@@ -1787,6 +1787,23 @@ _devmgt_add()
        echo ${tdl} >  /sys/class/scsi_host/host${h}/scan || _fail "Add disk failed"
 }
 
+_require_fstrim()
+{
+       if [ -z "$FSTRIM_PROG" ]; then
+               _notrun "This test requires fstrim utility."
+       fi
+}
+
+_test_batched_discard()
+{
+       if [ $# -ne 1 ]; then
+               echo "Usage: _test_batched_discard mnt_point" 1>&2
+               exit 1
+       fi
+       _require_fstrim
+       $FSTRIM_PROG ${1} &>/dev/null
+}
+
 ################################################################################
 
 if [ "$iam" != new -a "$iam" != bench ]