diff mbox series

[2/3] xfs/185: don't fail when rtfile is larger than rblocks

Message ID 173146178844.156441.16410068994780353980.stgit@frogsfrogsfrogs (mailing list archive)
State Deferred, archived
Headers show
Series [1/3] xfs/273: check thoroughness of the mappings | expand

Commit Message

Darrick J. Wong Nov. 13, 2024, 1:37 a.m. UTC
From: Darrick J. Wong <djwong@kernel.org>

This test creates a 200MB rt volume on a file-backed loopdev.  However,
if the size of the loop file is not congruent with the rt extent size
(e.g.  28k) then the rt volume will not use all 200MB because we cannot
have partial rt extents.  Because of this rounding, we can end up with
an fsmap listing that covers fewer sectors than the bmap of the loop
file.

Fix the test to allow this case.

Cc: <fstests@vger.kernel.org> # v2022.05.01
Fixes: 410a2e3186a1e8 ("xfs: regresion test for fsmap problems with realtime")
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
 tests/xfs/185 |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Christoph Hellwig Nov. 13, 2024, 8:47 a.m. UTC | #1
Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>
Zorro Lang Nov. 15, 2024, 10:13 a.m. UTC | #2
On Tue, Nov 12, 2024 at 05:37:14PM -0800, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
> 
> This test creates a 200MB rt volume on a file-backed loopdev.  However,
> if the size of the loop file is not congruent with the rt extent size
> (e.g.  28k) then the rt volume will not use all 200MB because we cannot
> have partial rt extents.  Because of this rounding, we can end up with
> an fsmap listing that covers fewer sectors than the bmap of the loop
> file.
> 
> Fix the test to allow this case.
> 
> Cc: <fstests@vger.kernel.org> # v2022.05.01
> Fixes: 410a2e3186a1e8 ("xfs: regresion test for fsmap problems with realtime")
> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> ---

Makes sense to me,

Reviewed-by: Zorro Lang <zlang@redhat.com>

>  tests/xfs/185 |    6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> 
> diff --git a/tests/xfs/185 b/tests/xfs/185
> index b14bcb9b791bb8..f3601a5292ef0b 100755
> --- a/tests/xfs/185
> +++ b/tests/xfs/185
> @@ -156,7 +156,9 @@ fsmap() {
>  
>  # Check the fsmap output contains a record for the realtime device at a
>  # physical offset higher than end of the data device and corresponding to the
> -# beginning of the non-punched area.
> +# beginning of the non-punched area.  The "found_end" check uses >= because
> +# rtfile can be larger than the number of rtextents if the size of the rtfile
> +# is not congruent with the rt extent size.
>  fsmap | $AWK_PROG -v dev="$rtmajor:$rtminor" -v offset=$expected_offset -v end=$expected_end '
>  BEGIN {
>  	found_start = 0;
> @@ -165,7 +167,7 @@ BEGIN {
>  {
>  	if ($1 == dev && $2 >= offset) {
>  		found_start = 1;
> -		if ($3 == end) {
> +		if ($3 >= end) {
>  			found_end = 1;
>  		}
>  	}
>
diff mbox series

Patch

diff --git a/tests/xfs/185 b/tests/xfs/185
index b14bcb9b791bb8..f3601a5292ef0b 100755
--- a/tests/xfs/185
+++ b/tests/xfs/185
@@ -156,7 +156,9 @@  fsmap() {
 
 # Check the fsmap output contains a record for the realtime device at a
 # physical offset higher than end of the data device and corresponding to the
-# beginning of the non-punched area.
+# beginning of the non-punched area.  The "found_end" check uses >= because
+# rtfile can be larger than the number of rtextents if the size of the rtfile
+# is not congruent with the rt extent size.
 fsmap | $AWK_PROG -v dev="$rtmajor:$rtminor" -v offset=$expected_offset -v end=$expected_end '
 BEGIN {
 	found_start = 0;
@@ -165,7 +167,7 @@  BEGIN {
 {
 	if ($1 == dev && $2 >= offset) {
 		found_start = 1;
-		if ($3 == end) {
+		if ($3 >= end) {
 			found_end = 1;
 		}
 	}