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@xxxxxxxx> --- common/rc | 11 +++++++++++ tests/generic/681 | 2 +- tests/generic/682 | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/common/rc b/common/rc index a9e0ba7e22f1..8be375965aaa 100644 --- a/common/rc +++ b/common/rc @@ -4719,6 +4719,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. diff --git a/tests/generic/681 b/tests/generic/681 index 090da795ce64..f41647741a7d 100755 --- a/tests/generic/681 +++ b/tests/generic/681 @@ -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 diff --git a/tests/generic/682 b/tests/generic/682 index b4cd0cd9dd2e..a51d18338742 100755 --- a/tests/generic/682 +++ b/tests/generic/682 @@ -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 -- 2.41.0