public inbox for fstests@vger.kernel.org
 help / color / mirror / Atom feed
From: Eryu Guan <eguan@redhat.com>
To: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: ocfs2-devel@oss.oracle.com, fstests@vger.kernel.org
Subject: Re: [PATCH 2/7] ocfs2/reflink: fix file block size reporting
Date: Mon, 12 Dec 2016 17:48:20 +0800	[thread overview]
Message-ID: <20161212094820.GY29149@eguan.usersys.redhat.com> (raw)
In-Reply-To: <148149317758.31093.14955725683270205488.stgit@birch.djwong.org>

On Sun, Dec 11, 2016 at 01:52:57PM -0800, Darrick J. Wong wrote:
> Some of the reflink tests try to require a specific filesystem block
> size so that they can test file block manipulation functions.  That's
> straightforward for most filesystems but ocfs2 throws in the additional
> twist that data fork block mappings are stored in units of clusters, not
> blocks, which causes these reflink tests to fail.
> 
> Therefore, introduce a new helper that retrieves the file minimum block
> size and adapt the reflink tests to use that instead.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
>  common/rc         |   21 +++++++++++++++++++--
>  tests/generic/205 |    2 +-
>  tests/generic/206 |    2 +-
>  tests/generic/216 |    2 +-
>  tests/generic/217 |    2 +-
>  tests/generic/218 |    2 +-
>  tests/generic/220 |    2 +-
>  tests/generic/222 |    2 +-
>  tests/generic/227 |    2 +-
>  tests/generic/229 |    2 +-
>  tests/generic/238 |    2 +-
>  11 files changed, 29 insertions(+), 12 deletions(-)
> 
> 
> diff --git a/common/rc b/common/rc
> index 2639fbd..30111d4 100644
> --- a/common/rc
> +++ b/common/rc
> @@ -925,7 +925,7 @@ _scratch_mkfs_blocksized()
>  	${MKFS_PROG}.$FSTYP -F $MKFS_OPTIONS -b $blocksize $SCRATCH_DEV
>  	;;
>      ocfs2)
> -	yes | ${MKFS_PROG}.$FSTYP -F $MKFS_OPTIONS -b $blocksize $SCRATCH_DEV
> +	yes | ${MKFS_PROG}.$FSTYP -F $MKFS_OPTIONS -b $blocksize -C $blocksize $SCRATCH_DEV
>  	;;
>      *)
>  	_notrun "Filesystem $FSTYP not supported in _scratch_mkfs_blocksized"
> @@ -3029,13 +3029,30 @@ _sysfs_dev()
>  	echo /sys/dev/block/$_maj:$_min
>  }
>  
> +# Get the minimum block size of a file.  Usually this is the
> +# minimum fs block size, but some filesystems (ocfs2) do block
> +# mappings in larger units.
> +get_file_block_size()

Name it with leading underscore? As it's a common helper.

> +{
> +	if [ -z $1 ] || [ ! -d $1 ]; then
> +		echo "Missing mount point argument for get_file_block_size"
> +		exit 1
> +	fi
> +	if [ "$FSTYP" = "ocfs2" ]; then
> +		stat -c '%o' $1
> +	else
> +		stat -f -c '%S' $1

We can use "get_block_size $1" here.

> +	fi
> +}
> +
> +# Get the minimum block size of an fs.
>  get_block_size()

We should rename it with a underscore too, but probably in an different
patch.

Thanks,
Eryu

  reply	other threads:[~2016-12-12  9:48 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-11 21:52 [PATCH 0/7] xfstests: misc reflink test fixes Darrick J. Wong
2016-12-11 21:52 ` [PATCH 1/7] ocfs2: test reflinking to inline data files Darrick J. Wong
2016-12-12  9:01   ` Eryu Guan
2016-12-12 18:09     ` Darrick J. Wong
2016-12-13  3:20       ` Eryu Guan
2016-12-13  7:11         ` Darrick J. Wong
2016-12-13 21:35           ` Darrick J. Wong
2016-12-14  7:32             ` Eric Ren
2016-12-11 21:52 ` [PATCH 2/7] ocfs2/reflink: fix file block size reporting Darrick J. Wong
2016-12-12  9:48   ` Eryu Guan [this message]
2016-12-12 23:08     ` Darrick J. Wong
2016-12-11 21:53 ` [PATCH 3/7] reflink: fix quota tests to work properly Darrick J. Wong
2016-12-12 10:06   ` Eryu Guan
2016-12-12 23:08     ` Darrick J. Wong
2016-12-11 21:53 ` [PATCH 4/7] reflink: fix space consumption tests Darrick J. Wong
2016-12-12 10:25   ` Eryu Guan
2016-12-12 23:03     ` Darrick J. Wong
2016-12-13  3:22       ` Eryu Guan
2016-12-11 21:53 ` [PATCH 5/7] reflink: make error reporting consistent Darrick J. Wong
2016-12-12 10:47   ` Eryu Guan
2016-12-12 23:06     ` Darrick J. Wong
2016-12-11 21:53 ` [PATCH 6/7] reflink: don't test disjoint block sharing sets Darrick J. Wong
2016-12-11 21:53 ` [PATCH 7/7] xfs/ext4: check negative inode size Darrick J. Wong
2016-12-12 11:07   ` Eryu Guan
2016-12-13 21:49     ` Darrick J. Wong

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=20161212094820.GY29149@eguan.usersys.redhat.com \
    --to=eguan@redhat.com \
    --cc=darrick.wong@oracle.com \
    --cc=fstests@vger.kernel.org \
    --cc=ocfs2-devel@oss.oracle.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