public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] fix generic quota tests for XFS with 32k and 64k block sizes
@ 2024-10-24 11:23 Pankaj Raghav
  2024-10-24 11:23 ` [PATCH 1/2] generic/219: use filesystem blocksize while calculating the file size Pankaj Raghav
  2024-10-24 11:23 ` [PATCH 2/2] generic: increase file size to match CoW delayed allocation for XFS 64k bs Pankaj Raghav
  0 siblings, 2 replies; 8+ messages in thread
From: Pankaj Raghav @ 2024-10-24 11:23 UTC (permalink / raw)
  To: fstests, zlang
  Cc: linux-xfs, gost.dev, mcgrof, p.raghav, kernel, david, djwong

Fixes to generic quota tests for XFS with 32k and 64k block sizes. The
tests are failing for bigger block sizes due to minimum allocation unit > IO size
or the way default delayed allocation works.

I have tested this on both 4k and 64k page size systems.

Pankaj Raghav (2):
  generic/219: use filesystem blocksize while calculating the file size
  generic: increase file size to match CoW delayed allocation for XFS
    64k bs

 tests/generic/219     | 18 +++++++++++++++---
 tests/generic/305     |  2 +-
 tests/generic/305.out | 12 ++++++------
 tests/generic/326     |  2 +-
 tests/generic/326.out | 12 ++++++------
 tests/generic/328     |  2 +-
 tests/generic/328.out | 16 +++++++++-------
 7 files changed, 39 insertions(+), 25 deletions(-)


base-commit: 891f4995ab07ee0a07eca156915ed87ab5f479f6
-- 
2.44.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/2] generic/219: use filesystem blocksize while calculating the file size
  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
  2024-10-24 18:19   ` 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
  1 sibling, 1 reply; 8+ messages in thread
From: Pankaj Raghav @ 2024-10-24 11:23 UTC (permalink / raw)
  To: fstests, zlang
  Cc: linux-xfs, gost.dev, mcgrof, p.raghav, kernel, david, djwong

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


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/2] generic: increase file size to match CoW delayed allocation for XFS 64k bs
  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 ` [PATCH 1/2] generic/219: use filesystem blocksize while calculating the file size Pankaj Raghav
@ 2024-10-24 11:23 ` Pankaj Raghav
  2024-10-24 18:17   ` Darrick J. Wong
  1 sibling, 1 reply; 8+ messages in thread
From: Pankaj Raghav @ 2024-10-24 11:23 UTC (permalink / raw)
  To: fstests, zlang
  Cc: linux-xfs, gost.dev, mcgrof, p.raghav, kernel, david, djwong

generic/305,326,328 have been failing for 32k and 64k blocksizes.

We do the following in the test 305 and 326 (highlighting only the part
that is related to failure):

- create a 1M test-1/file1
- reflink test-1/file2 and test-1/file3 based on test-1/file1
- Overwrite first half of test-1/file2 to do a CoW operation
- Expect the size of the test-1 dir to be 3M

The test is failing for 32k and 64k blocksizes as the number of blocks
(direct + delayed) is higher than number of blocks allocated for
blocksizes < 32k in XFS, resulting in size of test-1 to be more than 3M.
Though generic/328 has a different IO pattern, the reason for failure is
the same.

This is the failure output :
    --- tests/generic/305.out   2024-06-05 11:52:27.430262812 +0000
    +++ /root/results//64k_4ks/generic/305.out.bad      2024-10-23 10:56:57.643986870 +0000
    @@ -11,7 +11,7 @@
     CoW one of the files
     root 0 0 0
     nobody 0 0 0
    -fsgqa 3072 0 0
    +fsgqa 4608 0 0
     Remount the FS to see if accounting changes
     root 0 0 0

In these tests, XFS is doing a delayed allocation of
XFS_DEFAULT_COWEXTSIZE_HINT(32). Increase the size of the file so that
the CoW write(sz/2) matches the maximum size of the delayed allocation
for the max blocksize of 64k. This will ensure that all parts of the
delayed extents are converted to real extents for all blocksizes.

