From: Anthony Iliopoulos <ailiop@suse.com>
To: fstests@vger.kernel.org
Subject: [PATCH 1/2] generic/68[12]: use the dir blocksize for xfs filesystems
Date: Thu, 1 Feb 2024 17:17:31 +0100 [thread overview]
Message-ID: <20240201161732.6126-2-ailiop@suse.com> (raw)
In-Reply-To: <20240201161732.6126-1-ailiop@suse.com>
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>
---
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
next prev parent reply other threads:[~2024-02-01 16:17 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-01 16:17 [PATCH 0/2] generic/681 and generic/682 fixes Anthony Iliopoulos
2024-02-01 16:17 ` Anthony Iliopoulos [this message]
2024-02-02 10:56 ` [PATCH 1/2] generic/68[12]: use the dir blocksize for xfs filesystems Andrey Albershteyn
2024-02-01 16:17 ` [PATCH 2/2] generic/682: update and fix-up golden output Anthony Iliopoulos
2024-02-02 11:00 ` Andrey Albershteyn
2024-02-02 11:56 ` Zorro Lang
2024-02-06 17:31 ` Anthony Iliopoulos
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240201161732.6126-2-ailiop@suse.com \
--to=ailiop@suse.com \
--cc=fstests@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox