]> www.infradead.org Git - users/hch/xfstests-dev.git/commitdiff
generic/68[12]: use the dir blocksize for xfs filesystems
authorAnthony Iliopoulos <ailiop@suse.com>
Thu, 1 Feb 2024 16:17:31 +0000 (17:17 +0100)
committerZorro Lang <zlang@kernel.org>
Fri, 1 Mar 2024 11:24:16 +0000 (19:24 +0800)
The tests are using the filesystem block size for calculating the number
of dirents required to fill a 2-block directory. For v4 xfs filesystems
formatted with fs blocksize of 512 bytes this is failing, as the tests
do not take into account that the directory block size is not always
equal to the filesystem block size. As such, the tests never go over
quota, and even if they did there is no hard block limit being set (due
to 512 / 1024 = 0 calculation in setquota).

Use the directory blocksize instead of the filesystem blocksize, when
the fstype under test is xfs.

Signed-off-by: Anthony Iliopoulos <ailiop@suse.com>
Reviewed-by: Andrey Albershteyn <aalbersh@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
common/rc
tests/generic/681
tests/generic/682

index b53a1cbb59b0d0738d4d14199898f031f115d621..50dde313b85119b1e8e4a7afa54cc0862cf953dc 100644 (file)
--- a/common/rc
+++ b/common/rc
@@ -4756,6 +4756,17 @@ _get_block_size()
        stat -f -c %S $1
 }
 
+# Obtain the directory block size of an fs.
+_get_dir_block_size()
+{
+       case "$FSTYP" in
+       xfs)
+               _xfs_get_dir_blocksize $1 ;;
+       *)
+               _get_block_size $1 ;;
+       esac
+}
+
 # Require that the fundamental allocation unit of a file is the same as the
 # filesystem block size.  The sole parameter must be the root dir of a
 # filesystem.
index 090da795ce64b8cce62bb30e126bb599735c05dd..f41647741a7d69052a29aa7d5fc029956ad72d85 100755 (executable)
@@ -30,7 +30,7 @@ _scratch_mkfs > "$seqres.full" 2>&1
 _qmount_option usrquota
 _qmount
 
-blocksize=$(_get_block_size $SCRATCH_MNT)
+blocksize=$(_get_dir_block_size $SCRATCH_MNT)
 scratchdir=$SCRATCH_MNT/dir
 scratchfile=$SCRATCH_MNT/file
 mkdir $scratchdir
index b4cd0cd9dd2ed3e20c7424f304940306c9a9b76c..a51d18338742788f9aa82c32380e9afa1657f98c 100755 (executable)
@@ -30,7 +30,7 @@ _scratch_mkfs > "$seqres.full" 2>&1
 _qmount_option usrquota
 _qmount
 
-blocksize=$(_get_block_size $SCRATCH_MNT)
+blocksize=$(_get_dir_block_size $SCRATCH_MNT)
 scratchdir=$SCRATCH_MNT/dir
 scratchfile=$SCRATCH_MNT/file
 stagedir=$SCRATCH_MNT/staging