Even though this is not the most complete solution to fix these tests,
the objective of these tests are to test quota and not the effect of delayed
allocations.

Signed-off-by: Pankaj Raghav <p.raghav@samsung.com>
---
 tests/generic/305     |  2 +-
 tests/generic/305.out | 12 ++++++------
 tests/generic/326     |  2 +-
 tests/generic/326.out | 12 ++++++------
 tests/generic/328     |  2 +-
 tests/generic/328.out | 16 +++++++++-------
 6 files changed, 24 insertions(+), 22 deletions(-)

diff --git a/tests/generic/305 b/tests/generic/305
index c89bd821..6ccbb3d0 100755
--- a/tests/generic/305
+++ b/tests/generic/305
@@ -32,7 +32,7 @@ quotaon $SCRATCH_MNT 2> /dev/null
 testdir=$SCRATCH_MNT/test-$seq
 mkdir $testdir
 
-sz=1048576
+sz=4194304
 echo "Create the original files"
 $XFS_IO_PROG -f -c "pwrite -S 0x61 -b $sz 0 $sz" $testdir/file1 >> $seqres.full
 _cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
diff --git a/tests/generic/305.out b/tests/generic/305.out
index fbd4e241..1c348d1e 100644
--- a/tests/generic/305.out
+++ b/tests/generic/305.out
@@ -1,22 +1,22 @@
 QA output created by 305
 Format and mount
 Create the original files
-root 3072 0 0
+root 12288 0 0
 nobody 0 0 0
 fsgqa 0 0 0
 Change file ownership
 root 0 0 0
 nobody 0 0 0
-fsgqa 3072 0 0
+fsgqa 12288 0 0
 CoW one of the files
 root 0 0 0
 nobody 0 0 0
-fsgqa 3072 0 0
+fsgqa 12288 0 0
 Remount the FS to see if accounting changes
 root 0 0 0
 nobody 0 0 0
-fsgqa 3072 0 0
+fsgqa 12288 0 0
 Chown one of the files
 root 0 0 0
-nobody 1024 0 0
-fsgqa 2048 0 0
+nobody 4096 0 0
+fsgqa 8192 0 0
diff --git a/tests/generic/326 b/tests/generic/326
index 1783fbf2..321e7dc6 100755
--- a/tests/generic/326
+++ b/tests/generic/326
@@ -33,7 +33,7 @@ quotaon $SCRATCH_MNT 2> /dev/null
 testdir=$SCRATCH_MNT/test-$seq
 mkdir $testdir
 
-sz=1048576
+sz=4194304
 echo "Create the original files"
 $XFS_IO_PROG -f -c "pwrite -S 0x61 -b $sz 0 $sz" $testdir/file1 >> $seqres.full
 _cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
diff --git a/tests/generic/326.out b/tests/generic/326.out
index de7f20b5..4ccb3250 100644
--- a/tests/generic/326.out
+++ b/tests/generic/326.out
@@ -1,22 +1,22 @@
 QA output created by 326
 Format and mount
 Create the original files
-root 3072 0 0
+root 12288 0 0
 nobody 0 0 0
 fsgqa 0 0 0
 Change file ownership
 root 0 0 0
 nobody 0 0 0
-fsgqa 3072 0 0
+fsgqa 12288 0 0
 CoW one of the files
 root 0 0 0
 nobody 0 0 0
-fsgqa 3072 0 0
+fsgqa 12288 0 0
 Remount the FS to see if accounting changes
 root 0 0 0
 nobody 0 0 0
-fsgqa 3072 0 0
+fsgqa 12288 0 0
 Chown one of the files
 root 0 0 0
