public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: Pankaj Raghav <p.raghav@samsung.com>
Cc: fstests@vger.kernel.org, zlang@redhat.com,
	linux-xfs@vger.kernel.org, gost.dev@samsung.com,
	mcgrof@kernel.org, kernel@pankajraghav.com, david@fromorbit.com
Subject: Re: [PATCH 1/2] generic/219: use filesystem blocksize while calculating the file size
Date: Thu, 24 Oct 2024 11:19:10 -0700	[thread overview]
Message-ID: <20241024181910.GG2386201@frogsfrogsfrogs> (raw)
In-Reply-To: <20241024112311.615360-2-p.raghav@samsung.com>

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

  reply	other threads:[~2024-10-24 18:19 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 ` [PATCH 1/2] generic/219: use filesystem blocksize while calculating the file size Pankaj Raghav
2024-10-24 18:19   ` Darrick J. Wong [this message]
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=20241024181910.GG2386201@frogsfrogsfrogs \
    --to=djwong@kernel.org \
    --cc=david@fromorbit.com \
    --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=p.raghav@samsung.com \
    --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