From: Dave Chinner <david@fromorbit.com>
To: Allison Henderson <achender@linux.vnet.ibm.com>
Cc: xfs@oss.sgi.com, linux-fsdevel@vger.kernel.org,
linux-ext4@vger.kernel.org
Subject: Re: [PATCH 1/3 v2] XFS TESTS: Fix 252 Failure: Relax fiemap filter
Date: Tue, 28 Jun 2011 14:59:03 +1000 [thread overview]
Message-ID: <20110628045903.GK32466@dastard> (raw)
In-Reply-To: <1309235247-32650-2-git-send-email-achender@linux.vnet.ibm.com>
On Mon, Jun 27, 2011 at 09:27:25PM -0700, Allison Henderson wrote:
> The current test 252 tests punch hole by collecting fiemap information
> on the test file. However this does not work for all file systems since
> not all file systems layout their extents in the same way.
>
> This patch corrects this by adding a -h flag to the fiemap filter that ignores
> the extent types in the fiemaps. The result is that the fiemap contains only
> "extent" or "hole", instead of "unwritten", "data" or "hole". A checksum has
> also been added to each test to help ensure the file contents are correct.
>
> Signed-off-by: Allison Henderson <achender@linux.vnet.ibm.com>
> ---
> v1 -> v2
> Moved new golden output for 252 into a seperate patch to help make the set
> easier to read
>
> :100755 100755 5efa243... 1289094... M 252
> :100644 100644 ddf63b0... d3c89eb... M common.punch
> 252 | 8 ++++----
> common.punch | 38 ++++++++++++++++++++++++++++++++++++--
> 2 files changed, 40 insertions(+), 6 deletions(-)
>
> diff --git a/252 b/252
> index 5efa243..1289094 100755
> --- a/252
> +++ b/252
> @@ -53,15 +53,15 @@ _require_xfs_io_fiemap
> testfile=$TEST_DIR/252.$$
>
> # Standard punch hole tests
> -_test_generic_punch falloc fpunch fpunch fiemap _filter_fiemap $testfile -F
> +_test_generic_punch falloc fpunch fpunch fiemap "_filter_fiemap -h" $testfile -F
>
> # Delayed allocation punch hole tests
> -_test_generic_punch -d falloc fpunch fpunch fiemap _filter_fiemap $testfile -F
> +_test_generic_punch -d falloc fpunch fpunch fiemap "_filter_fiemap -h" $testfile -F
>
> # Multi hole punch tests
> -_test_generic_punch -k falloc fpunch fpunch fiemap _filter_fiemap $testfile -F
> +_test_generic_punch -k falloc fpunch fpunch fiemap "_filter_fiemap -h" $testfile -F
>
> # Delayed allocation multi punch hole tests
> -_test_generic_punch -d -k falloc fpunch fpunch fiemap _filter_fiemap $testfile -F
> +_test_generic_punch -d -k falloc fpunch fpunch fiemap "_filter_fiemap -h" $testfile -F
>
> status=0 ; exit
> diff --git a/common.punch b/common.punch
> index ddf63b0..d3c89eb 100644
> --- a/common.punch
> +++ b/common.punch
> @@ -203,17 +203,34 @@ _coalesce_extents()
>
> _filter_fiemap()
> {
> +
> + UNWRITTEN_EX="\"unwritten\""
> + DATA_EX="\"data\""
> + OPTIND=1
> + while getopts 'h' OPTION
> + do
> + case $OPTION in
> + h) UNWRITTEN_EX="\"extent\""
> + DATA_EX="\"extent\""
> + ;;
> + ?) echo Invalid flag
> + exit 1
> + ;;
> + esac
> + done
> + shift $(($OPTIND - 1))
> +
> awk --posix '
> $3 ~ /hole/ {
> print $1, $2, $3;
> next;
> }
> $5 ~ /0x[[:digit:]]*8[[:digit:]]{2}/ {
> - print $1, $2, "unwritten";
> + print $1, $2, '$UNWRITTEN_EX';
> next;
> }
> $5 ~ /0x[[:digit:]]+/ {
> - print $1, $2, "data";
> + print $1, $2, '$DATA_EX';
> }' |
> _coalesce_extents
> }
I seriously dislike conditional parameter passing in shell scripts
at the best of times, but for filter functions I really think it is
the wrong thing to do. It significantly obfuscates the working of
the function for no really good reason.
Just write a new filter function, and factor out the common parts of
them if the amount of code duplication is sufficient to make it
desirable to do so.
> + md5sum $testfile | cut -d ' ' -f1
Why cut out the file name? It's not like it changes at all....
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
next prev parent reply other threads:[~2011-06-28 4:59 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-28 4:27 [PATCH 0/3 v2] XFS TESTS: Fix 252 failure Allison Henderson
2011-06-28 4:27 ` [PATCH 1/3 v2] XFS TESTS: Fix 252 Failure: Relax fiemap filter Allison Henderson
2011-06-28 4:59 ` Dave Chinner [this message]
2011-06-28 5:17 ` Allison Henderson
2011-06-28 8:49 ` Dave Chinner
2011-06-28 4:27 ` [PATCH 2/3 v2] XFS TESTS: Fix 252 Failure: Update 252 Golden Output Allison Henderson
2011-06-28 5:09 ` Dave Chinner
2011-06-28 5:26 ` Allison Henderson
2011-06-28 13:29 ` Eric Sandeen
2011-06-28 15:03 ` Allison Henderson
2011-06-28 4:27 ` [PATCH 3/3 v2] XFS TESTS: Fix 252 Failure: Update 242 " Allison Henderson
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=20110628045903.GK32466@dastard \
--to=david@fromorbit.com \
--cc=achender@linux.vnet.ibm.com \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=xfs@oss.sgi.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;
as well as URLs for NNTP newsgroup(s).