-nobody 1024 0 0
-fsgqa 2048 0 0
+nobody 4096 0 0
+fsgqa 8192 0 0
diff --git a/tests/generic/328 b/tests/generic/328
index 0c8e1986..25e1f2a0 100755
--- a/tests/generic/328
+++ b/tests/generic/328
@@ -32,7 +32,7 @@ quotaon $SCRATCH_MNT 2> /dev/null
 testdir=$SCRATCH_MNT/test-$seq
 mkdir $testdir
 
-sz=1048576
+sz=4194304
 echo "Create the original files"
 $XFS_IO_PROG -f -c "pwrite -S 0x61 -b $sz 0 $sz" $testdir/file1 >> $seqres.full
 chown $qa_user $testdir/file1
diff --git a/tests/generic/328.out b/tests/generic/328.out
index b7fe9f8c..0167637e 100644
--- a/tests/generic/328.out
+++ b/tests/generic/328.out
@@ -2,24 +2,26 @@ QA output created by 328
 Format and mount
 Create the original files
 root 0 0 0
-fsgqa 3072 0 0
+fsgqa 12288 0 0
 Set hard quota to prevent rewrite
 root 0 0 0
-fsgqa 3072 0 1024
+fsgqa 12288 0 1024
 Try to dio write the whole file
 pwrite: Disk quota exceeded
 root 0 0 0
-fsgqa 3072 0 1024
+fsgqa 12288 0 1024
 Try to write the whole file
 pwrite: Disk quota exceeded
 root 0 0 0
-fsgqa 3072 0 1024
+fsgqa 12288 0 1024
 Set hard quota to allow rewrite
 root 0 0 0
-fsgqa 3072 0 8192
+fsgqa 12288 0 8192
 Try to dio write the whole file
+pwrite: Disk quota exceeded
 root 0 0 0
-fsgqa 3072 0 8192
+fsgqa 12288 0 8192
 Try to write the whole file
+pwrite: Disk quota exceeded
 root 0 0 0
-fsgqa 3072 0 8192
+fsgqa 12288 0 8192
-- 
2.44.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/2] generic: increase file size to match CoW delayed allocation for XFS 64k bs
  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)
  0 siblings, 1 reply; 8+ messages in thread
From: Darrick J. Wong @ 2024-10-24 18:17 UTC (permalink / raw)
  To: Pankaj Raghav; +Cc: fstests, zlang, linux-xfs, gost.dev, mcgrof, kernel, david

On Thu, Oct 24, 2024 at 01:23:11PM +0200, Pankaj Raghav wrote:
> generic/305,326,328 have been failing for 32k and 64k blocksizes.
> 
> We do the following in the test 305 and 326 (highlighting only the part
> that is related to failure):
> 
> - create a 1M test-1/file1
> - reflink test-1/file2 and test-1/file3 based on test-1/file1
> - Overwrite first half of test-1/file2 to do a CoW operation
> - Expect the size of the test-1 dir to be 3M
> 
> The test is failing for 32k and 64k blocksizes as the number of blocks
> (direct + delayed) is higher than number of blocks allocated for
> blocksizes < 32k in XFS, resulting in size of test-1 to be more than 3M.
> Though generic/328 has a different IO pattern, the reason for failure is
> the same.
> 
> This is the failure output :
>     --- tests/generic/305.out   2024-06-05 11:52:27.430262812 +0000
>     +++ /root/results//64k_4ks/generic/305.out.bad      2024-10-23 10:56:57.643986870 +0000
>     @@ -11,7 +11,7 @@
>      CoW one of the files
>      root 0 0 0
>      nobody 0 0 0
>     -fsgqa 3072 0 0
>     +fsgqa 4608 0 0
>      Remount the FS to see if accounting changes
>      root 0 0 0
> 
> In these tests, XFS is doing a delayed allocation of
> XFS_DEFAULT_COWEXTSIZE_HINT(32). Increase the size of the file so that
> the CoW write(sz/2) matches the maximum size of the delayed allocation
> for the max blocksize of 64k. This will ensure that all parts of the
> delayed extents are converted to real extents for all blocksizes.
> 
> Even though this is not the most complete solution to fix these tests,
> the objective of these tests are to test quota and not the effect of delayed
> allocations.
> 
> Signed-off-by: Pankaj Raghav <p.raghav@samsung.com>
> ---
>  tests/generic/305     |  2 +-
>  tests/generic/305.out | 12 ++++++------
>  tests/generic/326     |  2 +-
>  tests/generic/326.out | 12 ++++++------
>  tests/generic/328     |  2 +-
>  tests/generic/328.out | 16 +++++++++-------
>  6 files changed, 24 insertions(+), 22 deletions(-)
> 
> diff --git a/tests/generic/305 b/tests/generic/305
> index c89bd821..6ccbb3d0 100755
> --- a/tests/generic/305
> +++ b/tests/generic/305
> @@ -32,7 +32,7 @@ quotaon $SCRATCH_MNT 2> /dev/null
>  testdir=$SCRATCH_MNT/test-$seq
>  mkdir $testdir
>  
> -sz=1048576
> +sz=4194304

