public inbox for fstests@vger.kernel.org
 help / color / mirror / Atom feed
From: Eryu Guan <guan@eryu.me>
To: Jeffle Xu <jefflexu@linux.alibaba.com>
Cc: darrick.wong@oracle.com, fstests@vger.kernel.org
Subject: Re: [RFC PATCH] misc: skip fsx tests when op length not congruent with file allocation unit
Date: Sun, 18 Jul 2021 21:51:13 +0800	[thread overview]
Message-ID: <YPQx0cXESGzJyu0U@desktop> (raw)
In-Reply-To: <20210707104745.98822-1-jefflexu@linux.alibaba.com>

On Wed, Jul 07, 2021 at 06:47:45PM +0800, Jeffle Xu wrote:
> 
> Yes it works. For example in this RFC patch, generic/075 could be
> skipped once 'bigalloc' is detected for ext4.
> 
> I could fix all related test cases in this way, if it is acceptable to
> the community.

Looks fine to me.

> 
> Signed-off-by: Jeffle Xu <jefflexu@linux.alibaba.com>
> ---
>  common/rc         | 20 ++++++++++++++++++++
>  tests/generic/075 |  3 +++
>  2 files changed, 23 insertions(+)
> 
> diff --git a/common/rc b/common/rc
> index f58a542..92245e0 100644
> --- a/common/rc
> +++ b/common/rc
> @@ -4041,6 +4041,23 @@ _sysfs_dev()
>  	min=$(echo "ibase=16; $min" | bc)
>  	echo /sys/dev/block/$maj:$min
>  }
> +		
> +_ext4_get_file_block_size()

Another ext4 specific helper in common/rc, perhaps it's time to create
its own file for ext4, i.e. common/ext4, and move all ext4 specific
helpers in common/rc there.

> +{
> +	local path="$1"
> +	path="$(readlink -m "$path")"
> +	local dev=`$DF_PROG $dir | tail -1 | $AWK_PROG '{print $1}'`

$dir is not defined, you mean $path here?

> +	
> +	# The alloc unit size equals block size for ext4 without 'bigalloc'.
> +	if ! (tune2fs -l $dev | grep -q 'Cluster size'); then

$TUNE2FS_PROG

Perhaps you could call tune2fs only once and save its "Cluster size"
line for later use.

Thanks,
Eryu

> +		_get_block_size "$path"
> +		return
> +	fi
> +
> +	# Otherwise, call tune2fs acquiring cluster size.
> +	tune2fs -l $dev | sed -n -e 's/^.*Cluster size:\s*\([0-9]*\).*$/\1/p'
> +
> +}
>  
>  # Get the minimum block size of a file.  Usually this is the
>  # minimum fs block size, but some filesystems (ocfs2) do block
> @@ -4059,6 +4076,9 @@ _get_file_block_size()
>  	"xfs")
>  		_xfs_get_file_block_size $1
>  		;;
> +	"ext4")
> +		_ext4_get_file_block_size $1
> +		;;
>  	*)
>  		_get_block_size $1
>  		;;
> diff --git a/tests/generic/075 b/tests/generic/075
> index 7467bb7..d269a7c 100755
> --- a/tests/generic/075
> +++ b/tests/generic/075
> @@ -109,6 +109,9 @@ _process_args()
>  _supported_fs generic
>  _require_test
>  
> +blksz=$(_get_block_size $TEST_DIR)
> +_require_congruent_file_oplen $TEST_DIR $blksz
> +
>  size10=`expr 10 \* 1024 \* 1024`	# 10 megabytes
>  filelen=$size10
>  numops1=1000
> -- 
> 1.8.3.1

      reply	other threads:[~2021-07-18 13:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-05  6:58 [RFC,2/2] xfstests: common/rc: add cluster size support for ext4 JeffleXu
2021-07-06 18:14 ` Darrick J. Wong
2021-07-07 10:47   ` [RFC PATCH] misc: skip fsx tests when op length not congruent with file allocation unit Jeffle Xu
2021-07-18 13:51     ` Eryu Guan [this message]

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=YPQx0cXESGzJyu0U@desktop \
    --to=guan@eryu.me \
    --cc=darrick.wong@oracle.com \
    --cc=fstests@vger.kernel.org \
    --cc=jefflexu@linux.alibaba.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