FS/XFS testing framework
 help / color / mirror / Atom feed
From: Pankaj Raghav <p.raghav@samsung.com>
To: fstests@vger.kernel.org, zlang@redhat.com
Cc: linux-xfs@vger.kernel.org, gost.dev@samsung.com,
	mcgrof@kernel.org, p.raghav@samsung.com, kernel@pankajraghav.com,
	david@fromorbit.com, djwong@kernel.org
Subject: [PATCH 1/2] generic/219: use filesystem blocksize while calculating the file size
Date: Thu, 24 Oct 2024 13:23:10 +0200	[thread overview]
Message-ID: <20241024112311.615360-2-p.raghav@samsung.com> (raw)
In-Reply-To: <20241024112311.615360-1-p.raghav@samsung.com>

generic/219 was failing for XFS with 32k and 64k blocksize. Even though
we do only 48k IO, XFS will allocate blocks rounded to the nearest
blocksize.

Signed-off-by: Pankaj Raghav <p.raghav@samsung.com>
---
 tests/generic/219 | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/tests/generic/219 b/tests/generic/219
index 940b902e..d72aa745 100755
--- a/tests/generic/219
+++ b/tests/generic/219
@@ -49,12 +49,24 @@ check_usage()
 	fi
 }
 
+_round_up_to_fs_blksz()
+{
+	local n=$1
+	local bs=$(_get_file_block_size "$SCRATCH_MNT")
+	local bs_kb=$(( bs >> 10 ))
+
+	echo $(( (n + bs_kb - 1) & ~(bs_kb - 1) ))
+}
+
 test_accounting()
 {
-	echo "### some controlled buffered, direct and mmapd IO (type=$type)"
-	echo "--- initiating parallel IO..." >>$seqres.full
 	# Small ios here because ext3 will account for indirect blocks too ...
 	# 48k will fit w/o indirect for 4k blocks (default blocksize)
+	io_sz=$(_round_up_to_fs_blksz 48)
+	sz=$(( io_sz * 3 ))
+
+	echo "### some controlled buffered, direct and mmapd IO (type=$type)"
+	echo "--- initiating parallel IO..." >>$seqres.full
 	$XFS_IO_PROG -c 'pwrite 0 48k' -c 'fsync' \
 					$SCRATCH_MNT/buffer >>$seqres.full 2>&1 &
 	$XFS_IO_PROG -c 'pwrite 0 48k' -d \
@@ -73,7 +85,7 @@ test_accounting()
 	else
 		id=$qa_group
 	fi
-	repquota -$type $SCRATCH_MNT | grep "^$id" | check_usage 144 3
+	repquota -$type $SCRATCH_MNT | grep "^$id" | check_usage $sz 3
 }
 
 
-- 
2.44.1


  reply	other threads:[~2024-10-24 11:23 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-24 11:23 [PATCH 0/2] fix generic quota tests for XFS with 32k and 64k block sizes Pankaj Raghav
2024-10-24 11:23 ` Pankaj Raghav [this message]
2024-10-24 18:19   ` [PATCH 1/2] generic/219: use filesystem blocksize while calculating the file size Darrick J. Wong
2024-10-25  1:12     ` Pankaj Raghav (Samsung)
2024-10-25  5:28       ` Darrick J. Wong
2024-10-24 11:23 ` [PATCH 2/2] generic: increase file size to match CoW delayed allocation for XFS 64k bs Pankaj Raghav
2024-10-24 18:17   ` Darrick J. Wong
2024-10-25  3:23     ` Pankaj Raghav (Samsung)

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=20241024112311.615360-2-p.raghav@samsung.com \
    --to=p.raghav@samsung.com \
    --cc=david@fromorbit.com \
    --cc=djwong@kernel.org \
    --cc=fstests@vger.kernel.org \
    --cc=gost.dev@samsung.com \
    --cc=kernel@pankajraghav.com \
    --cc=linux-xfs@vger.kernel.org \
    --cc=mcgrof@kernel.org \
    --cc=zlang@redhat.com \
    /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