Hm, so you're increasing the filesize so that it exceeds 32*64k?
Hence 4M for some nice round numbers?

If so then I think I'm fine with that.  Let's see what testing thinks.
:)
Reviewed-by: Darrick J. Wong <djwong@kernel.org>

--D

>  echo "Create the original files"
>  $XFS_IO_PROG -f -c "pwrite -S 0x61 -b $sz 0 $sz" $testdir/file1 >> $seqres.full
>  _cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
> diff --git a/tests/generic/305.out b/tests/generic/305.out
> index fbd4e241..1c348d1e 100644
> --- a/tests/generic/305.out
> +++ b/tests/generic/305.out
> @@ -1,22 +1,22 @@
>  QA output created by 305
>  Format and mount
>  Create the original files
> -root 3072 0 0
> +root 12288 0 0
>  nobody 0 0 0
>  fsgqa 0 0 0
>  Change file ownership
>  root 0 0 0
>  nobody 0 0 0
> -fsgqa 3072 0 0
> +fsgqa 12288 0 0
>  CoW one of the files
>  root 0 0 0
>  nobody 0 0 0
> -fsgqa 3072 0 0
> +fsgqa 12288 0 0
>  Remount the FS to see if accounting changes
>  root 0 0 0
>  nobody 0 0 0
> -fsgqa 3072 0 0
> +fsgqa 12288 0 0
>  Chown one of the files
>  root 0 0 0
> -nobody 1024 0 0
> -fsgqa 2048 0 0
> +nobody 4096 0 0
> +fsgqa 8192 0 0
> diff --git a/tests/generic/326 b/tests/generic/326
> index 1783fbf2..321e7dc6 100755
> --- a/tests/generic/326
> +++ b/tests/generic/326
> @@ -33,7 +33,7 @@ quotaon $SCRATCH_MNT 2> /dev/null
>  testdir=$SCRATCH_MNT/test-$seq
>  mkdir $testdir
>  
> -sz=1048576
> +sz=4194304
>  echo "Create the original files"
>  $XFS_IO_PROG -f -c "pwrite -S 0x61 -b $sz 0 $sz" $testdir/file1 >> $seqres.full
>  _cp_reflink $testdir/file1 $testdir/file2 >> $seqres.full
> diff --git a/tests/generic/326.out b/tests/generic/326.out
> index de7f20b5..4ccb3250 100644
> --- a/tests/generic/326.out
> +++ b/tests/generic/326.out
> @@ -1,22 +1,22 @@
>  QA output created by 326
>  Format and mount
>  Create the original files
> -root 3072 0 0
> +root 12288 0 0
>  nobody 0 0 0
>  fsgqa 0 0 0
>  Change file ownership
>  root 0 0 0
>  nobody 0 0 0
> -fsgqa 3072 0 0
> +fsgqa 12288 0 0
>  CoW one of the files
>  root 0 0 0
>  nobody 0 0 0
> -fsgqa 3072 0 0
> +fsgqa 12288 0 0
>  Remount the FS to see if accounting changes
>  root 0 0 0
>  nobody 0 0 0
> -fsgqa 3072 0 0
> +fsgqa 12288 0 0
>  Chown one of the files
>  root 0 0 0
> -nobody 1024 0 0
> -fsgqa 2048 0 0
> +nobody 4096 0 0
> +fsgqa 8192 0 0
> diff --git a/tests/generic/328 b/tests/generic/328
> index 0c8e1986..25e1f2a0 100755
> --- a/tests/generic/328
> +++ b/tests/generic/328
> @@ -32,7 +32,7 @@ quotaon $SCRATCH_MNT 2> /dev/null
>  testdir=$SCRATCH_MNT/test-$seq
>  mkdir $testdir
>  
> -sz=1048576
> +sz=4194304
>  echo "Create the original files"
>  $XFS_IO_PROG -f -c "pwrite -S 0x61 -b $sz 0 $sz" $testdir/file1 >> $seqres.full
>  chown $qa_user $testdir/file1
> diff --git a/tests/generic/328.out b/tests/generic/328.out
> index b7fe9f8c..0167637e 100644
> --- a/tests/generic/328.out
> +++ b/tests/generic/328.out
> @@ -2,24 +2,26 @@ QA output created by 328
>  Format and mount
>  Create the original files
>  root 0 0 0
> -fsgqa 3072 0 0
> +fsgqa 12288 0 0
>  Set hard quota to prevent rewrite
>  root 0 0 0
> -fsgqa 3072 0 1024
> +fsgqa 12288 0 1024
>  Try to dio write the whole file
>  pwrite: Disk quota exceeded
>  root 0 0 0
> -fsgqa 3072 0 1024
> +fsgqa 12288 0 1024
>  Try to write the whole file
>  pwrite: Disk quota exceeded
>  root 0 0 0
> -fsgqa 3072 0 1024
> +fsgqa 12288 0 1024
>  Set hard quota to allow rewrite
>  root 0 0 0
> -fsgqa 3072 0 8192
> +fsgqa 12288 0 8192
>  Try to dio write the whole file
> +pwrite: Disk quota exceeded
>  root 0 0 0
> -fsgqa 3072 0 8192
> +fsgqa 12288 0 8192
>  Try to write the whole file
> +pwrite: Disk quota exceeded
>  root 0 0 0
> -fsgqa 3072 0 8192
> +fsgqa 12288 0 8192
> -- 
> 2.44.1
> 
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] generic/219: use filesystem blocksize while calculating the file size
  2024-10-24 11:23 ` [PATCH 1/2] generic/219: use filesystem blocksize while calculating the file size Pankaj Raghav
@ 2024-10-24 18:19   ` Darrick J. Wong
  2024-10-25  1:12     ` Pankaj Raghav (Samsung)
  0 siblings, 1 reply; 8+ messages in thread
From: Darrick J. Wong @ 2024-10-24 18:19 UTC (permalink / raw)
  To: Pankaj Raghav; +Cc: fstests, zlang, linux-xfs, gost.dev, mcgrof, kernel, david

On Thu, Oct 24, 2024 at 01:23:10PM +0200, Pankaj Raghav wrote:
> 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) ))

Nit: you can divide here, right?

	echo $(( (n + bs_kb - 1) / bs_kb ))

The rest seems fine.

--D

> +}
> +
>  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
> 
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Re: [PATCH 1/2] generic/219: use filesystem blocksize while calculating the file size
  2024-10-24 18:19   ` Darrick J. Wong
