common/rc: generalize _get_filesize()
[xfstests-dev.git] / tests / xfs / 076
index 1ecfca6fa4d6a76309d9de28a8bbae28f11ad6fd..2dcdd30c7d6a00d1ee0edcf5f2318553b10d93ec 100755 (executable)
@@ -1,4 +1,7 @@
 #!/bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2015 Red Hat, Inc.  All Rights Reserved.
+#
 # FS QA Test No. xfs/076
 #
 # Verify that a filesystem with sparse inode support can allocate inodes in the
 # space, allocates inodes to ENOSPC and then verifies that most of the available
 # inodes (.i.e., free space) have been consumed.
 #
-#-----------------------------------------------------------------------
-# Copyright (c) 2015 Red Hat, Inc.  All Rights Reserved.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation.
-#
-# This program is distributed in the hope that it would be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write the Free Software Foundation,
-# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-#
-#-----------------------------------------------------------------------
-#
-
 seq=`basename $0`
 seqres=$RESULT_DIR/$seq
 echo "QA output created by $seq"
@@ -48,7 +32,7 @@ status=1      # failure is the default!
 _cleanup()
 {
        cd /
-       umount $SCRATCH_MNT 2>/dev/null
+       _scratch_unmount 2>/dev/null
        rm -f $tmp.*
 }
 trap "_cleanup; exit \$status" 0 1 2 3 15
@@ -109,7 +93,7 @@ _consume_freesp $SCRATCH_MNT/spc
 # space. Note that we start at the end of the file and work backwards as a
 # reverse allocation pattern increases the chances of both left and right sparse
 # record merges.
-offset=`stat -c "%s" $SCRATCH_MNT/spc`
+offset=`_get_filesize $SCRATCH_MNT/spc`
 offset=$((offset - $CHUNK_SIZE * 2))
 while [ $offset -ge 0 ]; do
        $XFS_IO_PROG -c "fpunch $offset $CHUNK_SIZE" $SCRATCH_MNT/spc \