@ 2024-10-25  1:12     ` Pankaj Raghav (Samsung)
  2024-10-25  5:28       ` Darrick J. Wong
  0 siblings, 1 reply; 8+ messages in thread
From: Pankaj Raghav (Samsung) @ 2024-10-25  1:12 UTC (permalink / raw)
  To: Darrick J. Wong
  Cc: Pankaj Raghav, fstests, zlang, linux-xfs, gost.dev, mcgrof, david

On Thu, Oct 24, 2024 at 11:19:10AM -0700, Darrick J. Wong wrote:
> On Thu, Oct 24, 2024 at 01:23:10PM +0200, Pankaj Raghav wrote:
> > 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) ))
> 
> Nit: you can divide here, right?

No. I think you are talking about DIV_ROUND_UP(). We are doing a
round_up operation here.

We should get 64k as sz for bs 32k and 64k.

round_up(48k, 32k/64k) = 64k

> 
> 	echo $(( (n + bs_kb - 1) / bs_kb ))
> 
> The rest seems fine.
> 
> --D
> 
> > +}
> > +
> >  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
> > 
> > 

-- 
Pankaj Raghav

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Re: [PATCH 2/2] generic: increase file size to match CoW delayed allocation for XFS 64k bs
  2024-10-24 18:17   ` Darrick J. Wong
@ 2024-10-25  3:23     ` Pankaj Raghav (Samsung)
  0 siblings, 0 replies; 8+ messages in thread
From: Pankaj Raghav (Samsung) @ 2024-10-25  3:23 UTC (permalink / raw)
  To: Darrick J. Wong
  Cc: Pankaj Raghav, fstests, zlang, linux-xfs, gost.dev, mcgrof, david

> > +++ b/tests/generic/305
> > @@ -32,7 +32,7 @@ quotaon $SCRATCH_MNT 2> /dev/null
> >  testdir=$SCRATCH_MNT/test-$seq
> >  mkdir $testdir
> >  
> > -sz=1048576
> > +sz=4194304
> 
> Hm, so you're increasing the filesize so that it exceeds 32*64k?
> Hence 4M for some nice round numbers?
> 

Actually we do a CoW write for sz/2 in the test. So I wanted sz/2 to
match 2M (32 * 64k). I hope that makes sense.

> If so then I think I'm fine with that.  Let's see what testing thinks.
> :)

:) All the other solutions might require fs specific changes, so I went
with this approach. Let's hope this works.

> Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Thanks!

--
Pankaj

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Re: [PATCH 1/2] generic/219: use filesystem blocksize while calculating the file size
  2024-10-25  1:12     ` Pankaj Raghav (Samsung)
@ 2024-10-25  5:28       ` Darrick J. Wong
  0 siblings, 0 replies; 8+ messages in thread
From: Darrick J. Wong @ 2024-10-25  5:28 UTC (permalink / raw)
  To: Pankaj Raghav (Samsung)
  Cc: Pankaj Raghav, fstests, zlang, linux-xfs, gost.dev, mcgrof, david

On Fri, Oct 25, 2024 at 06:42:20AM +0530, Pankaj Raghav (Samsung) wrote:
> On Thu, Oct 24, 2024 at 11:19:10AM -0700, Darrick J. Wong wrote:
> > On Thu, Oct 24, 2024 at 01:23:10PM +0200, Pankaj Raghav wrote:
> > > 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) ))
> > 
> > Nit: you can divide here, right?
> 
> No. I think you are talking about DIV_ROUND_UP(). We are doing a
> round_up operation here.

Hah oops yeah.

> We should get 64k as sz for bs 32k and 64k.
> 
> round_up(48k, 32k/64k) = 64k

<nod>

post clue-bat,
Reviewed-by: Darrick J. Wong <djwong@kernel.org>

--D


> > 
> > 	echo $(( (n + bs_kb - 1) / bs_kb ))
> > 
> > The rest seems fine.
> > 
> > --D
> > 
> > > +}
> > > +
> > >  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
> > > 
> > > 
> 
> -- 
> Pankaj Raghav
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-10-25  5:28 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [PATCH 1/2] generic/219: use filesystem blocksize while calculating the file size Pankaj Raghav
2024-10-24 18:19   ` 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)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox